LoRaWanPacket

  • by

I have this library for some time, I created to make possible to encode and decode packages of LoRaWAN on Arduino. The idea is to insert de keys and configuration of the device on the library and then the crypto and the mic check is automatically generated from the LoRaWanPacket.

#include <LoRaWanPacket.h>

const char *devAddr = "11111111";
const char *nwkSKey = "11111111111111111111111111111111";
const char *appSKey = "11111111111111111111111111111111";

void setup()
{
  Serial.begin(115200);
  while (!Serial);

  LoRaWanPacket.personalize(devAddr, nwkSKey, appSKey);
}

void loop() {

  LoRaWanPacket.clear();
  LoRaWanPacket.print("Hello World");
  if (LoRaWanPacket.encode())
  {
    LORA_HEX_PRINTLN(Serial, LoRaWanPacket.buffer(), LoRaWanPacket.length());
  }
  delay(5000);
}

This example encodes the payload “Hello World” with the ABP keys and creates a LoRaWAN valid packet. In this case, is generate an Uplink every 5 seconds with a different up frame, adding one each time and shows the resulting packet on the serial monitor.

You can validate the packet on this online LoRaWAN packet decoder.

The library is still on working progress and only support:

  • ABP uplink and downlink.
  • JOIN uplink and downlink.

I still need to create a good documentation and add support to confirm and MAC commands.

If you are interested check the LoRaWanPacket.

See yaa!