On the Nano ESP32 a 0.96″ OLED goes exactly where it would on a classic Nano: SDA to A4, SCL to A5. The only change is power — use 3V3.
The sketch shows uptime and free heap every second.
Wiring
| Arduino Nano ESP32 | SSD1306 OLED 0.96″ (128×64, I2C) | Wire | Notes |
|---|---|---|---|
| GND | GND | black | |
| 3V3 | VCC | red | |
| A5 | SCL | yellow | |
| A4 | SDA | blue |
3.3–5 V (on-board regulator) part, 3.3 V board. Most modules have a regulator and run from 3.3 V or 5 V. Their I2C pull-ups go to VCC, so on ESP32 and Pico power the OLED from 3.3 V to keep SDA/SCL at a safe level.
Board quirks
- I2C stays on A4/A5 like on every Nano, so
Wire.begin()needs no pins. Inside, A4/A5 are the S3’s GPIO11/12. - Power the OLED from 3V3: its pull-ups then sit at 3.3 V. Most OLED boards also accept 5 V on VCC, but there is no 5V pin on this Nano — VBUS is only live on USB.
- A4 and A5 are ADC2 pins, so you can’t use them for analog with Wi-Fi on anyway — I2C is a good use for them.
Code
// SSD1306 128x64 I2C OLED on an Arduino Nano ESP32.
// GND → GND, VCC → 3V3, SDA → A4, SCL → A5 — the same pins as on a classic Nano.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
void setup() {
Serial.begin(115200);
uint32_t t0 = millis();
while (!Serial && millis() - t0 < 3000) {}
Wire.begin(); // SDA = A4, SCL = A5 on the Nano ESP32
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("SSD1306 not found at 0x3C - try 0x3D, and check the GND/VCC order on your module");
while (true) delay(1000);
}
display.setTextColor(SSD1306_WHITE);
Serial.println("OLED ready");
}
void loop() {
display.clearDisplay();
display.setTextSize(2);
display.setCursor(0, 0);
display.print("Nano ESP32");
display.setTextSize(1);
display.setCursor(0, 28);
display.printf("Uptime: %lu s", millis() / 1000);
display.setCursor(0, 44);
display.printf("Free heap: %u KB", ESP.getFreeHeap() / 1024);
display.display();
delay(1000);
}// SSD1306 128x64 I2C OLED on an Arduino Nano ESP32.
// GND → GND, VCC → 3V3, SDA → A4, SCL → A5 — the same pins as on a classic Nano.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
void setup() {
Serial.begin(115200);
uint32_t t0 = millis();
while (!Serial && millis() - t0 < 3000) {}
Wire.begin(); // SDA = A4, SCL = A5 on the Nano ESP32
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("SSD1306 not found at 0x3C - try 0x3D, and check the GND/VCC order on your module");
while (true) delay(1000);
}
display.setTextColor(SSD1306_WHITE);
Serial.println("OLED ready");
}
void loop() {
display.clearDisplay();
display.setTextSize(2);
display.setCursor(0, 0);
display.print("Nano ESP32");
display.setTextSize(1);
display.setCursor(0, 28);
display.printf("Uptime: %lu s", millis() / 1000);
display.setCursor(0, 44);
display.printf("Free heap: %u KB", ESP.getFreeHeap() / 1024);
display.display();
delay(1000);
}Library: Adafruit SSD1306 (Adafruit (also install Adafruit GFX Library)) — compiled with Adafruit SSD1306 2.5.17.
Expected serial output
OLED readyOLED ready
Common errors
“SSD1306 not found at 0x3C”
Try 0x3D; check A4/A5. Full fix.
Sketch uploads but the board doesn’t start
Something holds B1 (GPIO0) low at power-up. Keep B0/B1 free.