Animated Eyes with Python on Raspi [OLED]
- Created By Michael Reber
- Date 2022.11.13
- Category Robotics
For Halloween, a colleague of mine needed animated eyes that he could build into his prop. He wanted to be able to use it also in dark lighting conditions, so I decided to use OLEDs, because compared to LCDs the black edge of the display does not glow.
Knowhow push: With OLEDs, the pixels themselves light up and everything that is not used remains black. With LCDs, the whole display is illuminated from the background with white LEDs. So in the dark, you can only see those parts of the screen which are in use.
- The two OLED panels were connected to the Pi using an I2C extension for the Raspberry Pi. With a light sensor, the ambient brightness is measured continuously.
- The animation itself is done with Python and static graphics, which are formed into an oculus. During the rendering process, the graphics are curved in such a way that a 3D effect is created by the glass hemispheres.
- The movements of the eyes are done with a python-random function and look very natural with a few additional tweaks.
Of course, when the eyes are illuminated, they contract immediately after 0.2s thanks to the light sensor. When the light disappears they slowly widen again.