Projet

Général

Profil

Wiki » Historique » Version 89

Sylvain Bentz, 28/01/2016 02:47

1 86 Sylvain Bentz
{{toc}}
2 77 Sylvain Bentz
3 86 Sylvain Bentz
Ce Wiki regorge de liens vers de la documentation et des tutoriels pour faire communiquer une Arduino et une Raspberry Pi.
4 1 Sylvain Bentz
5 25 Sylvain Bentz
6 1 Sylvain Bentz
7 86 Sylvain Bentz
h1. Les bibliothèques : où les trouver ?
8 72 Sylvain Bentz
9 1 Sylvain Bentz
10 86 Sylvain Bentz
h2. Pour l'Arduino : http://playground.arduino.cc/Main/LibraryList#Comm
11 1 Sylvain Bentz
12 86 Sylvain Bentz
[[Les bibliothèques Arduino]] : la sélection d'e-gab (ce qui pourrait être intéressant pour le robot ^^)
13 1 Sylvain Bentz
14 1 Sylvain Bentz
15 86 Sylvain Bentz
h2. Pour la Raspberry Pi (Applications et bibliothèques) : http://playground.arduino.cc/Main/InterfacingWithSoftware
16 71 Sylvain Bentz
17 86 Sylvain Bentz
[[Les bibliothèques Raspberry Pi]] : la sélection d'e-gab
18 63 Sylvain Bentz
19 85 Sylvain Bentz
20 87 Sylvain Bentz
h2. Autres liens
21 87 Sylvain Bentz
22 87 Sylvain Bentz
http://robotsbigdata.com/ Des biblios pour Arduino
23 87 Sylvain Bentz
http://www.raspberrypi-spy.co.uk/ Pleins de choses concernant la Raspberry Pi
24 87 Sylvain Bentz
25 87 Sylvain Bentz
26 87 Sylvain Bentz
27 87 Sylvain Bentz
28 1 Sylvain Bentz
29 86 Sylvain Bentz
h1. Communication Raspberry-Arduino avec bus I2C
30 1 Sylvain Bentz
31 86 Sylvain Bentz
Nous (sbentz et tbenhnini) avons choisi le bus I2C pour faire communiquer Raspi et Arduino.
32 86 Sylvain Bentz
On a réussi à transférer des mesures (= des floats) et des ordres (= des int)...
33 86 Sylvain Bentz
...mais...
34 86 Sylvain Bentz
. les floats sont chiants à transférer
35 86 Sylvain Bentz
. les floats devaient être compris entre -100 et +100
36 86 Sylvain Bentz
. le floats reçu par la Raspi n'était pas égal au float envoyé par l'Arduino : si sa partie décimale était non nulle, il y avait une erreur relative de 10^-7
37 64 Sylvain Bentz
38 86 Sylvain Bentz
warning. Possible problème de tension entre la RasPi (3.3V) et l'arduino (5V) (Uno, Nano et Mega = 5V)
39 66 Sylvain Bentz
40 1 Sylvain Bentz
tip. Des solutions simples existent avec quelques résistances http://playground.arduino.cc/Main/I2CBi-directionalLevelShifter
41 1 Sylvain Bentz
42 86 Sylvain Bentz
h2. Tutoriels
43 1 Sylvain Bentz
44 88 Sylvain Bentz
_Raspberry-Pi - Arduino par l'intermédiaire d'un bus I2C_  *Au S7, on (sbentz et tbenhnini) s'en est inspiré pour faire communiquer Arduino-Raspi et coder*  https://github.com/E-gab-ECM/Link_Raspberry-Arduino
45 86 Sylvain Bentz
http://mchobby.be/wiki/index.php?title=ArduPi-I2C
46 86 Sylvain Bentz
47 1 Sylvain Bentz
_Tuto de Julien Enselme ! : La communication série avec arduino (et Python)_
48 1 Sylvain Bentz
http://www.jujens.eu/posts/2014/May/05/Communication-serie/
49 1 Sylvain Bentz
50 35 Sylvain Bentz
_Raspberry Pi – Arduino – Lier les deux via le bus I2C_
51 35 Sylvain Bentz
http://www.pihomeserver.fr/2013/08/13/raspberry-pi-home-server-arduino-lier-les-deux-via-bus-i2c/
52 36 Sylvain Bentz
53 8 Tarek Benhnini
_Arduino Serial communication_
54 1 Sylvain Bentz
http://www.oxgadgets.com/2011/07/arduino-serial-communication.html
55 21 Sylvain Bentz
56 86 Sylvain Bentz
h2. Documentation
57 83 Sylvain Bentz
58 1 Sylvain Bentz
Arduino lit octet par octet, cf fonction read()
59 1 Sylvain Bentz
60 68 Sylvain Bentz
Arduino peut interpréter l'octet comme nombre (type int) ou string (type char)
61 1 Sylvain Bentz
62 86 Sylvain Bentz
_Connecteurs I2C de l'Arduino : où sont-ils ?_
63 86 Sylvain Bentz
Regarder la page de Wire Library (cf lien ci-dessous)
64 86 Sylvain Bentz
Regarder la page officielle de la carte (Uno pour l'exemple) : https://www.arduino.cc/en/Main/ArduinoBoardNano
65 1 Sylvain Bentz
66 1 Sylvain Bentz
_Wire Library (I2C)_
67 1 Sylvain Bentz
https://www.arduino.cc/en/Reference/Wire
68 1 Sylvain Bentz
69 1 Sylvain Bentz
_Wikipedia I2C_
70 1 Sylvain Bentz
[[wikipedia>I²C]]
71 1 Sylvain Bentz
72 1 Sylvain Bentz
73 86 Sylvain Bentz
74 86 Sylvain Bentz
h1. Communication Raspberry-Arduino ou Raspberry-Carte moteur MD25 avec bus Sériel
75 86 Sylvain Bentz
76 1 Sylvain Bentz
warning. Toujours faire attention au 3.3V de la Raspi, ajoutez des résistances si nécessaire
77 1 Sylvain Bentz
78 1 Sylvain Bentz
tip. pour résoudre le problème, cf http://blog.oscarliang.net/raspberry-pi-and-arduino-connected-serial-gpio/
79 1 Sylvain Bentz
80 1 Sylvain Bentz
81 86 Sylvain Bentz
h2. Raspberry Pi
82 34 Sylvain Bentz
83 86 Sylvain Bentz
h3. Bibliothèque python : pySerial https://pypi.python.org/pypi/pyserial
84 86 Sylvain Bentz
85 86 Sylvain Bentz
_Documentation de pySerial_ : http://pythonhosted.org/pyserial/
86 86 Sylvain Bentz
87 84 Sylvain Bentz
h3. Tutos
88 13 Sylvain Bentz
89 84 Sylvain Bentz
_Lecture/Ecriture sur le port série de la Raspi:_
90 65 Sylvain Bentz
http://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/
91 37 Sylvain Bentz
92 34 Sylvain Bentz
93 86 Sylvain Bentz
h2. Carte commande MD25 (utilisée pour l'asservissement des moteurs du grand robot)
94 86 Sylvain Bentz
95 75 Sylvain Bentz
_Documentation_:
96 75 Sylvain Bentz
http://www.robot-electronics.co.uk/htm/md25tech.htm
97 48 Sylvain Bentz
98 86 Sylvain Bentz
notice. Comme indiqué il y a les deux modes I2C ou Serial de disponible pour la carte commande. Au choix.. mais le mode série est beaucoup plus clair.
99 78 Tarek Benhnini
100 78 Tarek Benhnini
101 86 Sylvain Bentz
h2. Arduino
102 86 Sylvain Bentz
103 86 Sylvain Bentz
h3. Bibliothèque officielle Arduino
104 86 Sylvain Bentz
105 86 Sylvain Bentz
notice. Elle s'appelle SoftwareSerial. A l'époque (2013) elle était appelée NewSoftSerial.
106 86 Sylvain Bentz
107 86 Sylvain Bentz
_Documentation_
108 86 Sylvain Bentz
http://arduiniana.org/libraries/NewSoftSerial/
109 78 Tarek Benhnini
https://www.arduino.cc/en/Reference/Serial
110 86 Sylvain Bentz
111 86 Sylvain Bentz
_A savoir_
112 89 Sylvain Bentz
Le port Seriel (pins 0 et 1) est lié au port USB. Ce sont les mêmes. On ne peut pas connecter son PC par le port USB et la RasPi aux pins 0 et 1. Cependant, il semble qu'on peut tout de même téléverser ;) (cf le tuto)
113 86 Sylvain Bentz
L'Arduino Mega a 3 autres ports sériels : Seriel3 (pins 14 et 15), Seriel2 (16,17) et Seriel3 (18,19).
114 86 Sylvain Bentz
La biblio Arduino (SoftwareSerial) permet d'utiliser d'autres pins.
115 86 Sylvain Bentz
116 86 Sylvain Bentz
_Tutos_
117 86 Sylvain Bentz
http://codeandlife.com/2012/07/29/arduino-and-raspberry-pi-serial-communication/
118 86 Sylvain Bentz
119 86 Sylvain Bentz
120 86 Sylvain Bentz
h1. Archives
121 86 Sylvain Bentz
122 86 Sylvain Bentz
[[Arduino - Raspberry Pi w/ USB]]
123 86 Sylvain Bentz
124 86 Sylvain Bentz
[[ArduinoLampone]]