Eye animation on OLED display with arduino nano

Source code https://github.com/intellar/oled_eye_display

This is a simple project to give a visual feedback to someone interacting with a device. Here the display shows eyes, that can blink, look up, look down, look amused, annoyed, etc.  The arduino renders simple basic forms (rounded squares, triangles) that mimic eyes. For this project, we used an oled display found on amazon, costing 11$, and a canaduino, which is a cost effective alternative to the arduino nano v3, costing 6$. This brings the total cost under 20$cad. No links are published since they will most likely not age well. Both devices are shown here:

The nano comes without the pins attached, so a little MacGyver soldering is required to connect the pins on the arduino board. It is easily done with a fine tip and common soldering iron. 

The connection of the arduino to the display is fairly simple, and it is important to note that the display uses power on 3v.  So dont plug it on the 5v pin. We followed the pinout suggested by the arduino module adafruit_ssd1306 for the i2c connection,

Arduino - Display
3v3 - vcc
Gnd - gnd
A5 - SCL
A4 - SDA

this results in the wiring shown in the next figure :

Now the fun part begins. You can download the code base here (for free! just say thanks). It is a cleaned and concise example of the library. It is meant to be simple and can easily be adapted for more complexe animation. 


There are two folders, one contains the arduino code, and the other contains the python script to communicate with the nano. To program the nano, you must upload the program "control_display.ino", that will handle the drawing and the communication with the pc.  I use the program arduino ide to compile and upload. The nano must be plugged in the computer for the programmation. 

Currently, there are 8 animations in the program, starting with the closed eyes. To trigger other animations, run the example script in the python folder. Note that in the example, the serial port in COM3,  it might not be the case on your computer. To find out which one to use,  start the hardware manager on windows.   

Quick explanation of the code



This video shows all the current animations: