====== SSH1106/SSD1306 OLED Display with I²C communication ====== {{ :sensor:ssh1x06_oled_03.png?180|SSH1106 OLED Display with I²C communication}}The SSD1306 and SH1106 (often misspelled as SSH1106 or SSH1306) are both popular single-chip CMOS OLED drivers used for small monochrome displays (0.91", 0.96", 1.3"). While they are very similar and often share the same [[com:basic_i2c|I²C]] address (0x3C), they are not directly compatible because of differences in memory mapping and supported operating modes. The key difference is that the SH1106 has more internal RAM (132x64) compared to the SSD1306 (128x64). As a result, a 128x64 display using an SH1106 chip may display garbage pixels or appear shifted by 2 pixels on each side when controlled with a standard SSD1306 library. * **SSD1306:** Works with standard libraries like Adafruit_SSD1306 * **SH1106:** Requires specific libraries, such as Adafruit_SH110x or U8g2 (using U8G2_SH1106_128X64_NONAME...) ^Feature^SSD1306^SH1106 (SSH1106)| |Max Resolution|128 x 64|132 x 64| |Internal RAM|128 x 64 bits|132 x 64 bits| |Addressing|Page, Horizontal, Vertical|Mostly Page Mode only| |Hardware Scroll|Yes|No| |Typical Use|0.96" OLED|1.3" OLED| |Driver Library|Adafruit_SSD1306|U8g2 / Adafruit_SH110x| Both are commonly used with Arduino, Raspberry Pi, and ESP8266/ESP32 via [[com:basic_i2c|I²C]] (SDA/SCL) or SPI, typically requiring only 4 pins (VCC, GND, SDA, SCL). If an SH1106 display is initialized with an SSD1306 library, the screen will likely show //"garbage"// or shifted lines. ^SSH1106 Chip 128 x 64 Pixel^SSD1306 Chip 64x48 Pixel^SSD1306 Chip 128 x 32 Pixel^SSD1306 Chip 128 x 64 Pixel| |{{:sensor:ssh1x06_oled_01.png?180|SSH1106 OLED Display with I²C communication}}|{{:sensor:ssh1x06_oled_05.png?180|SSH1106 OLED Display with I²C communication}}|{{:sensor:ssh1x06_oled_06.png?180|SSH1106 OLED Display with I²C communication}}|{{:sensor:ssh1x06_oled_07.png?180|SSH1106 OLED Display with I²C communication}}| ===== Pinout ===== ^Pin Label^Function^Description| ^GND|Ground|Ground (0V)| ^VCC|Power|3.3V or 5V (Most modules have a voltage regulator)| ^SCL|Clock|I²C Clock (D0 pin)| ^SDA|Data|I²C Data (D1 pin)| * Note on Ordering: On some cheap modules, VCC and GND are swapped. Verify your module label before powering it up to avoid damage. * I²C Address: Usually **0x3C** or **0x3D**. ===== Features of particular types ===== ^Name^ID^Characteristics| |AZ-Delivery 1.30' IIC V21|{{:sensor:ssh1x06_oled_08.png?100|AZ-Delivery 1.30' IIC V21}}|1.3 inch OLED Display \\ **SH1106** \\ 128 x 64 pixel| |AZ-Delivery 0.96 inch OLED SSD1306|{{:sensor:ssh1x06_oled_09.png?100|AZ-Delivery 0.96 inch OLED SSD1306}}|0.96 inch OLED \\ **SSD1306** \\ 128 x 64 pixel| ===== SSH1106 Arduino ===== - Installing the olikraus/u8g2 library (installation only works manually) from here: https://github.com/olikraus/u8g2 - Example program: #include #include #include // Constructor for SH1106 128x64 I2C (Hardware I2C) // U8G2_R0: No rotation. U8X8_PIN_NONE: No hardware reset pin. U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); void setup(void) { u8g2.begin(); } void loop(void) { u8g2.firstPage(); do { // https://docs.rs/u8g2-fonts/latest/u8g2_fonts/fonts/index.html u8g2.setFont(u8g2_font_ncenB14_tr); // Set font u8g2.drawStr(0, 24, "Hello World!"); // Draw text } while ( u8g2.nextPage() ); } ===== I²C topics on lamaPLC ===== {{topic>i2c}} \\ \\ {{tag>i2c oled display SSD1306 SH1106 SSH1106 Arduino CMOS}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}