An Organic Light Emitting Diode (OLED) is a display technology that uses organic compounds to emit light when an electric current is applied. Unlike traditional LCDs, OLED displays do not require a backlight, resulting in deeper blacks, higher contrast ratios, and more vibrant colors. Additionally, OLEDs offer wide viewing angles and fast response times, making them ideal for a variety of applications.
Common applications of OLED displays include:
This documentation focuses on using an OLED display with the Arduino UNO (manufacturer part ID: UNO).
Below are the key technical details for a typical OLED display module compatible with the Arduino UNO:
Specification | Details |
---|---|
Display Type | OLED (Organic Light Emitting Diode) |
Resolution | 128x64 pixels |
Interface | I2C (Inter-Integrated Circuit) |
Operating Voltage | 3.3V - 5V |
Current Consumption | ~20mA (varies with brightness) |
Viewing Angle | ~160° |
Dimensions | Varies (e.g., 0.96", 1.3", etc.) |
Driver IC | SSD1306 |
The OLED module typically has 4 pins for I2C communication. Below is the pin configuration:
Pin Name | Description |
---|---|
VCC | Power supply (3.3V or 5V) |
GND | Ground |
SCL | Serial Clock Line (I2C clock) |
SDA | Serial Data Line (I2C data) |
To use the OLED display with an Arduino UNO, follow these steps:
To control the OLED display, you need to install the following libraries in the Arduino IDE:
Below is an example code to display "Hello, World!" on the OLED:
#include <Adafruit_GFX.h> // Graphics library for OLED
#include <Adafruit_SSD1306.h> // SSD1306 driver library
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1 // Reset pin (not used with I2C)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
// Check if the display is connected
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Loop forever if initialization fails
}
display.clearDisplay(); // Clear the display buffer
display.setTextSize(1); // Set text size (1 = small, 2 = medium, etc.)
display.setTextColor(SSD1306_WHITE); // Set text color to white
display.setCursor(0, 0); // Set cursor position (x, y)
display.println(F("Hello, World!")); // Print text to the display
display.display(); // Display the text on the screen
}
void loop() {
// Nothing to do here
}
The OLED display does not turn on.
The display shows random or garbled characters.
The text or graphics are not visible.
display.display()
function is called after drawing.By following this documentation, you can successfully integrate and use an OLED display with the Arduino UNO for various projects.