I2C bus scanner
Probe every address on the I2C bus and report what answers. Run it before trusting any sensor wiring.
Board
ESP32
3V3
GND
EN
23
VP
22
VN
TX
34
RX
35
21
32
GND
33
19
25
18
26
5
27
17
14
16
12
4
GND
0
13
2
D2
15
D3
D1
CMD
D0
5V
CLK
Wiring
| From | To board | Note |
|---|---|---|
| Device VCC | 3V3 | |
| Device GND | GND | |
| Device SDA | GPIO 21 | |
| Device SCL | GPIO 22 |
Tested on this board
Not run on this board yet. Treat the wiring and code as a first draft.
Firmware, Arduino sketch for ESP32 Dev Module
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
}
void loop() {
int found = 0;
for (uint8_t addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.printf("Device at 0x%02X\n", addr);
found++;
}
}
Serial.printf("%d device(s) found\n\n", found);
delay(5000);
}S3
3V3
GND
3V3
TX
RST
RX
4
1
5
2
6
42
7
41
15
40
16
39
17
38
18
37
8
36
3
35
46
0
9
45
10
48
11
47
12
21
13
20
14
19
5V
GND
GND
GND
Wiring
| From | To board | Note |
|---|---|---|
| Device VCC | 3V3 | |
| Device GND | GND | |
| Device SDA | GPIO 8 | |
| Device SCL | GPIO 9 |
Tested on this board
Not run on this board yet. Treat the wiring and code as a first draft.
Firmware, Arduino sketch for ESP32S3 Dev Module
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(8, 9);
}
void loop() {
int found = 0;
for (uint8_t addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.printf("Device at 0x%02X\n", addr);
found++;
}
}
Serial.printf("%d device(s) found\n\n", found);
delay(5000);
}C3
GND
GND
3V3
TX
3V3
RX
2
GND
3
9
GND
8
RST
GND
GND
7
0
6
1
5
10
4
GND
GND
5V
18
5V
19
GND
GND
Wiring
| From | To board | Note |
|---|---|---|
| Device VCC | 3V3 | |
| Device GND | GND | |
| Device SDA | GPIO 6 | |
| Device SCL | GPIO 7 |
Tested on this board
Not run on this board yet. Treat the wiring and code as a first draft.
Firmware, Arduino sketch for ESP32C3 Dev Module
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(6, 7);
}
void loop() {
int found = 0;
for (uint8_t addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.printf("Device at 0x%02X\n", addr);
found++;
}
}
Serial.printf("%d device(s) found\n\n", found);
delay(5000);
}Parts
| Quantity | Part | Where to buy |
|---|---|---|
| 1× | ESP32 dev board | Buy at Amazon |
| 1× | Any I2C device | |
| 4× | Jumper wires |
Amazon buy links may include an Associates tag, and this site may earn a commission from qualifying Amazon purchases at no extra cost to you. Adafruit links are direct.
Libraries
Wire (built in)
Load it
- In the Arduino IDE, install the esp32 board package and pick the board named above the sketch.
- Paste the sketch, choose the board's port and upload. Hold BOOT if the upload stalls at Connecting.
- Close the IDE's serial monitor, then open the bench here to watch the output.