Close

Day 3 - J'S ON

A project log for Low Power LoRaWAN Gateway

Low power, low cost, low parts and low channel count USB talking LoRaWAN gateway (without concentrator) for OpenWRT routers and pals

morphmorph 02/07/2023 at 20:330 Comments
{
  "rxpk": [
    {
      "time": "2013-03-31T16:21:17.528002Z",
      "tmst": 3512348611,
      "chan": 2,
      "rfch": 0,
      "freq": 868000000,
      "stat": 1,
      "modu": "LORA",
      "datr": "SF9BW125",
      "codr": "4/5",
      "rssi": -39,
      "lsnr": 11,
      "size": 23,
      "data": "00FB5F00F07ED5B3708EBDC96952475D0004FAEC5DD086"
    }
  ]
}

I decided to follow the easy route for now with the packet formatting, its JSON. Forget about the "time" and "tmst" values above, the rest is real information :)

JSON is not ideal, but I'm worried that I'll get tangled up in writing gateway bridge code for OpenWRT. I can just compile the Semtech Packet Forwarder. Furthermore I'd have to anyway convert most other formats to something that Chirpstack understands. Eventually, when this single Channel LoRaWAN gateway traffic pipeline is complete and has been running for some time I will change JSON for a better packed format.

I found a fresh and pure C JSON serializer library for embedded systems: https://github.com/rdpoor/jems 

The best part is that it can "emit characters as you go", and I like to go. It means that the E5 can stream out JSON over USB character by character when a packet arrives. Combine that with the Mbed OS Event Queue and you can stream like there's no tomorrow without any major memory issues, other than my own.

Next I'll compile the packet forwarder on the router and sniff what it wants from what it thinks is a 'normal' gateway. We will give it all the JSON it needs, but not more.

Discussions