This repository contains the source code to transmit LoRaWAN compatible messages using GNU Radio. The LoRaWAN MAC layer is based on a modified version of arduino-lmic that can be compiled and executed on any computer. A corresponding GNU Radio block create an interface with the Physical layer of LoRa for GNU Radio gr-lora_sdr.
Note that currently, only uplink messages is supported. The transmission have been verified using a Ubuntu workstation connected to a NI-USRP 2920 and LoRa messages where received by [The Things Network](https://www.thethingsnetwork.org/).This work has be conducted in the Telecommunications Circuits Laboratory, EPFL in the context of a student semester project.
To install gr-lorawan
, follow these steps:
- Install the implementation of the physical layer gr-lora_sdr
- Clone this repository
- In a terminal move into the clones repository
- Create a build folder and move inside
mkdir build; cd build
- Build the OOT module
cmake ..
if you want to install in a specific prefix usecmake .. -DCMAKE_INSTALL_PREFIX=/path/to/prefix
make
(sudo) make install
-
Setting up the PHY layer
- Open the file
gr-lorawan/examples/lorawan_tx.grc
in gnuradio-companion - Change the UHD: USRP SINK according to your setup or replace by the block that supports your SDR
- You can run the PHY layer flowgraph. This flowgraph will listen for frames from the MAC layer and send them.
- Open the file
-
Configuring the node in the LoRaWAN Network
-
In this example we will explain how to configure the node for The Things Network, but any similar LoRaWAN network provider you have similar options
-
Connect to TTN and create a new application
-
In the new application, select register end device
-
Choose Enter end device specifics manually
-
Select the following options (! It is important to choose ABP as there will only be uplink transmissions)
-
You can press Generate for all other fields
-
Register this end device
-
-
Setting up the MAC layer
- Open the file
gr-lorawan/lmic_sdr/main.cpp
that contains the main code to control the transmission of messages - Copy both the network session key, application session key and device address of the node given in the end-device view. (You can press the button <> to get a suitable format to copy and paste)
- In the main() function, you can configure the transit gain, spreading factor and code rate
- The message is scheduled by the do_send() function
- You can now build the code
- Move into the folder
gr-lorawan/lmic_sdr/
- Create and move into the build folder
mkdir build; cd build
cmake ..
make
- Move into the folder
- Open the file
-
Running the code
- Launch the GNU Radio flowgraph
- Execute the MAC layer code inside
gr-lorawan/lmic_sdr/build
using./lorawan
- You should now see your messages in The Things Network console if a gateway is close enough to your transmitter!