Connect LoRa Gateway to The Thing Network

From Embedded Lab Vienna for IoT & Security
Revision as of 15:57, 22 July 2019 by Mtausig (talk | contribs) (Finish documentaion)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

This documentation describes how to setup a Lorix One antenna as a Lorawan Gateway and connect it to The Things Network

Requirements

The Lorix One antenna need to be mounted outdoors. It is powered by PoE. You should use a surge protector like Ethernet Surge Protector ETH-SP-G2 with it.

You also need to setup your network accordingly. The gateway need outgoing access to the internet on the UDP port 1700 and must be able to receive answers from that port. Standard access to HTTP, HTTPS, DNS, NTP is highly recommended. For administration, Port 22 on the antenna has to be reachable.

You also need an account with The Things Network.

Description

Basic configuration

The device comes with a Yocto Linux OS.

It is configured to the IP address 192.168.1.50 (configured at it at /etc/network/interfaces) and an open SSH port with the default credentials admin:lorix4u. Change them immediately after login.

During the first configuration you should update the device

sudo opkg update
sudo opkg upgrade
sudo opkg clean

(there might be some error messages due to obsolete packages, which can safely be ignored)

Configure Package Forwarder

Next the package forwarder, which forward received LoRa packages to the application server must be configured (it comes preinstalled).

 $ sudo /etc/init.d/clouds-manager.sh stop
 Stopping cloud loriot... done.
 $ sudo /etc/init.d/clouds-manager.sh configure
 ==========================================
 | LORIX One clouds manager configuration |
 ==========================================
 
 Actual configuration:
   autostart=true
       cloud=loriot
 
 Do you want to enable autostart at boot time?
 [Yes|No]
  > Yes
 
 Which cloud app. do you want to use ?
 [loriot|packet-forwarder|ttn|manual]
  > ttn
 
 New configuration:
   autostart=true
       cloud=ttn
 
 $ cd /opt/lorix/clouds/ttn/
 $ sudo cp local_conf.json local_conf.json.org

Next, you need to find out the EUI of your device:

 $ sudo /opt/lorix/utils/update_gwid.sh /opt/lorix/clouds/ttn/local_conf.json
 Gateway_ID set to fcc23dFFFE0a958a in file /opt/lorix/clouds/ttn/local_conf.json

(this command doesn't actually change the configuration file)

Next, you need to edit /opt/lorix/clouds/ttn/local_conf.json:

 {
 /* Put there parameters that are different for each gateway (eg. pointing one gateway to a test server while the others stay in production) */
 /* Settings defined in global_conf will be overwritten by those in local_conf */
   "gateway_conf": {
       "gateway_ID": "fcc23dFFFE0a958a",
       
       "servers": [
           {
               "server_address": "router.eu.thethings.network",
               "serv_port_up": 1700,
               "serv_port_down": 1700,
               "serv_enabled": true
           }
       ],
       "fake_gps": false,
       "ref_latitude": 10,
       "ref_longitude": 20,
       "ref_altitude": -1,
       "contact_email": "elvis@fh-campsuwien.ac.at",
       "description": "Wifx LORIX One gateway powered by ELVIS"
   }
 }

Immediately make a backup copy of this configuration file, as it might be overwritten by an update.

The sucessfull configuration can be tested by running /opt/lorix/clouds/ttn/poly_pkt_fwd.

If everything works, you can start the forwarder by running

 sudo /etc/init.d/clouds-manager.sh start

It should also work after a reboot

 sudo reboot

Register gateway with The Things Network

Login at The Things Network and open the the Console. Open Gateways -> Register

In the form, select "I'm using the legacy packet forwarder" and paste the gateway ID from above into that field (it will automatically be converted into a hex values). Then enter the following values:

  • Description: Can be any text
  • Frequency Plan: "Europe"
  • Router: "ttn-router-eu"
  • Location: Chose on map
  • Antenna Placement: Outdoor

Used Hardware

References