Sunday, July 26, 2015

Display animation on OLED using arduino i2c

A photo posted by Mohesh Mohan (@moheshmohan) on

Hey folks,

So i got this new cheap oled display that i wanted for a long time and its time for us to play with it. So you can find lot of tutorials on the web on how to drive the display but lets just move a step farther, lets do some animation with it.

OLED 0.96" 128X64 from aliexpress
what i have is an OLED 0.96" 128X64 I2C (or IIC) interface, with SSD1306 driver, 3.3/5V compatible.

There are 4 pin on the OLED module, GND, VCC, SCL and SDA. Typically to use I2C on an arduino uno you need to connect it something like this

GND - GND on Arduino Uno
VCC - 5V on Arduino Uno
SCL - A5 on Arduino Uno
SDA - A4 on Arduino Uno

Lets have a look at the fritzing view of the connections

Now how do we drive this thing? Don't worry there is an awesome library for led/lcd displays its called u8glib and you can get it here

Now based on this i have created a simple program to display an animation. You can get the source code here

Basically what i have done is just take 3 bitmap images and play it in a sequence to show the animation. If you look at the source code you can see the arrays in which image information is stored. Now its very easy to convert a bitmap into an array of hex values. you just need the picture editor called gimp

Open the desired image in gimp and save it as ".xbm" format and just open the xbm file in a text editor, you can get the hex values array for the image. Pretty simple :P

Mohesh loves robots :D
You can watch all of this in my video here

Here is the source code for those who don't wanna go to github


  1. Great Article Cloud Computing Projects

    Networking Projects

    Final Year Projects for CSE

    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. The layers that are obvious on the Layers board show up in the chose casing, and subsequently, in the animation. anime subthai