Saturday, November 02, 2019

First experiment with LoRa transceivers

LoRa is a fascinating radio system for low power but long range digital data communications. Low cost transceivers claim a range of 15km. John, VK2ASU, has been working with these for a few months with an application involving reporting activity at a remote site.

I also came across LoRa when talking with the City of Ballarat for a GovHack story. They put a LoRa Gateway up on the town hall and are using it to collect data from all over town including things like rubbish bins reporting their fullness.

Here's my hardware setup. (Receive and transmit sides look the same).


I'm using cheap Arduino Nano Pros. They need to be 3.3V to talk to the LoRa Module.

The modules I purchased are RA-01 SX1278 on 433MHz. They were AU$8.67 each (but cheaper if you buy 2 or more). For starters I'm using ones with the little spring antennas and obviously better antennas help them go further.



With one at the extreme end of the house to the other here's the received packets.


So none are being lost. I'm not sure if the protocol re-sends if there's no ACK.

The Arduino library is one of the ones available right in the IDE. It is by Sandeep Mistry and the source code and documentation is here. To get started I wired up to Arduino Nano Pros using the wiring diagram from this excellent tutorial. The examples titled "LoRaSender" and "LoRaReceiver" work well and the only change is to set the frequency to 433E6 (meaning 433MHz) on each end.

There are many levers to adjust with LoRa and you can trade of data rate for range. John ASU advises that he uses these settings:

TxPower (20,20);
Spreadfactor (12);
Bandwidth (62.5E3);

I'm just using the defaults for now.

The tutorial mentioned that the 3.3V supply from the Arduino wasn't sufficient and that may be the case at higher transmit power levels, but for me it's working from the VCC line on the board which is powered by the USB Serial board I use.

The LoRa physical protocol

LoRa is a proprietary protocol but, naturally, this puzzle has led to some excellent work to figure out how it works.


On a waterfall, the spectrum shows what people call "chirps", that is the frequency sweeps rapidly up or down. Here's a picture from the GRCon16 video above by Matt Knight.


The receiver looks for the regular header at the top and uses that to sync up with the transmitter before the data packet begins. Note that the image above is vastly expanded. I've tried to view this with an RTL-SDR dongle in SDR# and all you see is very brief signals for each packet.



No comments: