To do an I2C scan on a Raspberry Pi the i2cdetect command is used. If not already done, be sure to enable I2C on the Raspberry Pi via raspi-config. If the i2cdetect command is not found, install it with:

sudo apt-get install i2c-tools

And then to run a scan, use i2cdetect with the following command line parameters:

i2cdetect -y 1

On modern Raspberry Pi OS releases, you do not need to run the command with sudo. The -y disables interactive mode, so it just goes ahead and scans. The 1 specifies the I2C bus.

Normal Behavior

If all goes well, you should get a list of addresses for each device found. In the example below, an Adafruit BMP280 breakout is attached to a Raspberry Pi 4.

The BMP280's I2C address of 0x77 shows up as expected.

Missing Device or Pull Ups

If the device is disconnect and/or the pull up resistors are missing, the results will look like this:

The scan runs fine, but no addresses are shown. Keep in mind that Raspberry Pi's include pull up resistors on the SCL and SDA pins.

This guide was first published on Sep 16, 2021. It was last updated on Jul 21, 2024.

This page (Raspberry Pi) was last updated on Mar 08, 2024.

Text editor powered by tinymce.