Difference between revisions of "Embedded Radios Quick Start Guide"

From CityLab Testbed
Jump to navigation Jump to search
Line 27: Line 27:
 
=== Preparing the receiver node ===
 
=== Preparing the receiver node ===
  
* SSH into the <code>node_rx</code> and clone the <code>LoRaMac-node</code> repository
+
1) SSH into the <code>node_rx</code> and clone the <code>LoRaMac-node</code> repository
 
<pre>
 
<pre>
 
git clone https://github.com/imec-idlab/LoRaMac-node
 
git clone https://github.com/imec-idlab/LoRaMac-node
 
</pre>
 
</pre>
* Change to the root dir of the repository
+
2) Change to the root dir of the repository
 
<pre>
 
<pre>
 
cd LoraMac-node
 
cd LoraMac-node
 
</pre>
 
</pre>
* Edit the file <code>Makefile.local</code> and make sure it has the following contents:
+
3) Edit the file <code>Makefile.local</code> and make sure it has the following contents:
 
<pre>
 
<pre>
TARGET=
+
TARGET = beacon_rx
 +
CFLAGS += -DUSE_BAND_868=1
 +
CFLAGS += -DUSE_MODEM_LORA=1
 +
</pre>
 +
The <code>TARGET</code> line tells the compiler which application to build. The other lines tell the application to use the LoRa radio in the 868MHz band
 +
4) Compile the binary using the <code>make</code> command:
 +
<pre>
 +
make -j4
 +
</pre>
 +
If all went well you should now have a file named <code>beacon_rx.bin</code> in the local directory. If you get a complaint that no compiler could be found then, most likely you are not using the correct disk image.
 +
5) Flash the binary onto the EFM32GG device using the <code>flash_lora</code> script:
 +
<pre>
 +
flash_lora ./beacon_rx.bin
 
</pre>
 
</pre>
  
 +
6) Use <code>picocom</code> to listen to the serial port of the 'Lora' device
 +
<pre>
 +
sudo picocom -b 115200 /dev/ttyLORA
 +
</pre>
 +
In the above command:
 +
* <code>115200</code> is the baud rate to use
 +
* <code>/dev/ttyLORA </code> is the path to the serial port of the Lora device. (This is a symlink to the actual 'ttyUSB' device that auto-generated via udev-rules present in all 'CoT' disk images)
  
 +
At this point you won't see anything yet, but once the transmitter node has also been prepared you'll see text appearing here
  
 +
=== Preparing the transmitter node ===
  
=== SSH into both the <code>node_tx</code> and <code>node_rx</code> nodes in separate terminals. ===
+
The steps needed to prepare the transmitter node are almost identical to the steps needed to prepare the receiver node.
 +
 
 +
1) Open a new terminal, SSH into the <code>node_tx</code> and clone the <code>LoRaMac-node</code> repository
 +
2) Change to the root dir of the repository
 +
3) Edit the file <code>Makefile.local</code> and make sure it has the following contents:
 +
<pre>
 +
TARGET = beacon_tx
 +
CFLAGS += -DUSE_BAND_868=1
 +
CFLAGS += -DUSE_MODEM_LORA=1
 +
</pre>
 +
The only difference between the <code>Makefile.local</code> used here and the one used for the receiver is that we are now building the <code>beacon_tx</code> rather than the <code>beacon_rx</code> app.
 +
 
 +
The <code>TARGET</code> line tells the compiler which application to build. The other lines tell the application to use the LoRa radio in the 868MHz band
 +
4) Compile the binary using the <code>make</code> command
 +
5) Flash the binary onto the EFM32GG device using the <code>flash_lora</code> script:
 +
<pre>
 +
flash_lora ./beacon_tx.bin
 +
</pre>
 +
 
 +
6) Use <code>picocom</code> to listen to the serial port of the 'Lora' device
 +
<pre>
 +
sudo picocom -b 115200 /dev/ttyLORA
 +
</pre>
 +
You should now see lines similar to the ones below appearing:
 +
<pre>
 +
Sent Packet using LORA. size=16, counter=3 TimeOnAir(us)=52
 +
Sent Packet using LORA. size=16, counter=4 TimeOnAir(us)=52
 +
Sent Packet using LORA. size=16, counter=5 TimeOnAir(us)=52
 +
</pre>
 +
 
 +
7) Switch back to the terminal of the <code>node_rx</code> testbed node. You should see lines similar to the ones below appearing
 +
<pre>
 +
0x520B4614248AB601,10,-33,25
 +
0x520B4614248AB601,11,-35,25
 +
0x520B4614248AB601,12,-34,26
 +
0x520B4614248AB601,13,-33,24
 +
</pre>
 +
In the reported lines, the first field is the UUID of the node sending the beacons, the second field is the sequence number of the packet and the 3rd & 4th fields are the RSSI & LQI of the received beacon packet.
 +
 
 +
=== Experiment Cleanup ===
 +
 
 +
In both the <code>node_tx</code> and <code>node_tx</code>, perform the following actions to clean up the experiment:
 +
 
 +
1) Press the 'Control' key and then press the 'A' and 'X' one after the other while holding the 'Control' key pressed down. This control-sequence stops the running <code>picocom</code> program
 +
2) Run the <code>erase_lora</code> program to wipe the LoRa devices.
 +
<pre>
 +
erase_lora
 +
</pre>
 +
It is important you do this since otherwise the transmitter node will keep sending beacons.
  
 
== OpenMote / OpenUSB ==
 
== OpenMote / OpenUSB ==

Revision as of 09:38, 5 April 2023

This quick start guide will explain how to get started with the "LoRa" (EFM32GG+RFM95W) an the OpenUSB modules of the Citylab testbed nodes.

Prerequisites

This quick start guide assumes you already have access to the Citylab Testbed and that you are familiar with the steps required to start experiments. If that is not the case then please follow the Getting Started guide first.


Experiment Setup

  • Open the JFed GUI, create a new experiment and drag in two wireless nodes.
  • Configure the nodes. Make sure that you:
    • Set the correct testbed for the node (defaults to w-iLab.2, needs to be set to Citylab)
    • Set Disk image to Ubuntu 20.04 LTS 64-bit (CoT) with ARM gcc compiler. This is important as we'll need the ARM gcc toolchain to compile the images for the devices.
    • Explicitly set the specific node to use. **Make sure that the nodes you select are within range of each other!**. You can use the Node Map to help you with this.
    • name one of the nodes node_tx and the other one <node_rx>. You can use other node names but those are the node names that will be used throughout this guide.
  • Click "Run" to start the experiment and wait the the nodes to finish initialising. Important: It'll take a bit longer than usual to start the experiment as the Ubuntu 20.04 LTS 64-bit (CoT) with ARM gcc compiler image we're using in this experiment is quite large so it'll take some time to load it onto the nodes.


Getting started with the EFM32GG+RFM95W (LoRa) module

To help you get started with the "EFM32GG+RFM95W" module, we've ported the LoraWAN network stack to the "EFM32GG+RFM95W". This port can be found in the following Github repository:

In this guide, we'll use that repository to set up a basic broadcast tx/rx between two nodes but the stack has many other capabilities as well.

Preparing the receiver node

1) SSH into the node_rx and clone the LoRaMac-node repository

git clone https://github.com/imec-idlab/LoRaMac-node

2) Change to the root dir of the repository

cd LoraMac-node

3) Edit the file Makefile.local and make sure it has the following contents:

TARGET = beacon_rx
CFLAGS += -DUSE_BAND_868=1
CFLAGS += -DUSE_MODEM_LORA=1

The TARGET line tells the compiler which application to build. The other lines tell the application to use the LoRa radio in the 868MHz band 4) Compile the binary using the make command:

make -j4

If all went well you should now have a file named beacon_rx.bin in the local directory. If you get a complaint that no compiler could be found then, most likely you are not using the correct disk image. 5) Flash the binary onto the EFM32GG device using the flash_lora script:

flash_lora ./beacon_rx.bin

6) Use picocom to listen to the serial port of the 'Lora' device

sudo picocom -b 115200 /dev/ttyLORA

In the above command:

  • 115200 is the baud rate to use
  • /dev/ttyLORA is the path to the serial port of the Lora device. (This is a symlink to the actual 'ttyUSB' device that auto-generated via udev-rules present in all 'CoT' disk images)

At this point you won't see anything yet, but once the transmitter node has also been prepared you'll see text appearing here

Preparing the transmitter node

The steps needed to prepare the transmitter node are almost identical to the steps needed to prepare the receiver node.

1) Open a new terminal, SSH into the node_tx and clone the LoRaMac-node repository 2) Change to the root dir of the repository 3) Edit the file Makefile.local and make sure it has the following contents:

TARGET = beacon_tx
CFLAGS += -DUSE_BAND_868=1
CFLAGS += -DUSE_MODEM_LORA=1

The only difference between the Makefile.local used here and the one used for the receiver is that we are now building the beacon_tx rather than the beacon_rx app.

The TARGET line tells the compiler which application to build. The other lines tell the application to use the LoRa radio in the 868MHz band 4) Compile the binary using the make command 5) Flash the binary onto the EFM32GG device using the flash_lora script:

flash_lora ./beacon_tx.bin

6) Use picocom to listen to the serial port of the 'Lora' device

sudo picocom -b 115200 /dev/ttyLORA

You should now see lines similar to the ones below appearing:

Sent Packet using LORA. size=16, counter=3 TimeOnAir(us)=52
Sent Packet using LORA. size=16, counter=4 TimeOnAir(us)=52
Sent Packet using LORA. size=16, counter=5 TimeOnAir(us)=52

7) Switch back to the terminal of the node_rx testbed node. You should see lines similar to the ones below appearing

0x520B4614248AB601,10,-33,25
0x520B4614248AB601,11,-35,25
0x520B4614248AB601,12,-34,26
0x520B4614248AB601,13,-33,24

In the reported lines, the first field is the UUID of the node sending the beacons, the second field is the sequence number of the packet and the 3rd & 4th fields are the RSSI & LQI of the received beacon packet.

Experiment Cleanup

In both the node_tx and node_tx, perform the following actions to clean up the experiment:

1) Press the 'Control' key and then press the 'A' and 'X' one after the other while holding the 'Control' key pressed down. This control-sequence stops the running picocom program 2) Run the erase_lora program to wipe the LoRa devices.

erase_lora

It is important you do this since otherwise the transmitter node will keep sending beacons.

OpenMote / OpenUSB