LoRaWAN Bridge

From AllWize Wiki
Revision as of 08:21, 20 August 2019 by Allwize (talk | contribs)
Jump to navigation Jump to search

A LoRaWAN Network Server (LNS) is the piece of the LoRaWAN stack responsible for de-duplicating messages and route them to the Application Server where the user can configure the appropriate handlers to send the data to depending on the device address of the source node. Most of the servers available, including the The Things Network LNS and the LoRaServer open-source LNS support the Semtech Legacy Protocol. This protocol is a simple way to send data from a LoRaWAN Gateway to the LNS using UDP.

LoRaWAN Frame Format

The Semtech Legacy Protocol is open-spec and fairy simple so we can actually use it to send data to a LNS from wherever we want, the only requirement is that the data must be a LoRaWAN-compatible frame so the LNS can understand it. This is what a LoRaWAN frame looks like:

LoRaWAN Frame

The first row is the raw LoRa frame we don't have to worry about, the PHY Payload is the MAC part of the frame. In order:

  • MAC Header (0x40 for unconfirmed uplinks, maps to MBUS C-field)
  • Device Address (maps to Wize UID)
  • Frame Control (maps to Wize Control Byte)
  • Frame Counter (maps to Wize Frame Counter)
  • Frame Options (LoRaWAN MAC options, we can skip this for the moment)
  • Frame Port (maps to Wize Application Byte)
  • Frame Payload (the data, we can use LLP since the Application Server already have a decoder)
  • MIC (Message Integrity Code, used by the LNS to check the message is valid)

As you can see we can actually map up to 9 bytes of the frame to Wize specific frame

Sending a LoRaWAN message over Wize

  • MAC Header (0x40 for unconfirmed uplinks, maps to MBUS C-field)
  • Device Address (maps to Wize UID)
  • Frame Control (maps to Wize Control Byte)
  • Frame Counter (maps to Wize Frame Counter)
  • Frame Options (LoRaWAN MAC options, we can skip this for the moment)
  • Frame Port (maps to Wize Application Byte)
  • Frame Payload (the data, we can use LLP since the Application Server already have a decoder)
  • MIC (Message Integrity Code, used by the LNS to check the message is valid)

As you can see we can actually map up to 9 bytes of the frame to Wize specific frame