A research implementation of scalable LoRa mesh networking with gateway-aware cost routing and adaptive overhead reduction. This project extends the LoRaMesher library with novel routing optimizations for duty-cycle constrained Low-Power Wide-Area Networks (LPWAN).
Research Author: Nyein Chan Win Naing
Institution: Asian Institute of Technology (AIT)
Degree: Master of Science in Computer Science
Research Period: Sep - Dec 2025
- Overview
- Key Features
- Research Contributions
- Hardware Requirements
- Software Requirements
- Project Structure
- Installation
- Usage
- Configuration
- Research Results
- Documentation
- Citation
- License
- Acknowledgments
Standard LoRaWAN deployments struggle with coverage gaps due to single-hop topology limitations. While mesh networking addresses this through multi-hop relay, existing LoRa mesh protocols face critical scalability barriers from broadcast-based routing and fixed-interval control overhead.
xMESH implements a gateway-aware cost routing protocol that combines:
- Trickle Adaptive Scheduling - Reduces HELLO overhead through exponential backoff and redundancy suppression
- Multi-Metric Cost Function - Integrates signal quality (RSSI, SNR) and gateway load for intelligent path selection
- Proactive Fault Detection - Safety mechanisms preventing over-suppression while enabling rapid convergence
This research demonstrates that intelligent routing can achieve 30% HELLO overhead reduction, 96-100% packet delivery ratio in indoor scenarios, and successful dual-gateway load distribution while maintaining LoRa duty-cycle compliance (1% for AS923 Thailand).
- Multi-Hop Routing: Dynamic mesh topology with automatic route discovery
- Three Protocol Implementations: Comparative baseline for flooding, hop-count, and optimized gateway-aware routing
- Adaptive Control Overhead: Trickle-based scheduler reducing unnecessary HELLO broadcasts by 85-90%
- Zero-Overhead ETX Tracking: Sequence-gap detection eliminates ACK overhead for link quality assessment
- Active Gateway Load Sharing: Real-time load encoding enables dynamic traffic distribution across multiple gateways
- Duty Cycle Compliance: AS923 Thailand regulatory compliance (923.0-923.4 MHz, 1% duty cycle)
- ESP32-S3 Platform: Heltec WiFi LoRa 32 V3 boards with SX1262 transceivers
- OLED Display Support: Real-time network statistics visualization
- Raspberry Pi Gateway: MQTT-based data collection and network monitoring
- Multi-Node Testbed: Support for 3-7 node deployments
- Comprehensive Logging: RSSI, SNR, hop count, routing table changes, packet flows
- MQTT Integration: Real-time data publishing to cloud/local brokers
- Python Analysis Suite: Data visualization, performance metrics, scalability analysis
- Experimental Validation: Indoor/outdoor test scenarios with documented results
This research makes six novel contributions to LPWAN mesh networking:
- First Complete Trickle Integration with LoRaMesher - Adaptive scheduler achieving 85-90% suppression efficiency
- Local Fault Isolation Discovery - Trickle operates as local per-node decisions rather than network-wide cascades, limiting fault impact regionally
- Zero-Overhead ETX Tracking - Sequence-gap detection eliminates traditional ACK overhead
- Active Gateway Load Sharing - Real-time load encoding enabling dynamic traffic distribution
- Safety HELLO Mechanism - Prevents over-suppression while enabling rapid fault detection (<60s)
- Proactive Health Monitoring - Reduced fault detection time versus library baseline
Key Results:
- ~30% HELLO overhead reduction compared to fixed-interval baseline
- 96-100% PDR in indoor multi-hop scenarios
- Successful dual-gateway load distribution with real-time cost updates
- Multi-hop validation: relay nodes forwarding traffic with cost-based path selection
| Component | Specification | Quantity |
|---|---|---|
| Microcontroller | Heltec WiFi LoRa 32 V3 (ESP32-S3) | 3-7 nodes |
| LoRa Transceiver | Semtech SX1262 (onboard) | - |
| Display | 0.96" OLED (onboard) | - |
| Gateway Host | Raspberry Pi 3B+ or newer | 1-2 units |
| USB Cables | USB-C for Heltec boards | 3-7 cables |
| Power Supply | 5V USB power or battery | As needed |
Optional:
- GPS module (TinyGPS++) for location tracking
- External antennas for extended range testing
- PlatformIO (latest) - Cross-platform IDE
- Arduino Framework for ESP32
- Visual Studio Code (recommended)
- LoRaMesher (modified fork - this repository)
- RadioLib (^7.1.0) - LoRa radio driver
- Adafruit SSD1306 (^2.5.7) - OLED display
- Adafruit GFX Library (^1.11.5)
- TinyGPSPlus (^1.0.3) - GPS support
- Python 3.7+
- pyserial - Serial communication
- paho-mqtt - MQTT client
- pandas, matplotlib - Data analysis
- numpy, scipy - Statistical analysis
xMESH/
├── firmware/
│ ├── 1_flooding/ # Protocol 1: Simple flooding baseline
│ │ ├── src/
│ │ │ └── main.cpp
│ │ └── platformio.ini
│ ├── 2_hopcount/ # Protocol 2: Hop-count routing baseline
│ │ ├── src/
│ │ │ └── main.cpp
│ │ └── platformio.ini
│ ├── 3_gateway_routing/ # Protocol 3: Gateway-aware cost routing
│ │ ├── src/
│ │ │ └── main.cpp
│ │ └── platformio.ini
│ └── common/ # Shared utilities and configurations
│ ├── display_utils.h
│ ├── lora_config.h
│ └── node_config.h
├── src/ # Modified LoRaMesher library source
│ ├── LoraMesher.cpp
│ ├── LoraMesher.h
│ ├── services/ # Routing, packet, queue services
│ ├── modules/ # Display, health check modules
│ └── entities/ # Packet, routing table entities
├── raspberry_pi/ # Data collection & analysis
│ ├── serial_collector.py # Capture serial data from nodes
│ ├── mqtt_publisher.py # Publish to MQTT broker
│ ├── data_analyzer.py # Performance analysis
│ ├── generate_timeseries_plots.py
│ ├── multi_node_capture.py
│ └── README.md
├── final_report/ # LaTeX research documentation
│ ├── main.tex
│ ├── main.pdf
│ ├── chapters/
│ ├── appendices/
│ └── figures/
├── examples/ # Example implementations from LoRaMesher
├── library.json # PlatformIO library manifest
├── library.properties # Arduino library properties
└── README.md # This file
git clone https://github.com/ncwn/xMESH.git
cd xMESHVia VS Code Extension:
- Install Visual Studio Code
- Install PlatformIO IDE extension
- Restart VS Code
Via CLI:
pip install platformio- Connect Heltec LoRa 32 V3 boards via USB-C to your computer
- Identify USB ports (macOS:
/dev/cu.usbserial-*, Linux:/dev/ttyUSB*, Windows:COM*) - Configure node roles (see Configuration)
Navigate to desired protocol directory and upload:
cd firmware/3_gateway_routing
pio run --target upload --upload-port /dev/cu.usbserial-0001Or use PlatformIO IDE's "Upload" button.
Simple broadcast-based routing where nodes rebroadcast all received packets.
Use Case: Baseline for demonstrating scalability limitations of broadcast approaches.
cd firmware/1_flooding
# Edit platformio.ini to set NODE_ID
pio run --target upload
pio device monitorDefault LoRaMesher proactive distance-vector protocol using hop count as sole metric.
Use Case: Standard metric-based routing baseline.
cd firmware/2_hopcount
pio run --target upload
pio device monitorEnhanced protocol with composite cost metric (RSSI, SNR, ETX, gateway-bias) and Trickle adaptive scheduling.
Use Case: Optimized scalable routing for production deployments.
cd firmware/3_gateway_routing
pio run --target upload
pio device monitorKey Features:
- Multi-metric cost function
- Trickle adaptive HELLO scheduling
- Zero-overhead ETX tracking
- Active gateway load sharing
- Safety HELLO mechanism
Setup:
cd raspberry_pi
pip install -r requirements.txt # Create if needed: pyserial, paho-mqtt, pandas, matplotlibConfigure MQTT:
Edit mqtt_config.json:
{
"broker": "localhost",
"port": 1883,
"topic_prefix": "loramesher",
"username": "",
"password": ""
}Run Data Collector:
python serial_collector.py --port /dev/ttyUSB0 --baudrate 115200Multi-Node Capture:
python multi_node_capture.py --ports /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2Generate Analysis Plots:
python generate_timeseries_plots.py
python data_analyzer.pyEdit firmware/common/node_config.h:
// Node Role Assignment
#define NODE_ROLE_SENSOR 1
#define NODE_ROLE_ROUTER 2
#define NODE_ROLE_GATEWAY 3
// AS923 Thailand LoRa Settings
#define LORA_FREQUENCY 923.2 // MHz
#define LORA_BANDWIDTH 125.0 // kHz
#define LORA_SPREADING_FACTOR 7 // SF7 (max data rate)
#define LORA_CODING_RATE 5 // 4/5
#define LORA_TX_POWER 14 // dBm (under 16 dBm EIRP limit)
// Duty Cycle Compliance
#define DUTY_CYCLE_LIMIT 1.0 // 1% for AS923Protocol 3 (Gateway Routing):
Edit src/LoraMesher.h for advanced tuning:
// Composite Cost Function Weights
#define W_HOP_COUNT 0.3
#define W_RSSI 0.2
#define W_SNR 0.2
#define W_ETX 0.2
#define W_GATEWAY_BIAS 0.1
// Trickle Parameters
#define TRICKLE_I_MIN 8000 // ms
#define TRICKLE_I_MAX 60000 // ms
#define TRICKLE_K 3 // redundancy threshold
// Safety HELLO
#define SAFETY_HELLO_INTERVAL 60000 // ms| Metric | Protocol 1 (Flood) | Protocol 2 (Hop) | Protocol 3 (Gateway) |
|---|---|---|---|
| PDR | ~95% | ~97% | 96-100% |
| HELLO Overhead | N/A | Baseline (100%) | ~70% (30% reduction) |
| Multi-Hop | Limited | Yes | Enhanced |
| Load Balancing | No | No | Dual-gateway |
| ETX Tracking | No | Manual ACK | Zero-overhead |
| Fault Detection | N/A | Timeout-based | <60s proactive |
-
Trickle Adaptive Scheduling:
- 85-90% suppression efficiency in stable networks
- Local fault isolation prevents cascading failures
- Rapid convergence after topology changes
-
Multi-Metric Routing:
- Cost-based path selection outperforms hop-count in weak-link scenarios
- RSSI/SNR integration improves link quality awareness
- Gateway-bias ensures traffic flows toward border nodes
-
Scalability:
- Reduced control overhead enables larger mesh deployments
- Duty-cycle compliance maintained across 3-7 node testbeds
- Performance degradation less severe than flooding baseline
- Final Report - Complete results and analysis
- Raspberry Pi Guide - Data collection setup
If you use this research in your work, please cite:
@mastersinternship{ncwn/xMESH,
author = {Nyein Chan Win Naing},
title = {Design and Implementation of a LoRa Mesh Network with an Optimized Routing Protocol},
school = {Asian Institute of Technology},
year = {2025},
month = {December},
address = {Pathum Thani, Thailand},
type = {Master's Internship Research},
note = {School of Engineering and Technology}
}Research Supervisors:
- Chairperson: Prof. Attaphongse Taparugssanagorn
- Co-chairperson: Dr. Adisorn Lertsinsrubtavee
This project is licensed under the MIT License - see the LICENSE file for details.
Original LoRaMesher Library: LoRaMesher Contributors Licensed under MIT License
xMESH Research Fork: Nyein Chan Win Naing Asian Institute of Technology
- Prof. Attaphongse Taparugssanagorn - Research guidance and supervision
- Dr. Adisorn Lertsinsrubtavee - Technical advice and InterLAB resources
- Asian Institute of Technology (AIT) - Research facilities and academic support
- LoRaMesher Contributors - Original library foundation (Jaimi5, Roger Pueyo, Sergi Miralles)
- RadioLib - Excellent LoRa abstraction library
- AIT InterLAB - Experimental testbed environment
This is a research project fork. For contributing to the base LoRaMesher library, please visit: https://github.com/LoRaMesher/LoRaMesher
Potential extensions identified in the research:
- Phase 2 Integration: Connect with AIT Hazemon sensor platform
- Mobility Support: Enhanced protocol for high-mobility scenarios
- Power Analysis: Detailed battery lifetime characterization
- Security Hardening: Cryptographic overhead evaluation
- Regional Expansion: EU868, US915 frequency plan validation
- Larger Scale Testing: 10+ node deployments
- Environmental Diversity: Outdoor, industrial, agricultural deployments
Last Updated: November 2025
Version: 0.0.11 (based on LoRaMesher v0.0.11)