The IoT LoRa Gateway can be setup with a few different methods. In this tutorial we will show you how to set it up using our SD Card Image & LoRaWAN Provider The Things Network.

Our guide uses the pre-built SD Card image which has all of the software already installed and ready for use on it.

You’ll simply just need to change a couple of files on the SD Card using your computer and you’re ready to go.

What you need

  • Raspberry Pi & Gateway Hat Already Assembled
  • SD Card – Preferably 8GB Class 10
  • SD Card Reader
  • Power Supply
  • Ethernet Cable – If using a wired internet connection

Getting Started

Step 1 – Download our SD Card image

Begin by downloading the SD Card image from our Google Drive.  Do this by going to http://pisupp.ly/iotsd, clicking on the zip file and confirming the download.

The version of the SD Card image may change over time with all previous versions being put in the archive folder. At the time of writing the version is 2018-11-05-iot-lora-gateway-lite.zip

Step 2 – Image the SD Card

Next we need to write the SD card, before we can do this we need to first download a tool to write the data to the SD Card. For this we recommend balenaEtcher (Previously Resin) as it’s compatible with most Operating Systems and is easy to use.

Download Etcher from https://www.balena.io/etcher & install it on your computer and then run it.

Next select the SD Card image by clicking Select Image, and navigating to where the zip file downloaded on your computer (Usually in your downloads folder).

Then select the SD Card you wish to have the image written to, this is usually the only one that shows up if you only have one SD card plugged in.

And then click flash! The software will now write the data to the SD Card and present you with this screen when completed.

If you have it where it says validation error then the image may not have been written correctly. Try removing the SD Card, plugging it back into your computer and repeating the process. If this then still fails you may have a faulty SD Card.

Step 3 – Configuring the SD Card

Now we need to configure the SD Card, begin by removing and re-inserting the SD Card into your computer as this will make sure all of the new files appear.

Step 3.1 – The Things Network Setup

In this tutorial we are using The Things Network as our LoRaWAN Provider, The Things Network is a worldwide network where community members can setup gateways and use the network for their LoRa nodes.

The nodes transmit and can be picked up by any gateway that is setup with The Things Network and forwarded to your IOT Application.

Begin by going to https://console.thethingsnetwork.org/ and creating an account if not already signed up and then login. You should be presented with a page like this.

Now click gateways and then on the top right of the gateway box click register gateway.

On this window you need to fill out the following fields:

Gateway ID: This has to be a unique ID, this can be anything you like but has to be unique.

Description: This can be anything you like for you to have a description of a gateway.

Frequency Plan: This is the frequency of the gateway and should match your gateway. As we’re in Europe I’ve selected the Europe 868Mhz Plan.

Router: This is the closest server to your location, as we’re in Europe I’ve selected Europe but you might find there is a router closer to you.

Location: The location of the gateway is handy to put in, while not required it may be useful in the future and for signal coverage mapping.

Antenna Placement: If the gateway and antenna is indoors then select indoors, if the antenna is mounted externally select outdoors.

All of these settings can be modified later except for the gateway ID

Next we want to modify a few settings.

Click on the settings tab and you should be able to see the settings we configured and then on the information tab to the left.

Then in brand type in Multi-channel Raspberry Pi gateway, it should auto complete.

And for model select Raspberry Pi with Pi Supply Gateway HAT.

Finally click update gateway and return to the main screen. The overview should look similar to this.

Step 3.2 – Gateway File Configuration

There’s now two options to do this! 3.2.1 Is where you type the details into a development website and it’ll generate the configuration file. 3.2.2 is if you do this manually.

Step 3.2.1

To begin visit https://loradev.ryanteck.net/ and start by filling out your Email Address & Description of the gateway.

For the Gateway ID You will need to put the gateway ID as it is listed on your Things Network Console

For the Gateway Key copy it over from the Things Network Console

Then put an approximate altitude and use a tool to find your Latitude and Longitude.

Finally select the router that you set in the TTN Console and click create config!

The configuration file will download, you can then copy this to the /boot/iotloragateway , ensure it is named local_conf.json

Region File – global_conf.json

If you are not in the EU then you will first have to change the global_conf file’s details. The global_conf file contains the settings of the frequencies for the region you are using.

Begin by deleting the global_conf.json file in the folder and then clicking the global_confs folder, in here are template files for all of the different regions. Copy the one correct for your region (Identified by the two letter code) into the main folder above and rename this to global_conf.json

Step 3.2.2

Please read the instructions carefully

Finally we are at the last step, plug your SD Card back in your computer. You should see 1-2 new drives appear depending on what operating system you are using. Click on the one labeled BOOT.

Next click the folder called iotloragateway.

Region File – global_conf.json

If you are not in the EU then you will first have to change the global_conf file’s details. The global_conf file contains the settings of the frequencies for the region you are using.

Begin by deleting the global_conf.json file in the folder and then clicking the global_confs folder, in here are template files for all of the different regions. Copy the one correct for your region (Identified by the two letter code) into the main folder above and rename this to global_conf.json

Gateway Configuration File – local_conf.json

Finally we are on the last step of configuring the gateway, open the local_conf.json file with a text editor ready to edit.

Begin by putting a contact email, description and a random ID (of numbers and Letters) in the “gateway_ID”, “contact_email” and “description” where it says “CHANGE-ME”.

For the server_address field you should use the server address from the TTN Console that you selected,

For serv_gw_id this is the Gateway ID set in the console so you can copy / type this in here.

For the serv_gw_key field you will need to copy the gateway key from the TTN Console and paste it in here.

Finally if you wish to set the location of your gateway you can do at the bottom, this is recommended for a few reasons including being able to map out coverage of your gateway. You’ll require to get the latitude and longitude which can be done using a tool such as https://www.latlong.net/convert-address-to-lat-long.html

And then save the file! A completed file should look like the following.

 

Step 4 – Plug it all in!

Finally we’re ready for assembly, start by putting the RAK833 module into the Gateway HAT and then push the Gateway HAT onto the Raspberry Pi’s GPIO Headers.

Put the SD Card into the Raspberry Pi and connect it to ethernet and finally connect a power adaptor.

The gateway should now boot and load all of the software automatically, if there’s no issues you should notice a blue light turn on, on the gateway module and your gateway appear as online in the Things Network Console

First published at 1:28pm on November 14, 2018
Last updated at 11:35am on November 17, 2018