Wireless sensor systems are very handy. This is especially true if that system can work over long distances. In this project, you’ll learn how to build an easy long-range wireless sensor system using a modular electronics platform called XinaBox which doesn’t rely on Bluetooth or WiFi making it extremely reliable.
We will be using LoRa as our modulation for digital wireless comms. This low-cost off-the-shelf device can reach up to 15km while using very little power. Just make sure you’re operating in unlicensed bands, though.
The trade-off for long-range is that it’s narrowband and only really good for sending small amounts of data, so no good for transferring files, surfing the web or streaming video.
It’s all made possible by the chirp spread spectrum modulation and what’s known as ‘coding gains’ which increase receiver sensitivity so you can pick up signals from beneath the noise floor.
LoRa lets you spend more time on-air and transferring a certain size payload than you would with a more traditional modulation type like FSK or ASK/OOK.
For more about LoRa modulation and comparison to other types, check out Part 3 of Bill Marshall’s post series, RF Communication and the Internet of Things.
Whilst LoRa simply provides a channel for information, LoRaWAN builds on this to enable massively scalable networks with addressing and a comprehensive standard that covers device provisioning, different classes of service and interoperability etc…
LoRaWAN is fantastic for rolling-out a national or international network, but it does make life more complex with the need for servers and additional constraints. With our application, the requirements are quite simple so we’ll be using a simple peer-to-peer system rather than LoRaWAN.
For more on LoRaWAN, try A Closer Look at LoRaWAN and The Things Network.
When it comes to hardware to use with XinaBox, you can take your pick. Here are just a few of the many xChips out there which provide an ATmega328P microcontroller core (174-3696), Raspberry Pi interface (174-3694), GPS (174-3740), VOC/eCO2 gas (174-3732) and visible/UV light (174-3738) sensors, and power supply via a CR2032 coin cell battery (174-3721).
The CR02 (174-3699) is an xChip module based around an ATmega328P microcontroller, paired with an RFM95W LoRa radio configured for 868MHz. Other variants include CR01 (174-3698) and CR03 (174-3700), which are configured for 433MHz and 915MHz respectively.
Of course you’ll make sure you use the correct module (and thus band) given your location — e.g. 433 or 868MHz in Europe and 915MHz in the US.
These boards are compatible with the Arduino Pro and Arduino Pro Mini, hence are supported by the Arduino IDE without the need to install any additional board support packages. But bear in mind the CPU/core boards do not integrate a USB interface, since this might only be needed for programming and would add to the physical size and cost. So we’ll be using the IP01 (174-3703) programming interface, which is built on the FT232R and in Linux enumerates as /dev/ttyUSBn.
Still with us? Cool. Stay tuned for our next post where we’ll move on to programming a CRO2 module (or ‘xChip’) which features an integrated microcontroller and radio — and then sending and receiving data across a LoRa wireless link. How exciting is that?