I2C Scanner

I2C Scanner

Use an I2C scanner when a board powers up but a sensor library cannot find its device.

Step What you check Expected evidence
1. Power and ground Sensor VCC and GND match the controller voltage Sensor board powers on; no hot components
2. Bus wiring SDA to SDA, SCL to SCL, shared ground Scanner can probe the bus without lockup
3. Pull-ups SDA and SCL have pull-ups to the correct voltage Lines idle HIGH on a meter or oscilloscope
4. Address scan Probe addresses from 0x08 to 0x77 Known devices appear at their documented addresses
5. Conflict check Compare detected addresses against the design Duplicate addresses are resolved with address pins or a mux

Example scan result:

Detected address Likely device What to do next
0x3C OLED display Use the OLED library with address 0x3C.
0x76 BME280/BMP280 Use the sensor library with address 0x76.
No addresses Wiring, pull-up, or power problem Check SDA/SCL order, VCC, ground, and pull-up resistors.

Hands-On Lab: I2C Scanner

Objective: Find all I2C devices connected to your ESP32/Arduino.

Stage Student action Evidence to record
Baseline Scan with no external sensor attached No unexpected addresses, or only built-in board devices.
Add display Connect SSD1306 OLED New address appears at 0x3C or 0x3D.
Add sensor Connect BME280/BMP280 New address appears at 0x76 or 0x77.
Conflict test Add a second device with the same address if available Scanner still shows one address, but both devices may respond at once.
Fix Change address pin or use an I2C multiplexer Each device becomes uniquely selectable.

Sample scan interpretation:

Scanner output Meaning Next action
0x3C, 0x76 OLED and BME280 are both visible Start the sensor/display application.
Only 0x3C Sensor not responding Check BME280 power, SDA/SCL order, and address pin.
No addresses Bus-level fault Check pull-ups, ground, VCC, and whether SDA/SCL are swapped.

Back to the chapter