Hey Arduino folks,
I’m struggling to get a 0.96” SSD1306 OLED display working with my Arduino Nano over I2C. The screen stays blank, and my I2C scanner sketch reports “No I2C devices found.” I’ve double-checked my setup, but I’m stuck—hoping for some debug tips!
Setup:
- Board: Arduino Nano (ATmega328P, old bootloader, genuine).
- Display: 0.96” OLED (SSD1306, 128x64, I2C, 4-pin: VCC, GND, SCL, SDA).
- Connections:
- VCC to Nano 5V.
- GND to Nano GND.
- SCL to Nano A5.
- SDA to Nano A4.
- Environment: Arduino IDE 2.3.3, Windows 11, USB connection.
- Libraries: Adafruit_SSD1306 (v2.5.10), Adafruit_GFX (v1.11.10), Wire (built-in).
Code:
Here’s my test sketch (based on Adafruit’s example):
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println(F("Hello, Arduino!"));
display.display();
}
void loop() {}
I2C Scanner Code:
#include <Wire.h>
void setup() {
Serial.begin(9600);
Serial.println("I2C Scanner");
Wire.begin();
}
void loop() {
byte error, address;
int nDevices = 0;
Serial.println("Scanning...");
for (address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at 0x");
if (address < 16) Serial.print("0");
Serial.println(address, HEX);
nDevices++;
}
}
if (nDevices == 0) Serial.println("No I2C devices found");
Serial.println("Done\n");
delay(5000);
}
Issue:
- The OLED stays blank (no backlight or text).
- Serial monitor shows “SSD1306 allocation failed” for the test sketch.
- I2C scanner reports “No I2C devices found” every 5 seconds.
- No compile or upload errors in the IDE.
What I Tried:
- Swapped SDA/SCL pins (A4/A5) to rule out wiring mix-up.
- Tested with another Nano—same result.
- Added 4.7k pull-up resistors between SDA/SCL and 5V—no change.
- Tried I2C address 0x3D instead of 0x3C—still fails.
- Reinstalled libraries and IDE, verified board settings.
- Checked voltages: VCC at 4.8V, SDA/SCL idle at ~4.7V.
- Searched forum for SSD1306 issues; found similar threads (e.g., 2024 Nano I2C posts) but no clear fix for my setup.
Question:
Has anyone run into this with a Nano and SSD1306 OLED? Could it be a bad display, I2C bus issue, or code/config mistake? Any debug steps to narrow it down (e.g., specific Wire.h tweaks or multimeter tests)? Thanks for any ideas!