i2cdetect helps you find devices connected to the I2C bus on your Raspberry Pi. It shows which addresses are in use so you know what devices are connected.
0
0
i2cdetect for device scanning in Raspberry Pi
Introduction
You want to check if a sensor or device is properly connected to the Raspberry Pi's I2C bus.
You are troubleshooting why your I2C device is not responding.
You want to find the address of a new I2C device before programming it.
You want to verify that multiple I2C devices are detected on the bus.
Syntax
Raspberry Pi
sudo i2cdetect -y <bus_number>
-y skips the confirmation prompt so the scan runs immediately.
<bus_number> is usually 1 on modern Raspberry Pi models.
Examples
Scan the I2C bus number 1 without asking for confirmation.
Raspberry Pi
sudo i2cdetect -y 1Scan the I2C bus number 0, which may be used on older Raspberry Pi models.
Raspberry Pi
sudo i2cdetect -y 0Sample Program
This command scans the I2C bus 1 and prints a table showing device addresses. Addresses with numbers mean a device is found there.
Raspberry Pi
# Run this command in the Raspberry Pi terminal sudo i2cdetect -y 1
OutputSuccess
Important Notes
You need sudo because scanning requires root permissions.
If no devices show up, check your wiring and that I2C is enabled in Raspberry Pi settings.
The output shows a grid of addresses; numbers mean a device responded at that address.
Summary
i2cdetect scans the I2C bus to find connected devices.
Use sudo i2cdetect -y 1 on most Raspberry Pi models.
The output table helps you see which device addresses are active.
