LoRaWAN

LoRa long-range communication system, similier 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.

LoRaWAN defines the communication protocol and system architecture for network based on LoRa.

The Things Network is a global collaborative Internet of Things ecosystem that creates networks, devices and solutions using LoRaWAN.

 

Visualising Data on The Things Network

Data is stored on The Things Network for up to 7 days. The data can be exported, and it’s possible to integrate with many IOT platforms for handling live data streams.

API Reference

 

Terms:

OTAA: OTAA end devices are assigned a new DevAddr at establishing each new session. This allows them to move to different networks/clusters.

ABP: ABP end devices use a fixed DevAdd

AppEUI and JoinEUI are the same things

 

Lora First try

/* First Configuration This sketch demonstrates the usage of MKR WAN 1300/1310 LoRa module. This example code is in the public domain. */ #include <MKRWAN.h> LoRaModem modem; // Uncomment if using the Murata chip as a module // LoRaModem modem(Serial1); String appEui = "0000000000000000"; // AppEUI and JoinEUI are the same things String appKey = "YOUR APPKEY"; String devAddr = "YOUR DEVADDR" String nwkSKey; String appSKey; void setup() { // put your setup code here, to run once: pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); Serial.begin(115200); while (!Serial); Serial.println("Welcome to MKR WAN 1300/1310 first configuration sketch"); Serial.println("Register to your favourite LoRa network and we are ready to go!"); // change this to your regional band (eg. US915, AS923, ...) if (!modem.begin(EU868)) { Serial.println("Failed to start module"); while (1) {} }; Serial.print("Your module version is: "); Serial.println(modem.version()); if (modem.version() != ARDUINO_FW_VERSION) { Serial.println("Please make sure that the latest modem firmware is installed."); Serial.println("To update the firmware upload the 'MKRWANFWUpdate_standalone.ino' sketch."); } Serial.print("Your device EUI is: "); Serial.println(modem.deviceEUI()); int connected; Serial.print("Your APP EUI is "); Serial.println(appEui); Serial.print("Your APP Key is "); Serial.println(appKey); appKey.trim(); appEui.trim(); connected = modem.joinOTAA(appEui, appKey); if (!connected) { Serial.println("Something went wrong; are you indoor? Move near a window and retry"); while (1) {} } delay(5000); int err; modem.setPort(3); modem.beginPacket(); modem.print("HeLoRA world!"); err = modem.endPacket(true); if (err > 0) { Serial.println("Message sent correctly!"); digitalWrite(LED_BUILTIN, HIGH); } else { Serial.println("Error sending message :("); } } void loop() { while (modem.available()) { Serial.write(modem.read()); } modem.poll(); }

 

 

Â