Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 3.72 KB

README.md

File metadata and controls

68 lines (54 loc) · 3.72 KB

LoRaWAN for Software-defined Radios

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.

Installation

To install gr-lorawan, follow these steps:

  1. Install the implementation of the physical layer gr-lora_sdr
  2. Clone this repository
  3. In a terminal move into the clones repository
  4. Create a build folder and move inside mkdir build; cd build
  5. Build the OOT module
    1. cmake .. if you want to install in a specific prefix use cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/prefix
    2. make
    3. (sudo) make install

Usage

  1. Setting up the PHY layer

    1. Open the file gr-lorawan/examples/lorawan_tx.grc in gnuradio-companion
    2. Change the UHD: USRP SINK according to your setup or replace by the block that supports your SDR
    3. You can run the PHY layer flowgraph. This flowgraph will listen for frames from the MAC layer and send them.
  2. Configuring the node in the LoRaWAN Network

    1. 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

    2. Connect to TTN and create a new application

    3. In the new application, select register end device

    4. Choose Enter end device specifics manually

    5. Select the following options (! It is important to choose ABP as there will only be uplink transmissions)

    6. You can press Generate for all other fields

    7. Register this end device

  3. Setting up the MAC layer

    1. Open the file gr-lorawan/lmic_sdr/main.cpp that contains the main code to control the transmission of messages
    2. 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)

    3. In the main() function, you can configure the transit gain, spreading factor and code rate
    4. The message is scheduled by the do_send() function
    5. You can now build the code
      1. Move into the folder gr-lorawan/lmic_sdr/
      2. Create and move into the build folder mkdir build; cd build
      3. cmake ..
      4. make
  4. Running the code

    1. Launch the GNU Radio flowgraph
    2. Execute the MAC layer code inside gr-lorawan/lmic_sdr/build using ./lorawan
    3. You should now see your messages in The Things Network console if a gateway is close enough to your transmitter!