In this guide, we'll be connecting a sensor to two Feathers and pairing them with a gateway to bring all the data collected into the cloud. We're going to build our own network to send data from devices to a router. The router will then decode the data packets and route them to Adafruit IO or The Things Network.
Here's a network map (also known as a network topology) of the connections between the nodes/gateways/protocols of our network.
Devices need a way to communicate their data - the first step in building a network is selecting a mode of transport. As humans, we talk to each other in our native language(s). Electronic devices can also talk to each other, and there's a plethora of ways for them to communicate (for more information on transports, check out our All the Internet of Things - Part 1, which explains more about selecting a transport for your project)
In the first part of this guide, we're going to employ an Internet-of-Things transport protocol called LoRa to have our Feathers communicate with the Raspberry Pi Gateway. While we could use WiFi/BTLE/Cellular, we're not sending a large amount of data (a few bytes). We also do not need to send this data quickly, our sensors will transmit their data to the router every 15 minutes or so.
By sacrificing transmit speed and the amount of data which we're able to send, LoRa radios can transmit much farther than Bluetooth Low-Energy and WiFi with lower power utilization.
The second part of this guide uses LoRaWAN. LoRaWAN is a Low Power Wide Area Network (LPWAN) specification which allows connection of LoRa devices to the internet. LoRaWAN differs from LoRa by the inclusion of a physical layer.
Selecting a Device
To begin building a sensor network, we'll specify what we want the sensor device to do:
- Read a sensor
- Send data over LoRa (it'll need a LoRa radio)
- Connect to a LiPo battery (wireless operation!)
- Run CircuitPython
A board which meets all of these specifications is the Feather M0 with RFM95 LoRa Radio. This microcontroller runs CircuitPython, has a built-in LoRa radio, and a connector for LiPo batteries.
Next up, we'll need a sensor to gather and send data. The BME280 is a fantastic environmental sensor - it can read a location's temperature, barometric pressure, and humidity.
- Need less data? Just want the humidity from a location? We have lots of sensors to help build a sensor node.
Selecting a Router/Gateway
We're going to use the LoRa Radio Bonnet and a Raspberry Pi Zero W to act as a gateway - converting incoming packets (from the feathers) to readable values. After it converts this data, it'll forward it to either Adafruit IO or The Things Network.
You'll want to grab the following parts for this project: