LoRa long-range communication system, similar to WIFI but working over very long distances (up to 10km). Unlike regular wifi, LoRa is designed to send only very small amounts of data, and pretty slowly.
Hardware
The Arduino MKR WAN 1310 is a board that combines the functionality of the MKR Zero and LoRa / LoRaWANTM connectivity. There are also modules that allow LoRa communication for almost any device, and several other Arduino based devices with inbuilt LoRa functionality.
...
Compatible Antena
Jumper wires
Breadboard
A sensor
Getting started with the MKR WAN 1310
For this experiment, we need two LoRa devices. We also need to have a compatible antenna connected to both devices.
...
Code Block | ||
---|---|---|
| ||
#include <SPI.h> #include <LoRa.h> String contents = ""; void setup() { Serial.begin(9600); while (!Serial); // wait until serial has started Serial.println("LoRa Receiver"); if (!LoRa.begin(868E6)) { Serial.println("Starting LoRa failed!"); while (1); } } void loop() { // try to parse packet int packetSize = LoRa.parsePacket(); if (packetSize) { // received a packet Serial.print("Received packet '"); // read packet while (LoRa.available()) { contents += (char)LoRa.read(); } Serial.println(contents); // print RSSI of packet Serial.print("' with RSSI "); Serial.println(LoRa.packetRssi()); contents = ""; } } |
Advanced example MKR WAN 1310
In the previous example, you might have noticed a potential problem. The receiving device is getting LorRa LoRa messages from anyone sending data on that frequency. Furthermore, anyone can listen in to the data being sent. This could be resolved by encrypting the message.
...