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.
If you don’t have the connection board, wire the Pi and HT-M01 as below:
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:
Activate SPI by navigating Interfacing Options > SPI > Yes
You should probably change the password at this point as well. Reboot the Pi with
Now enter the following commands one at a time:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
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
make clean all
make clean all
chmod +x 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:
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:
./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 ‘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)
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.
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
Buy Me A Coffee
If you found something useful above please say thanks by buying me a coffee here...
15 Replies to “Heltec HT-M01 LoRa Gateway on the Things Network”
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.
Hi, It’s on my list to do another project with the gateway and some nodes to test distances. What range do you need?
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.
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.
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:
chmod +x 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.
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?
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?
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.
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.
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 ?
Hello. It’s probably better to ask on TTN website because it might be a region specific thing.
I’m experiencing very similar problems like Timo above regarding the high CRC error rate after using the HT-M01 for a couple of minutes. After cold start everything is fine (CRC_OK: 100%), but the CRC_FAIL is rapidly increasing and generally at 100% after 10 Minutes, even if a sending LoRa node is close by and other gateways (from another manufacturer) have no issues receiving.
I was able making it work again by putting a cooling pad from the fridge on the box. It also works permanently if placing the device outside where temperature is below 10 °C.
It didn’t make a difference if using the USB port (with PicoGW) or SPI. RPi power adapter was the original 3 A version and a Power Bank (also no difference).
Since it is the second device I received showing this same behavior I assume there might be a thermal problem with the current series. So, I wonder if somebody has a solution or if those devices are really unusable for real world.
Thanks and best regards
Have you asked Heltec? Maybe see if you can take off the cover and see if anything is getting really hot? Mine worked fine in a plastic box in full sun for hours when I tested it.
Yes, I asked Heltec. This was their statement:
“Seems that your problem may be caused by a hardware failure. Because your device did not experience this kind of problem during cold start, we ignored this problem during the factory testing.”
They then provided a flawless support and shipped a new device from a new batch which arrived at my company today and this device works without problems!
I got the HT-M01 about a year ago and it’s running well since. thanks to your tutorial.
However, since The Things Network updated to V3 the UDP packet forwarder has at least one flaw that it’s showing the gateway as offline despite the packets are coming trough. I’m trying to migrate to the basic station forwarder (cups) following this tutorial:
The forwarder is connecting but no packets are coming through.
Did anyone manage to get this working with the HT-M01 gateway?