Add idea 002: Solar LoRa Mesh
Browse files
ideas/002-solar-powered-lora-mesh.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 002 · Solar LoRa Mesh
|
| 2 |
+
|
| 3 |
+
**title:** Solar LoRa Mesh — a disaster-proof grid of low-power nodes that pass text messages village-wide
|
| 4 |
+
**status:** idea / prototype ready
|
| 5 |
+
**license:** MIT
|
| 6 |
+
|
| 7 |
+
## why
|
| 8 |
+
|
| 9 |
+
When a hurricane, earthquake, or network outage hits, cell towers go down and whole communities go silent. Amateur radio exists but needs licenses and gear most people don't have. LoRa radios, though, cost ~$10, run for months on a battery, and can carry short text messages over kilometers. A mesh of solar-powered LoRa nodes can keep a village talking when everything else is dark — no license needed for the 915/868 MHz ISM bands in most countries at low power.
|
| 10 |
+
|
| 11 |
+
## what
|
| 12 |
+
|
| 13 |
+
- **Nodes**: ESP32 or RP2040 + a Semtech SX1276/78 LoRa radio, powered by a small solar panel + LiFePO4 battery.
|
| 14 |
+
- **Mesh**: every node repeats messages for its neighbors (flooding with hop limit) — no single point of failure.
|
| 15 |
+
- **Messages**: simple text (SMS-style), broadcast or one-to-one, delivered store-and-forward.
|
| 16 |
+
- **View**: a phone or laptop on the mesh shows the inbox; a node can also bridge to the internet if any link survives.
|
| 17 |
+
- **Range**: 1–5 km node-to-node in open terrain; a village of 20 nodes covers a wide area.
|
| 18 |
+
|
| 19 |
+
## plan
|
| 20 |
+
|
| 21 |
+
1. Pick hardware: ESP32 (+ LoRa) or Heltec LoRa32. Solar: 6V 1W panel + TP4056 + 18650 or LiFePO4.
|
| 22 |
+
2. Flash a basic "hello" ping-pong between two nodes to validate radio range.
|
| 23 |
+
3. Implement a naive flooding protocol with sequence numbers + hop limit.
|
| 24 |
+
4. Add a tiny CLI/phone UI (BLE serial or WebSerial) to send/receive text.
|
| 25 |
+
5. Add store-and-forward: nodes keep a small queue for offline neighbors.
|
| 26 |
+
6. Add battery telemetry (deep sleep duty cycle ~1% → months of life).
|
| 27 |
+
7. Solar + enclosure field test. Publish firmware + build guide.
|
| 28 |
+
|
| 29 |
+
## code
|
| 30 |
+
|
| 31 |
+
Minimal two-node flooding firmware sketch (Arduino, ESP32 + SX1276):
|
| 32 |
+
|
| 33 |
+
```cpp
|
| 34 |
+
// lora_mesh_flood.ino — naive flooding mesh, send + receive text
|
| 35 |
+
#include <SPI.h>
|
| 36 |
+
#include <LoRa.h>
|
| 37 |
+
|
| 38 |
+
#define FREQ 915E6 // use 868E6 in EU
|
| 39 |
+
#define SS 18 // wiring for your board
|
| 40 |
+
#define RST 14
|
| 41 |
+
#define DIO0 26
|
| 42 |
+
const uint8_t MY_ID = 1; // unique per node
|
| 43 |
+
const uint8_t HOP_MAX = 4; // flooding radius
|
| 44 |
+
|
| 45 |
+
void setup() {
|
| 46 |
+
Serial.begin(115200);
|
| 47 |
+
LoRa.setPins(SS, RST, DIO0);
|
| 48 |
+
if (!LoRa.begin(FREQ)) { Serial.println("LoRa init failed"); while (1); }
|
| 49 |
+
LoRa.setSpreadingFactor(7);
|
| 50 |
+
LoRa.setTxPower(14);
|
| 51 |
+
Serial.println("Mesh node " + String(MY_ID) + " up");
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
void sendMsg(const String& text, uint8_t dst) {
|
| 55 |
+
// packet: <seq>|<src>|<dst>|<hop>|<text>
|
| 56 |
+
String pkt = String(millis()) + "|" + MY_ID + "|" + dst + "|0|" + text;
|
| 57 |
+
LoRa.beginPacket();
|
| 58 |
+
LoRa.print(pkt);
|
| 59 |
+
LoRa.endPacket();
|
| 60 |
+
Serial.println("TX: " + pkt);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
void loop() {
|
| 64 |
+
// send from serial
|
| 65 |
+
if (Serial.available()) {
|
| 66 |
+
String line = Serial.readStringUntil('\n'); line.trim();
|
| 67 |
+
if (line.length()) sendMsg(line, 0 /* broadcast */);
|
| 68 |
+
}
|
| 69 |
+
// receive + forward
|
| 70 |
+
int sz = LoRa.parsePacket();
|
| 71 |
+
if (sz) {
|
| 72 |
+
String pkt = "";
|
| 73 |
+
while (LoRa.available()) pkt += (char)LoRa.read();
|
| 74 |
+
// parse: seq|src|dst|hop|text
|
| 75 |
+
int i0 = pkt.indexOf('|'), i1 = pkt.indexOf('|', i0+1),
|
| 76 |
+
i2 = pkt.indexOf('|', i1+1), i3 = pkt.indexOf('|', i2+1);
|
| 77 |
+
uint8_t src = pkt.substring(i0+1, i1).toInt();
|
| 78 |
+
uint8_t hop = pkt.substring(i2+1, i3).toInt();
|
| 79 |
+
String text = pkt.substring(i3+1);
|
| 80 |
+
if (src == MY_ID) return; // don't re-forward own
|
| 81 |
+
Serial.println("RX from " + String(src) + ": " + text);
|
| 82 |
+
if (hop < HOP_MAX) { // re-flood
|
| 83 |
+
pkt.setCharAt(i2+1, '0' + (hop+1));
|
| 84 |
+
LoRa.beginPacket(); LoRa.print(pkt); LoRa.endPacket();
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
delay(100);
|
| 88 |
+
}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
For a real mesh you want sequence-number dedup and an ack for reliable delivery — see "next".
|
| 92 |
+
|
| 93 |
+
## next
|
| 94 |
+
|
| 95 |
+
- Sequence-number dedup table (don't re-forward the same packet twice).
|
| 96 |
+
- Automatic repeat request (ACK + retransmit) for guaranteed delivery.
|
| 97 |
+
- Deep-sleep duty cycle: wake every 60 s, listen 2 s → months on a 18650.
|
| 98 |
+
- Battery + solar MPPT telemetry over the mesh.
|
| 99 |
+
- A waterproof enclosure design (printable STL).
|
| 100 |
+
- Bridge node: one node with a 4G/Starlink uplink relays the mesh to the internet.
|