Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe most common reason an I2C sensor does not work is a wrong address. This tool scans the I2C bus, shows every device it finds on an OLED, and guesses what it is from a short list of common addresses, such as 0x3C for an OLED, 0x68 for an MPU6050 or DS3231 and 0x76 for a BMP280. Keep it in your toolbox: wire any I2C module next to the OLED and see its address instantly. The OLED shares the bus, so it shows up too.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB cable.
i2c_scanner.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const char* guess(uint8_t a) {
switch (a) {
case 0x3C: case 0x3D: return "OLED SSD1306";
case 0x68: return "MPU6050/DS3231";
case 0x69: return "MPU6050 (AD0 high)";
case 0x76: case 0x77: return "BMP280/BME280";
case 0x23: case 0x5C: return "BH1750";
case 0x53: return "ADXL345";
case 0x57: return "AT24C EEPROM";
case 0x5A: return "MLX90614";
case 0x29: return "VL53L0X/L1X";
case 0x40: return "INA219/HTU21D";
case 0x38: return "AHT10";
case 0x27: case 0x3F: return "LCD backpack";
default: return "unknown";
}
}
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(WHITE);
}
void loop() {
oled.clearDisplay();
oled.setCursor(0, 0); oled.print("I2C scan");
int found = 0, row = 0;
for (uint8_t a = 1; a < 127; a++) {
Wire.beginTransmission(a);
if (Wire.endTransmission() == 0) {
found++;
Serial.printf("found 0x%02X %s\n", a, guess(a));
if (row < 5) { oled.setCursor(0, 12 + row * 10); oled.printf("0x%02X %s", a, guess(a)); row++; }
}
}
if (!found) { oled.setCursor(0, 20); oled.print("nothing found"); }
oled.display();
delay(2000);
}
Your module is not answering. Check power, SDA and SCL, and that the module is not 5 V only.
Two modules share an address. Many have a jumper to change it.
A floating or wrongly wired bus can look like many devices. Check for a short.
A number from 1 to 127 that picks one device on the shared two-wire bus.
The ESP32 has two I2C controllers; change the pins in Wire.begin to scan another set.
To change the address so two identical modules can share the bus.
4 parts: ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 30 minutes. The build on this page has 6 steps.
No. This page has the complete, tested code (i2c_scanner.ino).
About ₹595 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How I2C addresses work; Scanning the bus from 0x01 to 0x7E; Pull-ups and wire length.
Ideas that reuse this build: ESP32 BH1750 lux meter. They are listed under Take it further on this page.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Learning project. Check every circuit and the datasheet of each part before you power it up.