Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


materiel:xbee:star:en

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
materiel:xbee:star:en [2014/09/19 12:10]
resonance [Softwares]
materiel:xbee:star:en [2018/01/28 15:41] (Version actuelle)
resonance ancienne révision (2016/02/01 00:06) restaurée
Ligne 6: Ligne 6:
   * License: GNU/FDL3   * License: GNU/FDL3
   * Files: {{:materiel:xbee:star:codes.zip|}}   * Files: {{:materiel:xbee:star:codes.zip|}}
 +  * Thanks to: Martin Peach, Hans-Christop Steiner, Vincent Pillet
  
 Xbee modules are used to transmit wireless data (radio waves). If you don't know anything about that and you are brave, you should follow a tutorial or mine but it is in French : [[http://jeromeabel.net/ressources/xbee-arduino|Xbee & Arduino]]. Xbee modules are used to transmit wireless data (radio waves). If you don't know anything about that and you are brave, you should follow a tutorial or mine but it is in French : [[http://jeromeabel.net/ressources/xbee-arduino|Xbee & Arduino]].
 +
  
 On the last tutorial we've seen how to make a "point-to-point" network, instead of wires. One Xbee talk to another one. Now, I focus on the star network topology wich allows two setups : one emitter (coordinator) send data to few receivers (End Devices) ; and in return, few emitters send data to one receiver. This article describe how to do this with **XBee Series 1**, **Pure Data** and **Arduino**. Some of my art projects ([[:projets:patatas-de-goma:|Patatas de goma]] and [[:projets:chimeres-orchestra:|Chimères Orchestra]]) will use this technique. On the last tutorial we've seen how to make a "point-to-point" network, instead of wires. One Xbee talk to another one. Now, I focus on the star network topology wich allows two setups : one emitter (coordinator) send data to few receivers (End Devices) ; and in return, few emitters send data to one receiver. This article describe how to do this with **XBee Series 1**, **Pure Data** and **Arduino**. Some of my art projects ([[:projets:patatas-de-goma:|Patatas de goma]] and [[:projets:chimeres-orchestra:|Chimères Orchestra]]) will use this technique.
- 
  
 {{ :materiel:xbee:star:xbee-star-topology.png |}} {{ :materiel:xbee:star:xbee-star-topology.png |}}
 +
 +
 +{{ vimeo>106574642?medium }}
  
  
Ligne 35: Ligne 39:
   * [[http://arduino.cc/en/Main/Software|Arduino]]   * [[http://arduino.cc/en/Main/Software|Arduino]]
   * [[https://processing.org/download/?processing|Processing]]   * [[https://processing.org/download/?processing|Processing]]
-  * [[http://www.itp.nyu.edu/physcomp/uploads/xbeeSerialTerminal.zip|xbeeSerialTerminal.zip]] (made in processing), to setup XBee+  * {{:materiel:xbee:star:xbeeterminal.zip|}} (made in processing), to setup XBee
   * Additional libraries (in "codes.zip"): [[http://code.google.com/p/xbee-api/|xbee-api]], [[https://code.google.com/p/xbee-arduino/|xbee-arduino]] et [[https://github.com/scogswell/ArduinoSerialCommand|SerialCommand]]   * Additional libraries (in "codes.zip"): [[http://code.google.com/p/xbee-api/|xbee-api]], [[https://code.google.com/p/xbee-arduino/|xbee-arduino]] et [[https://github.com/scogswell/ArduinoSerialCommand|SerialCommand]]
  
-==== Ressources ====+==== Resources ====
   * XBee Datasheet : {{:materiel:xbee:star:xbee_product_manual.pdf|}}   * XBee Datasheet : {{:materiel:xbee:star:xbee_product_manual.pdf|}}
   * XBee Arduino : [[https://code.google.com/p/etrack/wiki/XBeeAPIsTutorial|XBeeAPIsTutorial]], [[https://code.google.com/p/xbee-arduino/wiki/DevelopersGuide|XBee Arduino Developers Guide]] et[[http://www.tunnelsup.com/xbee-s2-quick-reference-guide-cheat-sheet|XBee series 2 quick reference guide]]   * XBee Arduino : [[https://code.google.com/p/etrack/wiki/XBeeAPIsTutorial|XBeeAPIsTutorial]], [[https://code.google.com/p/xbee-arduino/wiki/DevelopersGuide|XBee Arduino Developers Guide]] et[[http://www.tunnelsup.com/xbee-s2-quick-reference-guide-cheat-sheet|XBee series 2 quick reference guide]]
Ligne 50: Ligne 54:
   * **RX/TX** : be careful of the direction, the RX is linked to TX and TX is linked to the RX.   * **RX/TX** : be careful of the direction, the RX is linked to TX and TX is linked to the RX.
   * **RX/TX** : take out RX/TX wires branchés à l'Arduino quand vous téléversez le code vers l'Arduino   * **RX/TX** : take out RX/TX wires branchés à l'Arduino quand vous téléversez le code vers l'Arduino
-  * Attention au **baudrate** du port série et au numéro de port. Si vous changez de carte, le port n'est sans doute plus le même. De même si vous changez le //baudrate// du XBeevous devez impacter ce changement dans le programme "xbeeSerialTerminal"dans les codes Arduino et Pure Data. Des fois on croit ne plus pouvoir se connecter au modulemais c'est que son //baudrate// est différent de celui que l'on utilise pour s'y connecter+  * Be really careful with the **baudrate** of the serial communication and the port number which gonna change when you use another Arduino boardIf you change the //baudrate//, you need to change it everywhere, in xbeeSerialTerminal, Pure Data (//[comport .. ....]//)Arduino (//Serial.begin(....)//) and in the serial monitor of Arduino. Sometimes, when you can not communicate with your XBee, the reason could be that the baudrate is diffrent.  
-  * **Leonardo** : utiliser Serial1 à la place de Serial : //Serial1.begin(9600); xbee.setSerial(Serial1);//+  * **Leonardo** : use Serial1 instead of Serial : //Serial1.begin(9600); xbee.setSerial(Serial1);//
 </WRAP> </WRAP>
  
-==== Astuce ====  +==== Trick ====  
-En ouvrant deux fois le logiciel Arduino, on peut téléverser des codes dans deux Arduinos différentesCela évite de devoir changer la carte de destination à chaque fois. +If you open twice the Arduino softwareyou can upload codes into two different Arduinos. It avoids change the board name each time.
- +
  
 =====1/ To XBee (direct) ===== =====1/ To XBee (direct) =====
-Le premier exemple consiste à contrôler directement les sorties numériques et PWM des XBees à partir de Pure Data sans passer par Arduino. Pour les tests, nous branchons une LED sur la sortie D0 (digital) et une autre sur la sortie PWM1 (PWM).+The first example is to control directly digital and pwm outputs of XBees with Pure Data, without Arduino. We connect LEDs on the D0 (digital) and PW1 (PWM) pins of the XBee.
  
-**Schéma** :  Pd/AT/SERIAL/XBEE1 ---> XBEE2, XBEE3, ... \\+**Schematic** :  Pd/AT/SERIAL/XBEE1 ---> XBEE2/LEDS, XBEE3/LEDS, ... \\
 **Code** : to-xbee-star.pd **Code** : to-xbee-star.pd
  
Ligne 68: Ligne 71:
        
 ==== Configuration ==== ==== Configuration ====
-Ouvrir le XBee Terminal avec Processing et entrer pour chaque XBee sa configuration :+Open the xBeeSerialTerminal with Processing and setup XBees :
   * XBEE#1 Coordinator: ATRE, ATID1111, ATAP2, ATCE1, ATWR   * XBEE#1 Coordinator: ATRE, ATID1111, ATAP2, ATCE1, ATWR
   * XBEE#2 End Device : ATRE, ATID1111, ATMY2, ATWR   * XBEE#2 End Device : ATRE, ATID1111, ATMY2, ATWR
   * XBEE#3 End Device : ATRE, ATID1111, ATMY3, ATWR   * XBEE#3 End Device : ATRE, ATID1111, ATMY3, ATWR
  
-La grande différence par rapport aux précédentes configurations est le fait que nous ne spécifions pas d'adresse de destinataire en "dur", nous la spécifions directement dans la commande envoyée au coordinateur grâce au **mode API** (ATAP2). Voir les [[.:#annexes|annexes]] en bas pour en savoir plus.+The main difference between last setups is that we do not write the destination address. The address is part if the message sended by Pure Data to the coordinator. It is because we use the **API mode** (ATAP2). See  [[.:#appendices|appendices]] at the bottom to know more.
  
 {{:materiel:xbee:star:xbee-terminal.png|}} {{:materiel:xbee:star:xbee-terminal.png|}}
  
  
-==== Explications ====+==== Explanations ====
 ^ AT Command         ^ Description  ^ ^ AT Command         ^ Description  ^
-| ATRE     Revenir à la configuration de base +| ATRE     Come back to the default settings 
-| ATID1111 | Adresse du réseau +| ATID1111 | Network address 
-| ATAP2    | Coordinateur en mode API | +| ATAP2    | Coordinator is in API mode 
-| ATCE1    | Rôle de coordinateur +| ATCE1    | Coordinator behavior  
-| ATMY2    | Adresse du XBee +| ATMY2    | Addresses of end devices 
-| ATWR     Enregistrement de la configuration |+| ATWR     Write the settings |
  
-**Remarques** : +**Notes** : 
-| ATAP2    | Par défaut le mode API est optionnel pour les End Devices| +| ATAP2    | By default : API mode is not necessary for End Devices| 
-| ATMY0    | Par défaut l'adresse du coordinateur est à par défaut +| ATMY0    | By default coordinator addres is by default 
-ATCE0    Par défaut mode AT pour les End Devices | +ATAP0    By default : AT for the End Devices 
-| ATDH0    | Par défaut adresse en 16 bits| +| ATCE0    | By default : End Device behavior 
-| ATDL0    | Par défaut Adresse du coordinateur pour les End Devices+| ATDH0    | By default : 16 bits addresses
-ATIU1    | ? : pour ne pas utiliser les entrées/sorties RX/TX dans ce cas-là (direct) | +| ATDL0    | By default Destination addresse
-| ATMY1    | ? : si l'adresse du coordinateur est 1, cela pourrait éviter d'envoyer des infos inutiles au coordinateur |+ATIU0    | ? : if we not use RX/TX in our case (direct) | 
 +| ATMY1    | ? : if the coordinator address is 1, we avoid send useless data to it |
  
  
 ==== Pure Data ==== ==== Pure Data ====
-Envois des commandes avec Pure Data+Send commands with Pure Data 
  
 {{:materiel:xbee:star:to-xbee-star.png|}} {{:materiel:xbee:star:to-xbee-star.png|}}
   
-=== Explications ===+=== Explanations ===
 ^ AT Command           ^ Description  ^ ^ AT Command           ^ Description  ^
 |RAT 0x0 0x2 2 D0 4  | digital switch off| |RAT 0x0 0x2 2 D0 4  | digital switch off|
Ligne 109: Ligne 113:
 |RAT 0x0 0x3 2 M1 $1 | Control PWM (0-255) with M1 (use P0 and M0 for PWM0 pin)| |RAT 0x0 0x3 2 M1 $1 | Control PWM (0-255) with M1 (use P0 and M0 for PWM0 pin)|
  
-**Décryptage du message "Remot AT commands (RAT)"**+**Remote AT commands (RAT)**
 |64-bit_destination| 0x0 (any, not needed here)| |64-bit_destination| 0x0 (any, not needed here)|
 |16-bit_destination:| XBee end devices addresses| |16-bit_destination:| XBee end devices addresses|
Ligne 117: Ligne 121:
        
 <WRAP center round tip> <WRAP center round tip>
-Si vous envoyer des données très rapidementvous verrez que les LEDs réagissent lentementOn observe une inertie qui n'est pas souhaitable pour du contrôle en temps-réelC'est parce que le **baudrate** par défaut est de 9600, ce qui est très lentPour avoir une meilleure réponse, on peut le changer dans les modules XBee, avec la commande **ATBD6** pour 57600. Attentionpour reconfigurer le XBee avec le terminal, il faudra le lancer avec nouveau //baudrate// sinon vous n'avez plus accès au module : //myPort = new Serial(thisportnum, 57600);//. Pareil dans Pure Data, il faut le changer.+If you send a lot of datayou should see the LED light slowlyWe don't want that for real-time communicationsTo have a better behavior we can change the baudrate. By default it is 9600, which is very slowWith the **ATBD6** command we obtain 57600. When you do that on XBeesbe careful to report this value on all serial communication (xbeeSerialTerminal, Pure Data, Arduino, Serialm monitor).
 </WRAP> </WRAP>
  
  
-=====2/ Analyse de la trame ===== +=====2/ Packets monitoring ===== 
-Pour comprendre ce qu'envoie les modules XBee, on peut afficher le contenu de la trame pour savoir où sont les données utiles envoyées. Le schéma est très simple, on utilise le moniteur série du logiciel Arduino pour visualiser ces données.+We can understand what is in Xbee packets with serial monitoring
  
-**Schéma** : Pd/SERIAL/XBEE1 ---> XBEE2/RX/ARDUINO \\+**Schematic** : Pd/SERIAL/XBEE1 ---> XBEE2/RX/ARDUINO \\
 **Fichiers** : to-xbee-serial.pd, from_serial.ino, from_xbee_serial.ino (get packet), from_xbee_serial_2.ino (get one data)\\ **Fichiers** : to-xbee-serial.pd, from_serial.ino, from_xbee_serial.ino (get packet), from_xbee_serial_2.ino (get one data)\\
  
 {{:materiel:xbee:star:xbee-monitor.png|}} {{:materiel:xbee:star:xbee-monitor.png|}}
  
-**Remarque** : en passant par le convertisseur série, sans Arduino, je n'arrive pas à voir les trames... Je ne comprend pas.+**Note** : when I use simply the serial converter without Arduino, I catch nothing... I don't understand. 
  
 ==== Configuration ==== ==== Configuration ====
Ligne 135: Ligne 140:
   * XBEE#2 End Device : ATRE, ATID1111, ATMY2, ATWR   * XBEE#2 End Device : ATRE, ATID1111, ATMY2, ATWR
   
-==== Résultats ====  +==== Results ====  
-Données           ^ Résultats  ^ +Data           ^ Results  ^ 
-|Chiffres quelconques OK. Limités à 0-255 (byte)|+|Whatever numbers Ok, the range is 0-255 (byte)|
 |print **A** | **65**| |print **A** | **65**|
 |print **hello**| **104 101 108 108 111**| |print **hello**| **104 101 108 108 111**|
Ligne 144: Ligne 149:
 |TX 0x0 0x2 0 0 **10 11 12 13 14 15**|  126 0 125 51 16 30 0 0 0 0 0 0 0 0 0 2 0 0 **10 11 12 13 14 15** 145| |TX 0x0 0x2 0 0 **10 11 12 13 14 15**|  126 0 125 51 16 30 0 0 0 0 0 0 0 0 0 2 0 0 **10 11 12 13 14 15** 145|
  
-==== Récupérer une donnée (parser)  ==== +==== Get a data (parser)  ====
 {{:materiel:xbee:star:xbee-monitor-get-data.png|}} {{:materiel:xbee:star:xbee-monitor-get-data.png|}}
  
  
 =====3/ XBee API - Arduino ===== =====3/ XBee API - Arduino =====
-On fait communiquer uniquement des Arduinos entre elles pour comprendre comment envoyer et recevoir des trames XBee avec Arduino.+One Arduino send data to two other to understand how to send and receive Xbee packets. We wire a LED to pin 9 of each End Devices Arduinos to see what it is happen.
  
-**Schéma** : ARDUINO/TX/XBEE1 ---> XBEE2/RX/ARDUINO et XBEE3/RX/ARDUINO\\+**Schematic** : ARDUINO/TX/XBEE1 ---> XBEE2/RX/ARDUINO/LED et XBEE3/RX/ARDUINO/LED\\
 **Codes** : to_xbee_api.ino, from_xbee_api.ino\\ **Codes** : to_xbee_api.ino, from_xbee_api.ino\\
                          
Ligne 162: Ligne 167:
  
  
-==== Résultat ====+==== Results ====
 {{:materiel:xbee:star:xbee-api-monitor.png?400|}} {{:materiel:xbee:star:xbee-api-monitor.png?400|}}
  
  
-=====4/ XBee API - Arduino et Pure Data ===== +=====4/ XBee API - Arduino and Pure Data =====  
-N'étant pas arrivé à envoyer des données en passant par le convertisseur sériej'ai dû utilisé une Arduino pour formater correctement ces données pour les autres modules récepteursOn utilise la bibliothèque //SerialCommand// dans Arduino pour récupérer six données envoyées de Pure Data (une liste de six données). Celles-ci sont ensuite formatées par Arduino et la bibliothèque //XBee//Les récepteurs récupèrent uniquement le tableau de données de la trame.+To use Pure Data and send Xbee packetI had no success in using only a serial converter. I needed use an Arduino to make real XBee packets for the receiversI use the //SerialCommand// library in Arduino to parse 6 data from Pure Data (a list). These data are formatted by Arduino and the //XBee// libraryReceivers get only the good data from the packet. The LED is connected to the pin 9 to see what it's going on.
  
-**Schéma** : Pd/CMD/ARDUINO/XBEE1 ---> XBEE2/RX/ARDUINO et XBEE3/RX/ARDUINO\\+**Schematic** : Pd/CMD/ARDUINO/XBEE1 ---> XBEE2/RX/ARDUINO/LED et XBEE3/RX/ARDUINO/LED\\
 **Codes** : to-xbee-cmd.pd, to_xbee_api_cmd.ino, from_xbee_cmd.ino  **Codes** : to-xbee-cmd.pd, to_xbee_api_cmd.ino, from_xbee_cmd.ino 
  
Ligne 180: Ligne 185:
  
 <WRAP center round important> <WRAP center round important>
-**Changement de baudrate** : il faut donc les changer partout (Pure Data, Arduino, xbeeTerminal, moniteur série).+**Baudrate changes** : you need to change it everywhere (Pure Data, Arduino, xbeeTerminal, serial monitor).
 </WRAP> </WRAP>
  
Ligne 186: Ligne 191:
 {{:materiel:xbee:star:xbee-star-cmd-puredata-bd.png|}} {{:materiel:xbee:star:xbee-star-cmd-puredata-bd.png|}}
  
-=====4/ Réception des données (direct) ===== +=====4/ Data receptions (direct) ===== 
-Réception des données directes (capteurs) de plusieurs XBees sans Arduinos par le XBee coordinateuravec Pure Data et Processing. Très pratique pour récupérer les données d'un réseau de capteurs.  +The coordinator get data directly from sensors connected to XBee senders whithout Arduinos, with Pure Data or Processing. Very useful to get data from a network of sensors
- +  
-**Schéma** : XBEE2 et XBEE3 (seules) --->  SERIAL/XBEE1\\+**Schematic** : SENSOR/XBEE2 et SENSOR/XBEE3 (only) --->  SERIAL/XBEE1\\
 **Codes** : from-xbee-star-1.pd, from-xbee-star-2.pd\\ **Codes** : from-xbee-star-1.pd, from-xbee-star-2.pd\\
  
Ligne 200: Ligne 205:
  
 ==== Pure Data ==== ==== Pure Data ====
-Sans unpackxbee\\+Without [mrpeach/unpackxbee]\\
 {{:materiel:xbee:star:from-xbee-star-1.png|}} {{:materiel:xbee:star:from-xbee-star-1.png|}}
  
-Avec unpackxbee\\+With [mrpeach/unpackxbee]\\
 {{:materiel:xbee:star:from-xbee-star-2.png|}} {{:materiel:xbee:star:from-xbee-star-2.png|}}
  
Ligne 210: Ligne 215:
  
  
-===== Annexes ====== +===== Appendices ====== 
  
 ==== API ==== ==== API ====
Ligne 246: Ligne 251:
  
 ==== Broadcast / Unicast ==== ==== Broadcast / Unicast ====
-Pour envoyer des commandes à plusieurs destinatairesune autre solution aurait été d'utilise d'envoyer des messages à tout le monde (Broadcastet que les destinataires analysent les données (parser) pour ne récupérer que ce qui leur était destinéJe pars du principe que le mode API fait pour cela est peut-être plus rapide à exécuter ces opérationssachant que l'envoi de message physiquement (ondes radio) est envoyé à tout le mondeC'est les modules entre eux qui font le travail de déterminer qui est le destinataire, quelles sont les données, etc.+To send data to few modulesanother way would be to send messages to everyone (broadcast). Then the receivers parse data to get only what they want. I think the API mode seems to be "The" way to achieve that. In realthe message is physically send throuh air (radio waveslike a broadcastXBee modules seems manage data to know which data are the good ones, etc.
  
 **Series 2** ([[https://forum.sparkfun.com/viewtopic.php?f=13&t=31047|forum.sparkfun.com]]) : \\ **Series 2** ([[https://forum.sparkfun.com/viewtopic.php?f=13&t=31047|forum.sparkfun.com]]) : \\
/home/resonancg/www/wiki/data/attic/materiel/xbee/star/en.1411121421.txt.gz · Dernière modification: 2014/09/19 12:10 de resonance