An long range distance experiment with LoRaWAN on The Things Network
October 04, 2023
Image source: a wonderful creation by Dall-E
I have previously written about sending data to The Things Network using LoRa, with third party gateways relaying the transmission to TTN servers. I’m planning for TTN to be a secondary telemetry tracking solution for my high altitude balloon flight, alongside receiving a separate point to point transmission on my own receiving device.
When sending data over such a potential long distance of a HAB flight, the telemetry transmission distance is a critical aspect of the flight. I’ve carried out a rudimentary distance test a few months ago, and while that experiment was great for comparing LoRa and antenna configuration, it wasn’t great for determining if the distance would be suitable for a real balloon flight, where altitudes can reach 20km or more.
This post will show my first long distance LoRa transmission experiment.
Testing LoRaWAN and TTN in Crete
Before embarking on a recent holiday to Crete to visit my in-laws, I noticed a few TTN gateways in their area:
I had only briefly connected to a TTN gateway in the UK once before this, so I decided to take my makeshift breadboard LoRa transmitter (programmed to send to the TTN) with me on holiday to try sending to another gateway (mainly to work on my previous blog post).
I had a simple LoRa module/ESP32 combo, powered by a Anker power bank:
This setup was stripped down, containing only these couple of components, for a couple of reasons. It meant I was more likely to get through airport security, and because I was only interested in testing that the gateway could receive any message, there was no need to bring other modules like GPS.
Experiment 1 - on the ground
The plan was to drive nearby the location of a gateway whilst checking The Things Network dashboard to see incoming transmissions. I had the TTN dashboard on my phone.
The transmitter was sending a short message of a single byte of data. If the transmission was received by the TTN gateway, the gateway would forward the payload to TTN servers where I would be able to receive in my dashboard. The transmitter is programmed with my TTN credentials, which is how the gateway knows where to route the incoming transmission.
I initially drove to the closest gateway to test sending a transmission at any distance. This was important to ensure there was in fact a gateway present at the location on the map, and also to ensure it was functioning ok and accepting transmissions. The point on the map was in a remote location with only one building in the area, which I’m sure was where the gateway was located.
I was able to observe the transmissions successfully, but only when I was within about 200m. Once the transmissions were coming through ok I began to drive away from the gateway, where I kept seeing them on my TTN dashboard to around 1km. At the 1km mark they stopped. In retrospect, this was probably happening because the initial transmissions from LMIC-node is always an authentication one. Once authenticated, LMIC-node is programmed to send the payload. This is because the method of authentication I use is OTAA (over the air activation) which relies on sending the TTN keys in an initial request, and exchanging those keys for the auth token, which is used in subsequent requests.
The distance of 1km was relatively short because of objects on the ground blocking line of sight:
Max distance reached: 1km
Experiment 2 - from the mountain
While visiting, we set a day aside to climb a nearby mountain which is around 1,400m (similar to that of Ben Nevis). This mountain was thankfully positioned nearby one of the TTN gateways, so the opportunity presented itself to see if the nearby gateway would receive my LoRa transmission at a great height, and if it did, how far would it reach as we climbed the mountain.
The benefit of doing this at a great height is that there should be almost an unobstructed line of sight from a higher altitude, allowing the transmission to reach the gateway more effectively:
The technical setup was a little different this time around. I’d previously checked the TTN dashboard on my phone, checking live data being transmitted from my LoRa module, however as I’d be walking up a mountain I was unable to receive 4G/5G data on my phone, meaning I couldn’t check the TTN dashboard. I decided to get creative in order to get updates:
The LoRa transmission would reach the TNN gateway which would initiate a webhook to send a request from TTN to a server of my choice. I run a Kubernetes cluster for side projects, so I spun up a quick server there to receive the TTN webhook requests. My server would then send the request to a Firebase DB so I have record of each request later, logging the time the request was received. As well as sending to Firebase, my server also sends the request to the Twilio API which would send a SMS to my phone. Sending a SMS does reach my phone while I’m walking up the mountain, as there’s still enough phone signal to receive basic phone communications (just not enough to receive data).
I began receiving SMS messages at around 600m, at a point where we were high enough to be within a straight line to the TTN gateway on the ground. My LoRa device was set to transmit a payload once every 30 seconds, and I pretty much received every single SMS message for about 2 hours as we climbed the remainder of the ascent.
We eventually reached a final altitude of 1,139m where I was still receiving SMS messages! It was great to still be receiving at this height, especially as the distance between me and the gateway was significant. As the SMS messages were coming through consistently every 30 seconds still, I think I could have reached a much higher altitude and kept receiving them.
As I know the altitude of our climb, and the distance from our latitude/longitude position to the position of the gateway, I was able to calculate the line of sight distance between our highest position down to the TTN gateway:
Max distance reached: 10.25km
The line of sight distance achieved was more than I expected. Even though I know LoRa has potential to reach much further than 10km, it was still exciting to receive the messages. The altitude of a balloon flight is know ahead of time (as it’s used to calculate required gas to lift the balloon), and knowing that I may be aiming for 15-18km, I feel more confident that my LoRa tracking device will perform effectively.
Here’s a few snaps from the walk:
Senior Engineer at Haven