twlora is a comprehensive suite of tools and programs for LoRa communication experiments and sensor network integration within the TWSNMP ecosystem.
This repository provides a collection of software to bridge the gap between physical LoRa modules and network management systems. It covers everything from hardware configuration to data forwarding via modern protocols.
- Serial/USB Configurator (Go): A utility to configure LoRa module parameters via USB-Serial interface.
- ESP32 Configurator (Arduino): A firmware tool to manage LoRa module settings directly from an ESP32-C6.
- Radar Sensor Transmitter (ESP32-C6): A program that captures LD2410C 24GHz mmWave Radar data and broadcasts it over LoRa.
- LoRa TxRx Test: A simple bridge program to test LoRa communication.
- twLoRaToLog: A high-performance Go-based receiver that processes incoming LoRa packets and forwards them to Syslog or MQTT for TWSNMP analysis.
This project uses mise for tool and task management.
- Install
miseon your system. - Trust the configuration in this repository:
mise trust
-
Install Tools and Setup Arduino Environment:
mise install mise run arduino:setup
-
Build All Components:
mise run build
Built binaries and firmware will be saved in the
dist/directory. -
Individual Tasks:
- Build Go projects:
mise run go:build(Outputs:twLoRaToLog,twLoRaSetup) - Compile Radar firmware:
mise run arduino:compile:radar - Build Setup firmware:
mise run arduino:compile:setup
- Build Go projects:
A Go-based utility to configure LoRa module parameters via USB-Serial.
Read Configuration:
twLoRaSetup <Port>
# Example: twLoRaSetup /dev/tty.usbserial-1410Write Configuration:
twLoRaSetup <Port> <Channel> <Address>
# Example: Set to 920MHz (Channel 920) and Address 1
twLoRaSetup /dev/tty.usbserial-1410 920 1A high-performance receiver that processes LoRa packets and forwards them to Syslog, MQTT, or SNMP Trap.
Basic Usage:
twLoRaToLog -port <Port> [options]Options:
-port: Serial port name (Required)-syslog: Destination for Syslog (e.g.,192.168.1.1:514)-mqtt: MQTT Broker URL (e.g.,tcp://localhost:1883)-mqttuser: MQTT Username-mqttpassword: MQTT Password-snmp: SNMP Trap destination (e.g.,192.168.1.1:162)-snmpcommunity: SNMP community name (Default:public)-snmpinterval: SNMP Trap interval in minutes (Default:0- every event)-list: List available serial ports-debug: Enable debug mode (prints logs to console and triggers beep on detection)
Example (Forward to Syslog and MQTT):
twLoRaToLog -port /dev/tty.usbserial-1410 -syslog 192.168.1.100:514 -mqtt tcp://broker.hivemq.com:1883 -debugAfter setting up the environment, you can build and flash the firmware using the following methods.
- Install Arduino IDE.
- Follow the XIAO ESP32C6 Setup Guide to add the ESP32 board support.
- Install the required libraries via Library Manager:
ld2410by Trevor ShannonEspSoftwareSerial
- Open the
.inofile from the project directory (e.g.,ESP32C6LoRaLD2410C/ESP32C6LoRaLD2410C.ino). - Select Tools > Board > esp32 > Seeed Studio XIAO ESP32C6.
- Connect your device, select the correct port in Tools > Port.
- Click the Upload button.
If you have arduino-cli installed (via mise install):
# For Radar Sensor
arduino-cli upload -p <PORT> --fqbn esp32:esp32:XIAO_ESP32C6 ESP32C6LoRaLD2410C
# For Setup Tool
arduino-cli upload -p <PORT> --fqbn esp32:esp32:XIAO_ESP32C6 ESP32LoRaSetupNote: Replace <PORT> with your actual serial port (e.g., /dev/tty.usbmodem... on macOS or COMx on Windows).
If you are using the pre-compiled binaries in the dist/ directory:
- Download the ESP32 Flash Download Tool.
- Select ChipType: ESP32-C6.
- Load the binary files from
dist/<component>/:...bootloader.bin@0x0...partitions.bin@0x8000...ino.bin@0x10000
- Set SPI SPEED to 80MHz and SPI MODE to DIO.
- Select the COM port and click START.
You can also use esptool.py (installable via pip install esptool):
esptool.py --chip esp32c6 --port <PORT> --baud 921600 write_flash 0x0 dist/radar/ESP32C6LoRaLD2410C.ino.bootloader.bin 0x8000 dist/radar/ESP32C6LoRaLD2410C.ino.partitions.bin 0x10000 dist/radar/ESP32C6LoRaLD2410C.ino.bin
