Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

1.3" SH1106 OLED with Arduino Uno — U8g2 page mode that fits in RAM

Wire a 1.3" SH1106 I2C OLED to an Arduino Uno R3 (check the VDD/GND order) and drive it with U8g2’s page-buffer mode, which needs only 128 bytes of RAM.

Arduino C++Verified — core avr 1.8.8, U8g2 2.36.19, 3 Nov 2026Compile-only

Community draft — report a mistake

The 1.3-inch OLED is the bigger sibling of the 0.96-inch display: the same 128×64 pixels, but larger and easier to read across a room. Almost all of them use the SH1106 controller, which the Adafruit SSD1306 library can’t drive properly.

On the Uno, two things matter. First, the pin order: many 1.3” boards print VDD before GND, so check the silkscreen before you wire 5V. Second, RAM. The U8g2 library offers a page-buffer mode (constructors with _1_) that keeps only one eighth of the screen in memory — 128 bytes instead of 1 KB. On a 2 KB Uno that leaves room for sensors and their libraries.

The sketch shows a title, an uptime clock in large digits and a live A0 reading, redrawn twice a second with the page loop.

Wiring

Arduino Uno R3Only the pins used are shown · 5 V logicSH1106 OLED 1.3″ (128×64, I2C)5VGNDSDA · 18SCL · 19VDDGNDSCKSDA
Every connection
Arduino Uno R3SH1106 OLED 1.3″ (128×64, I2C)WireNotes
5VVDDredMany 1.3" boards print VDD first, GND second — the reverse of the 0.96" OLED. Read the silkscreen.
GNDGNDblack
SCLSCKyellowPrinted SCK or SCL; it is the I2C clock. Same signal as A5.
SDASDAblueSame signal as A4

3.3–5 V (on-board regulator) part, 5 V board. Most modules have a regulator and pull-ups to VDD. On ESP32 and Pico power the OLED from 3.3 V so SDA/SCK stay at 3.3 V; on Uno 5 V is fine.

Board quirks

  • The 1.3" module uses an SH1106, not an SSD1306. With an SSD1306 driver you get a shifted picture with a noisy stripe at one edge, or nothing.
  • U8g2’s _1_ constructors draw the screen in 8 strips, so they need 128 bytes of RAM instead of 1 KB. The cost: your drawing code runs 8 times per frame, inside the firstPage()/nextPage() loop.
  • Prepare values (like the time string) before the page loop. Reading a sensor inside it would read it 8 times per frame, and the strips could disagree.
  • U8g2 is a large library. Each font you use adds flash — on the Uno, stick to two or three fonts.
  • The board has a regulator, so 5 V is fine, and its pull-ups then sit at a level the Uno reads properly.

Code

sh1106-uno.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// 1.3" SH1106 128x64 I2C OLED on an Arduino Uno R3 with U8g2 in page-buffer mode.
// VDD → 5V, GND → GND, SCK → SCL (A5), SDA → SDA (A4). Address 0x3C (some boards 0x3D).
// The _1_ constructor keeps only 128 bytes of the screen in RAM and draws it in 8 pages,
// instead of the 1 KB a full buffer would take from the Uno's 2 KB.
#include <Wire.h>
#include <U8g2lib.h>

U8G2_SH1106_128X64_NONAME_1_HW_I2C oled(U8G2_R0, U8X8_PIN_NONE);

void setup() {
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(0x3C);
  bool at3C = Wire.endTransmission() == 0;
  if (!at3C) oled.setI2CAddress(0x3D * 2);  // U8g2 takes the 8-bit address
  oled.begin();
  Serial.print(F("SH1106 at 0x"));
  Serial.println(at3C ? F("3C") : F("3D"));
}

void loop() {
  unsigned long s = millis() / 1000;
  char buf[12];
  snprintf(buf, sizeof(buf), "%02lu:%02lu:%02lu", s / 3600, (s / 60) % 60, s % 60);
  int a0 = analogRead(A0);
  oled.firstPage();
  do {  // this block runs once per page (8 times) - draw the whole screen each time
    oled.setFont(u8g2_font_6x12_tr);
    oled.drawStr(0, 12, "Arduino Uno");
    oled.drawStr(0, 26, "SH1106 1.3\" OLED");
    oled.setFont(u8g2_font_logisoso22_tn);
    oled.drawStr(0, 56, buf);
    oled.setFont(u8g2_font_6x12_tr);
    oled.setCursor(98, 64);
    oled.print(a0);
  } while (oled.nextPage());
  delay(500);
}

Library: U8g2 (oliver) — compiled with U8g2 2.36.19.

Expected serial output

Serial Monitor · 9600Output
SH1106 at 0x3C

Common errors

Screen stays black

VDD and GND swapped (check the print), or the wrong constructor. See U8g2 blank screen.

Image shifted by 2 pixels with a garbage stripe

An SSD1306 driver on an SH1106 panel. Use the U8G2_SH1106_… constructor as in this sketch.

Only the top eighth of the screen shows text

Drawing code is outside the do { … } while (oled.nextPage()) loop. Everything you draw must be inside it.

↑↓ to move · Enter to open