Skip to content

Latest commit

 

History

History
32 lines (29 loc) · 1.72 KB

03-Basic_I2C.md

File metadata and controls

32 lines (29 loc) · 1.72 KB

Enabling the I²C (Inter-Integrated Circuit) Interface

So now tht GPS is up and running, it's time to get some of the other sensors working.
The I²C interface is an opensource, single-bit serial bus that allows multiple devices connected to just two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), and are logicaly seperated by a device address. For the Raspberry Pi, these address fall between hex 03 and hex 77. A couple of the sensors use the I²C interface which needs to be enabled. These are the steps to get I²C enabled.
First, let's install some tools:
sudo apt-get install python-smbus i2-tools
You could enable the i2c interface via the GUI, but where's the fun in that. Let's use raspi-config instead.
sudo raspi-config
Select the following sequence:
Advanced Options => I2C => <Yes> => <Ok> => <Finish>
Or you can add the dtparam=i2c1=on line, and un-comment the line #dtparam=i2c_arm=on in the /boot/config.txt file.

The interface can be checked with the command sudo i2cdetect -y 1
You sould see an table displayed with an address at each grid vector.
Here is mine:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77