Two controller names keep showing up in my workshop parts bins: SH1107 and SSD1315. The SH1107 drives the square 128x128 and the 64x128 OLEDs. The SSD1315 now ships on many 0.96 inch modules that used to carry an SSD1306. One of them is a drop-in replacement. The other needs a different library. This guide shows you which is which, with working Arduino code for both.
If your module is a 1.3 inch 128x64 with a picture shifted two pixels to the side, you have the third common chip, the SH1106. That one has its own guide: SH1106 vs SSD1306.
SSD1306 vs SH1106 vs SH1107 vs SSD1315 vs SSD1309
| Controller | Typical module | Resolution | Arduino library | Notes |
|---|---|---|---|---|
| SSD1306 | 0.96" and 0.91" | 128x64, 128x32 | Adafruit SSD1306, U8g2 | The default everyone codes for |
| SSD1315 | Newer 0.96", Grove OLED 0.96" v2 | 128x64 | Adafruit SSD1306, U8g2 SSD1306 | Same commands as SSD1306 |
| SH1106 | 1.3" | 128x64 (132 column memory) | Adafruit SH110X, U8g2 SH1106 | 2-pixel offset if driven as SSD1306 |
| SH1107 | 1.12" square, 1.3" 64x128, Feather OLED | 128x128, 64x128 | Adafruit SH110X, U8g2 SH1107 | Not SSD1306 compatible |
| SSD1309 | 1.54" and 2.42" | 128x64 | U8g2 SSD1309, often Adafruit SSD1306 | Bigger glass, needs a reset pin on some boards |
How do I know which controller I have?
- Read the listing or the back of the board. Sellers usually print the chip name. "SSD1315" and "SH1107" are rarely mislabelled. "SSD1306" on a 1.3 inch module often is.
- Look at the shape. A square screen is almost certainly SH1107. A thin bar is SSD1306 128x32.
- Run the I2C scanner. All of these answer at 0x3C or 0x3D, so the scanner confirms wiring, not the chip. The scanner sketch is in my Arduino OLED example code post.
- Try the SSD1306 hello world. Clean picture means SSD1306 or SSD1315. Shifted with a noisy right edge means SH1106. Garbage or only a strip lit means SH1107.
SSD1315: use your SSD1306 code unchanged
The SSD1315 comes from Solomon Systech, the same company that makes the SSD1306. It keeps the same command set, the same 128x64 memory layout and the same I2C addresses. In practice, SSD1315 vs SSD1306 makes no difference to your sketch. I have run the exact same Adafruit SSD1306 code on both side by side.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1); // works for SSD1315 too
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) while (true) {}
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(2);
display.setCursor(0, 0);
display.println("SSD1315");
display.setTextSize(1);
display.println("same code as SSD1306");
display.display();
}
void loop() {}
In U8g2, use the normal U8G2_SSD1306_128X64_NONAME_F_HW_I2C constructor. Animations exported from the
OLED Animation Maker with SSD1306 selected run on an SSD1315 with no edits.
SH1107: wiring and the right library
The SH1107 is a Sino Wealth chip with 128x128 pixels of memory. Modules use either the full square, like the Seeed Grove OLED 1.12 inch v2 and the Adafruit 1.12 inch 128x128, or a 64x128 strip mounted sideways, like the Adafruit FeatherWing OLED 128x64. Wiring is ordinary I2C: GND, VCC, SDA and SCL, the same pins as any OLED on your board.
Install Adafruit SH110X from Library Manager. It contains the Adafruit_SH1107 class. The
Adafruit SSD1306 library will not work, because the SH1107 addresses its memory differently.
128x128 SH1107 with Adafruit SH110X
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
// width, height, wire, reset pin, I2C speed while drawing, speed after
Adafruit_SH1107 display(128, 128, &Wire, -1, 1000000, 100000);
void setup() {
Serial.begin(115200);
if (!display.begin(0x3C, true)) { // Adafruit's 128x128 board uses 0x3D
Serial.println("SH1107 not found");
while (true) {}
}
display.clearDisplay();
display.setTextColor(SH110X_WHITE);
display.setTextSize(2);
display.setCursor(10, 10);
display.println("SH1107");
display.drawRect(0, 0, 128, 128, SH110X_WHITE);
display.fillCircle(44, 80, 12, SH110X_WHITE);
display.fillCircle(84, 80, 12, SH110X_WHITE);
display.display();
}
void loop() {}
Note the colour constant: SH110X_WHITE, not SSD1306_WHITE. Everything else, from
drawBitmap to setCursor, is the familiar Adafruit GFX API.
64x128 SH1107 (FeatherWing style)
Adafruit_SH1107 display(64, 128, &Wire);
void setup() {
display.begin(0x3C, true);
display.setRotation(1); // landscape: 128 wide, 64 tall
display.clearDisplay();
display.setTextColor(SH110X_WHITE);
display.setCursor(0, 0);
display.println("64x128 SH1107");
display.display();
}
void loop() {}
Without setRotation(1) the text runs down the long side. If yours ends up upside down, try rotation 3.
SH1107 with U8g2
U8g2 has several SH1107 constructors. Pick the one that matches your module:
| Module | U8g2 constructor (full buffer, hardware I2C) |
|---|---|
| Generic 128x128 | U8G2_SH1107_128X128_F_HW_I2C |
| Seeed Grove OLED 1.12" v2 | U8G2_SH1107_SEEED_128X128_F_HW_I2C |
| Generic 64x128 | U8G2_SH1107_64X128_F_HW_I2C |
#include <Wire.h>
#include <U8g2lib.h>
U8G2_SH1107_SEEED_128X128_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void setup() { u8g2.begin(); }
void loop() {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(8, 30, "128x128");
u8g2.drawFrame(0, 0, 128, 128);
u8g2.sendBuffer();
delay(500);
}
Will a 128x128 SH1107 run on an Arduino Uno?
This is the trap. A 128x128 frame buffer is 128 × 128 / 8 = 2,048 bytes. The Uno has exactly 2,048 bytes of
RAM for everything, so the Adafruit SH110X example and the U8g2 _F_ constructor both fail, usually by hanging or
resetting. You have two options:
- Use U8g2 page mode. Swap
_F_for_1_(128 bytes) or_2_(256 bytes) and draw inside thefirstPage()/nextPage()loop. It is slower but fits. - Use a bigger board. An ESP32, ESP8266 or Raspberry Pi Pico has room for the full buffer and many frames. See Pico + OLED in Arduino IDE.
// Uno-friendly page mode, 128 byte buffer
U8G2_SH1107_128X128_1_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void loop() {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_6x10_tf);
u8g2.drawStr(0, 12, "Page mode on Uno");
u8g2.drawCircle(64, 70, 30);
} while (u8g2.nextPage());
delay(1000);
}
Animations on SH1107 and SSD1315
The square SH1107 is lovely for robot faces, since two big eyes fit with room for a mouth. The
OLED Robot Eyes generator draws eyes in code, so you can adapt its sketch by changing the
display object to Adafruit_SH1107 and the screen height to 128. For frame-based clips, make your frames in the
OLED Animation Maker at 128x64 and draw them centred on the 128x128 panel with
drawBitmap(0, 32, frame, 128, 64, SH110X_WHITE). Single logos and icons convert with the
Image to Byte Array tool, which works for any width and height.
Troubleshooting
- SH1107 shows a lit strip or random lines. You are using the SSD1306 library. Switch to Adafruit SH110X or U8g2 SH1107.
- Picture is half height or mirrored. The width and height in the constructor are swapped. 64x128 modules are 64 wide in memory.
- Uno resets as soon as the screen draws. Out of RAM. Use U8g2 page mode.
- Nothing at 0x3C. Try 0x3D. Adafruit's 128x128 SH1107 board ships at 0x3D.
- SSD1309 2.42 inch stays black. Many of these need the RES pin wired to a GPIO and passed to the constructor.
Make frames for any OLED
Draw, import a GIF or MP4, and preview it pixel-exact in the OLED Simulator. Export for SSD1306, SSD1315 and SH1106 in one click.
Open OLED Animation Maker →Popular searches: sh1107 · sh1107 arduino · ssd1315 · ssd1315 vs ssd1306 · 128x128 oled arduino · adafruit sh110x · u8g2 sh1107 · grove oled 1.12 · ssd1309 vs ssd1306
Frequently asked questions
Is SSD1315 the same as SSD1306?
For Arduino code, yes. The SSD1315 uses the same command set and the same 128x64 page memory as the SSD1306, so the Adafruit SSD1306 library and the U8g2 SSD1306 constructors work unchanged. It is a newer chip from the same maker, Solomon Systech.
Which library do I use for an SH1107 OLED?
Adafruit SH110X (class Adafruit_SH1107) or U8g2 with an SH1107 constructor such as U8G2_SH1107_128X128_F_HW_I2C or U8G2_SH1107_SEEED_128X128_F_HW_I2C for the Grove 1.12 inch module. The Adafruit SSD1306 library does not work with SH1107.
Can an Arduino Uno drive a 128x128 SH1107?
Not with a full frame buffer. A 128x128 buffer needs 2,048 bytes and the Uno has 2,048 bytes of RAM in total. Use U8g2 in page mode (a constructor with _1_ or _2_ instead of _F_) or move to an ESP32, ESP8266 or Raspberry Pi Pico.
What I2C address does an SH1107 use?
Usually 0x3C. The Adafruit 128x128 SH1107 module defaults to 0x3D. Run an I2C scanner to be sure, and pass the address to begin().
Why is my SH1107 picture rotated or squashed?
SH1107 memory is 128 rows tall and the 64x128 modules are mounted sideways. Create the display as 64 by 128 and call setRotation(1) in Adafruit SH110X, or pick the U8g2 64X128 constructor with U8G2_R1.
Can I use OLED Animation Maker frames on an SH1107 or SSD1315?
Yes. On an SSD1315 the exported SSD1306 sketch runs as is. On an SH1107 keep the frame arrays and draw them with drawBitmap from Adafruit SH110X, or with drawXBM in U8g2 if you export XBM style.
Related guides you might like
- SH1106 vs SSD1306
- U8g2 vs Adafruit SSD1306
- Arduino OLED example code (10 sketches)
- Raspberry Pi Pico + OLED in Arduino IDE
- Robot eyes OLED animation
- Arduino OLED display tutorial
Free tools: OLED Animation Maker for your SSD1306 and SH1106 animations, OLED Robot Eyes for animated robot faces, Image to Byte Array for your logos, the OLED Simulator to preview before you flash, and Assemble Studio for your name and logo animations. See all tools.