...
Every RouterBOARD with a miniPCI-e slot which supports LTE modems can also be used as a LoRaWAN gateway by installing R11e-LoRa8 or R11e-LoRa9 card. Both UDP and LNS (starting with v7.12rc1 testing version) protocols are supported.
In order to work with Lora, IoT package should be installed. You can find the package for your device architecture in extra packages archive on the download page.
Info |
---|
Starting with v7.11 (stable), LoRa functionality is moved into the IoT package that is available on the download page under extra packages. A separate Lora package is still available for download. When using IoT package, LoRa functionality will move to a LoRa package is not obligatory anymore and is left only for compatibility reasons. |
Warning |
---|
note: RouterOS does not support 3rd party LoRaWAN gateway cards. |
Properties
Sub-menu: /iot lora
Property | Description |
---|---|
antenna-gain (integer [-128..127]; Default: 0) | Antenna gain in dBi. |
channel-plan (as-923 | au-915 | custom | eu-868 | in-865 | kr-920 | ru-864 | ru-864-mid | us-915-1 | us-915-2; Default: eu-868) | Frequency plans for various regions. |
disabled (yes | no; Default: yes) | Whether LoRaWAN gateway is disabled. |
forward (crc-disabled | crc-error | crc-valid; Default: crc-valid,crc-error) | Defines what kind of packets should be forwarded to Network server:
|
gateway-id (string) | Gateway ID or Gateway EUI, is used when registering the gateway with the server. |
lbt-enabled (yes | no; Default: no) | Whether gateway should use LBT (Listen Before Talk) protocol. |
listen-time (integer [0us..4294967295us]; Default: 5000us) | Time in microseconds to track RSSI before TX (used when lbt-enabled=yes). |
name (string; Default: ) | Name of LoRaWAN gateway. |
network (private | public; Default: public) | Whether sync word should (network=private) or should not (network=public) be used. |
rssi-threshold (integer [-32,768 .. 32,767]; Default: -65dB) | RSSI value to determine whether forwarder may use specific channel to talk. If RSSI value is below rssi-threshold, channel could be used (used when lbt-enabled=yes). |
servers (list of string; Default: ) | Name or names of servers from /lora servers. |
src-address (IP; Default: ) | Specifies uplink packet source address if necessary (address should match an address configured on the RB). |
spoof-gps (string; Default: ) | Set custom GPS location:
|
...
Sometimes it can happen, that when trying to register the LoRaWAN gateway on the LoRaWAN server, the server can display an error indicating that the gateway ID/EUI is already taken by someone else. It just means that the other user luckily guessed/took your gateway ID and assigned it to their device before you.
If that happens, you can change it manually:
...
language | ros |
---|
...
and then try re-registering this newly changed ID again.
Channels
Sub-menu: /iot lora channels
Property | Description |
---|---|
bandwidth (7.8_kHz | 15.6_kHz | 31.2_kHz | 62.5_kHz | 125_kHz | 250_kHz | 500_kHz; Default: 125_kHz) | Bandwidth of specific channel, predefined when any of channel-plan preset is used, but could be manually changed when channel-plan is set to custom. |
disabled (yes | no; Default: no) | Whether specific channel is disabledDisable or enable the channel. |
freq-off (integer [-400000..400000]; Default: ) | Channel frequency offset against radio central frequency, it makes possible to adjust channel frequencies so that channels does not overlap. |
radio (radio0 | radio1; Default: ) | Defines which radio uses selected channel. |
spread-factor (SF7 | SF8 | SF9 | SF10 | SF11 | SF12; Default: ) | Defines the Spread Factor for a channel with type=LoRa. Lower Spread Factor means higher data rate. |
To view current channels, issue the command /iot lora cannels print
:
Code Block | ||
---|---|---|
| ||
/iot lora channels print
Columns: NAME, TYPE, RADIO, FREQ-OFF, BANDWIDTH, FREQ, SPREAD-FACTOR, DATARATE
# NAME TYPE RADIO FREQ-OFF BANDWIDTH FREQ SPREAD-FACTOR DATARATE
0 gateway-0 MSF radio1 -400000 125_kHz 868.1
1 gateway-0 MSF radio1 -200000 125_kHz 868.3
2 gateway-0 MSF radio1 0 125_kHz 868.5
3 gateway-0 MSF radio0 -400000 125_kHz 867.1
4 gateway-0 MSF radio0 -200000 125_kHz 867.3
5 gateway-0 MSF radio0 0 125_kHz 867.5
6 gateway-0 MSF radio0 200000 125_kHz 867.7
7 gateway-0 MSF radio0 400000 125_kHz 867.9
8 gateway-0 LoRa radio1 -200000 250_kHz 868.3 SF7
9 gateway-0 FSK radio1 300000 125_kHz 868.8 50000 |
Channels are created using freq-off
and radio's center-freq
frequencies. To view radios center frequencies use the command /iot lora radios print
.
To understand how each channel's frequency is calculated, check the example below:
Code Block | ||
---|---|---|
| ||
# NAME TYPE RADIO FREQ-OFF BANDWIDTH FREQ SPREAD-FACTOR DATARATE
0 gateway-0 MSF radio1 -400000 125_kHz 868.1 |
radio1
is selected to be used for channel #0 and it is configured with center-freq=868500000
(868500000 Hz or 868.5 MHz).
By using frequency offset, freq-off=-400000
(-400000 Hz or -0.4 MHz), we define channel #0 to be 868500000-400000=868100000
Hz or 868.1 MHz.
Info | |||||
---|---|---|---|---|---|
To configure custom channels, select "custom" channel profle with the help of the command:
|
Join EUI
The gateway will forward to the server every single LoRaWAN payload it receives. That includes neighboring LoRaWAN node's payloads as well. It might not be ideal to forward everything, as, for example, it can increase the data amount used (and directly impact ISP plan cost).
...
You can find the Join EUI used by your node with the help of RouterOS GUI. Go to the "LoRa" section and to the "Traffic" sub-menu (which is only available using the graphical interface). After you power your LoRaWAN node, the node should send a "Join-request" packet. Double-click on it to inspect it:
Sub-menu: /iot lora joineui
...
To add a filter for a specific NetId, use the command (you can add more than one using a "comma" separator):
Code Block | ||
---|---|---|
| ||
/iot lora joineuinetids add name=TTN netids=000013 |
...
Custom servers can be added as well. Data forwarding to multiple servers can work simultaneously if the first server does not change "DevAdress" part of the packet and under the condition that all servers are able to decode the packet.
Property | Description |
---|---|
address (domain name or IP address; Default: ) | Defines LoRaWAN Network server address. |
name (string; Default: ) | Defines server name. |
protocol (UDP | LNS | CUPS; Default: UDP) | Specify whether to use UDP, LNS or CUPS protocol for the communication with the LoRaWAN server. |
down-port (integer [0..65535]; Default: 1700) | Parameter that is used when UDP protocol is selected. Defines port for down-link communication (from server to node) with LoRaWAN Network server. Most of known open source servers uses port 1700 as default, but it can change if multiple servers are configured on the same machine. |
up-port (integer [0..65535]; Default: 1700) | Parameter that is used when UDP protocol is selected. Defines port for up-link communication (from node to server) with LoRaWAN Network server. Most of known open source servers uses port 1700 as default, but it can change if multiple servers are configured on the same machine. |
netid (list of string; Default: ) | Parameter that is used when UDP protocol is selected. Applies a filter to only send LoRaWAN payloads that match the Network ID (Net ID) filter configured. |
joineui (list of string; Default: ) | Parameter that is used when UDP protocol is selected. Applies a filter to only send LoRaWAN payloads that match the Join EUI filter configured. |
port (integer [0..65535]; Default: 8887) | Parameter that is used when LNS or CUPS protocol is selected. For LNS, defines the WSS (WebSocket) port and, for CUPS, defines HTTPS port. |
key (string; Default: ) | Parameter that is used when LNS or CUPS protocol is selected. Specify the LoRa Basics Station LNS Authentication Key or CUPS API KEY (both generated on the server). |
ssl (yes or no; Default: no) | Parameter that is used when LNS or CUPS protocol is selected. Specify whether to use or not to use SSL (if the server supports TLS server authentication). When this option is choosen, root SSL certificate(s) must be uploaded under the certificates menu. |
certificate (list of string; Default: none) | Parameter that is used when LNS or CUPS protocol is selected. Select an uploaded client certificate (if the server awaits TLS client authentication). If TLS client authentication is not required by the server, use the default "none" setting. |
interval (integer [0..65535]; Default: ) | Parameter that is used when CUPS protocol is selected. Specify the interval with which the LoRa Basics Station will query CUPS server for configuration updates/changes. |
Debugging
If you have issues with the connection, make sure to enable logs:
Code Block | ||
---|---|---|
| ||
/system/logging/add topics=debug,lora |
This will enable debug logging and help you pin point where the potential issue could be. Logs can be viewed using:
Code Block | ||
---|---|---|
| ||
/log/print
|
A successful connection would look like this:
Code Block | ||
---|---|---|
| ||
13:50:33 lora,info gateway-0 forwarder started 13:50:38 lora,info [LNS] connecting to wss://eu1.cloud.thethings.network:8887/router-info 13:50:39 lora,info [LNS] eu1.cloud.thethings.network discovered 13:50:39 lora,info [LNS] eu1.cloud.thethings.network disconnected 13:50:39 lora,info [LNS] connecting to wss://eu1.cloud.thethings.network:8887/traffic/eui-xxxx 13:50:39 lora,info [LNS] eu1.cloud.thethings.network configured 13:50:52 lora,info gateway-0 forwarder is ready |
More logging information can be found in our Log guide.