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:
Consumer electronics such as smartphones, tablets, and TVs
Wearable devices like smartwatches and fitness trackers
Embedded systems and microcontroller projects
Industrial equipment displays
Automotive dashboards and heads-up displays (HUDs)
This documentation focuses on using an OLED display with the Arduino UNO (manufacturer part ID: UNO).
Explore Projects Built with oled
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit is a robotic vehicle controlled by an Arduino UNO, featuring an ultrasonic sensor for obstacle detection, multiple DC gear motors for movement, and servomotors for precise control. The system uses an L293D driver shield to interface the motors and sensors, and includes an ESP32-CAM for potential video streaming or image capture capabilities.
This is a sensor-rich embedded system with communication and display capabilities, designed for monitoring environmental parameters and controlling motors. It integrates alcohol and temperature sensors, vibration detection, GPS tracking, GSM communication, and an LCD for output, all managed by an Arduino Mega 2560.
This circuit integrates a Bela Board with various sensors and actuators, including a TRILL CRAFT touch sensor, an ADXXL335 accelerometer, a vibration motor, and a loudspeaker. The Bela Board processes input from the touch sensor and accelerometer, and controls the vibration motor and loudspeaker, while an OLED display provides visual feedback.
This circuit features an Arduino UNO microcontroller connected to a touch sensor, an OLED display, a servomotor, and a buzzer. The touch sensor's output is connected to a digital pin on the Arduino for touch input detection. The OLED display communicates with the Arduino via I2C (SDA and SCL lines connected to A4 and A5), the servomotor is controlled by a digital PWM output (D9), and the buzzer is connected to another digital pin (D8) for audio feedback.
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
Pin Configuration
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)
Usage Instructions
Connecting the OLED to Arduino UNO
To use the OLED display with an Arduino UNO, follow these steps:
Connect the VCC pin of the OLED to the 5V pin on the Arduino UNO.
Connect the GND pin of the OLED to the GND pin on the Arduino UNO.
Connect the SCL pin of the OLED to the A5 pin on the Arduino UNO (I2C clock line).
Connect the SDA pin of the OLED to the A4 pin on the Arduino UNO (I2C data line).
Installing Required Libraries
To control the OLED display, you need to install the following libraries in the Arduino IDE:
Adafruit_GFX: A graphics library for drawing shapes, text, and images.
Adafruit_SSD1306: A library specifically for SSD1306-based OLED displays.
Open the Arduino IDE.
Go to Sketch > Include Library > Manage Libraries.
Search for "Adafruit GFX" and "Adafruit SSD1306" in the Library Manager.
Install both libraries.
Example Code
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
}
Important Considerations
Ensure the OLED module's operating voltage matches the Arduino UNO's output voltage (5V).
Use appropriate pull-up resistors on the I2C lines if the OLED module does not have built-in pull-ups.
Avoid excessive brightness settings to prolong the OLED's lifespan.
Troubleshooting and FAQs
Common Issues
The OLED display does not turn on.
Verify the wiring connections (VCC, GND, SDA, SCL).
Ensure the OLED module is receiving the correct voltage (3.3V or 5V).
Check if the I2C address (default: 0x3C) matches the one in the code.
The display shows random or garbled characters.
Ensure the correct libraries are installed and included in the code.
Verify the I2C connections and ensure no loose wires.
The text or graphics are not visible.
Check the contrast/brightness settings in the code.
Ensure the display.display() function is called after drawing.
Tips for Troubleshooting
Use the Arduino Serial Monitor to print debug messages and confirm the OLED initialization.
Test the I2C connection using an I2C scanner sketch to detect the OLED's address.
If the display flickers, ensure the power supply is stable and sufficient.
By following this documentation, you can successfully integrate and use an OLED display with the Arduino UNO for various projects.