Skip to content

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Week 10: LoRaWAN Sensor Network with STM32WL55

Project: LoRaWAN Sensor Network - Native STM32WL integrated radio Hardware: 2x NUCLEO-WL55JC1 + RAK7268V2 Gateway Network Server: RAK Built-in LoRa Server (AU915) Status: βœ… COMPLETE - Both nodes operational, Grafana dashboard live

LoRaWAN Sensor Network


System Overview

Week 10 implements a production LoRaWAN sensor network using STM32WL55 microcontrollers with native SubGHz radio. The system includes a complete data pipeline from sensors to Grafana visualization.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     LORAWAN SENSOR NETWORK                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚ LoRa-1               β”‚         β”‚ LoRa-2               β”‚              β”‚
β”‚  β”‚ STM32WL55JC1         β”‚         β”‚ STM32WL55JC1         β”‚              β”‚
β”‚  β”‚ SHT41 (Temp/Hum)     β”‚         β”‚ BME680 (Env Sensor)  β”‚              β”‚
β”‚  β”‚ SSD1306 OLED 128x32  β”‚         β”‚ SH1106 OLED 128x64   β”‚              β”‚
β”‚  β”‚ DevEUI: 23ce1b...    β”‚         β”‚ DevEUI: 24ce1b...    β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚             β”‚                                 β”‚                          β”‚
β”‚             β”‚         LoRaWAN AU915           β”‚                          β”‚
β”‚             β”‚        (915.2-916.6 MHz)        β”‚                          β”‚
β”‚             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β”‚
β”‚                              β”‚                                           β”‚
β”‚                              β–Ό                                           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
β”‚                    β”‚ RAK7268V2 Gateway    β”‚                             β”‚
β”‚                    β”‚ Built-in LoRa Server β”‚                             β”‚
β”‚                    β”‚ MQTT: 10.10.10.254   β”‚                             β”‚
β”‚                    β”‚ Application: "TOT"   β”‚                             β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β”‚
β”‚                               β”‚                                          β”‚
β”‚                               β”‚ MQTT (TCP :1883)                        β”‚
β”‚                               β–Ό                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                     Docker Services                              β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
β”‚  β”‚  β”‚ wk10-mqtt-bridge│─▢│ wk7-influxdb│─▢│ wk7-grafana         β”‚  β”‚   β”‚
β”‚  β”‚  β”‚ Python decoder  β”‚  β”‚ Time-series β”‚  β”‚ Dashboard           β”‚  β”‚   β”‚
β”‚  β”‚  β”‚                 β”‚  β”‚ :8086       β”‚  β”‚ :3000               β”‚  β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Hardware Configuration

LoRa-1 - SHT41 Temperature/Humidity Sensor βœ… OPERATIONAL

Component Specification
MCU STM32WL55JC1 (Probe: 003E00463234510A33353533)
Sensor SHT41 (I2C 0x44) - High-precision temp/humidity
Display SSD1306 OLED 128x32 (I2C 0x3C)
I2C Bus I2C2: PA12 (SCL), PA11 (SDA)
Radio Integrated SubGHz SX126x
DevEUI 23ce1bfeff091fac
Payload 4 bytes (temp + humidity)

Current Readings: ~31Β°C, 58% RH Uplink Interval: ~30 seconds

LoRa-2 - BME680 Environmental Sensor βœ… OPERATIONAL

Component Specification
MCU STM32WL55JC1 (Probe: 0026003A3234510A33353533)
Sensor BME680 (I2C 0x76) - Temp/Hum/Pressure/Gas
Display SH1106 OLED 128x64 (I2C 0x3C)
I2C Bus I2C2: PA12 (SCL), PA11 (SDA)
Radio Integrated SubGHz SX126x
DevEUI 24ce1bfeff091fac
Payload 12 bytes (temp + humidity + pressure + gas + padding)

Current Readings: ~28Β°C, 60% RH, 1020 hPa, 134 kOhm gas resistance Uplink Interval: ~30 seconds

Gateway - RAK7268V2 WisGate Edge Lite 2 βœ… OPERATIONAL

Parameter Value
Gateway EUI ac1f09fffe1bce23
IP Address 10.10.10.254
Region AU915 Sub-band 2 (915.2-916.6 MHz)
Network Server Built-in LoRa Server (NOT ChirpStack)
MQTT Broker 10.10.10.254:1883 (no auth)
Application "TOT"

Data Pipeline

End-to-End Flow

Sensor β†’ STM32WL55 β†’ LoRaWAN β†’ RAK Gateway β†’ MQTT β†’ Python Bridge β†’ InfluxDB β†’ Grafana

Components

  1. MQTT Bridge (mqtt_to_influx.py)

    • Subscribes to gateway MQTT (10.10.10.254:1883)
    • Decodes Base64 LoRaWAN payloads
    • Writes to InfluxDB with tags (node, sensor, dev_eui)
  2. InfluxDB (wk7-influxdb container)

    • Bucket: lorawan
    • Measurement: lorawan_sensor
    • Fields: temperature, humidity, pressure, gas_resistance, rssi, snr
  3. Grafana Dashboard (wk7-grafana container)

Grafana Dashboard


Building and Flashing

Prerequisites

# Install probe-rs
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh

# Add Rust embedded target
rustup target add thumbv7em-none-eabihf

Build and Flash

LoRa-1:

cd firmware/lora-1
cargo run --release

LoRa-2:

cd firmware/lora-2
cargo run --release

Monitor RTT Logs

probe-rs attach --chip STM32WL55JCIx

Running the Data Pipeline

Start Infrastructure

# Start Week 7 services (InfluxDB + Grafana)
cd ~/dev/4-month-plan/wk7-mqtt-influx
docker compose up -d

# Start MQTT bridge
cd ~/dev/4-month-plan/wk10-lorawan
docker compose up -d

Verify Data Flow

# Check MQTT bridge logs
docker logs -f wk10-mqtt-bridge

# Expected output:
# [10:05:15] lora1: Temp=31.0C Hum=58.0% RSSI=-13 SNR=13.2 -> InfluxDB: OK
# [10:05:51] lora2: Temp=28.0C Hum=60.0% Press=1020.0hPa Gas=135kOhm RSSI=-17 SNR=12.0 -> InfluxDB: OK

Access Dashboard


Payload Encoding

LoRa-1 (SHT41) - 4 bytes

Bytes Type Description Decode
0-1 i16 BE Temperature Γ— 100 value / 100 = Β°C
2-3 u16 BE Humidity Γ— 100 value / 100 = %

LoRa-2 (BME680) - 12 bytes

Bytes Type Description Decode
0-1 i16 BE Temperature Γ— 100 value / 100 = Β°C
2-3 u16 BE Humidity Γ— 100 value / 100 = %
4-5 u16 BE Pressure Γ— 10 value / 10 = hPa
6-7 u16 BE Gas Resistance kOhm
8-11 - Padding (unused)

Decode Payloads

# Decode a Base64 payload
python3 decode_payload.py CowZyA==
# Output: Temp: 27.00Β°C, Humidity: 66.00%

MQTT Topics

Subscribe to gateway MQTT for debugging:

# All TOT application messages
mosquitto_sub -h 10.10.10.254 -t "application/TOT/device/#" -v

# LoRa-1 uplinks only
mosquitto_sub -h 10.10.10.254 -t "application/TOT/device/23ce1bfeff091fac/rx" -v

# LoRa-2 uplinks only
mosquitto_sub -h 10.10.10.254 -t "application/TOT/device/24ce1bfeff091fac/rx" -v

# Join events
mosquitto_sub -h 10.10.10.254 -t "application/TOT/device/+/join" -v

Documentation

Document Description
USERGUIDE.md Complete setup and operation guide
HARDWARE_CONFIG.md Detailed hardware specifications
LORAWAN_CREDENTIALS.md Device credentials and EUIs
docs/rak7268v2-config.md Gateway configuration
TROUBLESHOOTING_WL55.md Common issues and solutions
CLAUDE.md Development notes and constraints
NOTES.md Technical learnings

Deliverables

Gateway βœ… Complete

  • RAK7268V2 deployed and configured (AU915 Sub-band 2)
  • Built-in LoRa Server operational
  • Application "TOT" created with OTAA credentials
  • MQTT broker accessible at 10.10.10.254:1883

LoRa-1 (SHT41) βœ… Complete

  • STM32WL55 hardware integration
  • SHT41 sensor reading (temperature, humidity)
  • SSD1306 OLED display (TX count, readings, SNR/RSSI)
  • LoRaWAN OTAA join
  • Uplink transmission (~30 second interval)
  • LED flash on transmission

LoRa-2 (BME680) βœ… Complete

  • STM32WL55 hardware integration
  • BME680 sensor reading (temp, humidity, pressure, gas)
  • SH1106 OLED display (TX count, readings, SNR/RSSI)
  • LoRaWAN OTAA join
  • Uplink transmission (~30 second interval)
  • LED flash on transmission

Data Pipeline βœ… Complete

  • Python MQTT bridge subscribing to gateway
  • Payload decoding (both node formats)
  • InfluxDB bucket and data writes
  • Grafana datasource configured
  • Dashboard with 10 panels

Documentation βœ… Complete

  • USERGUIDE.md - Comprehensive deployment guide
  • Hardware configuration documented
  • Gateway configuration documented
  • Troubleshooting guide

Key Learnings

  1. LoRaWAN Byte Order: EUIs must be reversed (little-endian) in firmware
  2. No FPU: STM32WL55 requires integer-only math
  3. SHT41 Wake-up: Sensor needs measurement command before I2C scan
  4. MQTT 3.1 Protocol: RAK gateway requires older MQTT protocol version
  5. Peripheral Stealing: Embassy async pattern for I2C sharing

Performance Metrics

Metric Value
Join Time ~7 seconds
Uplink Interval ~30 seconds
LoRa-1 Payload 4 bytes
LoRa-2 Payload 12 bytes
Typical RSSI -15 to -80 dBm
Typical SNR -10 to +14 dB
End-to-End Latency <2 seconds

Status: βœ… Week 10 Complete Last Updated: 2026-01-09

About

Migration from point-to-point LoRa to production LoRaWAN using STM32WL55. Two NUCLEO-WL55JC1 sensor nodes (BME688, SHT41) join via OTAA to a RAK7268V2 gateway and ChirpStack (AU915), integrating with Modbus TCP nodes, MQTT, InfluxDB, and Grafana for a unified IIoT system. Wk10

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages