This tutorial is about interfacing an OLED display with Arduino. OLED (Organic Light Emitting Diode) displays are made by placing a series of thin organic films between two conductors. When electrical current is applied, a bright light is emitted. These displays are more effective then LCD displays. OLED displays are called organic as they are composed of carbon and hydrogen. They are also very efficient and do not contain any bad metals. Using a 128*64 OLED display, we will display bitmap images.
1. 1.3’ or 0.96’ OLED display
Make sure you know which driver IC your display has. Usually, the 1.3’ display has an SH1106 driver IC and the 0.96’ display has the SSD1306 driver IC. The library we would be using in this project is the U8glib, which supports both ICs (make sure to uncomment the one in use and comment the one not in use). The Adafruit OLED and GFX libraries only support the SSD1306 driver IC. The OLED used utilizes the I2C bus, which reduces the number of pins required for connection.
This is optional, you can also connect the OLED display to your Arduino directly if you have appropriate wires for this task.
3. Jumper Wires
These are necessary for connecting the Arduino to the OLED display.
I have used an Arduino Nano, but you can use whichever Arduino board is available. Just make sure you know the pins for I2C bus communication. For Arduino Uno and Nano, it is A4 and A5.
Before you upload the code, you would need to make sure you have the bitmap image in code format. Here’s the link to the main code and the LCD assistant library (this will convert your bitmap image to code).
Also, make sure your image is cropped in 2:1 ratio, and is black and white. The black and white image can be achieved after selecting the Indexed colors option in the photo editor and selecting the black and white sub option in it. Change the size of the image to 128*64 pixels, and export it as a bitmap image. Use the LCD assistant to convert your bitmap to code.
Save the output with a .c extension and open it with notepad, to obtain the code. Download and install the U8glib from here, and upload the code. The image should now be visible on the OLED display.
Author- Moksh Jadhav