Prototyping LoRa Wireless Monitoring with XinaBox Part 1: Introduction
Rapid prototyping of a long-range wireless sensor system with the modular electronics platform.
XinaBox is a modular electronics system which includes embedded processors, host interfaces, sensors, power, communication, output and more. Interconnection is made possible without wires, soldering or breadboards, thanks to a standard form factor and compact “xBUS” bus connectors.
In this series of posts, we’ll take a look at how XinaBox can be used to prototype a wireless sensor system which is able to operate over remarkably long distances and/or in challenging environments.
Our hypothetical use case is wireless monitoring for safety applications, where systems such as Bluetooth and WiFi are not a good fit due to their relatively short range. So this might be a solution for use across a sprawling site spanning hundreds of meters or more, with no shortage of obstacles. For example, a manufacturing operation. Or it could be container shipping, where once again distances could be challenging and signals might be severely attenuated by obstacles in the path.
LoRa is a proprietary modulation for digital wireless communications that with low-cost off-the-shelf devices is typically able to achieve a range of up to 15km while using very little power and operating in unlicensed bands. Of course, you don’t get anything for nothing and the trade-off is that it is narrowband and suited to sending only small amounts of data. Perfect for wireless sensors, but no good for transferring files, surfing the web and streaming video. Which in our case is fine.
While achieving communications over a distance of many kilometres with only a few milliwatts may seem like magic, this is made possible by the chirp spread spectrum modulation used and what’s known as “coding gains”, which increase receiver sensitivity and enable the retrieving of signals from beneath the noise floor. In short, with LoRa you spend more time on-air and transmitting to transfer a certain size payload than you would with a more traditional modulation type, such as FSK or ASK/OOK. However, this is typically not a problem with small payloads.
For a more in-depth description of LoRa modulation and comparison to other types, see Part 3 of Bill Marshall’s post series, RF Communication and the Internet of Things.
A common source of confusion is the relationship between LoRa and LoRaWAN. The distinction is quite simple and whereas LoRa simply provides a channel or conduit 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.
A much simpler system will be used in place of the LoRaWAN MAC layer shown here.
Once again, you don’t get anything for nothing and while LoRaWAN is fantastic if you want to roll-out a national or international network, it does bring with it a degree of added complexity, the need for servers and on top of this various constraints. With our safety application, the requirements are quite simple and we want to eliminate as much complexity as possible and remove any reliance on external services, so we’ll be using a very simple peer-to-peer system — and not LoRaWAN.
For further details on LoRaWAN, see the post, A Closer Look at LoRaWAN and The Things Network.
Plenty of options
There is no shortage of hardware options with XinaBox and above we can see just a small selection of the available xChips, 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.
It’s obviously important to make sure that 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. However, 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. Here we’ll be using the IP01 (174-3703) programming interface, which is built on the FT232R and in Linux enumerates as /dev/ttyUSBn.
In the next post in this series we’ll take a closer look at the simple LoRa system we’ll be using, before then moving on to sending and receiving data using this.