Skip to content

Latest commit

 

History

History
129 lines (92 loc) · 3.9 KB

RN2483.md

File metadata and controls

129 lines (92 loc) · 3.9 KB

RN2483 LoRa Modules

⚠️ Please view the correctly rendered version of this page at https://www.espruino.com/RN2483. Links, lists, videos, search, and other features will not work correctly when viewed on GitHub ⚠️

  • KEYWORDS: Module,RN2483,RN2903,Microchip,UART,LoRa,LoRaWAN,Wireless,Radio,Transceiver

The RN2483 is a fully-certified 433/868 MHz module based on wireless LoRa technology. The module's embedded LoRaWAN Class A protocol allows you connect to LoRaWAN compliant network infrastructure

Wiring Up

All you need to connect is power, ground, RX and TX pins (to UART-capable pins on your Espruino), and optionally the Reset pin.

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:

RN2483 Pin Espruino connection
GND GND
3V3 3.3v
RST B3 (Optional)
RX B6 (Serial1 TX)
TX B7 (Serial1 RX)

Software

Get started by initialising the RN2483 module with Serial at 57600 baud on the correct pins:

var RN2483 = require("RN2483");
Serial1.setup(57600, { tx:B6, rx:B7 });
var lora = new RN2483(Serial1, {reset:B3});

Note: If attempting to debug you can use {debug:true} in the options, eg: var lora = new RN2483(Serial1, {reset:B3, debug:true});

Stand-alone Radio

Once the radio has been set up as above, you can set the RN2483 up to listen on Non-LoRaWAN radio for a certain period of time:

lora.radioRX(10000 /* 10000ms = 10 seconds */, function(data) {
  if (data === undefined) {
    console.log("No data received");
  } else {
    console.log("Got data: "+JSON.stringify(data));
  }
});

You can then transmit on another module:

lora.radioTX("Hello World!", function() {
  console.log("Data sent");
});

And the callback on the first module will be called with the data. radioTX and radioRX automatically pack and unpack the data they are sent, so you can send a String or Uint8Array containing binary data if you require. (although radioRX will always return data as a string).

LoRaWAN

If you need a LoRaWAN server that's relatively lightweight and easy to install on something like a Raspberry Pi, you could use lorawan-server by Petr Gotthard.

Once the RN2483 is set up (see above), you need to connect to a LoRa gateway:

lora.LoRaWAN(
  "01234567", // device address
  "0123456789ABCDEF0123456789ABCDEF", // nwkSKey
  "0123456789ABCDEF0123456789ABCDEF", // appSKey
  function(err) {
    if (!err) throw Error(err);
});

You can transmit with:

lora.loraTX("my_string_of_data", function(err) {
  if (!err) throw Error(err);
});

And can receive data by handling the message event:

lora.on('message', function(d) {
  console.log("RECEIVED",JSON.stringify(d));
});

You only need to call the above code once - it'll be executed whenever a message is received.

Note: LoRa Class A devices only receive data within a short window right after transmitting, so you'll want to ensure that you transmit every minute or so in order to receive data in a timely manner.

Reference

  • APPEND_JSDOC: RN2483.js

Buying

You can get the modules themselves from normal elecronics distributors like Farnell, Mouser or RS. Just search for RN2483.

However you'll need a breakout board. You can buy one from DrAzzy on Tindie that will break out the connections in a form that will connect directly to the edge of the Espruino Pico or WiFi boards.