The OLED (Organic Light Emitting Diode) display is a type of 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 higher contrast ratios, vibrant colors, and energy efficiency. These displays are available in various sizes and resolutions, making them suitable for a wide range of applications.
Common applications of OLED displays include:
Below are the general technical specifications for a typical small OLED display module (e.g., 128x64 resolution):
Parameter | Value |
---|---|
Display Type | OLED (Organic Light Emitting Diode) |
Resolution | 128x64 pixels |
Interface | I2C or SPI |
Operating Voltage | 3.3V - 5V |
Operating Current | ~20mA (varies with brightness) |
Viewing Angle | >160° |
Pixel Color | Monochrome (white, blue, or yellow) |
Dimensions | Varies (e.g., 0.96", 1.3") |
Pin Name | Description |
---|---|
VCC | Power supply (3.3V or 5V) |
GND | Ground |
SCL | Serial Clock Line (I2C clock) |
SDA | Serial Data Line (I2C data) |
Pin Name | Description |
---|---|
VCC | Power supply (3.3V or 5V) |
GND | Ground |
SCK | Serial Clock (SPI clock) |
MOSI | Master Out Slave In (SPI data) |
RES | Reset pin |
DC | Data/Command control pin |
CS | Chip Select |
Wiring: Connect the OLED display to the Arduino UNO as follows:
Install Required Libraries:
Sketch
> Include Library
> Manage Libraries...
.Adafruit GFX Library
Adafruit SSD1306
Upload Example Code: Use the following example code to display text on the OLED:
// Include necessary libraries
#include <Adafruit_GFX.h> // Graphics library for OLED
#include <Adafruit_SSD1306.h> // Driver for SSD1306 OLED
// Define OLED display dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Create an instance of the display object
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
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 (;;); // Stop execution if initialization fails
}
// Clear the display buffer
display.clearDisplay();
// Set text size and color
display.setTextSize(1); // Text size multiplier
display.setTextColor(SSD1306_WHITE); // White text
// Display a message
display.setCursor(0, 0); // Set cursor position
display.println(F("Hello, OLED!")); // Print text
display.display(); // Update the display
}
void loop() {
// Nothing to do here
}
0x3C
. If the display does not work, check the address using an I2C scanner sketch.The display does not turn on:
The display shows random or garbled characters:
The display flickers or dims:
Can I use the OLED display with a 3.3V microcontroller?
How do I change the I2C address of the display?
Can I use the OLED display with a Raspberry Pi?
luma.oled
for Python programming.By following this documentation, you can successfully integrate and use an OLED display in your projects!