How to connect an OLED SSD1306 to Arduino
0.96″ display on A4 and A5, address 0x3C.
Wiring diagram
Open in the builderStep-by-step assembly
4 steps- 4 wires in order: ground, power, buses.Click a wire on the diagram or a table row to open its step.The ← → arrow keys flip through the steps.
- Step 1: GND of the display to GND of the board
- Step 2: VCC of the display to 5V of the board5 V. The display draws up to 25 mA, the pin supplies about 400 mA.
- Step 3: SCL of the display to A5 of the boardI2C address of the display: 0x3C, alternative 0x3D.
- Step 4: SDA of the display to A4 of the board
- Done: 4 wires in place.Check against the connection table below.
Connections
| Step | From | To | Color |
|---|---|---|---|
| 1 | Arduino Nano GND | OLED SSD1306 GND | black |
| 2 | Arduino Nano 5V | OLED SSD1306 VCC | red |
| 3 | Arduino Nano A5 | OLED SSD1306 SCL | I2C, green |
| 4 | Arduino Nano A4 | OLED SSD1306 SDA | I2C, green |
Power and wiring check
- The schematic check, the same as in the builder, found no errors: pin voltages match, ground is common, buses are fully connected.
- OLED SSD1306 draws up to 25 mA (about 10 typically) from the 5V pin of Arduino Nano, the pin supplies about 400 mA: USB gives 500 mA, the board takes part of it.
Current of the whole circuit and how long it runs on a battery: power budget. Where to plug what: breadboard layout.
Example code
Arduino IDE, Adafruit SSD1306 2.5, Adafruit GFX 1.11.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void setup() {
// 0x3D if the address resistor on the back is moved
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) for (;;);
oled.clearDisplay();
oled.setTextSize(2);
oled.setTextColor(SSD1306_WHITE);
oled.setCursor(0, 0);
oled.println("olerast");
oled.display();
}
void loop() {}
Part pinouts
Next steps for this circuit
How it is connected
On an Arduino Nano, I2C is on A4 (SDA) and A5 (SCL). An SSD1306 OLED module runs on 3.3-5 V and has its own regulator and pull-ups on the board, so it connects straight to the Nano's 5V. The order of GND and VCC on the header differs between batches: read the labels on your module before connecting.
The Adafruit_SSD1306 library keeps a 128×64 frame in memory: 1024 bytes of the Nano's 2048 bytes of RAM. If the sketch is large and the screen doesn't start (begin returns false), use U8g2 in page mode.
FAQ
- What is the address of a 0.96" OLED?
- 0x3C. If the address resistor on the back has been moved, 0x3D. The marking 0x78 on the board means the same 0x3C in eight-bit form.
- How is connecting to an Uno different?
- The wires are the same: SDA to A4, SCL to A5, and on an Uno R3 the same lines are also brought out to the SDA and SCL pins by AREF.
- Is a 1.3" screen connected the same way?
- The wires are the same, but it more often has an SH1106: the code needs a library for the SH1106 (Adafruit_SH110X or U8g2), otherwise the image is shifted by 2 columns.