The SH1106 is a monochrome OLED display driver designed to control OLED panels with a resolution of 128x64 pixels. It is widely used in embedded systems for displaying text, graphics, and simple animations. The SH1106 supports both I2C and SPI communication protocols, making it versatile and compatible with a variety of microcontrollers, including Arduino, Raspberry Pi, and other development boards.
The SH1106 is a highly efficient display driver with the following key specifications:
Parameter | Value |
---|---|
Display Resolution | 128x64 pixels |
Communication Protocol | I2C or SPI |
Operating Voltage | 2.4V to 3.6V |
Logic Voltage Levels | 3.3V (compatible with 5V logic via level shifter) |
Operating Temperature | -40°C to +85°C |
Power Consumption | Low power consumption |
Pin Name | Pin Number | Description |
---|---|---|
GND | 1 | Ground |
VCC | 2 | Power supply (2.4V to 3.6V) |
SCL | 3 | Serial clock input for I2C |
SDA | 4 | Serial data input/output for I2C |
RES | 5 | Reset pin (active low) |
DC | 6 | Data/Command control pin |
CS | 7 | Chip select (used in SPI mode, tie to GND for I2C) |
Pin Name | Pin Number | Description |
---|---|---|
GND | 1 | Ground |
VCC | 2 | Power supply (2.4V to 3.6V) |
SCK | 3 | Serial clock input for SPI |
MOSI | 4 | Master Out Slave In (data input) |
RES | 5 | Reset pin (active low) |
DC | 6 | Data/Command control pin |
CS | 7 | Chip select (active low) |
Below is an example of how to use the SH1106 with an Arduino UNO using the popular Adafruit_SH1106
library.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>
// Define the reset pin for the SH1106 display
#define OLED_RESET 4
// Initialize the SH1106 display object
Adafruit_SH1106 display(OLED_RESET);
void setup() {
// Initialize the display
if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
// Display initialization failed
Serial.println(F("SH1106 initialization failed!"));
for (;;); // Halt execution
}
// Clear the display buffer
display.clearDisplay();
// Set text size and color
display.setTextSize(1); // Small text size
display.setTextColor(WHITE);
// Display a message
display.setCursor(0, 0); // Set cursor to top-left corner
display.println(F("Hello, SH1106!"));
display.display(); // Update the display with the buffer content
}
void loop() {
// Add your main code here
}
Adafruit_SH1106
library must be installed in your Arduino IDE. You can install it via the Library Manager.SSD1306_I2C_ADDRESS
is typically 0x3C
or 0x3D
. Check your display's datasheet or documentation for the correct address.Display Not Turning On:
No Output on the Display:
Flickering or Corrupted Display:
Library Errors:
Adafruit_SH1106
) is installed and included in your project.Q: Can the SH1106 work with 5V microcontrollers?
A: Yes, but you need to use a level shifter to convert the 5V logic signals to 3.3V.
Q: What is the difference between SH1106 and SSD1306?
A: Both are OLED display drivers, but the SH1106 has a slightly different memory mapping and supports larger displays. Ensure your library supports the SH1106 specifically.
Q: How do I identify the I2C address of my SH1106 display?
A: Use an I2C scanner sketch to detect the address. It is typically 0x3C
or 0x3D
.
Q: Can I use the SH1106 with Raspberry Pi?
A: Yes, the SH1106 is compatible with Raspberry Pi via I2C or SPI. Use libraries like luma.oled
for Python development.
By following this documentation, you should be able to successfully integrate and use the SH1106 in your projects!