Heltec HT-M01 LoRa Gateway on the Things Network

gateway-outside.jpg

Setting up the Heltec HT-M01 and using it as a gateway for The Things Network (TTN)

The HT-M01 concentrator board is based on the  SX1301 baseband chip  and is available in 433MHz, 470~510MHz, 868MHz and 915MHz versions. Combined with a Raspberry Pi Zero it makes a very cost effective Lora Gateway. These are available from the Heltec store on AliExpress here . I would recommend buying one of the packages if you want to make things as easy as possible. These come with a board that connects the Pi Zero and the gateway together so you don’t need to wire them together.

Before you start it is very important to connect an antenna. If you wait until later in the tutorial and forget you could damage the gateway.

There are two parts to this guide. Connecting and setting up with the Raspberry Pi Zero and setting up a gateway account at The Things Network.

Wiring

If you don’t have the connection board, wire the Pi and HT-M01 as below:

Heltec Gateway Pi Zero Wiring

 

Pi Zero Software Installation

I prefer to access the Pi Zero via SSH. Follow the guide here:  https://robotzero.one/headless-install-raspbian-stretch-lite/ If the gateway is later installed somewhere away from a computer this will make it much easier to view the console.
Once you are logged into the Pi, type:

sudo raspi-config

Activate SPI by navigating Interfacing Options > SPI > Yes
You should probably change the password at this point as well. Reboot the Pi with

sudo reboot

Now enter the following commands one at a time:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
mkdir lora
cd lora
git clone https://github.com/Lora-net/lora_gateway.git
git clone https://github.com/Lora-net/packet_forwarder.git
git clone https://github.com/HelTecAutomation/lorasdk.git
cd /home/pi/lora/lora_gateway
make clean all
cd /home/pi/lora/packet_forwarder
make clean all
cd /home/pi/lora/lorasdk
chmod +x install.sh
./install.sh

Copy the Gateway ID (In Putty left mouse drag over the ID to copy to the clipboard and paste it into Notepad)

Refer to this webpage https://github.com/HelTecAutomation/lorasdk to see the global_config filenames. Use the correct one below (replace global_conf_EU868)

sudo cp -f /home/pi/lora/lorasdk/global_conf_EU868.json /home/pi/lora/packet_forwarder/lora_pkt_fwd/global_conf.json

The new global_conf file needs a few changes. To edit it type:

nano /home/pi/lora/packet_forwarder/lora_pkt_fwd/global_conf.json/global_conf.json

At the end of the file make these changes:

“gateway_ID”: “YOUR_GATEWAY_ID”, 
“server_address”: “router.eu.thethings.network”,
“serv_port_up”: 1700,
“serv_port_down”: 1700,

The server address may vary depending on your location

To start the gateway:

cd ~/lora/packet_forwarder/lora_pkt_fwd
./lora_pkt_fwd start global_conf.json

Registering the Gateway at The Things Network

Sign up for an account here: https://account.thethingsnetwork.org/register
When you have completed account registration, go here: https://console.thethingsnetwork.org/

Follow these steps:
Click ‘Gateways’
Click ‘Register Gateway’
Tick the checkbox I’m using the legacy packet forwarder
Paste your Gateway ID (that you were given during the Raspberry Pi install above)

Register Gateway

Complete the rest of the details in the form.

Your gateway is now registered on The Things Network! If you are have nodes in range or you set up your own, you should see something like this in the Gateway Traffic section.

Gateway Traffic

References

The following pages helped me with setting up this device:
Raspberry Pi Pin Diagram – https://pinout.xyz/
Things Network forum post about the HT-M01 – https://www.thethingsnetwork.org/forum/t/heltec-ht-m01-lora-concentrator-board-for-100/13478
Manufacturer’s documents: http://www.heltec.cn/download/HT-M01%20documents%20package.zip
Manufacturer’s product page – http://www.heltec.cn/project/ht-m01-lora-gateway/
Gateway SDK on Github – https://github.com/HelTecAutomation/lorasdk

11 Replies to “Heltec HT-M01 LoRa Gateway on the Things Network”

  1. Timo says:

    Hey,

    have you made any experiences with the maximum range of the cell?
    I want to use the TTN for my sensors, but so far there are no gateways in my region.
    So I would like to know if I could reach them with a gateway placed at home.
    As node I would use the Heltec Wifi LoRa ESP32 DevKit.

    Best regards, Timo.

    1. WordBot says:

      Hi, It’s on my list to do another project with the gateway and some nodes to test distances. What range do you need?

      1. Timo says:

        It’s about 5km. But there is a slag heap right in the crow.
        The information Heltec is giving are not really precise.
        Thought you may have geathered some information with field tests.
        They talk about 17km range, but who knows under wich conditions…

        Would you recommend the HT-M01 as GW for TTN so far?
        I think then I just would buy it to do some tests and geather experiences with LoRa.

        1. WordBot says:

          I guess as with all radio technology there are so many variables that can affect range and signal quality it’s not possible to give an accurate range. I’ve only briefly tested the HT-M01 but it seems to work well.

          Probably one of those things that you won’t know for sure until you try it.

  2. Timo says:

    Hi,
    I’m experiencing some problems with getting the gateway to work.
    I did try to do everything like you did.
    I just saw that these steps:
    “cd /home/pi/lora/lorasdk
    chmod +x install.sh
    ./install.sh”
    Already start a service, that starts the packet forwarder already, so one should not run the script by hand after doing these steps.

    But thats all not the problem. When I run the gateway it only works for the first or very rare for the second packet received. It also answers the join request and the node joins the ttn, but afterwards all packets (if they are at least seen by the gateway) leed to a crc error, independent on their type (join request or data from the joined node).
    Restarting the script does not fix the problem. Neither does the rst-button of the gateway.
    I need to powercycle it.

    Did you encounter similar problems? Or may this be due to an hardware defekt?

    I already tried different antennas and attenuation in the link.

    Best regards,
    Timo

    1. WordBot says:

      I’m not sure what the problem is. At the weekend I ran through the set up again because I wanted to try (an over-optimistic) 10km test and I noticed one thing in the tutorial that is wrong.

      This line: nano global_conf.json
      Should be: nano /home/pi/lora/packet_forwarder/lora_pkt_fwd/global_conf.json/global_conf.json

      I guess you noticed that and set up the config file correctly?

      1. Timo says:

        Yeah I noticed that and edited the file in the right place.
        I also tried a newer version of the packet forwarder (https://github.com/kersing/packet_forwarder) but it runs into the same problems.

        How do you supply the power to the pi zero and the gateway?
        Because due to the powercycle beeing the only thing fixing it, it seems to deal with the hardware, I would guess.

        And your gateway runs stable for a longer periode of time and multiple messages?

        1. WordBot says:

          I used a good quality powerbank to supply power to the Pi and the gateway takes it’s power from this. I had it on the roof in the sun for about 6 hours without any TTN errors but.. I only had the node switched on in the house for 5 minutes and then left to test from the top of a nearby mountain. I’ll try another test now and leave it running to see what happens.

          1. Timo says:

            First of all: thanks for your support.
            I heard of people getting the wrong frequency version which leads to high crc errors.
            I looked into it once, but couldnt read what was printed on the chips. I’m gonna have a closer look.

            I read that the powersupply from the pi is not enough. I think its limited to 50mA and while transceiving the gateway drains more.
            But I tried every setup and none changed it…

            If it works to you, I think its hardware related and I will write the manufracturer.

            Thanks, again.

  3. Altop says:

    Hey .

    I’m Ali from Indonesia. I’m newbie in lora.
    I just bought a lora gateway as above (HT-M01) 915MHZ. I have followed the steps above with some settings in my area. such as ID and Server address to become router.as2.thethings.network. but my gateway status in the TTN console is still not connected. Can you help me what is wrong with my configuration ?

    1. WordBot says:

      Hello. It’s probably better to ask on TTN website because it might be a region specific thing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

scroll to top