Configuration between Device and Gateway

Before we broadcast to the single-channel radio, there are some things to keep in mind:

Since this gateway only listens on one channel - frequency and spread factor should be the same between both the gateway and the device. This means that if you're sending data over 904.1MHz (channel 1 in the US) with spread factor of 7, the gateway should be listening  for transmissions on 904.1MHz with a spread factor of 7.

From the gateway, you can check and/or modify the gateway's configuration within global_conf.json under freq and spread_factor.

You'll want to modify your code to send over a single-channel (frequency). By default, TinyLoRa sends with a spread factor of 7.

Gateway Usage

Run the Python program by entering the following into the terminal:

python3 lorawan_gateway.py

Press the first button to display statistics about the Pi, such as its IP, CPU load, and available memory.

Press the third button to display the name of the gateway along with the frequency, spreading factor, and The Things Network router.

Press the second button to launch the gateway. It'll display the current status (if a packet is received or not) and update the timestamp every minute.

When a LoRa Packet is received by the gateway, the terminal will display that a packet has been received, and it'll print out useful data coming from the packet :

incoming pkt...
{"rxpk":[{"tmst":4067850409,"freq":905.1,"chan":0,"rfch":0,"stat":1,"modu":"LORA","datr":"SF7BW125","codr":"4/5","rssi":-35,"lsnr":10.0,"size":24,"data":"QLERAiYAKAABE0NCX+3lkSnK09WVlk8N"}]}

The display will also refresh to display that a packet has been received. In this example, we're sending data from a RFM9x FeatherWing to the Gateway:

We can't read the incoming data since it's encrypted. After all, device data shouldn't be read-able by a gateway operator. We'll need to check our device on The Things Network Console to read the decrypted data.

From The Things Network Console, navigate to the data tab for the device. You should see a packet pass through this page when a new packet is received.

 

 

Click on the packet to display the packet's payload

 

 

Scrolling down on the packet's information will show the gateways used to communicate (one device can communicate to more than one gateway) and the packet's information (metadata) .

We've received data, but what about making it readable by humans - we have instructions about using the Things Network's payload decoder here.

This guide was first published on Jan 17, 2019. It was last updated on Mar 28, 2024.

This page (Gateway Usage) was last updated on Mar 08, 2024.

Text editor powered by tinymce.