• Ok, there's now a module. It's not published yet, but is on GitHub.

    Since it's not on the website yet, you can use it by URL:

    var RN2483 = require("http://raw.githubusercontent.com/espruino/EspruinoDocs/master/devices/RN2483.js");
    Serial1.setup(57600, { tx:B6, rx:B7 });
    var lora = new RN2483(Serial1, {reset:B3, debug:true});
    
    lora.radioTX("Hello World!", function() {
      console.log("Data sent");
    });
    

    If you want to add extra stuff, it's easy - just do:

    RN2483.prototype.setTXPower = function(pwr, callback) {
      this.at.cmd("radio set pwr "+pwr+"\r\n",1000,callback);
    };
    

    Right now I don't have a Things Network gateway within range, so I've done what I can test - which is radio->radio comms without using LoRaWAN. Hopefully this is a good start though.

    I've used the AT command library to make this kind of thing a lot easier - everything has timeouts.

    I have used promises for getStatus. This is a really tidy way of chaining stuff like the initialisation code that was posted above.

    The only problem is it's relatively new - you'll need an up to date build of Espruino (eg. one newer than 1v87) for it to work I'm afraid. I think it's worth it though, and at some point I'll be swapping existing libraries like the ESP8266/GSM ones to use it too.

    Any questions just ask - it'd be great to get a nice easy to use library that works with The Things Network. Even better if someone could come up with some instructions for setting up your own LoRaWAN :)

About

Avatar for Gordon @Gordon started