📘 MeshRadio – Embedded LoRa Mesh Engineering

🔗 Additional Resources

📥 Downloads & Examples

📥 Help for MeshRadio Webinterface

📥 Help for MeshRadio Console GUI – Live-Monitoring

Source code and accompanying materials for this book.

📚 Buy on Amazon


📘 Preface – MeshRadio – Embedded LoRa Mesh Engineering

This book is not an installation guide.

It does not explain how to flash ready-made firmware, configure an existing mesh system, or operate a preconfigured network.
Instead, it follows a different goal:

This book shows how to develop your own LoRa mesh radio system.

From the first frames to routing, ACK/retry mechanisms, security, and stable radio architecture, a complete system is built step by step — not as a black box, but as a transparent engineering process.


Why This Book Exists

Many LoRa mesh projects provide finished solutions.
That is convenient — but often leaves unanswered questions:

  • Why does routing work this way?
  • Why do packet storms occur?
  • Why does a mesh become unstable?
  • What really happens on the radio layer?

This book answers these questions not through theory, but through real implementation.

The reader follows the development of a system that grows with every chapter:

  • custom frame format
  • custom routing logic
  • custom control plane
  • AES-CCM encryption with replay protection
  • hardware ports for multiple boards
  • and most importantly: stability in real radio environments

Target Audience

This book is intended for:

  • Radio amateurs who want to understand how mesh systems work internally
  • Developers and makers building their own wireless projects
  • Technically interested readers who want to learn embedded systems in a practical way

It does not require perfect prior knowledge — but it does require the willingness to truly understand how things work.


An Important Difference

This book does not replicate an existing system.
It develops a new one.

This means:

  • Decisions are explained
  • Architecture is deliberately designed
  • Errors and design pitfalls are made visible

By the end, the reader should not only be able to use a mesh — but understand why it is stable.


Guiding Principle: Pro-Level Stable

During development it quickly becomes clear:

A mesh rarely fails because of the radio module.
It fails because of architecture.

Therefore one guiding idea runs through the entire project:

Radio path first. Stability before features.

Only a deterministic design leads to a system that works not just in the lab, but reliably in the field.


What This Book Does NOT Try To Be

  • It is not an official standard.
  • It does not replace existing amateur radio projects.
  • It does not claim to be the only correct approach.

It is a practical development path — open, understandable, and extendable.


Outlook

At the end of this book there is not only a working mesh.

There is a foundation on which new ideas can grow:

  • new routing strategies
  • alternative hardware
  • field optimizations
  • extensions for real deployments

Because the real goal is not software.

The real goal is understanding.


Note on Target Audience and Application

This book originated from practical amateur radio experience and uses many examples from that environment, where experimental radio technology traditionally plays an important role.

At the same time, this work is explicitly not limited to amateur radio.

The concepts, architectures, and software described here should be understood as a general embedded engineering project and can equally be applied to:

  • industrial and technical mesh communication
  • IoT and sensor networks
  • experimental research and development projects
  • off-grid communication and field systems
  • education, maker projects, and prototyping

The focus is the development of an open, understandable, and technically extensible LoRa mesh system — independent of existing amateur radio protocols or platforms.

Amateur radio serves as inspiration, not limitation.


The author is happy to support future projects in the field of LoRa mesh, embedded radio systems, and distributed networks — either in an advisory or active role.

Whether prototype, research, amateur radio, maker project, or industrial development — sharing experience and collaborative engineering remain central.

Because stable systems are not created by code alone, but through collaboration, experimentation, and the courage to explore new ideas.

Good luck developing — and enjoy the radio.

All source code for every chapter is available on GitHub.
Address in the downloads section.

Friedrich Riedhammer, DJ2RF

Table of Contents
Imprint ……………………………………………………………………………………………………………… 2
Foreword ………………………………………………………………………………………………………………. 18
Chapter 1 Why LoRa in Amateur Radio? …………………………………………………………………… 21
1.1 From Packet Radio to Modern Data Transmission ……………………………………………. 21
1.2 What makes LoRa special in amateur radio ……………………………………………………… 21
1.3 Why a LoRa mesh? ……………………………………………………………………………………….. 22
1.4 Regulatory framework …………………………………………………………………………………… 22
1.5 Aim of this book ……………………………………………………………………………………………. 23
1.6 What to expect in the next chapter ………………………………………………………………….. 23
Chapter 2 Hardware & Antennas ……………………………………………………………………………… 23
2.1 Our reference hardware …………………………………………………………………………………. 24
2.2 Why 433 MHz in amateur radio? ……………………………………………………………………. 25
2.3 The LoRa Transceiver (SX1276)……………………………………………………………………… 26
2.4 Antennas – The Underestimated Factor………………………………………………………….. 26
2.4.1 λ/4 calculation for 433 MHz ……………………………………………………………………. 26
2.4.2 SMA vs. Wire Antenna …………………………………………………………………………… 27
2.5 Power supply ……………………………………………………………………………………………….. 27
2.6 Typical beginner’s mistakes …………………………………………………………………………… 27
2.7 Goal of the next step ………………………………………………………………………………………28
2.8 Difference to Heltec WiFi LoRa 32 ………………………………………………………………….28
2.8.1 Technical similarities ………………………………………………………………………………28
2.8.2 Key Differences ………………………………………………………………………………………28
2.8.3 Why we use DollaTek + T-Beam in the book ……………………………………………. 30
2.8.4 Compatibility Note ……………………………………………………………………………….. 30
Chapter 3 Setting Up the Development Environment ……………………………………………….. 30
3.2 Prerequisites ………………………………………………………………………………………………… 31
3.3 Installing ESP-IDF (Recommended Method) ………………………………………………….. 31
3.4 Check USB drivers ………………………………………………………………………………………… 32
3.5 Create your first project …………………………………………………………………………………. 33
3.6 Select Target Processor (Important!) ……………………………………………………………… 33
3.7 Configuring the Project …………………………………………………………………………………. 33
3.8 Compiling ……………………………………………………………………………………………………. 34
3.9 Flashing ………………………………………………………………………………………………………. 34
3.10 Starting the Serial Monitor …………………………………………………………………………… 34
3.11 Typical Mistakes & Solutions ………………………………………………………………………… 34
3.12 Installation Video Tutorial …………………………………………………………………………… 35
3.13 What we have now ………………………………………………………………………………………. 35
Chapter 4 Initializing SPI ………………………………………………………………………………………… 36
4.1 How the SX1276 is connected …………………………………………………………………………. 36
4.2 Typical pin assignment (example DollaTek) ……………………………………………………. 36
4.3 Initializing SPI in the ESP-IDF ………………………………………………………………………. 36
4.4 Implementing Registry Access ………………………………………………………………………..38
4.5 Reset Sequence …………………………………………………………………………………………….. 39
4.6 Testing Initial Communication ………………………………………………………………………. 39
4.7 Typical errors ………………………………………………………………………………………………. 40
Chapter 5 Activating LoRa Mode and Setting the Frequency ……………………………………… 40
5.1 Enable LoRa Mode ……………………………………………………………………………………….. 40
Chapter 6 Sending the First Packet (TX) …………………………………………………………………… 43
Chapter 7 Receiving (RX) ………………………………………………………………………………………… 51
Chapter 8 Interrupt (DIO0) + Packet Format ……………………………………………………………. 52
8.1 What is DIO0? ……………………………………………………………………………………………… 52
8.2 Basic principle: ISR only makes “small” ………………………………………………………….. 52
8.3 DIO0 mapping in the SX1276 ………………………………………………………………………… 53
8.4 Why we don’t necessarily do TX via interrupt ………………………………………………….. 53
8.5 Package Format: MeshRadio Frame v1 …………………………………………………………… 53
8.6 What happens when receiving (RX-Flow) ……………………………………………………….. 54
8.7 What happens when sending (TX-Flow) …………………………………………………………. 55
8.8 What makes this chapter “finished” ……………………………………………………………….. 55
Chapter 9 TTL, Deduplication and Flooding Light …………………………………………………….. 55
Chapter 10 ACK System, Target Call Signs & Simple Chat Function …………………………….. 56
10.1 Frame Extension …………………………………………………………………………………………. 56
10.2 Logic on Receiving ………………………………………………………………………………………. 57
10.3 Global Node Configuration…………………………………………………………………………… 57
10.4 ACK Wait Logic …………………………………………………………………………………………… 57
10.5 Advanced RX Logic ……………………………………………………………………………………… 58
10.6 Send ACK …………………………………………………………………………………………………… 58
10.7 Sending with ACK ……………………………………………………………………………………….. 59
10.8 Simple Chat Demo ……………………………………………………………………………………… 60
Chapter 11 – OLED Status Indicator: Neighbours & RSSI on Display………………………….. 60
11.1 Aim and benefits ………………………………………………………………………………………….. 61
11.2 Hardware Requirements ………………………………………………………………………………. 61
11.2.1 Boards and OLED …………………………………………………………………………………. 61
11.2.2 I²C Pins (Current Status) ………………………………………………………………………. 61
11.3 Software Concept…………………………………………………………………………………………. 62
11.3.1 OLED as an optional feature ………………………………………………………………….. 62
11.3.2 OLED in its own task …………………………………………………………………………….. 62
11.4 Display Library (ESP-IDF Component) ………………………………………………………….. 62
11.5 I²C Recovery and Address Detection ……………………………………………………………… 62
11.5.1 Why Recovery? ……………………………………………………………………………………… 62
11.5.2 Why address 0x3C and 0x3D? ……………………………………………………………….. 63
11.6 OLED Output: Neighbor List ………………………………………………………………………… 63
11.7 Troubleshooting ………………………………………………………………………………………….. 63
11.8 Complete Sources (Chapter 11) ……………………………………………………………………… 63
11.9 Outlook ………………………………………………………………………………………………………. 64
Chapter 11A – Fallback: Output via UART/Serial Monitor (PuTTY & ESP-IDF) ……………. 64
11A.1 Why UART Always Matters ………………………………………………………………………… 64
11A.2 UART Basic Settings ………………………………………………………………………………….. 64
11A.3 Output via ESP-IDF Monitor ………………………………………………………………………. 65
11A.4 Output via PuTTY (very important) …………………………………………………………….. 65
11A.5 Important: Flashing + PuTTY at the same time…………………………………………….. 66
11A.6 Sample Output in PuTTY ……………………………………………………………………………. 66
11A.7 Status Output via UART …………………………………………………………………………….. 66
11A.8 Why Many Developers Prefer PuTTY …………………………………………………………… 67
11A.9 Professional tip (from practice) …………………………………………………………………… 67
11A.10 Summary ………………………………………………………………………………………………… 67
Chapter 12 – Terminal Chat via LoRa (UART Mesh Chat) ………………………………………….. 67
12.1 Objective of the Chapter ………………………………………………………………………………..68
12.2 Why UART Chat? …………………………………………………………………………………………68
12.3 New Frame Format ………………………………………………………………………………………68
12.4 UART Reading Input …………………………………………………………………………………… 69
12.5 Send Chat …………………………………………………………………………………………………… 70
12.6 Receiving Chat ……………………………………………………………………………………………. 70
12.7 Extending the Main Loop …………………………………………………………………………….. 71
12.8 Test setup …………………………………………………………………………………………………… 71
12.9 Test ……………………………………………………………………………………………………………. 72
12.10 Important Restrictions (deliberately simple) ………………………………………………… 72
12.11 Why this is a milestone ……………………………………………………………………………….. 72
12.12 Outlook Chapter 13 ……………………………………………………………………………………. 72
Chapter 13 – Flooding Routing (Multi-Hop Mesh) …………………………………………………….. 72
13.1 Objective …………………………………………………………………………………………………….. 73
13.2 Why flooding? …………………………………………………………………………………………….. 73
13.3 Problem: Broadcast Storm …………………………………………………………………………… 73
13.4 Message-ID Cache ………………………………………………………………………………………. 73
13.5 Cache Structure …………………………………………………………………………………………… 74
13.6 Checking if Message Is Known ……………………………………………………………………… 74
13.7 Bookmark Message ……………………………………………………………………………………… 74
13.8 TTL (Time To Live) ……………………………………………………………………………………… 75
13.9 Routing Logic ……………………………………………………………………………………………… 75
13.10 Forward Function ……………………………………………………………………………………… 75
13.11 Expand RX Dealer ……………………………………………………………………………………… 76
13.12 Chat works automatically via mesh ……………………………………………………………… 76
13.13 Test setup (IMPORTANT) ………………………………………………………………………….. 76
13.14 Debug Output ……………………………………………………………………………………………. 76
13.15 Why this is already real mesh ……………………………………………………………………… 77
13.16 Limits of Flooding ……………………………………………………………………………………… 77
13.17 Outlook Chapter 14 …………………………………………………………………………………….. 77
Chapter 14 – Smart Forwarding ………………………………………………………………………………. 77
14.1 Problem of Flooding …………………………………………………………………………………….. 78
14.2 Idea: Forward only strong links ……………………………………………………………………. 78
14.3 Calculating RSSI Correctly …………………………………………………………………………… 78
14.4 Forward only with good signal quality …………………………………………………………… 78
14.5 Defining Minimum RSSI ……………………………………………………………………………… 79
14.6 Extending the Forward Function ………………………………………………………………….. 79
14.7 New Forward Logic ……………………………………………………………………………………… 79
14.8 Customizing the RX Handler ………………………………………………………………………. 80
14.9 Result ……………………………………………………………………………………………………….. 80
14.10 Optional: Random delay against collisions ………………………………………………….. 80
14.11 Comparison Chapter 13 vs 14 ……………………………………………………………………… 80
14.12 Why This Matters ……………………………………………………………………………………… 80
14.13 Outlook Chapter 15 …………………………………………………………………………………….. 81
Chapter 15 – Neighbor Ranking & Preferred Forwarding ……………………………………………. 81
15.1 Idea ……………………………………………………………………………………………………………. 81
15.2 Data Structure ……………………………………………………………………………………………..82
15.3 Why Ranking? ……………………………………………………………………………………………..82
15.4 Neighbor Update ………………………………………………………………………………………….82
15.5 Ranking Idea ……………………………………………………………………………………………….83
15.6 Checking if Good Neighbour …………………………………………………………………………83
15.7 Smart Forward 2.0 ……………………………………………………………………………………….84
15.8 Result …………………………………………………………………………………………………………84
15.9 Mesh behaviour (realistic) …………………………………………………………………………….84
15.10 Debug Output (extremely helpful) ………………………………………………………………..84
15.11 Why this is awesome …………………………………………………………………………………… 85
15.12 What’s Changing for Readers ………………………………………………………………………. 85
15.13 Outlook Chapter 16 …………………………………………………………………………………….. 85
Note on Chapter 15A – Making Visible What the Mesh Thinks ……………………………….. 85
15A.1 Why this is particularly useful …………………………………………………………………….. 85
15A.2 Recommendation for readers ………………………………………………………………………86
Chapter 16 – Store-and-Forward: Buffering Messages and Delivering Them Later ………..86
16.1 What Store-and-Forward Does ………………………………………………………………………86
16.2 Basic Principle in the MeshRadio Context ……………………………………………………… 87
16.3 What do we store per message? …………………………………………………………………….. 87
16.4 When is something put in the outbox? …………………………………………………………… 87
16.5 Backoff Strategy …………………………………………………………………………………………. 88
16.6 Terms of Service…………………………………………………………………………………………. 88
16.7 Duplicate detection remains mandatory ……………………………………………………….. 88
16.8 Terminal Output for Diagnostics …………………………………………………………………..89
16.9 Practice Test Setup ………………………………………………………………………………………89
16.10 Limits of Store-and-Forward without ACK ……………………………………………………89
Chapter 17 – ACK/Retry for Directed Messages ……………………………………………………….. 90
17.1 Basic idea …………………………………………………………………………………………………… 90
17.2 New Frame Types ……………………………………………………………………………………….. 90
17.3 ACK Payload (Small and Robust) …………………………………………………………………. 90
17.4 When is an ACK sent? ………………………………………………………………………………….. 91
17.5 Outbox extended: “ACK expected” ………………………………………………………………… 91
17.6 Retry Logic for ACK Jobs ……………………………………………………………………………… 91
17.7 How does the transmitter detect the ACK? …………………………………………………….. 91
17.8 Dedupe at ACKs ………………………………………………………………………………………….. 92
17.9 Directed Chat Input (UART) ………………………………………………………………………… 92
17.10 Flow Chart ………………………………………………………………………………………………… 92
17.11 Radio practice: why ACK does not flood ……………………………………………………….. 92
17.12 Outlook Chapter 18…………………………………………………………………………………….. 93
Chapter 18 – Route Learning (Next-Hop Routing instead of Flooding) ……………………….. 93
18.1 Objective of Chapter 18 ………………………………………………………………………………… 93
18.2 Basic idea: Route table ………………………………………………………………………………… 93
18.3 How do we learn routes? ……………………………………………………………………………… 94
18.4 Routing Decision in Forward ……………………………………………………………………….. 94
18.5 Directed Transmission instead of Broadcast ………………………………………………….. 94
18.6 Route Aging ……………………………………………………………………………………………….. 95
18.7 Example Procedure ……………………………………………………………………………………… 95
18.8 Fallback Mechanism ……………………………………………………………………………………. 95
18.9 ACK + Routing Interaction …………………………………………………………………………… 95
18.10 Advantage over classic LoRa flooding ………………………………………………………….. 96
18.11 Memory Requirements ……………………………………………………………………………….. 96
18.12 What we do NOT do …………………………………………………………………………………… 96
18.13 Result according to Chapter 18 ……………………………………………………………………. 96
Chapter 19 – Final Destination + Next-Hop Separated (True Routing) ………………………… 97
19.1 New Header Format (Version 2) ……………………………………………………………………. 97
19.2 Why This Is Better ……………………………………………………………………………………….98
19.3 Route Learning Gets Clean ……………………………………………………………………………98
19.4 Forward Decision (new) ……………………………………………………………………………….98
19.5 What happens at the final destination? ………………………………………………………….. 99
19.6 ACK Adjustment to V2 …………………………………………………………………………………. 99
19.7 Discovery/Fallback Mechanism ……………………………………………………………………. 99
19.8 Compatibility with Chapter 18 ……………………………………………………………………… 99
19.9 Result according to Chapter 19 ……………………………………………………………………… 99
Chapter 19A – last hop field (clean route learning over multiple hops) ………………………. 100
19A.1 New Header: Version 3 …………………………………………………………………………….. 100
19A.2 Rule: Always set last_hop ………………………………………………………………………… 101
19A.3 Route Learning Becomes Correct ……………………………………………………………… 101
19A.4 Forwarding: Update last_hop …………………………………………………………………… 101
19A.5 Why Routing Really Works Now ……………………………………………………………….. 101
19A.6 ACKs automatically benefit ………………………………………………………………………. 102
19A.7 What’s Next? …………………………………………………………………………………………… 102
19A.8 Mini-Test ……………………………………………………………………………………………….. 102
Chapter 20 – Beacons + Route Refresh (network “lives”, even without chat) ……………… 102
20.1 Objective ………………………………………………………………………………………………….. 103
20.2 Beacon Frame (V3 Compatible) ………………………………………………………………….. 103
20.3 Beacon Interval and Jitter …………………………………………………………………………. 103
20.4 Beacon Doesn’t Send Everything Dead ……………………………………………………….. 104
20.5 How Beacons Improve Routing ………………………………………………………………….. 104
20.6 Beacon as “Router Discovery”…………………………………………………………………….. 104
20.7 Route Aging: Timeout instead of forever ……………………………………………………… 104
20.8 Debug Output …………………………………………………………………………………………… 104
20.9 What We Intentionally DON’T Do Yet ………………………………………………………… 105
20.10 Result after Chapter 20 ……………………………………………………………………………. 105
Chapter 21 – Persistence with NVS (Config + Node ID + Optional Routes) ………………… 105
21.1 Objective …………………………………………………………………………………………………… 105
21.2 Why NVS? ………………………………………………………………………………………………… 105
21.3 What exactly do we store? ………………………………………………………………………….. 106
21.4 NVS Setup ………………………………………………………………………………………………… 106
21.5 Default Strategy ………………………………………………………………………………………… 106
21.6 What changes to the previous code? ……………………………………………………………. 107
21.7 Tests ………………………………………………………………………………………………………… 107
21.8 Result according to Chapter 21……………………………………………………………………. 107
Chapter 22 – CLI/UART Configuration (Call, Frequency, SF, BW, CRC, Save) …………… 107
22.1 Objective ………………………………………………………………………………………………….. 107
22.2 Why CLI instead of menu? …………………………………………………………………………. 108
22.3 Connection/Terminal ………………………………………………………………………………… 108
22.4 Commands ……………………………………………………………………………………………….. 108
22.5 Application of Parameters ………………………………………………………………………….. 108
22.6 Validation (so nothing breaks) ……………………………………………………………………. 109
22.7 Result according to Chapter 22 …………………………………………………………………… 109
Chapter 22A – WRITE SF/BW/CRC really correctly in SX1276 register …………………….. 109
22A.1 Bit Mapping (SX1276) ……………………………………………………………………………… 109
22A.2 LDO Decision (Rule of Thumb) ………………………………………………………………… 110
22A.3 Result ……………………………………………………………………………………………………. 110
Chapter 22B – Wi-Fi Configuration (Web Server) Instead of UART CLI …………………….. 110
22B.1 Objective ………………………………………………………………………………………………… 110
22B.2 Variants ………………………………………………………………………………………………….. 111
22B.3 Dependencies (ESP-IDF) ………………………………………………………………………….. 111
22B.4 Endpoints (HTTP) …………………………………………………………………………………… 111
22B.5 Security …………………………………………………………………………………………………… 111
22B.6 What remains identical to 22A? ………………………………………………………………… 111
22B.7 Test …………………………………………………………………………………………………………112
Chapter 22B+ – Beacon Control via Web Setup …………………………………………………………112
22B+.1 Test (Practical) ……………………………………………………………………………………….112
Chapter 23 – Making Neighbours & Routes Visible (CLI + Web) ……………………………….. 113
Chapter 23 – Expenses (example) ………………………………………………………………………. 113
23.1 Mini-Test for Chapter 23 …………………………………………………………………………….. 113
Chapter 23A …………………………………………………………………………………………………………..114
23A.1 Test Setup for Chapter 23A (3 Boards Ideal) ………………………………………………..114
Chapter 23B ………………………………………………………………………………………………………114
23B.1 What Matters Now ……………………………………………………………………………….114
Chapter 24 – Smart Relay: Less Flooding, More Power Quality ………………………………….114
24.1 What is Smart Relay? ………………………………………………………………………………….. 115
24.2 What are the benefits of this in practice? ……………………………………………………… 115
24.3 Control via Web API ……………………………………………………………………………………116
24.4 Test Setup for Chapter 24 ……………………………………………………………………………116
Chapter 25 Targeted Routing Instead of Flooding ……………………………………………………..116
25.1 What is flooding – and why is it expensive? ………………………………………………….. 117
25.2 Targeted Routing: Basic Idea ………………………………………………………………………. 117
25.3 The Three Address Fields in the DATA Frame ………………………………………………. 117
25.4 Destination Table ……………………………………………………………………………………… 118
25.5 How do we learn routes? (Beacon-based learning) ……………………………………….. 118
25.6 Sending a Message: Next-Hop Selection ……………………………………………………… 118
25.7 Receive logic: What does a node do with DATA? ………………………………………….. 118
25.8 TTL remains mandatory ……………………………………………………………………………..119
25.9 Broadcast fallback (if no route is known) ………………………………………………………119
25.10 Web Configuration and Testing ………………………………………………………………….119
25.11 Limits of this approach (consciously!) ………………………………………………………… 120
Chapters 25A–25D – Extensions at a glance ……………………………………………………………. 120
25A – Route Priorities ………………………………………………………………………………………. 120
Chapter 25A Quality-Based Route Selection (RSSI-Aware Routing) ………………………….. 120
25A.1 Why is “first route found” not enough? ……………………………………………………….121
25A.2 RSSI as a quality indicator …………………………………………………………………………121
25A.3 Extended Routing Table ……………………………………………………………………………121
25A.4 Learning Rule (Improved) ……………………………………………………………………….. 122
25A.5 Why Hysteresis Matters …………………………………………………………………………… 122
25A.6 Aging: Forgetting old routes …………………………………………………………………….. 122
25A.7 Real-world example ………………………………………………………………………………… 123
25A.8 Effects on the grid …………………………………………………………………………………… 123
25A.9 Limitations of this method ………………………………………………………………………. 123
25A.10 Summary ……………………………………………………………………………………………… 124
25B – Route-Advertisement ………………………………………………………………………………. 124
25B.1 Why Route-Advertisement? ……………………………………………………………………… 124
25B.2 Basic Idea ………………………………………………………………………………………………. 125
25B.3 New Frame Type: ROUTE_ADV ………………………………………………………………. 125
25B.4 Simple Metric: Hop Count + RSSI Bonus ………………………………………………….. 125
25B.5 Who sends route advertisements – and when? …………………………………………… 126
25B.6 How is a ROUTE_ADV processed? …………………………………………………………… 126
25B.7 Protection against Nonsense: Plausibility Checks ……………………………………….. 126
25B.8 Loop Risk (and Why TTL Is Enough) ………………………………………………………… 127
25B.9 Test setup ………………………………………………………………………………………………. 127
25B.10 Limitations of this Approach (Conscious) ………………………………………………… 127
25B.11 Summary ………………………………………………………………………………………………. 128
25C – ACK and Retry (Reliability) ……………………………………………………………………… 128
25C.1 Why ACKs are not “free” in LoRa………………………………………………………………. 129
25C.2 Basic principle: DATA → ACK → Retry …………………………………………………….. 129
25C.3 What exactly do we confirm? ……………………………………………………………………. 129
25C.4 New Frame Type: ACK …………………………………………………………………………….. 130
25C.5 Who sends ACK – and when? …………………………………………………………………… 130
25C.6 ACK Timeout and Retry Strategy ……………………………………………………………… 130
25C.7 Pending-ACK Table (Small and Efficient) …………………………………………………… 131
25C.8 Receive Logic: DATA with ACKREQ ………………………………………………………….. 131
25C.9 Avoid ACK Storm …………………………………………………………………………………….. 131
25C.10 Test setup …………………………………………………………………………………………….. 132
25C.11 Limitations of this solution ……………………………………………………………………… 132
25C.12 Summary………………………………………………………………………………………………. 132
25D – Store-and-Forward …………………………………………………………………………………. 133
Chapter 25D Store-and-Forward ……………………………………………………………………………. 133
25D.1 Basic Idea ………………………………………………………………………………………………. 133
25D.2 What is stored? ………………………………………………………………………………………. 134
25D.3 When do we store a message? ………………………………………………………………….. 134
25D.4 Lifecycle ………………………………………………………………………………………………… 134
25D.5 Expiration Time ……………………………………………………………………………………… 135
25D.6 Location: RAM or Flash? …………………………………………………………………………. 135
25D.7 Store Queue Limits …………………………………………………………………………………. 135
25D.8 Retry strategy in the store ……………………………………………………………………….. 136
25D.9 Interaction with ACK (Chapter 25C) …………………………………………………………. 136
25D.10 Real-world example ………………………………………………………………………………. 136
25D.11 Risks & Protective Measures …………………………………………………………………… 137
25D.12 What we deliberately DO NOT do …………………………………………………………… 137
25D.13 Summary ……………………………………………………………………………………………… 137
25A-D Summary ………………………………………………………………………………………………. 137
Chapter 26 – Loop-Safe Routing (Stable Mesh Paths)………………………………………………. 138
26.1 Why Routing Loops Arise …………………………………………………………………………… 138
26.2 Why TTL alone is not enough …………………………………………………………………….. 138
26.3 Basic idea: Route versions (Sequence Numbers) ………………………………………….. 139
26.4 Extension of the Routing Table …………………………………………………………………… 139
26.5 Route Update Rules (Important!) ……………………………………………………………….. 139
26.6 Feasibility Rule (Light Version) ………………………………………………………………….. 140
26.7 Where does the Sequence Number come from? ……………………………………………. 140
26.8 Behaviour in the event of network changes ………………………………………………….. 140
26.9 Why It’s “Professional”………………………………………………………………………………. 140
26.10 Effects on the Grid …………………………………………………………………………………….141
26.11 What We Consciously DO NOT Do ………………………………………………………………141
26.12 Summary ………………………………………………………………………………………………….141
Chapter 26A – Visualization: Why Sequence Numbers Prevent Loops…………………………141
26A.1 The Problem Without Sequence Numbers …………………………………………………. 142
26A.2 Why this happens …………………………………………………………………………………… 142
26A.3 The Solution: Sequence Numbers …………………………………………………………….. 142
26A.4 What happens now …………………………………………………………………………………. 143
26A.5 Visualization of the Decision ……………………………………………………………………. 143
26A.6 Feasibility Rule (Light) – second protective layer ………………………………………. 143
26A.7 What the reader should remember ……………………………………………………………. 144
26A.8 Why Real Mesh Protocols Do It Too …………………………………………………………. 144
26A.9 Mental model (very important) ………………………………………………………………… 144
26A.10 Result…………………………………………………………………………………………………… 144
Chapter 27 – ETX-Light: real link quality instead of just RSSI ………………………………….. 145
27.1 Why RSSI Alone Is Not Reliable ………………………………………………………………….. 145
27.2 Basic idea of ETX ………………………………………………………………………………………. 145
27.3 ETX-Light: minimal but effective ……………………………………………………………….. 146
27.4 What is our metric in routing? ……………………………………………………………………. 146
27.5 Which ETX is written to the routing table? ………………………………………………….. 146
27.6 How is ETX created in our system? …………………………………………………………….. 146
27.7 Route Updates with ETX ……………………………………………………………………………. 147
27.8 What happens with asymmetric links? ………………………………………………………… 147
27.9 Avoiding Airtime Traps: ETX Needs Limits …………………………………………………. 147
27.10 Web View: Making ETX Visible ………………………………………………………………… 147
27.11 Limits of ETX-Light………………………………………………………………………………….. 148
27.12 Summary ………………………………………………………………………………………………… 148
Chapter 28 – Control Plane Discipline and Network Scaling …………………………………….. 148
28.1 Why LoRa Meshes Otherwise “Jam Themselves”………………………………………….. 148
28.2 Goal: Send less – but on time …………………………………………………………………….. 149
28.3 Beacon Discipline ……………………………………………………………………………………… 149
28.4 Route advertisements only when changes are made ……………………………………… 149
28.5 Rate Limit per Node: Token Bucket (Simple & Effective) ………………………………. 150
28.6 Avoiding ACK Storms………………………………………………………………………………… 150
28.7 “Top-N”: announce only the best routes ………………………………………………………. 150
28.8 Hold-Down Timer vs. Flapping ………………………………………………………………….. 150
28.9 “Busy Channel” Light: Don’t Start Sending Blindly ……………………………………….. 151
28.10 Web Configuration (extremely helpful for testing) ………………………………………. 151
28.11 Summary …………………………………………………………………………………………………. 151
Chapter 29 – Encryption & Auth in the ISM Band (Mesh-Ready) ……………………………… 152
29.1 Why encryption is mandatory in the LoRa mesh …………………………………………… 152
29.2 Goals: What does our security layer need to be able to do? ……………………………. 152
29.3 Two Key Models (We Decide Consciously) …………………………………………………… 152
29.4 What do we encrypt in the frame? ………………………………………………………………. 153
29.5 Algorithm Choice (ESP32 Friendly) ……………………………………………………………. 153
29.6 Nonce / IV – the most important point of all ……………………………………………….. 153
29.7 Replay Protection (Anti-Replay Window) ……………………………………………………. 154
29.8 Authenticated Header (AAD) ……………………………………………………………………… 154
29.9 Key Storage (Convenient) ………………………………………………………………………….. 154
29.10 Debug Strategy ……………………………………………………………………………………….. 154
29.11 Summary ………………………………………………………………………………………………… 155
Chapter 30 – Heltec Port ………………………………………………………………………………………. 155
30.1 What Remains Identical (Chapters 25–29 Core) …………………………………………… 156
30.2 Objective of this Chapter ……………………………………………………………………………. 156
30.3 Pinmapping Heltec V3.x (SX1262) ……………………………………………………………… 156
30.4 SX1276 Register Driver Removal ………………………………………………………………… 156
30.5 ESP-IDF + RadioLib (C++ conversion) ……………………………………………………….. 157
30.6 Central Architecture Design: A Radio Path (Serial) ………………………………………. 157
30.7 TX Queue: Why it is mandatory (HTTP/Retry must not transmit) …………………. 157
30.8 Interrupt-based TX (SX1262, RadioLib 7.6) ………………………………………………… 158
30.9 RX in main loop (polling) + length determination from header …………………….. 158
30.10 CAD/Backoff in Heltec port: Pseudo-CAD (Random Delay) ………………………… 159
30.11 Patch List ………………………………………………………………………………………………… 159
30.12 Outcome of the Chapter …………………………………………………………………………… 159
Chapter 31 – OLED on Heltec WiFi LoRa 32 V3 / V3.2 (ESP32-S3) …………………………… 160
31.1 Why OLED at all – and why separate from the mesh core? …………………………….. 160
31.2 Hardware: internal OLED wiring (Heltec V3/V3.2 S3) ………………………………….. 160
31.3 Software concept: “OLED TTY” instead of graphics library ……………………………..161
31.4 Board Configuration in Code ………………………………………………………………………..161
31.5 Initialization: the most important part (VEXT + I²C + Reset) ………………………….161
31.6 First Edition: Demo Screen ………………………………………………………………………… 162
31.7 Flicker-Free Update: Change Only One Line ………………………………………………… 162
31.8 Why This Demo Is Called “MANUAL” …………………………………………………………. 162
31.9 Typical sources of error (from practice) ……………………………………………………….. 163
31.10 Outcome of the chapter …………………………………………………………………………….. 163
31.11 Outlook: next step – port OLED to LILYGO ………………………………………………… 163
Chapter 32 – OLED on LILYGO T3 LoRa32 V1.6.1 …………………………………………………… 164
32.1 Why a separate LILYGO-OLED chapter? ……………………………………………………… 164
32.2 Hardware: OLED wiring (LILYGO T3 V1.6.1) ………………………………………………. 164
32.3 Board-Config in Code ………………………………………………………………………………… 165
32.4 Initialization: “OLED optional, system continues to run” ……………………………… 165
32.5 Demo Screen: Describe all 8 pages ……………………………………………………………… 165
32.6 Flicker-free update: change only the last line ……………………………………………….. 165
32.7 Difference from Chapter 31 (Heltec vs LILYGO) …………………………………………… 166
32.8 Typical Sources of Error (T3 V1.6.1) ……………………………………………………………. 166
32.9 Outcome of the chapter ……………………………………………………………………………… 166
32.10 Outlook: MeshRadio continues without OLED …………………………………………… 167
Author’s Note on OLED Displays ………………………………………………………………….. 167
Chapter 33 – Pro Level Stable ………………………………………………………………………………… 168
33.1 Why This Chapter Is Coming Now ………………………………………………………………. 168
33.2 What “pro-level stable” means technically …………………………………………………… 168
33.3 The Most Important Rule: Only One Radio Path ………………………………………….. 168
33.4 Airtime is the real opponent ………………………………………………………………………. 169
33.5 Rate limits are not a nice-to-have ……………………………………………………………….. 169
33.6 Retry Must Be Slow …………………………………………………………………………………… 170
33.7 Routing Must Be Sluggish ………………………………………………………………………….. 170
33.8 Forwarders don’t decrypt …………………………………………………………………………… 170
33.9 Stability Rules for New Features …………………………………………………………………. 170
33.10 Result ……………………………………………………………………………………………………… 171
Chapter 34 – Node Roles ……………………………………………………………………………………….. 171
34.1 Why Node Roles Are Necessary……………………………………………………………………. 171
34.2 Goal of Node Reels ……………………………………………………………………………………. 172
34.3 The Three Basic Roles ……………………………………………………………………………….. 172
Relay Node …………………………………………………………………………………………….. 172
Edge Node ……………………………………………………………………………………………… 172
Sensor Node …………………………………………………………………………………………… 173
34.4 Why the Mesh Immediately Becomes More Stable ……………………………………….. 173
34.5 Minimal Code Approach (deliberately small) ……………………………………………….. 173
34.6 Controlling Behavior …………………………………………………………………………………. 173
34.7 Why This Solution Is So Good …………………………………………………………………….. 174
34.8 Typical network structure (practice) …………………………………………………………… 174
34.9 Effects on Airtime ……………………………………………………………………………………… 174
34.10 Pro-Level Insight …………………………………………………………………………………….. 175
34.11 Conclusion of Volume 1 …………………………………………………………………………….. 175
34.12 Outlook (Volume 2) …………………………………………………………………………………. 176
Where LoRa mesh is used ………………………………………………………………………………… 176
Amateur Radio & Experimental Data Radio ………………………………………………. 176
Off-grid communication ………………………………………………………………………….. 177
Emergency and backup communication ……………………………………………………. 177
Sensor and telemetry networks (AIoT / IoT) ……………………………………………… 177
Industrial & Site Surveillance …………………………………………………………………… 178
Mobile mesh nets ……………………………………………………………………………………. 178
Field Testing & Radio Research ……………………………………………………………….. 178
What LoRa mesh is NOT …………………………………………………………………………. 179
Why MeshRadio is particularly interesting here ………………………………………… 179
Conclusion …………………………………………………………………………………………………………… 180
Feedback, Errata and Suggestions for Improvement ………………………………………. 181
Links used in the book: …………………………………………………………………………………………. 181