Monday, 20 April 2026

Turning a Rpi and RAK2245 into a LoRaWAN TTN Gateway

(Mon 20th Apr 2026 18:57)

Amazing how straightforward the process is. I have done both a RPi3 (drumgeely) and a RPi4 (tarbh) over the last two days.

Here are the steps:

1) Use the RPi Imager on a laptop to flash "Raspberry Pi OS (Legacy 32-bit) Full, Debian Bookworm released 2026-04-13" onto a 16GB microSD card. I confugired it to have SSH enabled and to use the WiFi SSID: Tenda_D98860

2) Install the microSD into a RPi and boot up. Log in using SSH and run "sudo raspi-config" to enable VNC, SPI, I2C and disable terminal but enable hardware over Serial Port. Also do a "sudo apt update" followed by an "sudo apt upgrade"

3) Next install DOCKER using the commands:

$ curl -sSL https://get.docker.com | sh

$ sudo usermod -aG docker $USER

Then log out and back in again.

(See https://raspberrytips.com/docker-on-raspberry-pi/ )

(PS: Handy cheat sheet here: https://docker.how/)

4) After this follow the instructions at: https://github.com/WGLabz/LoRaWAN-Basic-Station-RAK831-

Namely:

4a) Edit the example.env file to have your MQTT and TTN values. I set TTN_API_KEY to one I generated on the TTN gateway site just to shared gateway data. Oh and create a new TTN gateway if you need to. You'll be needing its TTN gatewy_id

4b) The run "set -a; env ./example.env; set +a; env" Check all is OK

4c) Then run "docker compose build gateway-mqtt-publisher" followed by "docker compose up -d"

That's it you should be connected to the TTN gateway and sharing data.

I also installed zerotier on the RPi see: https://pimylifeup.com/raspberry-pi-zerotier/

And I installed the RPi health monitor over MQTT see: https://github.com/RichFesler/rpi-healthmon

After installing "sudo apt install mosquitto-clients" you should see:

pi@tarbh:~/LoRaWAN-Basic-Station-RAK831- $ mosquitto_sub -h BROKER_IP_ADDR -u USER -P PASSWORD -t 'gateways/#' -v

gateways/ttn/uplink_count 2

gateways/ttn/downlink_count 2

gateways/ttn/last_uplink_received_at 2026-04-20T17:11:54.574278383Z

gateways/ttn/last_downlink_received_at 2026-04-20T17:11:55.025295058Z

gateways/ttn/connected 1

gateways/ttn/last_update 2026-04-20T17:15:50.177083



gateways/ttn/uplink_count 2

gateways/ttn/downlink_count 2

gateways/ttn/last_uplink_received_at 2026-04-20T17:11:54.574278383Z

gateways/ttn/last_downlink_received_at 2026-04-20T17:11:55.025295058Z

gateways/ttn/connected 1

gateways/ttn/last_update 2026-04-20T17:16:00.385460

gateways/ttn/uplink_count 2

gateways/ttn/downlink_count 2

gateways/ttn/last_uplink_received_at 2026-04-20T17:11:54.574278383Z

gateways/ttn/last_downlink_received_at 2026-04-20T17:11:55.025295058Z

gateways/ttn/connected 1

gateways/ttn/last_update 2026-04-20T17:16:10.593140


and:

pi@tarbh:~/rpi-healthmon $ mosquitto_sub -h $MQTT_BROKER -u $MQTT_USER -P $MQTT_PASS -t 'health/#' -v

health/drumgeely_rpi3/376f195d8ae4/status online

health/drumgeely_rpi3/376f195d8ae4/state {"ts":"2026-04-20T09:54:22.198247+00:00","node_id":"376f195d8ae4","state":"FAULT","uptime_s":26,"root_ro":false,"failed_units_count":0,"kernel_event_counts":{},"fault_flags":["power_thermal:throttled"],"temp_c":31.1,"throttled":"0x50005","load_1m":2.42,"mem_avail_pct":79.5,"disk_used_pct_root":84}

health/site/376f195d8ae4/status online

health/site/376f195d8ae4/state {"ts":"2026-04-19T17:45:49.917683+00:00","node_id":"376f195d8ae4","state":"FAULT","uptime_s":72973,"root_ro":false,"failed_units_count":0,"kernel_event_counts":{},"fault_flags":["power_thermal:throttled"],"temp_c":49.4,"throttled":"0x50000","load_1m":0.01,"mem_avail_pct":75.0,"disk_used_pct_root":84}

health/site/981195a3cb65/status online

health/site/981195a3cb65/state {"ts":"2026-04-20T16:36:23.744367+00:00","node_id":"981195a3cb65","state":"FAULT","uptime_s":3459,"root_ro":false,"failed_units_count":0,"kernel_event_counts":{},"fault_flags":["power_thermal:throttled"],"temp_c":49.2,"throttled":"0x50000","load_1m":0.21,"mem_avail_pct":94.7,"disk_used_pct_root":83}

health/tarbh_rpi4/981195a3cb65/status online

health/tarbh_rpi4/981195a3cb65/state {"ts":"2026-04-20T16:45:58.302428+00:00","node_id":"981195a3cb65","state":"FAULT","uptime_s":4034,"root_ro":false,"failed_units_count":0,"kernel_event_counts":{},"fault_flags":["power_thermal:throttled"],"temp_c":49.2,"throttled":"0x50000","load_1m":0.31,"mem_avail_pct":94.7,"disk_used_pct_root":83}


Enjoy :)





No comments:

Post a Comment