background image

I2C on Raspberry Pi - 

OS and Library Install 

If you’re starting from scratch, with a blank microSD card, you’ll want to install Raspbian. If you’ve 
already got a working Raspbian system, skip ahead to step 3. 

1.

 

Download the 

NOOBS

 

image. As of this writing, it’s at version 2.4.4. 

2.

 

Follow the official 

installation instructions

3.

 

Follow the 

Wiring Pi Instructions

 to get 

git

, update and upgrade your Rasbpian packages, 

then install WiringPi. 

Be patient 

– each of these steps takes a while. 

Once you’ve got wiringPi installed, run the 

gpio

 commands shown below. 

COPY CODE>gpio -v 
>gpio readall 

It should respond with some information about the wiringPi version and the Pi that its running on, 
then draw a table illustrating the configuration for the pins in the 40-pin connector. 

Configuration 

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 

COPY CODE>ls /dev/*i2c* 

The Pi should respond with 

COPY CODE/dev/i2c-1 

Which represents the user-mode I2C interface. 

 

 

Содержание Qwiic Shield

Страница 1: ...ered to the PCB to The Qwiic Shields have 4x Qwiic connect ports all on the same I2 C bus Logic level converters are included for the Qwiic connect port s SDA and SCL lines so you do not have to worry...

Страница 2: ...e are also buses for ground 5V and 3 3V on the shield for Arduino outlined below The headers also allow for every pin on the microcontroller of your choice to still be accessed through the female head...

Страница 3: ...der has been soldered to the PCB to The Qwiic shield for the Particle Photon also includes 4x Qwiic connect ports a prototyping area and buses for 3 3V and ground However they are much smaller The Pho...

Страница 4: ...those headers to your shield properly These tips are also useful when installing the headers for the Qwiic shield for Photon Once you ve attached headers to your Qwiic shield you re ready to plug it i...

Страница 5: ...Qwiic HAT for Raspberry Pi The Qwiic HAT has 4 Qwiic connect ports all on the same I2 C bus In addition to this some of the pins on the Raspberry Pi are broken out for the user...

Страница 6: ...Qwiic HAT simply plug it into the headers on the Raspberry Pi make sure that the USB arrow on the HAT is pointing towards the USB on the Raspberry Pi Once the HAT is plugged in you can start plugging...

Страница 7: ...stalled run the gpio commands shown below COPY CODE gpio v gpio readall It should respond with some information about the wiringPi version and the Pi that its running on then draw a table illustrating...

Страница 8: ...rogram will probe all the addresses on a bus and report whether any devices are present Call i2cdetect y 1 to probe the first I2 C bus which is what the Qwiic HAT is connected to COPY CODEpi raspberry...

Страница 9: ...Arduino you ll need to grab a logic level converter to boost your signals up to 5V Also be aware that all Qwiic devices have pull up resistors on the I2 C lines So if your device does not have it you...

Страница 10: ...abled board Using pliers snap off a row of 4 pins from the right angle male header Using diagonal cutters you will need to sacrifice one socket in order cut off a row of 4 pins from the female header...

Отзывы: