Modifications

Sauter à la navigation Sauter à la recherche
2 184 octets ajoutés ,  22 novembre 2022 à 20:35
Ligne 2 : Ligne 2 :     
== Forewords ==
 
== Forewords ==
{{traduction}}
  −
   
It is now time to establish a communication between:
 
It is now time to establish a communication between:
 
* a '''Data Emitter''' (CanSat) made with a raspberry-Pico + RFM69HCW-433MHz.  
 
* a '''Data Emitter''' (CanSat) made with a raspberry-Pico + RFM69HCW-433MHz.  
Ligne 9 : Ligne 7 :     
As the kit contains contains two Pico microcontroller we will be able to create the "Data Emitter" on the CanSat as well as the Data Receiver at the ground station.
 
As the kit contains contains two Pico microcontroller we will be able to create the "Data Emitter" on the CanSat as well as the Data Receiver at the ground station.
  −
In this simple example:
  −
# The '''Data Emitter''' will send a message and wait 500ms for a response (ACK).
  −
# The '''Data Receiver''' will receive the message.
  −
# The '''Data Receiver''' will send a ACK reply.
      
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-00.jpg|640px]]
 
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-00.jpg|640px]]
   −
As we will see, there are 2 key items to be highlighted:
+
As we will see, there are 3 key items to be highlighted:
 
# The frequency must be identical in the emitter and the receiver (eg: 433.1 MHz in this example).
 
# The frequency must be identical in the emitter and the receiver (eg: 433.1 MHz in this example).
 
# The encryption key must be identical on the both side.
 
# The encryption key must be identical on the both side.
 +
# Node_IDs used to allow ACK exchange between nodes
 +
 +
In this simple example:
 +
# The '''Data Emitter''' (CanSat) will send a message and wait 500ms for a response (ACK).
 +
# The '''Data Receiver''' (BaseStation) will receive the message.
 +
# The '''Data Receiver''' (BaseStation) will send a ACK reply.
 +
 +
The following sequence diagram (click to enlarge) shows how the calls takes place within scripts, within the library and within the air.
 +
 +
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-00a.png|705px]]
    
== Installing the RFM69 library ==
 
== Installing the RFM69 library ==
Ligne 172 : Ligne 175 :  
|-
 
|-
 
| MOSI
 
| MOSI
| GP7 (Miso)
+
| GP7 (Mosi)
 
|-
 
|-
 
| MISO
 
| MISO
| GP4 (Mosi)
+
| GP4 (Miso)
 
|-
 
|-
 
| SCK
 
| SCK
Ligne 190 : Ligne 193 :  
Now we will load and executes the {{fname|test_receiver.py}} receiver script. The script must be downloaded from the repository.
 
Now we will load and executes the {{fname|test_receiver.py}} receiver script. The script must be downloaded from the repository.
   −
{{traduction}}
+
{{download-box|'''test_receiver''' Python script|https://github.com/mchobby/cansat-belgium-micropython/blob/main/test-rfm69/test_receiver.py}}
 
  −
TODO DOWNLOAD
      
The script can be either executed from Thonny -OR- transfered to the Pico and executed directly on the microcontroler.
 
The script can be either executed from Thonny -OR- transfered to the Pico and executed directly on the microcontroler.
Ligne 222 : Ligne 223 :  
The NODE_ID doesn't have to be updated, its is used as node identifier allowing message & ACK exchange between one receiver and several emitter (each having an unique NODE_ID (for the same ENCRYPTION_KEY and FREQ).
 
The NODE_ID doesn't have to be updated, its is used as node identifier allowing message & ACK exchange between one receiver and several emitter (each having an unique NODE_ID (for the same ENCRYPTION_KEY and FREQ).
   −
{{underline|'''Openning the Serial Line:'''}}
+
=== Receiver test ===
 +
'''Openning the Serial Line''' and run the {{fname|receiver_test.py}} script.
    
As we want to see the received message, we will open a terminal to receives the messages over the USB-Serial line.
 
As we want to see the received message, we will open a terminal to receives the messages over the USB-Serial line.
Ligne 235 : Ligne 237 :  
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-20.png|640px]]
 
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-20.png|640px]]
   −
Voilà, We are ready to test the emitter (cansat).
+
Voilà, we are ready to test the emitter (cansat).
   −
{{ambox|text=IF the file {{fname|test_receiver.py}} is copied to the micropython board THEN it can be started from REPL<br />with {{fname|import test_receiver}} }}
+
 
 +
In this second screen capture (here below), we do used the "mpremote" (command line tools) to access the REPL/Shell session on the Pico board.
 +
 
 +
{{ambox|text=WHEN the file {{fname|test_receiver.py}} is copied to the micropython board THEN it can be started from REPL<br />with {{fname|import test_receiver}} }}
 +
 
 +
As we can see on the screen capture, the script is receiving messages from emitter and sending ACK back to the sender.
 +
 
 +
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-21.png]]
 +
 
 +
As the first message received is numbered 136, we do know for sure that the emitter script was started a while before.
    
== The Emitter (CanSat) ==
 
== The Emitter (CanSat) ==
Ligne 262 : Ligne 273 :  
Here how to wire the RFM69 module to the {{pl|2271|base board of Cansat Kit with Pico}} as recommended.  
 
Here how to wire the RFM69 module to the {{pl|2271|base board of Cansat Kit with Pico}} as recommended.  
   −
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-to-Cansat-Pico-Base.jpg|640px]]
+
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-to-Cansat-Pico-Base-fixed.jpg|640px]]
    
{| class="wikitable"  
 
{| class="wikitable"  
Ligne 281 : Ligne 292 :  
| keep the same pin as receiver.<br />Otherwise use UEXT 10 (=gp10)
 
| keep the same pin as receiver.<br />Otherwise use UEXT 10 (=gp10)
 
|-
 
|-
| MOSI
+
| MISO
 
| 7
 
| 7
 
|  
 
|  
 
| GP4 = MISO
 
| GP4 = MISO
 
|-
 
|-
| MISO
+
| MOSI
 
| 8
 
| 8
 
|  
 
|  
Ligne 307 : Ligne 318 :  
|}
 
|}
    +
{{ambox | text = 22/11/2022 21:23 - ''fixed the wiring miso-->miso & mosi-->mosi in the diagram''.}}
 
{{ambox|text=The "''Slave Select''" line on the UEXT connector is not used in this setup because it is wired to PICO GP10. As we want the RFM69 setup code to be the same between the emitter and the receiver... we do need to wire the RFM69's CS line to GP5.}}
 
{{ambox|text=The "''Slave Select''" line on the UEXT connector is not used in this setup because it is wired to PICO GP10. As we want the RFM69 setup code to be the same between the emitter and the receiver... we do need to wire the RFM69's CS line to GP5.}}
   Ligne 314 : Ligne 326 :  
The script must be downloaded from the repository.
 
The script must be downloaded from the repository.
   −
{{traduction}}
+
{{download-box|'''test_emitter''' Python script|https://github.com/mchobby/cansat-belgium-micropython/blob/main/test-rfm69/test_emitter.py}}
 
  −
TODO DOWNLOAD
      
The script can be either executed from Thonny -OR- transfered to the Pico and executed directly on the microcontroler.
 
The script can be either executed from Thonny -OR- transfered to the Pico and executed directly on the microcontroler.
Ligne 346 : Ligne 356 :  
* The '''BaseStation ID''' the node id (0..255) where the CanSat emitter must sent the messages (and from which the ACK response are expected).
 
* The '''BaseStation ID''' the node id (0..255) where the CanSat emitter must sent the messages (and from which the ACK response are expected).
   −
Locate the following lines:
+
The NODE_ID and BASESTATION_ID are preconfigured and doesn't need to be updated.
 +
 
 +
{{underline|Remark:}} the frequency & encryption key are enough to "isolate a group". Nodes ID are used to create mesh network within a group. A simple mesh with 2 nodes (the Receiver base station and the Emitter CanSat) is enough to exchange messages with Acknowledgement.
 +
 
 +
Anyway Node ID can be updated for test purpose. To do so, locate the following lines:
    
<syntaxhighlight lang="python">NODE_ID        = 120 # ID of this node
 
<syntaxhighlight lang="python">NODE_ID        = 120 # ID of this node
Ligne 352 : Ligne 366 :  
</syntaxhighlight>
 
</syntaxhighlight>
    +
=== Emitter test ===
 +
'''Opens the Serial Line''' and run the {{fname|emitter_test.py}} script.
   −
The NODE_ID and BASESTATION_ID are preconfigured and doesn't need to be updated (they can be updated for test purpose).
+
As we want to see the sent messages and acknowledgments, we will open a terminal to receives the messages over the USB-Serial line.
 
  −
{{underline|Note:}} the frequency & encryption key are enough to "isolate groups". Nodes ID are used to create mesh network within a group. A simple mesh with 2 nodes: the Receiver base station and the Emitter CanSat.
  −
 
  −
 
  −
{{underline|'''Opening the Serial Line:'''}}
  −
 
  −
As we want to see the received message, we will open a terminal to receives the messages over the USB-Serial line.
      
This can be done with the help of:
 
This can be done with the help of:
Ligne 367 : Ligne 376 :  
* mpremote  
 
* mpremote  
   −
Just starts the script it will start to send messages to the base station:
+
Just starts the script it will start to send messages (as the CanSat will do) to the base station and waits for the ACK notification from the base station:
    
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-30.png|640px]]
 
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-30.png|640px]]
   −
{{ambox|text=IF the file {{fname|test_emitter.py}} is copied to the micropython board THEN it can be started from REPL<br />with {{fname|import test_emitter}} }}
+
As the base station ({{fname|receiver_test.py}}) is not running now ACKnowledgment are sent to the emitter.
 +
 
 +
{{ambox|text=WHEN the file {{fname|test_emitter.py}} is copied to the micropython board THEN it can be started from REPL<br />with {{fname|import test_emitter}} }}
 +
 
 +
The following capture show the {{fname|emitter_test.py}} script running from the Thonny. As seen below the messages are properly received by the receiver (the base station) as it sent back the ACKnowledgment.
 +
 
 +
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-31.png|640px]]
 +
 
 +
== Stress Test ==
 +
 
 +
By reducing the emission delay from 1 second between messages to 100ms (0.1sec), it is possible to evaluates the reliability and stability of the communication with ACK.
 +
 
 +
The following screen capture shows the receiver and emitter captured after 2200+ messages sent and ack.
 +
 
 +
[[Fichier:ENG-CANSAT-PICO-RFM69HCW-TEST-40.png|560px]]
    
== More info ==
 
== More info ==
Ligne 380 : Ligne 403 :  
More complex setup could used addressed communication and '''Reliable Datagram'''.
 
More complex setup could used addressed communication and '''Reliable Datagram'''.
   −
* '''Addressed communication''' allows you to associate a unique identifier (node id, an integer from 0..255) to each RFM69 module. This allows detect the sender when receiving a message on the frequency and to act appropriately properly.
+
* '''Addressed communication''', used here, allows you to associate a unique identifier (node id, an integer from 0..255) to each RFM69 module. This allows identifies the sender when receiving a message (on the frequency+AES) and to act appropriately properly and possibly send back a response. Addressed mode is suited when '''building a team of robot'''!
* '''Reliable Datagram''' do a lot of management with connection to make sure that the packets were received. You do not have to send the acknowledgement in your code, the Reliable Datagram take care of it for you.
+
* '''Reliable Datagram''' do a lot of management with connection to make sure that the packets were received. You do not have to send the acknowledgement in your own code, the Reliable Datagram take care of it for you from inside the library.
    
Check the [https://github.com/mchobby/esp8266-upy/tree/master/rfm69 examples associated the RFM69 library] for more informations.  
 
Check the [https://github.com/mchobby/esp8266-upy/tree/master/rfm69 examples associated the RFM69 library] for more informations.  
    
{{ENG-CANSAT-PICO-TRAILER}}
 
{{ENG-CANSAT-PICO-TRAILER}}
29 917

modifications

Menu de navigation