The 0.96" 4-pin OLED Display is a compact, low-power display module that utilizes organic light-emitting diodes (OLEDs) to produce bright, high-contrast, and vibrant images. With a resolution of 128x64 pixels, this display is ideal for applications requiring clear visuals in a small form factor. Its 4-pin interface simplifies integration with microcontrollers, making it a popular choice for hobbyists, students, and professionals alike.
Parameter | Specification |
---|---|
Display Type | OLED (Organic Light-Emitting Diode) |
Resolution | 128x64 pixels |
Display Size | 0.96 inches (diagonal) |
Interface | I2C (Inter-Integrated Circuit) |
Operating Voltage | 3.3V to 5V |
Operating Current | ~20mA |
Viewing Angle | >160° |
Driver IC | SSD1306 |
Communication Speed | Up to 400kHz (I2C Fast Mode) |
Operating Temperature | -40°C to +85°C |
Pin Name | Pin Number | Description |
---|---|---|
GND | 1 | Ground pin. Connect to the ground of the power supply. |
VCC | 2 | Power supply pin. Connect to 3.3V or 5V. |
SCL | 3 | I2C clock line. Connect to the SCL pin of the microcontroller. |
SDA | 4 | I2C data line. Connect to the SDA pin of the microcontroller. |
VCC
pin to a 3.3V or 5V power source and the GND
pin to the ground.SCL
pin to the I2C clock line of your microcontroller.SDA
pin to the I2C data line of your microcontroller.Adafruit_GFX
and Adafruit_SSD1306
libraries via the Arduino Library Manager.0x3C
. Verify this in the datasheet or by scanning I2C devices.#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED display width and height
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Create an SSD1306 display object connected via I2C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Initialize the OLED display
if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
// If initialization fails, print an error message
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Halt the program
}
// Clear the display buffer
display.clearDisplay();
// Display a welcome message
display.setTextSize(1); // Set text size
display.setTextColor(SSD1306_WHITE); // Set text color
display.setCursor(0, 0); // Set cursor position
display.println(F("Hello, OLED!")); // Print text
display.display(); // Update the display
delay(2000); // Wait for 2 seconds
}
void loop() {
// Clear the display buffer
display.clearDisplay();
// Draw a rectangle
display.drawRect(10, 10, 50, 30, SSD1306_WHITE);
// Display the rectangle
display.display();
// Wait for 1 second
delay(1000);
}
Display Not Turning On:
VCC
and GND
).0x3C
or 0x3D
).No Output on the Display:
SCL
and SDA
) for proper wiring.Flickering or Unstable Display:
Text or Graphics Not Displaying Correctly:
Adafruit_GFX
and Adafruit_SSD1306
libraries are up to date.Q: Can I use this display with a 3.3V microcontroller?
A: Yes, the display is compatible with both 3.3V and 5V systems.
Q: What is the lifespan of the OLED display?
A: The typical lifespan is around 10,000 to 50,000 hours, depending on brightness and usage.
Q: Can I use this display with SPI instead of I2C?
A: No, this specific 4-pin OLED display is designed for I2C communication only. For SPI, consider a different model.
Q: How do I reduce power consumption?
A: Lower the brightness or turn off the display when not in use to save power.