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, OLEDs do not require a backlight, allowing for thinner, more energy-efficient displays with superior image quality. OLEDs are known for their high contrast ratios, vibrant colors, and ability to produce deep blacks, making them ideal for applications requiring high visual fidelity.
Below are the general technical specifications for an OLED display module compatible with the Arduino UNO:
Parameter | Specification |
---|---|
Manufacturer | Arduino |
Part ID | UNO |
Display Type | OLED (Organic Light Emitting Diode) |
Resolution | 128 x 64 pixels |
Interface | I2C or SPI |
Operating Voltage | 3.3V to 5V |
Current Consumption | ~20mA (varies with brightness) |
Viewing Angle | ~160° |
Operating Temperature | -40°C to 85°C |
Dimensions | Varies (e.g., 0.96-inch diagonal) |
The pinout for a typical I2C-based OLED module is as follows:
Pin Name | Description |
---|---|
VCC | Power supply (3.3V or 5V) |
GND | Ground |
SCL | Serial Clock Line for I2C communication |
SDA | Serial Data Line for I2C communication |
For SPI-based OLED modules, the pinout may include additional pins such as CS
(Chip Select) and DC
(Data/Command).
Connect the OLED to the Arduino UNO:
VCC
to the 5V pin on the Arduino.GND
to the GND pin on the Arduino.SCL
to the A5 pin (or SCL pin on newer boards).SDA
to the A4 pin (or SDA pin on newer boards).Install Required Libraries:
Adafruit_GFX
and Adafruit_SSD1306
libraries. These libraries provide functions for controlling the OLED.Upload Example Code:
#include <Adafruit_GFX.h> // Graphics library for OLED
#include <Adafruit_SSD1306.h> // OLED 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 via I2C
#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 (;;); // Don't proceed, loop forever
}
display.clearDisplay(); // Clear the buffer
display.setTextSize(1); // Set text size (1 = small, 2 = medium, etc.)
display.setTextColor(SSD1306_WHITE); // Set text color
display.setCursor(0, 0); // Set cursor position
display.println(F("Hello, OLED!")); // Print text to display
display.display(); // Display the text
}
void loop() {
// Nothing to do here
}
0x3C
. If the display does not work, check the address using an I2C scanner sketch.The OLED does not display anything:
Adafruit_GFX
and Adafruit_SSD1306
) are installed and up to date.The display flickers or shows distorted graphics:
The text or graphics are not visible:
Q: Can I use the OLED with a 3.3V microcontroller?
A: Yes, most OLED modules are compatible with both 3.3V and 5V logic levels. Check the module's datasheet to confirm.
Q: How do I display custom graphics on the OLED?
A: Use the Adafruit_GFX
library to draw shapes, lines, and bitmaps. You can also use online tools to convert images into bitmap arrays for display.
Q: Can I use multiple OLEDs with one Arduino?
A: Yes, you can use multiple OLEDs by assigning unique I2C addresses or using separate SPI chip select pins.
By following this documentation, you can successfully integrate and use an OLED display in your Arduino projects.