User Manual

Like the SPI peripheral, I2C is not turned on by default. Again, we can use raspi-config
to enable it.
1. Run sudo raspi-config .
2. Use the down arrow to select 5 Interfacing Options
3. Arrow down to P5 I2C .
4. Select yes when it asks you to enable I2C
5. Select OK and then Finish
Once you return to terminal, enter this command:
>ls /dev/*i2c*
The Pi should respond with:
/dev/i2c-1
Which represents the user-mode I2C interface.
Utilities
There is a set of command-line utility programs that can help get an I2C interface
working. You can get them with the apt package manager.
sudo apt-get install -y i2c-tools
In particular, the i2cdetect program will probe all the addresses on a bus, and report
whether any devices are present. Call i2cdetect -y 1 to probe the first I C bus, which is
what the Qwiic pHAT is connected to.
pi@raspberrypi:~/$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
This map indicates that there is a peripheral at address 0x60. We can read and write its
registers using the i2cget , i2cset and i2cdump commands.
2
9/9