Documentation

How to Work with LoRaMesher

From PlatformIO setup to multi-hop mesh gateway — everything you need to get started.

Getting Started

Up and Running in 30 Minutes

Five steps from zero to a working mesh network on ESP32.

1

Install PlatformIO

Install the PlatformIO IDE extension for VS Code or use the CLI.

bash
# Install PlatformIO CLI
pip install platformio

# Or install VS Code extension:
# Extensions → search "PlatformIO IDE"
2

Add LoRaMesher to Your Project

Add the library to your platformio.ini dependencies.

ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

lib_deps =
    https://github.com/LoRaMesher/LoRaMesher.git
3

Initialize the Radio

Get the singleton instance and call begin() in your setup().

cpp
#include <LoraMesher.h>

LoraMesher& radio = LoraMesher::getInstance();

void setup() {
  Serial.begin(115200);
  radio.begin(); // Uses default SPI pins
  radio.start();
  Serial.printf("Node: %X\n", radio.getLocalAddress());
}
4

Send a Packet

Create and send a typed packet to any node address.

cpp
// Send a float to the gateway (address 0x01)
float temperature = 24.5f;
radio.createPacketAndSend(0x01, &temperature, sizeof(float));
5

Receive Packets

Register a callback that fires when a packet arrives at your node.

cpp
void onReceive(AppPacket<uint8_t>* pkt) {
  float* temp = reinterpret_cast<float*>(pkt->payload);
  Serial.printf("Temp from 0x%X: %.1f°C\n", pkt->src, *temp);
  LoraMesher::deletePacket(pkt);
}

void setup() {
  Serial.begin(115200);
  radio.begin();
  radio.setReceiveCallback(onReceive);
  radio.start();
}

Architecture

How the Mesh Works

Three-layer design: field sensors communicate through a self-healing mesh to reach a gateway connected to your cloud.

Sensors & Field Devices

ESP32 + SX1276 nodes

Mesh Network

Self-healing multi-hop LoRa

Gateway → Cloud

WiFi/Ethernet bridge to backend

↑ Packets route automatically through intermediate nodes

Technology Comparison

TechnologyRangePowerNative MeshCostMobile Nodes
WiFi~100mHighLow
Bluetooth~30mMediumLow
LoRaWAN2–15kmVery LowMedium
LoRa Mesh (LoRaMesher)2–10kmVery LowVery Low
Zigbee~100mLowMedium
Cellular (LTE-M)UnlimitedHighHigh

Hardware

Supported Hardware

LoRaMesher runs on any ESP32 board with a LoRa radio via RadioLib.

ESP32 + SX1276 Module

~€8–15

Maximum flexibility with separate microcontroller and LoRa module. Ideal for custom PCB designs.

ESP32 + SX1276 · Full GPIO access, custom antenna design possible

TTGO LoRa32

~€12–20

All-in-one development board with integrated OLED display. Great for prototyping.

ESP32 + SX1276/SX1278 · 128×64 OLED, Li-Po battery connector

Heltec WiFi LoRa 32

~€15–25

Compact board with display, WiFi, BLE, and LoRa. Popular for gateway nodes.

ESP32 + SX1276 · USB-C, 0.96" OLED, compact form factor

Generic RadioLib Compatible

Varies

LoRaMesher uses RadioLib under the hood — any supported board works.

Any RadioLib board · SX1262, SX1278, RFM95, and more

Code Examples

Common Patterns

Four real-world examples to get you building fast.

cpp
#include <LoraMesher.h>

LoraMesher& radio = LoraMesher::getInstance();

void setup() {
  Serial.begin(115200);

  // Initialize with default SPI pins
  radio.begin();
  radio.start();

  Serial.println("LoRaMesher node started!");
  Serial.printf("Node address: %X\n", radio.getLocalAddress());
}

void loop() {
  // The mesh runs autonomously in the background
  // Routes are discovered and maintained automatically
  delay(1000);
}

Open Source on GitHub

Read the source, open issues, contribute improvements, or star the repo to follow development.

Star the Repo
Fork & Contribute
Read the Docs
View LoRaMesher on GitHub