Lora and Espruino

Posted on
  • Hello,

    How would I connect to a LoRaWan network using javascript?

    I currently have an RN2483 from Microchip. We also have access to Everynet base stations here in London.

    Any suggestions?

  • Have you seen this page? https://www.espruino.com/RN2483

    That'll get you connected to the RN2483, and then it's a matter of connecting to LoRa.

    It should be as easy as:

    var RN2483 = require("RN2483");
    Serial1.setup(57600, { tx:B6, rx:B7 });
    var lora = new RN2483(Serial1, {reset:B3});
    /* configure the LoRaWAN parameters
     devAddr = 4 byte address for this device as hex - eg. "01234567"
     nwkSKey = 16 byte network session key as hex - eg. "01234567012345670123456701234567"
     appSKey = 16 byte application session key as hex - eg. "01234567012345670123456701234567"
    lora .LoRaWAN = function (devAddr, nwkSKey, appSKey, function() {
      lora.loraTX("Hello", function() {

    But I don't have a LoRa base station set up here to test with I'm afraid. I'll see if there's anyone that has had it working that can confirm.

  • I wrote a guide for that a few months ago. It is not totally completed but you should still be able to make your first experiments by following it:

  • Thanks for your quick replies. I will order a Pico today.

    It seems that if one uses the RN2483, they still have to programme it in Arduino Sketch. So, they don't actually simplify development to one language(javascript). For example, I need to conserve power as my device will be out in the field. I will still have to use Arduino Sketch to configure the RN2483 to wake up only say, twice per day.

    Perhaps the only way to just use Javascript is if I buy a SX1276/77/78/79 LoRa Module? But these modules do not appear to be production ready. Perhaps I am missing something?

    Also, why would someone choose the Espruino WiFi when they are connecting via LoRa? "If you're using this breakout board then you can place it in breadboard alongside an Espruino Pico or WiFi, making sure it connects as follows..."

    Finally, Things Connected have a step by step guide for the RN2483 which you might find interesting https://www.thingsconnected.net/support/­#step-1_4

  • Also, why would someone choose the Espruino WiFi when they are connecting via LoRa? "If you're using this breakout board then you can place it in breadboard alongside an Espruino Pico or WiFi, making sure it connects as follows..."

    LoRa and WiFi are totally different. With LoRa you will achieve very low power consumption. With WiFi you will benefit from relatively high bandwidth. As always, it depends on what you want to do :-)

  • Right. So you wouldn't purchase an Espruino Wifi with a RN2483 because the RN2483 is for LoRa.

  • Are you ever in London for say, IoT meetups?

  • Why do you think you need the Arduino IDE for RN2483? I have Espruino devices using it here without an Arduino in sight. As the RN2483 page suggests, you connect 5 wires between the two boards, and that's it - LoRa.

    Also, why would someone choose the Espruino WiFi when they are connecting via LoRa?

    Espruino WiFi can be a WiFi access point, so maybe they are trying to aggregate data from several WiFi devices in a location that doesn't have internet access and send them over LoRa. Also, the WiFi board is a bit faster with a bit more memory.

    All that page is saying is that since the WiFi and Pico boards share basically the same Pinout you can use either of them with that adaptor PCB.

    Are you ever in London for say, IoT meetups?

    I am very occasionally. I have nothing planned at the moment though.

  • It would be good if you could answer a few questions from the London tech community, as many developers code in Javascript and would like to get started with IoT.

    Power consumption. The battery on the RN2483 will not last very long unless one alters the code to optimise power consumption. http://www.microchip.com/forums/m913217.­aspx

    Still, others seem to be having a success creating javascript only solutions with Puck.js. http://www.tele2iot.com/pr-solution-prev­ent-diesel-theft-won-tele2-iot-challenge­/
    But not all problems can be solved with a puck.

  • I'm not sure I see the alteration that's needed to reduce power consumption? I don't think it needs an Arduino. 45uA isn't that bad for power draw - that's still 5 years on a 2000mAh battery!

    Worst case you can add an FET to disconnect the LoRa module when it's not in use?

    Also I think that particular article is about something else that just happens to have the word 'Puck' in it?

  • Gordon, some JavaScript example using SPI LoraWAN ?

  • Which SPI LoRaWAN did you have in mind?

    Right now I think the only one supported is http://www.espruino.com/RN2483 (which is Serial) - but if there's a module that implemented LoRaWAN (not just LoRa) it should be pretty easy to support.

    To support LoRaWAN on basic radio modules like SX1276 we'd have to build the LoRaWan stack into Espruino (unless someone wants to make a JS implementation!). It's not impossible but due to space constraints it's not something I think I'd be able to add to the existing firmware, so it'd have to be a new firmware file that you flashed instead

  • ok! You are right!

    I had here some sx1276 and i am was curious!

  • Detected!

    1 Attachment

    • sx.png
  • next month i will text the reception on a wisol lora module!

  • I just got LoRa comms working between a Pixl.js (connected to a RFM95W module) and a TTGO ESP32 LoRA board using the SX127x module!

    Now I'm wondering how difficult it would be to add a LoRaWAN stack. It appears these are two actively developed stacks that could be ported:

    I imagine that should be easier than writing a JS LoRaWAN stack from scratch?

    Then there are the new STM32WL chips that have an integrated SX126x radio. So now I'm also wondering how difficult it would be to port Espruino to the NUCLEO-WL55JC dev board and get LoRa working on there?

  • It's probably not too hard to include in Espruino itself - It'll just be a matter of changing the SPI comms functions from Arduino to Espruino (you could even make a wrapper library for that) and then handling timing

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Lora and Espruino

Posted by Avatar for user75003 @user75003