Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials_radio [2016/11/25 16:37]
admin
tutorials_radio [2016/11/25 16:46] (current)
admin
Line 3: Line 3:
 We will use the SparrowTransfer library to establish a radio link between two Sparrow nodes. The class implements a protocol over some bsic transmit and receive functions and can be downloaded from {{::​sparrowradio.zip|here}}. We will use the SparrowTransfer library to establish a radio link between two Sparrow nodes. The class implements a protocol over some bsic transmit and receive functions and can be downloaded from {{::​sparrowradio.zip|here}}.
  
-To install the library, just unzip it to your Arduino\libraries folder+To install the library, just unzip it to your Arduino\libraries folder ​or use Arduino IDE's Library Installer. 
 + 
 +The API for interfacing with the Atmega128RFA1 radio is derived from [[https://​learn.sparkfun.com/​tutorials/​atmega128rfa1-dev-board-hookup-guide/​example-code|Sparkfun'​s implementation]]. 
 + 
 +Here is a code example of two nodes communicating via the protocol. You will need two Sparrow sensor nodes: the first one acts as a sender and the second one will receive the data. 
 + 
 +The code from the Sender runs on a stand-alone Sparrow node, while the Receiver needs to be connected to a computer in order to view the received data on the Serial Terminal. 
 + 
 +<​imgcaption protocol | Simple setup for testing the transmission protocol>​{{ :​protocol.jpg?​700 |}}</​imgcaption>​ 
  
 We have below an example of two Arduino sketches that allow transmitting and receiving data packets over the radio interface. You will need two nodes for this example, one of them will act as a transmitter (Tx), and the second one will receive the data the first node is sending (Rx). We have below an example of two Arduino sketches that allow transmitting and receiving data packets over the radio interface. You will need two nodes for this example, one of them will act as a transmitter (Tx), and the second one will receive the data the first node is sending (Rx).
 +
 +You can send virtually any data between the two nodes, as long as the code on each node uses the same data structure. The protocol sends the structure as a whole, so it is important that all variables in the structure are defined in the same order and have the same data types both at the sender and at the receiver.
 +
 +There is a very simple data error detection mechanism implemented as a checksum byte obtained by XOR-ing all of the bytes in a data frame. Received data frames that have the wrong checksum are automatically dropped. It is possible to also add a more reliable CRC check, but from what I have seen, the XOR checksum does a decent job.
  
 The Transmitter code: The Transmitter code: