LoRa technology was developed by a company called Semtech and it is a new wireless protocol designed specifically for long-range, low-power communications. LoRa stands for Long Range Radio and is mainly targeted for M2M and IoT (internet of things) networks 1. In the US, LoRa communication works on 915 Mhz, which is a license free spectrum.
For a large amount of differently placed sensors and devices, it is recommended to set up a LoRaWAN network. However, if you seek to establish simple device-to-device communication for a separate system, LoRa with the RadioHead library works great.
The RadioHead library from www.airspayce.com works for communication between two devices, a server and a client. If you want to install the RadioHead library, click on the link with the ending .zip on the previously mentioned website.
Then, add the library to your Arduino IDE. Once added, you can open the example file under examples --> radiohead --> rf95 --> client or server
In the (example) sketch, make sure to assign LED to something other than 9. If set to 9, the restart of the LoRa board will be triggered.
LoRa WAN is the internet-based version of LoRa. While LoRa communication only works between generally two devices, LoRa WAN can communicate between hundreds of devices by the means of a gateway. LoRa WAN consists of end-nodes and at least one gateway. Communication between the gateway and the nodes is bidirectional and based on LoRa radio communication.
List of tutorial videos on some useful related LoRa WAN subjects
Different device types - Class A,B,C - Youtube tutorial
EIRP and ERP
RSSI and SNR
LoRa Packet Format, Time on Air and Adaptive Data Rate
Different types of LoRa chips
LoRa End Node Libraries
A gateway can be a LG01-N Single Channel Gateway. It works in a LoRaWAN setup and communicates with the nodes. In a LoRaWAN setup, the nodes don't communicate with each other. A gateway creates a connection with the internet and uploads the data to a platform such as TheThingsNetwork (TTN). This is a potential great opportunity for improving the current system at the farm.
Nanopb protocol buffer
Protocol buffers are a data serialization format from Google which are supported in multiple programming languages. Protocol Buffers messages are encoded in a binary format, which means they are not human-readable unless we decode them back to a readable format. One of the main advantages of using Protocol Buffers is that the serialization and deserialization process is fast and the generated messages are small.3 Nanopb is a version of the protocol buffer in the programming language C, which works well with 32 bit systems such as the Arduino.
This dfrobot tutorial leads you through installing the Nanopb library and compiler on your laptop. You can use this online proto buffer decoder to decode proto buffer messages that were encoded for sending.
The Nanopb library needs a
.proto file that clarifies the variables that will be serialized. Once, the different types of variables are serialized or encoded, they are unreadable for humans in a binary format. This number is expressed as hexadecimal that can easily be sent over wireless radio as it requires small amounts of data.
The encoded message needs to be decoded on the side of the receiver. The receiver also needs to know the specific variable types in the message to properly decode the message. The abovementioned tutorial only walks you through setting up the Nanopb environemnt on your laptio and encoding a message. A different tutorial by dfrobot shows how to encode and decode messages between an Arduino and ESP32.