Run an I2C scanner first. It shows whether the device answers at all, and at which address. If the scanner finds nothing, the fault is wiring, power or pull-ups. If it finds a different address, your code has the wrong one.
What the message means
I2C uses two wires, SDA and SCL, plus power and ground. Every device has an address. A scanner tries each address and prints the ones that reply.
Fix it in this order
- Upload the scanner below and open the Serial Monitor at 115200 baud.
- If nothing is found, swap SDA and SCL. They are often crossed.
- Check the pins. An Uno uses A4 (SDA) and A5 (SCL). The ESP32 default is GPIO 21 (SDA) and GPIO 22 (SCL).
- Check power and ground, and check the module voltage matches the board. Do not feed 5 V logic into a 3.3 V ESP32.
- Check the pull-ups. Many breakout boards include them. Bare chips need roughly 4.7 kohm from SDA and SCL to the supply.
- Shorten wires and lower the bus speed if the scanner finds the device only sometimes.
An I2C scanner
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin();
for (byte addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.print("Found 0x");
Serial.println(addr, HEX);
}
}
}
void loop() {}Why it happens
Common causes are swapped SDA and SCL wires, a missing common ground, the wrong supply voltage, a different address than the example assumes, and missing pull-up resistors. A scanner shows what is actually on the bus.
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(); // Uno SDA=A4 SCL=A5; many ESP32 boards SDA=21 SCL=22
for (byte a = 1; a < 127; a++) {
Wire.beginTransmission(a);
if (Wire.endTransmission() == 0) { Serial.print("found 0x"); Serial.println(a, HEX); }
}
}
void loop() {}
Example sketch: change pins and values for your own wiring. It has not been bench-tested on your hardware.
If nothing is found, check wiring and power first. Breakout boards usually include pull-ups; bare chips need about 4.7 kΩ on each line to the logic voltage.
If you see this, do this
| You see | Do this |
|---|---|
| Scanner finds 0x27 or 0x3F | A typical LCD backpack. Use the address it printed. |
| Scanner finds 0x68 or 0x69 | Typically an MPU6050 style sensor. |
| Scanner finds nothing | Wiring, power or pull-ups. Re-check SDA and SCL. |
Related
ESP32 pinout for robotics, Arduino IDE setup.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.