Project

General

Profile

Wiki » History » Version 86

Sylvain Bentz, 01/28/2016 02:13 AM

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