The 1.3" OLED Display Module is a compact and versatile screen suitable for adding visual output to electronic projects. OLED stands for Organic Light Emitting Diode, a technology known for its high contrast ratios, deep blacks, and wide viewing angles. This module is commonly used in wearable devices, small instruments, and any application where a small yet clear display is required.
Pin Number | Pin Name | Description |
---|---|---|
1 | GND | Ground |
2 | VCC | Power supply (3.3V - 5V) |
3 | SCL | Serial Clock Line (I2C) or SPI Clock (SPI) |
4 | SDA | Serial Data Line (I2C) or SPI Data (SPI) |
5 | RES | Reset pin (optional for some models) |
6 | DC | Data/Command (SPI mode only) |
7 | CS | Chip Select (SPI mode only) |
#include <Wire.h> // Include Wire library for I2C
#include <Adafruit_GFX.h> // Include core graphics library
#include <Adafruit_SSD1306.h> // Include Adafruit SSD1306 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 (SCL, SDA pins)
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// Initialize with the I2C addr 0x3C (for the 128x64)
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// Clear the buffer
display.clearDisplay();
// Draw a single pixel in white
display.drawPixel(10, 10, WHITE);
// Display the drawing
display.display();
}
void loop() {
// Nothing here for this simple example
}
Q: Can I use this display with a 5V system? A: Yes, most 1.3" OLED modules are 5V tolerant, but always check the specifications.
Q: How do I know if my display is using the SSD1306 or SH1106 driver? A: This information is usually provided by the vendor. If not, you may need to test with both drivers or consult the module's datasheet.
Q: Can I display images on the OLED? A: Yes, the Adafruit GFX library allows you to display bitmap images on the OLED.
Q: Is it possible to use multiple OLED displays with an Arduino? A: Yes, you can use multiple displays by assigning different addresses for I2C or different chip select lines for SPI.