5.2 OLED Display Interface
5.2 OLED Display Interface
5.2.1 What is OLED?
OLED means Organic Light-Emitting Diode.
An OLED is a display technology in which individual pixels produce their own light. Unlike many conventional LCDs, an OLED does not require a separate backlight.
A popular Arduino OLED module is the:
0.96-inch 128×64 OLED display
This means it contains:
- 128 horizontal pixels
- 64 vertical pixels
5.2.2 OLED Interface
Many small OLED modules communicate with Arduino using I2C.
Typical pins are:
|
Pin |
Function |
|
VCC |
Power |
|
GND |
Ground |
|
SDA |
Serial Data |
|
SCL |
Serial Clock |
Some OLED displays use SPI instead of I2C.
5.2.3 How OLED Works
The Arduino sends commands and data to the OLED.
For example:
Sensor → Arduino → OLED → Displayed information
The OLED can display:
- Text
- Numbers
- Symbols
- Icons
- Simple graphics
- Sensor measurements
- Small diagrams
5.2.4 OLED Libraries
Common Arduino OLED libraries include:
Adafruit_GFX
Adafruit_SSD1306
The Adafruit_GFX library provides general graphics functions, while Adafruit_SSD1306 supports displays based on the SSD1306 controller.
5.2.5 Simple OLED Program
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
while (true);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println(“Hello Student”);
display.setCursor(0, 20);
display.println(“Arduino OLED”);
display.display();
}
void loop() {
}
5.2.6 Important OLED Functions
|
Function |
Purpose |
|
display.begin() |
Initializes the OLED |
|
display.clearDisplay() |
Clears the screen buffer |
|
display.setCursor() |
Sets text position |
|
display.setTextSize() |
Sets text size |
|
display.setTextColor() |
Sets text color |
|
display.print() |
Displays information |
|
display.println() |
Displays information and moves to next line |
|
display.display() |
Sends the buffer contents to the OLED |
Advantages of OLED
- High contrast
- Bright display
- Good viewing angle
- Low power for many applications
- Thin and compact
- Can display graphics
- Does not require a conventional backlight
Disadvantages of OLED
- Usually more expensive than basic character LCDs
- Some OLED materials can degrade over long periods
- Small modules have limited display area
- Programming graphics requires additional code
Applications of OLED
OLED displays are commonly used in:
- IoT devices
- Wearable electronics
- Smart sensors
- Portable instruments
- Digital meters
- Embedded systems
- Smart home devices
- Environmental monitoring systems


