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 https://github.com/olikraus/u8glib

Now based on this i have created a simple program to display an animation. You can get the source code here https://github.com/moheshmohan/arduino_oled_animation

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 http://www.gimp.org/

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. nemo slot jili slot เข้าสู่ระบบ ฟรีเครดิต เว็บไซต์พวกเรานั้นเป็นเว็บไซต์ที่ให้บริการเกมออนไลน์ชั้น 1 ในประเทศไทย ที่เปิดให้บริการอย่างครบวงจร pg slot สล็อต ฝากถอนไม่มีอย่างน้อย


Post a Comment