Différences entre versions de « Rasp-Hack-GPIO Configurer I2C »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « {{Rasp-Hack-GPIO-NAV}} {{Rasp-Hack-GPIO-TRAILER}} »)
 
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}}

Version du 14 janvier 2013 à 12:24


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

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:

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:

sudo nano /etc/modules

and add these two lines to the end of the file: Copy Code

i2c-bcm2708 
i2c-dev

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.

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

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)

sudo i2cdetect -y 1

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:

sudo i2cdetect -y 0

The Raspberry Pi designers swapped over I2C ports between board releases.


Source: GPIO Setup, créé par Simon Monk pour AdaFruit Industries.

Traduit et augmenté par Meurisse D. pour MCHobby.be, également basé sur des informations provenant du GitHub RaspberryPi

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.