Dragino LoRa Hat Single-Channel-Gateway

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search

Used Hardware:

  • Raspberry Pi 4
  • Dragino Raspberry Pi LoRa/GPS HAT
  • SD Card sufficient for Raspberry Pi OS Installation

Hardware Assembly

Carefully place the HAT onto the Raspberry Pi’s GPIO pins and gently push down. Always remember never to power on the HAT without a mounted antenna, as doing so could result in hardware damage.

System setup

For this hardware, a clean install of Raspberry Pi OS is recommended. I recommend using the Raspberry Pi Imager, as it allows you to pre-set ssh settings before flashing the OS.

  • Connect to the Raspberry Pi via ssh
  • Enable SPI interface: sudo raspi-config
    • Select Interface Options -> Select Yes when asked if you want to enable the SPI interface
  • Reboot the Raspberry Pi: sudo shutdown -r now

Note: On the Raspberry Pi 4, there can be problems with installing the WiringPi package. If you encounter the same issue with an error message appearing when trying to install it, use the following commands to install a compatible version of WiringPi:

Once WiringPi is installed and configured correctly, the Dragino LoRa/GPS Hat can be set up to act as a few different things.

LoRa Single Channel Gateway

The Dragino LoRa Hat can be setup as an 868 MHz single-channel LoRa gateway. To do this, we can leverage existing software. - sudo apt install git - git clone https://github.com/tftelkamp/single_chan_pkt_fwd - cd ~/single_chan_pkt_fwd - nano main.cpp

In the main.cpp file, you can define variables necessary for registering the gateway (e.g. longitude and latitude) - You must also change the server IP to the IP of eu1.cloud.thethings.network (

Server IP.png

  • make
  • sudo ./single_chan_pkt_fwd

You can hit Ctrl+Z to exit the program and close down the gateway - this means the gateway is only running when the command is executed.

Registering the Gateway in The Things Network

After starting the gateway program as stated before, the Gateway ID will be displayed (see image below).


You can now register a new gateway in the TTN console with this ID. If everything is configured correctly, you should see some activity coming from the gateway.

Note: By default, the Things Network will not display single-channel gateways on the map of gateways, as they are considered less reliable. However, for most experimental purposes, they suffice.