Playing with LoRa radio
30 July 2016 at 12:45 am
I’ve played around with different radio technologies the last year. Some are cheap, some are expensive, but most of these have a fairly short range. LoRa is different and well worth checking out! Here I’ll go through the dev-boards I used, power usage and what range you can expect from LoRa radios.
A little different history
LoRa is a spread spectrum technology jumping between frequencies is at the core of the technology. Looking at the history of this technique, you’ll discover that one of the inventors stands out by being a female Hollywood Actor! Hedy Lamarr developed this technique with a friend (who was a composer!) to prevent the Germans from jamming the Allied torpedoes in WW2. Not shabby?
Radios based on the techniqe have been available for some time, but they have mostly been used by military and niche businesses.
Availability and pricing
There is a lot of LoRa dev-boards out there. The castellated modules from Hope RF are nice and you can get these separately to build your own board, but I always have a preference for Adafruit when playing with new technology. It just makes things so much easier since they excel in doumentation and quality.
The Adafruit LoRa boards are $39 a piece and you can choose between 16Mhz 32u4 or 48Mhz ARM M0 microcontrollers to control the radio and do I/O. These come with a voltage regulator that switches automatically between exernal USB power and the builtin LiPoly battery charger. If USB is connected, it will use this to both run the MCU+radio, but also to charge any connected LiPo battery. Very convenient!
Test setup
For my test setup I used 2500mAh LiPo batteries and these lasted much longer than I had expected! For convenience, I stacked a 15x7 led matrix shield on the first radio. This one was just plugged into a 400 hole breadboard and I taped the LiPo battery underneath the breadboard. This made for a nice and fairly compact package that I could hold in my hand while walking. The output on the led matrix feather was the dBm received from the stationary transmitter.
The other radio was put on a protoboard for some testing of basic sensors. It was then put into a waterproof project box with a transparent lid. After some testing, I’ve now drilled a hole for the antenna on this one. Its a 10 dBm penealty to enclosing the antenna in such a plastic box. That’s quite a bit more than what I expected, but easy to fix.
I used basic whip antennas made with solid core copper wire. I experimented with using half-wavelength antennas (15.59cm) but cut this down to 7.79cm as it produced a better signal. I used the excellent Radiohead library and set the radio to the recommended 23dB power setting. The software was the server/client sketch with a modification to confirm that the radio did indeed receive the full text sent by the stationary radio.
What kind of range can you expect?
I’ve tested 315Mhz radios before but they have rather limited range, so I was expecting more from the LoRa radios despite the higher frequency. I had seen some claim 20 and even 50km in some cases, so I was curious to see what I got.
My first test was just leaving one radio inside my house and walk around. From this, I got about 300 metres of range, provided that my house was in sight. Not shabby? If there was something big blocking the radio, no signal got through.
The second test was placing the radio on (fairly high ground) outside a local school. First with the antenna inside the enclosure and then with the antenna out through the enclosure. I was quite disappointed with the first of these two, but as soon as the antenna was sticking out and had free sight it looked better.
I went for a walk to a local petrol station a few kilometers away and kept checking the radio status. When measuring in a straight line, I got 1.8km of reach until I lost the signal. During this distance, the radio never got a partial message. It got the full text always. I walked a road further up when going back and that gave me a better signal overall.
I live in a small town with up to 6 storey buildings. In this area, the signals bounced a bit between buildings but you can’t expect many kilometers in such a setting. 2-300 meters is more realistic, unless you manage to place the radios really high up on the tallest building.
How about battery use?
This is the part that impressed me the most. These things are really not using a lot of power. None of my tests tried to conserve power in any way. I sent a signal twice per second and I blinked the LED on the server on each transmit. The receiver had the 15x7 LED matrix, so I expected this to drain the battery quickly. To make it last a little longer I only lit the display for 100ms after receiving a transmission. I expected maybe 3-4 hours for this one, but it lasted 12.5 hours before the 2500mAh battery drained. Not shabby?
The server is a different story! It transmitted for 71.5 hours(!) on that single 2500mAh LiPo. This really wasn’t expected at all. I presume that by just turning off the LED and transmit just once every 10 seconds, I can make it last much, much longer! Then If you start playing with putting the entire microcontroller to sleep… My intent is to play around with solar charging next, so this could become something that keeps running for a very long time.
Final thoughts
I think there’s no need to doubt that these radios can reach tens of kilometers given the right conditions. The ideal condition would be free sight to the receiver, so you need to get the radio high up on a house or a radio tower if you want to go really far. They were surprisingly solid and never skipped a beat. They work well in office buildings, so they could be well suited for sensors in a building where WiFi is spotty. I’m really looking forward to using these when teaching the M2M Communications topic at Westerdals this autumn!
90 RSSI at Kolbotn Church, 750 meters from the transmitter. Some nice Pokemons there as well. Pokemon Go goes really well with radio testing!