How to Setup Laird RG186 Gateway in India and Configure it to Communicate with The Things Network

Laird RG186 Gateway with The Things Network

As technology advances and IoT technology becomes popular day by day, Wi-fi and Bluetooth are losing their popularity as the way-to-go solutions for IoT applications. It's predicted that there will be 75 billion connected devices by 2025, and the demand for bandwidth will go up exponentially. This is why some experts in the industry say that LoRa will emerge as the best alternative solution for connected devices. So in this article, we decided to discuss all the pros and cons of LoRa and will configure the RG186 based LoRa gateway to communicate with The Things Network and make a small example to send data to TTN. So without further ado, let's get right into it.

What is LoRaWAN Technology and How Does it Work

LoRa is the short form of Long Range. This is a  physical layer, or the wireless modulation, utilized to create the long-range communication link. This is possible because of the chirp spread spectrum technology. LoRa runs on top of the LoRaWAN network protocol, transmitting encoded small data packets over long-range distances.

LoRaWAN Gateway Working Process

At the bottom-most level, we have our End Nodes that consist of End devices like GPS tracker, microcontroller, and sensors. On top of that, we have our gateways. The gateway consists of a powerful microprocessor that can handle both LoRa packages and WiFi packages which is able to handle Internet connection and LoRa connection simultaneously. Theoretically, these gateways have a range of 10KM. A gateway also has a powerful microprocessor that runs packet forwarder software and a concentrator module.

Now that the end nodes can communicate with the gateway, we can set up something called a network server. For  LoRaWAN, one of the popular and open-source network providers is The Things Network. Finally, on top of all, we have the Application server which normally is a website or mobile application that gets information from the network server and presents it with analytics to the end-user.

Selecting the right LoRAWAN Gateway

Now that we know how the LoRaWAN topology works, we can now deploy it in our area and we can have a ton of connected IoT nodes that can communicate with each other, or send data to the application server. Now the question remains how we can do so?

If you search the internet for lora gateways, you can find a plethora of devices to choose from. From Raspberry Pi-based DIY! solutions to professional-grade outdoor LoRa gateways, we decided to go with the Sentrius RG186 LoRaWAN Gateway from Liard Connectivity. Here are the specifications that you should check while selecting a gateway for your applications.

Sentrius RG186 LoRaWAN Features

When we are setting up a LoRaWAN gateway, the most important thing to consider is the operating frequency. In India, the legal operating frequency for Lora is between 865Mhz to 867Mhz. The gateway we have selected for this project can have a range of 863.5 to 869.5 which falls well under our required Indian standard frequency range. 

Next is the number of channels, a LoRaWAN Gateway should have a minimum of two channels, our gateway has 5 channels, meaning it can communicate with 5 end nodes at the same time. Next is the cost of the gateway, now the cheapest option here is to build your own lora gateway using Raspberry Pi and RAK831 Concentrator board but this will have only one channel and hence it cannot be called a LoRaWAN Gateway. Also comparing its price with RG186, there was not much difference. The outdoor gateways are long-range but they are pretty expensive. The RG186 is an indoor gateway and can technically cover a distance of 15km line of sight. I am eager to do a range test on this one but let’s keep that for some other time. Finally, the last thing is the ease of configuration, here if the gateways are certified by Lora Alliance, then things get a lot easier but those gateways are very expensive. Anyhow, if you are planning to use your gateway with the Things Network, then even the RG186 gateway makes it pretty simple.

Configuring the LoRaWAN Gateway to Establish Communication with The Things Network

Once you purchase the RG186 gateway, you will have everything you need to get up and running. In the box itself, you have a 2V 2.5A adapter with a European plug, so you would have to find an adapter to use it in India. Also, you will have three antennas, the two shorter ones for Wi-Fi and the longer one for the LoRa antenna. And you will also get an ethernet cable to connect the device to your local router.

Sentrius RG186 LoRaWAN

On the front side, you have a power connector, a user button, a reset button, and an SD card slot. And on the backside, we have some important information like MAC ID and EUI. Make a note of the last of our digits of your Ethernet MAC ID since we will need it later.

Now power up your Sentrius RG186 gateway with the given DC adapter and plug in the ethernet cable from your gateway to your router, and make sure that you are connected to the same network as the gateway. Now put in rg1xx in your browser followed by the last six digits of your MAC address. It will be something like https://rg1xx297952.local/login. If it says, the connection did not secure, just get into advanced and click on proceed. By default, the user name will be sentrius and the password will be RG1xx. I have already configured everything, so my dashboard looks like this.

Sentrius RG186 LoRaWAN Dashboard

If you are configuring it for the first time, then you need to set up the Wi-Fi first, for that click on the scan button and you will be presented with a list of available open networks.

Sentrius RG186 LoRaWAN Configuration

Now click on your personal wi-fi network and you will be presented with a screen where you need to provide your Wi-Fi password. Once entered, click on connect button and the Wi-Fi should connect automatically to your router.

Now click on the LoRTab and select The Things Network Legacy -EU. Also, make sure to copy the gateway EUI Number shown on the left side because we will need it while registering the Gateway with Things network.

Configuring LoRa Gateway

Now under the radio, we need to configure it so that it could work as per the Indian frequency standards. Now if you see the interface carefully it has Radio 0 and Radio 1 modules. I am using the Radio 0 module here to work in the Indian frequency which is 865 to 867 MHz and the Radio 1 module to work in the European frequency of 868Mhz. This is mandatory and changing both to 868MHz frequency will not work.

Setting up LoRa Gateway Frequency

You can see each radio module has up to 5 channels for which the frequencies are automatically allocated based on the center frequency. For our Radio 0 modules, the Indian frequency channels 865.1, 865.3, 865.5, 865.7, and 865.9 are allocated. After checking these values click on Update.

Radio Frequency

Once this is done, you are good to go and now we need to set up and configure TTN so that we can send and receive our data through TTN.

Registering the Gateway with Things Network Server

The next step is to register your gateway with TTN, to do so, open up thethingsnetwork.org and sign up if you have not already registered. Now you need to open up the console, and under the consoles click on Gateway and click on add gateway.

Things Network Server Add Gateway

Once you do that you will be presented with a screen where we need to put in a unique Gateway ID, and the Gateway EUI. This is what we have copied from the gateway. Now you need to add a Gateway name and you need to copy the gateway server address for future reference.

The Things Network Gateway

Now select the frequency plane (for this test, we choose Europe 863-870 MHZ (SF9 for RX2 - recommended)) and click on the create gateway button.

TTN Gateway Frequency Plan

Once this is done, log back into your gateway. Click on LoRa then click on Forwarder and update the Network Server Address with the address which we have copied from the TTN setup process.

Updating LoRa Network Server Address

If you have done everything correctly and open the TTN console you will be receiving gateway status in the Live data Section which will look like something that is shown below.

The Things Network Console

Also, if you get into the TTN gateway map, you will see your Gateway being listed. Like you can see mine here. Once this is done, our LoRaWAN Gateway is all set for action. Now any LoRa End Device in this region can communicate with the things network through our Gateway to test this out, I built a simple Lora node using Arduino.

TTN Mapper

Sending Data to TTN with HDP13A and DHT22 Sensor

It uses the popular SX1276 Transceiver IC from HPDTeK. For testing, we have connected it to the Arduino to the LoRa module and we have also connected a DHT22 Temperature and Humidity Sensor so that we could upload temperature and humidity data to TTN.

Arduino with Lora Module and DHT22 Sensor

Now we have just uploaded the simple code and as you can see we are getting temperature and humidity data in the TTN console.

Sending Data to TTN

Once your gateway gets active by sending some payload to the TTN server, it will also be listed on the ttnmapper like this. So any lora node in your locality can make use of your gateway to send their data to the TTN server.

Setup Laird Gateway

So this pretty much sums up my article on RG186 LoRaWAN gateway. I hope it was useful and you learned something on the way. If you have any questions, do leave them in the comment section below.