The DollaTek 128x64 OLED Display is a compact and versatile screen module that utilizes organic light-emitting diodes to provide a high-contrast, high-resolution display. This particular model, identified by the part ID SSH1106, is capable of displaying graphics and text in a monochrome (single-color) format. It supports multiple communication protocols, including I2C (Inter-Integrated Circuit), IIC (Intelligent Interface Controller, often used interchangeably with I2C), and SPI (Serial Peripheral Interface), making it highly adaptable to various microcontroller platforms, such as Arduino, Raspberry Pi, and others.
Pin Number | I2C/IIC Mode | SPI Mode | Description |
---|---|---|---|
1 | GND | GND | Ground |
2 | VCC | VCC | Power Supply (3.3V-5V) |
3 | SCL | D0/CLK | Serial Clock Line |
4 | SDA | D1/MOSI | Serial Data Line |
5 | RES | RES | Reset Pin |
6 | DC | DC | Data/Command Control Pin |
7 | CS | CS | Chip Select (SPI mode) |
8 | - | - | Not Connected |
#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 (SDA, SCL 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
}
Note: The example code provided uses the Adafruit SSD1306 library, which is compatible with the SSH1106 driver with minor differences. The library can be installed via the Arduino Library Manager.
Q: Can I use this display with a 5V microcontroller? A: Yes, the display can be powered with 5V, but ensure that the logic levels for data lines match the microcontroller's.
Q: How do I know if my display is in I2C or SPI mode? A: The mode is determined by how you wire the display to your microcontroller and how you initialize it in your code.
Q: What library should I use for this display? A: For Arduino, the Adafruit SSD1306 library is commonly used, though you may need to make minor adjustments for the SSH1106 driver.
Q: Can I display images on this OLED? A: Yes, you can display bitmap images by converting them into a byte array format that the display can interpret.
Q: How do I adjust the contrast or brightness of the display? A: These settings can be adjusted through commands sent from the microcontroller to the display. Refer to the SSH1106 datasheet for specific commands.