Skip to content

[ChirpStack] Forwarding LoRa frames using UDP (to TTN, ...)

Sébastien Jean edited this page Feb 15, 2023 · 3 revisions

By default, concentratord forwards Lora frames directly to a MQTT broker, either local or remote.

The following describes how to enable LoRa frames forwarding using UDP, by using chirpstack-udp-bridge.

Prerequisites

In the following, some it is assumed to be known

  • how to establish an SSH connection to the gateway
  • how to access gateway terminal-based configuration tool

Refer to this other page for details.

Adding chirpstack-udp-bridge to services monitored by monit

To add chirpstack-udp-bridge as a service managed by monit, in order to launch it at startup (as others already are), edit a configuration file by typing the following command in a terminal:

sudo nano /etc/monit.d/chirpstack-udp-bridge

The script file should be as below:

check process chirpstack-udp-bridge with pidfile /var/run/chirpstack-udp-bridge.pid
    start program = "/etc/init.d/chirpstack-udp-bridge start"
    stop program = "/etc/init.d/chirpstack-udp-bridge stop" 

To take this new service into account, type the following commands in a terminal:

  • sudo monit reload (to restart all gateway services or sudo monit start chirpstack-udp-bridge to only start this one)
  • sudo monit summary (to check if services are started normally, as below
┌─────────────────────────────────┬────────────────────────────┬───────────────┐
│ Service Name                    │ Status                     │ Type          │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ raspberrypi3                    │ OK                         │ System        │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-udp-bridge           │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-network-server       │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-gateway-bridge       │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-concentratord        │ OK                         │ Process       │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ chirpstack-application-server   │ OK                         │ Process       │
└─────────────────────────────────┴────────────────────────────┴───────────────┘

Configuring a network server

To edit chirpstack-udp-bridge configuration file (located at etc/chirpstack-udp-bridge/chirpstack-udp-bridge.toml), just type the following command in a terminal:

sudo nano /etc/chirpstack-udp-bridge/chirpstack-udp-bridge.toml 

Then, locate the [[udp_bridge.servers]] section and set the server address:

# Servers to forward the data to using UDP.
# This section can be repeated.
  [[udp_bridge.servers]]
#    Server (hostname:port).
#    server="localhost:1700"
     server="eu1.cloud.thethings.network:1700"

N.B. no need to add a local server, since concentratord is also running and forwards to local MQTT.

Restart chirpstack-udp-bridge in order for changes to be applied.

Configuring multiple network servers

In order to configure UDP forwarding to multiple servers simultaneously, just repeat [[udp_bridge.servers]] section, as following example:

# Servers to forward the data to using UDP.
# This section can be repeated.
  [[udp_bridge.servers]]
    # Server (hostname:port).
#    server="localhost:1700"
     server="lns.campusiot.imag.fr:1700" 
  [[udp_bridge.servers]]
#    Server (hostname:port).
#    server="localhost:1700"
     server="eu1.cloud.thethings.network:1700"