The Adafruit OLED Monochrome 128x64 1.3 inch display module is a compact and versatile screen suitable for adding a visual interface to your electronics projects. With its high contrast and sharp display, it is perfect for displaying text, graphics, and animations. Common applications include wearable devices, small handheld instruments, and user interfaces for various DIY projects.
Pin Number | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VCC | Power supply (3.3V to 5V) |
3 | SCL | Serial Clock Line for I2C |
4 | SDA | Serial Data Line for I2C |
5 | RES | Reset pin (active low) |
6 | DC | Data/Command control pin (SPI) |
7 | CS | Chip Select for SPI |
8 | D1 | SPI MOSI line |
9 | D0 | SPI Clock line |
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#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
#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, SSD1306_WHITE);
// Display the drawing
display.display();
}
void loop() {
// Nothing here for this simple example
}
Q: Can I use this display with a 5V microcontroller like an Arduino UNO? A: Yes, the display can be powered with 5V and is compatible with 5V logic levels.
Q: How do I install the Adafruit SSD1306 library? A: You can install the library through the Arduino Library Manager by searching for "Adafruit SSD1306" and installing it.
Q: What is the maximum refresh rate of the display? A: The refresh rate depends on several factors, including the communication speed and the complexity of the content being displayed. For simple text and graphics, the display can be refreshed several times per second.
Q: Can I display images on this OLED? A: Yes, you can display bitmap images using the Adafruit GFX library functions. Images need to be converted to a bitmap array in the correct format.