RAK7249 LoRaServer integration (3.0)

Yes, I’m trying a RAK2245 Pi Hat installed on a Raspberry Pi 3 B+.

The lora-gateway-os-base image only includes the Semtech packet-forwarder and the LoRa Gateway Bridge that converts UDP data from the packet-forwader into MQTT messages, as indicated on: https://www.loraserver.io/lora-gateway-os/use/lora-gateway-os-base/. I’m using the image “lora-gateway-os-base-raspberrypi3–20190423145941.sdimg.gz”.

I have a cloud server with Mosquitto, Lora Server and Lora App Server installed for my tests. I’m using TLS to secure the MQTT connection between the Lora Gateway Bridge on the Raspberry Pi and Mosquitto on the server. Here you can find a great article of Stephen Cope “Mosquitto SSL Configuration - MQTT TLS Security” that explains how to do it: http://www.steves-internet-guide.com/mosquitto-tls/. This article explains in detail how to create all certificate files needed and configure Mosquitto to use them. In order to enable this on the RAK Gateway I only had to copy the ca.crt file created to “/etc/lora-gateway-bridge/”, add the line ca_cert=“/etc/lora-gateway-bridge/ca.crt” to the lora-gateway-bridge.toml file and restart the lora-gateway-bridge service ( sudo monit restart lora-gateway-bridge).

Hi @Nesken,

thank you for clear advice! I have installed lora-gateway-os-base w/o any problem. I have modified packet-forwarder config to set “server_address” pointing to my cloud server. Restarted packet-forwarder. Than I made changes to lora-gateway-bridge.toml to add “/event/” as per your advice. Than restarted lora-gateway-bridge. Ah yes, I have also checked if marshaler=“protobuf”.
On cloud side I have installed loraserver and lora-app-server with standard version 3.xx toml config files (tweaked as described in doc for loraserver*). Everything seems works good, I have defined GW etc. But still no communication is visible in web, no live frames of the gateway. So where to look for a problem?

Hi @Oskariot.
Communication goes as this: packet-forwarder -> gateway-bridge -> mosquitto. The packet-forwarder and gateway-bridge are running in the gateway box, so the packet-forwarder has to point to localhost (server_address=localhost). The gateway-bridge converts data comming from the packet-forwarder and then send it to mosquitto, so you have to set server=“tcp://{mosquitto_ip_address}:1883” in your lora-gateway-bridge.toml file, assuming your are not using SSL.

Hi @Nesken, thank you for fast reaction. Well, I’m using SSL and I’m behind NGINX. Are you using also NGINX?

Hi @Oskariot,

I was trying to activate devices through my RAK2245 Lora Gateway without success. After multiple tests I realized that Lora Gateway Bridge 2.X doesn’t work with Lora Server 3.0, even activating “protobuf” and changing topic templates as I had mentioned. So I started from scratch using the Raspberry PI image published by RAKWireless, then upgrade Lora Gateway Bridge to 3.0.1, and now I have a working RAK2245 gateway. In order to do that, just follow the next steps (as root) after completing “Get_Start_with_RAK2245&RAK831_RPi_LoRa_Gateway.pdf”. This document can be found at https://downloads.rakwireless.com/en/LoRa/RAK2245-Pi-HAT/Application-Notes/.

  1. Disable and stop unused services. In my case I only want to use Lora Gateway Bridge in this box.
    systemctl disable postgresql
    systemctl disable mosquitto
    systemctl disable lora-app-server
    systemctl disable loraserver
    systemctl stop postgresql
    systemctl stop mosquitto
    systemctl stop lora-app-server
    systemctl stop loraserver
  1. Upgrade LoRa Gateway Bridge to 3.0.1 (from https://www.loraserver.io/guides/debian-ubuntu/)
    apt install apt-transport-https dirmngr
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1CE2AFD36DBCCA00
    echo "deb https://artifacts.loraserver.io/packages/3.x/deb stable main" | sudo tee /etc/apt/sources.list.d/loraserver.list
    apt update
    apt install lora-gateway-bridge
    systemctl start lora-gateway-bridge
    systemctl enable lora-gateway-bridge
  1. Setup MQTT SSL Connection.
  • Copy ca.crt to /etc/lora-gateway-bridge.
  • Comment out or remove server parameter in /etc/lora-gateway-bridge/lora-gateway-bridge.toml.
    #server="tcp://127.0.0.1:1883"
  • Add the following lines to /etc/lora-gateway-bridge/lora-gateway-bridge.toml.
    server="ssl://mqtt.yourdomain.com:8883"
    ca_cert="/etc/lora-gateway-bridge/ca.crt"
  • Make sure gatewaybridge user owns everything inside /etc/lora-gateway-bridge directory.
    chown -R gatewaybridge:gatewaybridge /etc/lora-gateway-bridge/
  • Restart Lora Gateway Bridge service.
    systemctl restart lora-gateway-bridge

Hi @Nesken,

I have also realised that Gateway 2.X in not working with LoraServer 3.X.
Thank you for sharing your findings. I have tried it out, I did all steps you described, I have Gateway version 3.0.1 running on RasPI, it is connected to MQTT broker in the cloud but it seems that still there is something missing in my configuration. I can only see in LIVE LORAWAN FRAMES “up” frames. I’ll investigate what is going on and I’ll come back.
And can see these topics in MQTT cloud broker:
MQTT-message

Hi,
Does anybody have any news about the RAK7249 integration with LoraServer?
I’m interested in buying some outdoors gateways for a project but I need to connect them to Loraserver (3.x.x).
Thanks :slight_smile:

I’m still waiting for an update. Loraserver 3.2 has some nice features and FUOTA but all my instances are still 2.7.1

Hello,

Version 3.x.x of LoraServer and Lora App Server uses Google’s protobuf instead of the ordinary json packet for MQTT. (you can verify it from the loraserver config files)

To make it work, you need to set up a separate Gateway Bridge (the new version from loraserver,io is using the protobuf) and point your RAK7249 to that Gateway Bridge. (https://www.loraserver.io/lora-gateway-bridge/overview/)

You can set it up in your linux server or raspberry pi with IP address accessible by your RAK7249

I have my setup working on version 3.x.x

root@aratiles-server2:~# loraserver version
3.2.0
root@aratiles-server2:~# lora-app-server version
3.3.0
root@aratiles-server2:~# lora-gateway-bridge version
3.2.1
root@aratiles-server2:~#

root@aratiles-server2:~# systemctl status loraserver.service
● loraserver.service - LoRa Server
Loaded: loaded (/lib/systemd/system/loraserver.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-08-23 06:24:16 UTC; 5 days ago
Docs: https://www.loraserver.io/
Main PID: 8116 (loraserver)
Tasks: 8 (limit: 2362)
CGroup: /system.slice/loraserver.service
└─8116 /usr/bin/loraserver

root@aratiles-server2:~# systemctl status lora-gateway-bridge.service
● lora-gateway-bridge.service - LoRa Gateway Bridge
Loaded: loaded (/lib/systemd/system/lora-gateway-bridge.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-08-23 06:09:28 UTC; 5 days ago
Docs: https://www.loraserver.io/
Main PID: 7647 (lora-gateway-br)
Tasks: 8 (limit: 2362)
CGroup: /system.slice/lora-gateway-bridge.service
└─7647 /usr/bin/lora-gateway-bridge

● lora-app-server.service - LoRa App Server
Loaded: loaded (/lib/systemd/system/lora-app-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-08-23 12:21:26 UTC; 4 days ago
Docs: https://www.loraserver.io/
Main PID: 17306 (lora-app-server)
Tasks: 9 (limit: 2362)
CGroup: /system.slice/lora-app-server.service
└─17306 /usr/bin/lora-app-server

Here is your RAK7249 config for the gateway

Hope this helps.

It’s a workaround but in a production environment I can’t have a VM for each gateway. I’ll end up buying different gateways for our deployment… LoraServer has evolved a lot since 2.7 and there are some features that I need to have like FUOTA and clock syncronization. It’s such a shame that I can’t use RAK’s outdoor gateways, they are a strong shoice against expensive gateways with similar charateristics.

You dont need to put a lot.of Gateway bridges . It does not need to be one is to one. It depends on your network architecture.

Desing-wise we won’t deploy a VM for hosting GatewayBridge, we are buying gateways that support Loraserver architecture only.

Still waiting for firmware update on this issue

here is a diagram of architecture options from loraserver.io. Your gateway right now (RAK7249) is the sample on the left (that tower on the left), while the middle and the right is the option im talking about.

if you wish you can tinker with your gateway device . Its running openwrt linux

BusyBox v1.23.2 (2019-07-05 14:22:55 CST) built-in shell (ash)


RAK Wireless LoraWAN Gateway (1.1.0043_Release r173 20190705)

root@RAK7249_TestUnit01:~# ps

1581 root 2284 S /usr/sbin/uhttpd -f -h /www -r RAK7249_TestUnit01 -x
1596 mosquitt 3548 S /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
1606 root 2252 S lora_pkt_fwd -g /var/etc/global_conf.json
1608 root 22744 S lora_pkt_fwd -g /var/etc/global_conf.json
1632 root 4516 S /usr/sbin/loragwbr -C /var/etc/loragwbridge.json
1634 root 4676 S /usr/sbin/loragwbr -C /var/etc/loragwbridge.json
1639 root 4516 S /usr/sbin/lorasrv -C /var/etc/loraserver.json -D /mn
1641 root 4868 S /usr/sbin/lorasrv -C /var/etc/loraserver.json -D /mn
1672 root 812 S /usr/bin/mpstat -f -t -u 5
1754 nobody 996 S /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k -x /va
2034 root 1504 S /usr/sbin/ntpd -n -S /usr/sbin/ntpd-hotplug -p 0.ope
2607 root 1500 R ps
10820 root 0 SW [kworker/u2:2]