LinuxCommandLibrary

i2cdetect

Detect I2C devices on a bus

TLDR

List active I2C buses

$ i2cdetect -l
copy

Scan devices on an I2C bus
$ i2cdetect [i2c_bus]
copy

Scan devices on an I2C bus without asking for confirmation
$ i2cdetect -y [i2c_bus]
copy

SYNOPSIS

i2cdetect [options] I2CBUS
i2cdetect -l

PARAMETERS

-l, --list
    List all detected I2C/SMBus adapters with bus numbers.

-y I2CBUS, --yes-do-it
    Disable interactive prompt; force scan on specified bus.

-r, --read-also
    Probe with SMBus 'read byte' protocol too (slower, for non-standard devices).

-q, --quiet
    Suppress non-fatal warnings, like 10-bit address notes.

-a
    Probe full address range 0x00-0x7f (default excludes some reserved).

-V, --version
    Print version information and exit.

I2CBUS
    Bus number to scan, e.g. 1 for /dev/i2c-1.

DESCRIPTION

i2cdetect is a utility from the i2c-tools package for scanning I2C (Inter-Integrated Circuit) or SMBus buses to detect attached slave devices. It probes each 7-bit address (default range 0x03-0x77) by sending a dummy start/stop sequence and checking for ACK responses.

The output is a grid table:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 50 -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Numbers indicate responding addresses, UU shows kernel-bound drivers, -- means no ACK.

Essential for debugging hardware on embedded systems like Raspberry Pi, Arduino shields, or industrial controllers. Interactive mode prompts 'Scan bus?'; use -y for non-interactive scripting. List buses with -l. Requires access to /dev/i2c-* (root or i2c group).

Probes are quick but -r adds SMBus read-byte for stubborn devices, increasing scan time. Widely used since early 2000s for verifying sensors, EEPROMs, RTCs.

CAVEATS

Probing may lock up or reset sensitive hardware; avoid on production systems. Interactive mode prevents accidents—do not always use -y. Some devices ignore probes or share addresses. Requires kernel I2C support and device permissions.

OUTPUT LEGEND

--: No response.
XX: Address acknowledged (e.g. 50 = 0x50).
UU: Kernel driver bound (instantiate_info).
Whitespace: Not probed.

PERMISSIONS

Needs read/write on /dev/i2c-BUS. Add user to i2c group: sudo usermod -aG i2c $USER.

EXAMPLE

i2cdetect -l → lists buses.
i2cdetect -y 1 → scans bus 1 non-interactively.

HISTORY

Introduced in early i2c-tools (circa 2001) for Linux 2.4/2.6 I2C subsystem by Frodo Looijaard and Mark D. Studebaker. Maintained by Jean Delvare; evolved with SMBus support and kernel driver integration.

SEE ALSO

i2cget(1), i2cset(1), i2cdump(1), i2ctransfer(1)

Copied to clipboard