Last updated
OLED is organic light-emitting diode, OLED is considered to be the next generation of flat panel displays due to its excellent characteristics such as self-luminous, no backlight, high contrast, thin thickness, wide viewing angle, fast response time, flexible panels, wide range of temperatures, and simple construction and manufacturing process.
Resolution: 128 x 64 dot matrix panel
Power supply
VDD = 1.65V to 3.3V for IC logic
VCC = 7V to 15V for Panel driving
For matrix display
OLED driving output voltage, 15V maximum
Segment maximum source current: 100uA
Common maximum sink current: 15mA
256 step contrast brightness current control
Embedded 128 x 64 bit SRAM display buffer
Pin selectable MCU Interfaces:
8-bit 6800/8080-series parallel interface
3 /4 wire Serial Peripheral Interface
I 2 C Interface
Screen saving continuous scrolling function in both horizontal and vertical direction
RAM write synchronization signal
Programmable Frame Rate and Multiplexing Ratio
Row Re-mapping and Column Re-mapping
On-Chip Oscillator
Chip layout for COG & COF
Wide range of operating temperature: -40°C to 85°C
Because the OLED display uses I2C communication protocol, wiring is very simple. You just need to connect to the Arduino Uno I2C pins as shown in the table below.
If you’re using a different Arduino board, make sure you check the correct I2C pins:
Nano: SDA (A4); SCL (A5);
MEGA: SDA (20); SCL (21);
Leonardo: SDA (20); SCL (21);
To control the OLED display you need the adafruit_SSD1306.h and the adafruit_GFX.h libraries. Follow the next instructions to install those libraries.
1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.
2. Type “SSD1306” in the search box and install the SSD1306 library from Adafruit.
3. After installing the SSD1306 library from Adafruit, type “GFX” in the search box and install the library.
4. After installing the libraries, restart your Arduino IDE.
Here’s some functions that will help you handle the OLED display library to write text or draw simple graphics.
display.clearDisplay() – all pixels are off
display.drawPixel(x,y, color) – plot a pixel in the x,y coordinates
display.setTextSize(n) – set the font size, supports sizes from 1 to 8
display.setCursor(x,y) – set the coordinates to start writing text
display.print(“message”) – print the characters at location x,y
display.display() – call this method for the changes to make effect
After wiring the OLED display to the Arduino and installing all required libraries, you can use one example from the library to see if everything is working properly.
In your Arduino IDE, go to File > Examples > Adafruit SSD1306 and select the example for the display you’re using.
If your OLED doesn’t have a RESET pin, you should set the OLED_RESET variable to -1 as shown below:
Upload the code to your Arduino board. Don’t forget to select the right board and COM port in the Tools menu.
You should get a series of different animations in the OLED as shown in the following short video.
Pin
Wiring to Arduino Uno
Vin
5V
GND
GND
SCL
A5
SDA
A4