The OLED Display 128x64 (Manufacturer: Adafruit, Part ID: SSD1306) is a compact, low-power display module with a resolution of 128x64 pixels. It is based on organic light-emitting diode (OLED) technology, which provides high contrast, wide viewing angles, and low power consumption. This display is ideal for applications requiring clear and sharp text or graphics in embedded systems.
The following table outlines the key technical details of the OLED Display 128x64:
Parameter | Specification |
---|---|
Manufacturer | Adafruit |
Part ID | SSD1306 |
Display Resolution | 128x64 pixels |
Display Type | Monochrome OLED |
Interface | I2C or SPI (configurable) |
Operating Voltage | 3.3V to 5V |
Power Consumption | ~20mA (typical) |
Dimensions | 27mm x 27mm x 4mm |
Viewing Angle | >160° |
Operating Temperature | -40°C to +85°C |
The OLED Display 128x64 module typically has the following pinout:
Pin Name | Description |
---|---|
GND | Ground |
VCC | Power supply (3.3V or 5V) |
SCL | I2C clock line |
SDA | I2C data line |
Pin Name | Description |
---|---|
GND | Ground |
VCC | Power supply (3.3V or 5V) |
SCK | SPI clock line |
MOSI | SPI data line |
CS | Chip select |
DC | Data/command control |
RES | Reset |
VCC
pin to a 3.3V or 5V power source and the GND
pin to ground.SCL
and SDA
to the corresponding pins on your microcontroller. For SPI, connect SCK
, MOSI
, CS
, DC
, and RES
as required.SCL
and SDA
lines.Below is an example of how to use the OLED Display 128x64 with an Arduino UNO via I2C:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the screen dimensions
#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 display
if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
// If initialization fails, print an error message
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Halt execution
}
// 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:
GND
and VCC
.No Output on the Display:
0x3C
) matches the one in your code.Flickering or Artifacts:
Library Initialization Fails:
By following this documentation, you can effectively integrate and troubleshoot the OLED Display 128x64 in your projects.