Modifications

Sauter à la navigation Sauter à la recherche
2 734 octets ajoutés ,  14 janvier 2013 à 12:24
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Rasp-Hack-GPIO-NAV}}
 
{{Rasp-Hack-GPIO-NAV}}
    +
I2C is a very commonly used standard designed to allow one chip to talk to another. So, since the Raspberry Pi can talk I2C we can connect it to a variety of I2C capable chips and modules.
 +
 +
Here are some of the Adafruit projects that make use of I2C devices and modules:
 +
 +
* http://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi
 +
* http://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi
 +
* http://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi
 +
* http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi
 +
* http://learn.adafruit.com/mcp4725-12-bit-dac-with-raspberry-pi
 +
* http://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi
 +
* http://learn.adafruit.com/using-the-bmp085-with-raspberry-pi
 +
 +
{{ambox | text = Avec le temps, nous traduirons de plus en plus des tutoriels mentionnés ci-dessus... mais peut-être oublierons nous de remplacer les liens. N'hésitez pas a nous envoyer un petit mail (soyez précis svp) depuis le formulaire de contact  de www.mchobby.be ;-) }}
 +
 +
If you are using Occidentalis, then your Pi is ready to go with I2C as far as enabling the hardware goes. However, if you are using Raspbian, you will need to open LXTerminal and enter the following command:
 +
 +
<nowiki>sudo nano /etc/modules</nowiki>
 +
 +
and add these two lines to the end of the file:
 +
Copy Code
 +
 +
<nowiki>i2c-bcm2708
 +
i2c-dev</nowiki>
 +
 +
[[Fichier:Rasp-Hack-GPIO-I2CConfig-1.png]]
 +
 +
After editing the file, you will need to reboot for the changes to take effect.
 +
 +
If you have problems with I2C on Raspbian, then it is well worth updating to the latest version. These instructions were tested with the release dated 2012-10-28.
 +
 +
The I2C bus allows multiple devices to be connected to your Raspberry Pi, each with a unique address, that can often be set by changing jumper settings on the module. It is very useful to be able to see which devices are connected to your Pi as a way of making sure everything is working.
 +
 +
To do this, it is worth running the following commands in the Terminal to install the i2c-tools utility.
 +
 +
<nowiki>sudo apt-get install python-smbus
 +
sudo apt-get install i2c-tools</nowiki>
 +
 +
Once these are installed you can type the following command to see all the connected devices (if you are running a 512MB Raspberry Pi Model B)
 +
 +
<nowiki>sudo i2cdetect -y 1</nowiki>
 +
 +
[[Fichier:Rasp-Hack-GPIO-I2CConfig-2.png]]
 +
 +
 +
 +
This shows that two I2C addresses are in use – 0x40 and 0x70.
 +
 +
Note that if you are using one of the very first Raspberry Pis (a 256MB Raspberry Pi Model B) then you will need to change the command to:
 +
 +
<nowiki>sudo i2cdetect -y 0</nowiki>
 +
 +
The Raspberry Pi designers swapped over I2C ports between board releases.
    
{{Rasp-Hack-GPIO-TRAILER}}
 
{{Rasp-Hack-GPIO-TRAILER}}
29 917

modifications

Menu de navigation