Before a Gateway can be used with The Things Network (TTN), it needs to be registered.
First, register an account with TTN.
- Navigate to their account registration page to set up an account.
Once logged in, navigate to the The Things Network Console. This page is where you can register applications and add new devices or gateways.
Click Gateways
Click register gateway
Tick the I'm using the legacy packet forwarder checkbox.
Then, enter the Gateway EUI displayed on the gateway.
Fill out a description of what the gateway is.
Set the frequency plan to your region's frequency, we set ours to United States.
Set the Router to the location closest to you.
- Adafruit is located in New York City, so I set the router to ttn-router-us-west.
Click Register Gateway. TTN will register the gateway and redirect you to the Gateway Overview page.
The Things Network does not list Single Channel gateways on their map - these gateways are not great at handling multiple devices or accurately receiving a packets every time they're sent by a device. However, they're great for hacking on, experimenting, and using in a staging/lab setup.
We'll want to set the Gateway Privacy to Private and set the location to Unlisted.
From the Gateway Overview page, click Edit Info.
On the Privacy Page, untick all of the options and click Save Settings.
Before starting up the gateway, we'll optionally set the gateway information.
From the Gateway Overview page, click Edit Info
For brand, select Single-Channel DIY Gateway
For model, type Raspberry Pi
It's time to test! Run the Python program by entering the following into the terminal:
python3 lorawan_gateway.py
and press the middle button to launch the gateway.
You should see the Status of the gateway on your console switch from from Not Connected to Connected. If you've had previously connected the gateway: the Last Seen label should update to Now.
Our gateway is now listening for new packets, it'll refresh whenever it's received a new packet.
Next, we're going to set up a device to send data to the gateway.
Usage with Pi Zero
If you are using a Pi Zero, you will need to modify the global_conf.json file prior to running the command above.
Change the following line in the JSON configuration from:
"is_pi_zero": false,
to
"is_pi_zero": true,
And save the file.
{ "SX127x_conf": { "freq": 905100000, "spread_factor": 7, "pin_nss": 11, "pin_dio0": 3, "pin_rst": 25 }, "gateway_conf": { "ref_latitude": 0.0, "ref_longitude": 0.0, "ref_altitude": 10, "name": "Radio Pi Bonnet", "email": "[email protected]", "desc": "Adafruit Radio Pi LoRa 1-Ch Gateway", "is_pi_zero": false, "servers": [ { "address": "router.us.thethings.network", "port": 1700, "enabled": true }, { "address": "router.eu.thethings.network", "port": 1700, "enabled": false } ] } }
Then, run the Python program by entering the following into the terminal:
python3 lorawan_gateway.py
Page last edited January 22, 2025
Text editor powered by tinymce.