Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use sh1106: Examples, Pinouts, and Specs

Image of sh1106Design with sh1106 in Cirkit Designer

Introduction

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.

Explore Projects Built with sh1106

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!

Common Applications and Use Cases

Technical Specifications

The SH1106 is a highly efficient display driver with the following key specifications:

General 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 Configuration (I2C Mode)

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 Configuration (SPI Mode)

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)

Usage Instructions

How to Use the SH1106 in a Circuit

  1. Power Supply: Connect the VCC pin to a 3.3V power source and the GND pin to ground.
  2. Communication Interface:
    • For I2C: Connect the SCL and SDA pins to the corresponding I2C pins on your microcontroller.
    • For SPI: Connect the SCK, MOSI, and CS pins to the corresponding SPI pins on your microcontroller.
  3. Reset Pin: Connect the RES pin to a GPIO pin on your microcontroller for resetting the display.
  4. Data/Command Pin: Use the DC pin to toggle between sending data and commands to the display.

Important Considerations and Best Practices

Example Code for Arduino UNO (I2C Mode)

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
}

Notes on the Code

Troubleshooting and FAQs

Common Issues and Solutions

  1. Display Not Turning On:

    • Verify the power connections (VCC and GND).
    • Ensure the RES pin is properly connected or tied high.
  2. No Output on the Display:

    • Check the communication protocol (I2C or SPI) and ensure the wiring matches the selected mode.
    • Verify the I2C address or SPI configuration in your code.
  3. Flickering or Corrupted Display:

    • Ensure proper pull-up resistors are used for I2C lines.
    • Check for loose or poor-quality connections.
  4. Library Errors:

    • Ensure the correct library (Adafruit_SH1106) is installed and included in your project.
    • Update the library to the latest version if issues persist.

FAQs

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!