Skip to main content
Back to projects

Autonomous Drone Mesh DTN: Disaster Response System

An offline-first, dual-radio Delay-Tolerant Networking (DTN) drone platform delivering zero-install survivor triage, cryptographically signed store-and-forward sync, and live flight control without cloud or cellular networks.

Verified results and performance

106 PassedBackend pytest suiteMulti-node sync conflicts, local_seq clock skew, boot_id replay guard, HKDF auth & rate limiting
138+ PassedFlutter & Dart tests94 GCC desktop, 23 emergency mobile, 21 shared client + PTY hardware simulations & Rescue suite
0Cloud Dependency100% edge-native Raspberry Pi 4 compute with SQLite WAL store-and-forward replication
SecuredDefense-in-Depth IsolationHKDF-SHA256 key separation, Fleet-CA cert pinning, open HTTP captive portal & MAVLink firewall

Project details

Role
Embedded & Full-Stack Systems Engineer (Final-Year Project, Team of 4)
Timeline
2025 to 2026
Tracks
embedded, software

Technologies and skills

TLSFirewalls & ACLsSQLitePythonDartRaspberry PiFlutterGitLinuxBLEApplied Cryptography (RSA, AES, Diffie-Hellman, HMAC)LoRaFastAPI

Abstract

In post-disaster scenarios (earthquakes, floods, landslides), cellular base stations collapse and GPS locks fail under dense canopy or rubble. Aero-Link is an offline-first Delay-Tolerant Drone Mesh Network (DTN) running on UAV-mounted Raspberry Pi 4 edge nodes (DRONE_A, DRONE_B, DRONE_S). Rather than single-radio AP/client time-slicing or complex multi-hop routing (802.11s), Phase 2 isolates an always-on 5 GHz user Access Point (wlan0) from a 2.4 GHz AR9271 IBSS ad-hoc cell (wlan1, fixed BSSID 02:12:34:56:78:9A), allowing victims to stay connected uninterrupted while drones exchange signed UDP presence beacons and pull-sync deltas over HTTPS. To survive GPS-denied clock jumps and out-of-order reboots, replication uses monotonic local_seq cursors and boot_id beacon epochs alongside HKDF-SHA256 purpose-separated keys (K_MSG, K_SYNC, K_TOKEN) and Fleet Root CA pinning. Hardware nodes pair a Seeed Studio XIAO ESP32-C3 aux module (INA3221 bidirectional dual-battery sensing, TinyGPS++, NimBLE AD Type 0x07 discovery, RFM95 915 MHz LoRa watchdog fallback) with a live CC3D MAVLink gateway on DRONE_S, operated through three offline-first Flutter applications (GCC desktop, Rescue App, Emergency App).

The physical System Drone (DRONE_S) quadcopter equipped with Raspberry Pi 4 compute core, external antenna, GPS module, and dedicated battery power.
The physical System Drone (DRONE_S) quadcopter equipped with Raspberry Pi 4 compute core, external antenna, GPS module, and dedicated battery power.
Slide 1 of 7The Spark: From Phase 1 Time-Slicing to a Phase 2 Clean Rebuild
Section 01

The Spark: From Phase 1 Time-Slicing to a Phase 2 Clean Rebuild

1 of 7

In post-disaster scenarios such as earthquakes, floods, and landslides, cellular base stations lose power or backhaul connectivity while dense canopy and rubble block GPS signals. Trapped civilians cannot install apps or bypass TLS warnings, and rescue teams operate blind across disconnected field sectors.

Phase 1 proved end-to-end message propagation across Raspberry Pi nodes, but exposed seven severe architectural limits: cycling a single Wi-Fi radio between Access Point and client modes kicked connected victims off Wi-Fi for ~40 seconds every cycle, sync failed if two nodes entered client windows simultaneously, field reports never replicated, and Bluetooth inquiry scanning failed to wake civilian phones.

"In a disaster zone, connectivity honesty and zero-drop user access matter more than assuming real-time links exist everywhere."

Instead of patching stale state, Phase 2 executed a clean scripted rebuild from blank SD cards featuring dual-radio networking, clock-independent DTN sync, layered edge security, a unified ESP32-C3 hardware aux module, a live MAVLink control gateway, and a cross-platform Flutter suite.

System drone quadcopter

The physical System Drone (DRONE_S / AeroSync 5) 225 mm quadcopter carrying a Raspberry Pi 4 companion computer and dual AR9271 radios.

Scroll down or tap to advance
Section 02

Dual-Radio Networking & System Architecture

2 of 7

Each drone node runs the exact same software image, specialized only by per-node config files (DRONE_A, DRONE_B, DRONE_S). Crucially, each node separates user access and inter-drone synchronization onto two physically distinct Wi-Fi interfaces:

  • Why IBSS Over 802.11s and AP/Client Cycling (Decision D2): Because the Raspberry Pi 4's onboard brcmfmac chip does not support IBSS mode, an external AR9271 (ath9k_htc) USB adapter handles the 2.4 GHz IBSS cell (RESCUE_DTN, pinned BSSID 02:12:34:56:78:9A so split cells never form), leaving onboard wlan0 dedicated permanently to the 5 GHz victim/rescuer AP (RESCUE_x). Complex 802.11s + BATMAN-adv multi-hop routing was deliberately rejected as unnecessary failure-mode overhead for a three-node DTN fleet.
  • Honest Connectivity Model: The Ground Control Center joins one node in range (https://10.42.0.1:8443) and never fabricates live global state. Every UI surface explicitly renders data freshness (formatAge()) reflecting the last successful DTN sync or fallback LoRa beacon.
Text17 lines
  Civilian Phone / Rescue Phone / GCC Desktop
         │
         │ (Always-on 5 GHz AP: RESCUE_A/B/S @ 10.42.0.1)
         ▼
+-------------------------------------------------------------------+
|  UAV EDGE NODE (Raspberry Pi 4 Model B)                           |
|                                                                   |
|  wlan0 (onboard brcmfmac) -> Permanent 5 GHz User AP (10.42.0.1)  |
|  wlan1 (AR9271 ath9k_htc) -> 2.4 GHz IBSS Cell (10.99.0.1/.2/.3)  |
|  aux   (XIAO ESP32-C3)    -> INA3221, TinyGPS++, NimBLE, RFM95    |
|  fc    (DRONE_S only)     -> CC3D Serial <-> UDP :14550 MAVLink   |
+-------------------------------------------------------------------+
         │
         │ (2.4 GHz IBSS Ad-Hoc Cell: RESCUE_DTN, Ch 6 / 2437 MHz)
         │ (Fixed BSSID 02:12:34:56:78:9A prevents IBSS split-cells)
         ▼
   [ Neighboring Drone Nodes (Store-and-Forward HTTPS Pull Sync) ]
Three-layer system architecture

System architecture spanning Civilian Access, Dual-Radio Drone DTN Mesh, and Ground Control / Rescue operations.

Scroll down or tap to advance
Section 03

Distributed Systems & Clock-Independent Sync

3 of 7

Maintaining consistent shared state across intermittently connected drones in GPS-denied terrain required solving three core distributed systems failures:

1. Monotonic Sequence Replication (local_seq) vs. Wall Clocks

  • The Problem: Raspberry Pi 4 nodes lack battery-backed Real-Time Clocks (RTC). In GPS-denied indoor or jungle zones, nodes boot to epoch dates (1970) or stale fake-hwclock times before acquiring GPS fixes. Legacy WHERE local_ts > cursor synchronization silently dropped victim messages created during backward clock jumps.
  • The Solution: Upgraded sync_engine.py and SQLite schema v3 to track per-table monotonic sequence cursors (local_seq) locally per node (GET /sync/<table>?since_seq=...). Nodes replicate every new row deterministically regardless of wall-clock skew, while keeping signed origin timestamps (updated_at) for semantic conflict resolution and marking pre-fix timestamps as relative (time_source = 'relative').

2. Boot-Session Epochs (boot_id) on Signed UDP Beacons

  • The Problem: Signed UDP presence beacons on port 48555 (10s broadcast interval) use monotonic counters to block replay attacks. However, when a drone rebooted and reset its counter to 1 while peers had already recorded counter 500, peers permanently rejected all beacons as replays until databases were wiped.
  • The Solution: Added a per-boot boot_id UUID alongside the counter inside canonical HMAC verification (_beacon_payload_canonical). Peers still reject duplicate/older counters inside the active epoch, but seamlessly reset the peer replay window when a valid signed beacon presents a new boot_id.

3. Per-Table Conflict Resolution & Selective Non-Replication

All replicated tables (messages, personnel, personnel_locations, announcements, gs_messages, checkins, message_replies, lora_events) are registered centrally in REPLICATED_TABLES with per-table error isolation:

  • messages: CLAIMED strictly overrides NEW; ties between dual offline claims resolve deterministically to the earliest signed claimed_at.
  • personnel: REVOKED permanently overrides ACTIVE across all hops to lock out compromised responder accounts immediately.
  • message_replies: Indexed by victim_device_id and replicated fleet-wide so a victim who switches drones on a second pass still receives replies written earlier.
  • lora_events vs. node_health: LoRa fallback receptions derive their primary key deterministically from frame content + listening node_id so two drones hearing the same downed drone produce two corroborating evidence rows without duplicating on re-sync. Meanwhile, node_health is deliberately not replicated so stale self-opinions never poison live fleet health; DEGRADED status is always derived from fresh evidence (FALLBACK_EXPIRY = 120s) rather than permanently latched flags.
Scroll down or tap to advance
Section 04

Layered Edge Security Architecture

4 of 7

Designed around an explicit threat model across isolated trust boundaries with zero cloud identity dependencies:

  1. HKDF-SHA256 Purpose Key Separation (crypto_keys.py): Derives three cryptographically isolated 256-bit keys (K_MSG, K_SYNC, K_TOKEN) from one deploy-generated NODE_MASTER_SECRET (salt="rescue-mesh-phase2-v1"). Compromising an inter-node header (X-Node-Auth) cannot forge victim triage records or mint responder tokens.
  2. Fleet Root CA Pinning: deploy/make_fleet_ca.sh generates a fleet Root CA and per-node TLS certificates for HTTPS port 8443. All Flutter clients embed the Root CA via RescueMeshClient in shared_dart and fail closed against evil-twin access points.
  3. Network Segregation (HTTP :80 vs. HTTPS :8443) & Privacy: http_app.py serves captive portal detection probes (RFC 7710), form intake, and /area-map (returning positions only, stripping content and user IDs) over plain HTTP so panicked civilians face zero TLS warning friction, while signing every ingested record with K_MSG at write time.
  4. Stateless Offline Responder Auth & Carried QR Enrolment: POST /auth/login verifies 16-byte salted PBKDF2-SHA256 (100,000 iterations) PIN hashes via hmac.compare_digest and mints K_TOKEN-signed tokens (base64url(payload).hmac), validated locally on any drone even before sync converges (session_clock tolerates clock offsets via local monotonic deadlines). Field rescuers issued credentials at Drone A can carry their HMAC-signed record in a QR code and self-enrol at an unsynced Drone B via POST /enrol (ingest_personnel).
  5. Anti-DoS Rate Limiting & Log-Injection Defense: ratelimit.py enforces thread-safe sliding-window per-IP and global write caps (GlobalLimiter) to withstand MAC/DHCP-spoofing floods on the open captive portal. audit.py passes every external string (SOS messages, LoRa payloads) through _SanitiseFilter, escaping non-printable control characters (\x00-\x1f, \x7f) to keep the shared audit log tamper-proof and grep-safe.
Scroll down or tap to advance
Section 05

Edge Stack, ESP32-C3 Aux Hardware & System Drone

5 of 7

On every Raspberry Pi 4 node running SQLite in WAL mode (PRAGMA journal_mode=WAL), dedicated systemd daemons manage each boundary cleanly:

  • Seeed Studio XIAO ESP32-C3 Aux Module (firmware/aux1/src/main.cpp):
    • Symmetric Watchdog State Machine (INIT -> NORMAL <-> FALLBACK): Monitors Pi keep-alive pings over native USB CDC serial. After 15 seconds of Pi silence (following startup grace), transitions into FALLBACK and beacons compact FB| pipe-delimited frames (carrying node_id, GPS fix, battery, and flash-cached last SOS summary) over RFM95 LoRa (915 MHz, SF7, BW 125 kHz) every 30s; recovers cleanly back to NORMAL after 3 consecutive Pi pings (15s hysteresis) so transient daemon restarts never permanently trap a healthy drone.
    • INA3221 Bidirectional Sensing & Bench Hardware Fixes: Monitors two flight battery packs (0.100 ohm shunts) separating charging (current < 0) from discharging (current > 0) via compiler-safe explicit 13-bit mask/subtract sign extension (ina13Bit()), with NVS-persisted channel presence flags (battAPresent/battBPresent) eliminating phantom ~4.18 V readings on unwired floating channels. Bench debugging also caught and documented moving LoRa SPI MISO from D9 to D0 (GPIO2) and placing the fixed 128-bit NimBLE UUID (2b57461c-1c04-49c4-944a-13643c1618da) in AD Type 0x07 complete-services list so phone background BLE scanners reliably wake on nearby drones.
  • System Drone DRONE_S (mavlink_gateway/mav_gateway.py):
    • Fitted with a second AR9271 adapter so it participates as a full IBSS mesh peer while bridging raw MAVLink bytes bidirectionally between its CC3D Open Revolution Mini flight controller serial port and UDP :14550. Commands are strictly live (never store-and-forwarded), reachable either directly (10.42.0.1:14550) or relayed over the mesh through volunteer nodes (10.99.0.3:14550), firewalled via nftables, heartbeat-gated (linkFresh < 2s), and bench-verified props-off via DO_MOTOR_TEST and force-disarm (21196).
Text8 lines
deploy/systemd/ Service Units:
  dtn-net.service               Brings up wlan1 AR9271 IBSS cell (RESCUE_DTN)
  rescue-portal.service         http_app.py on HTTP :80 (CAP_NET_BIND_SERVICE)
  rescue-mesh-api.service       api.py on HTTPS :8443 (Fleet-CA TLS + Auth/Sync)
  rescue-mesh-sync.service      sync_daemon.py (UDP :48555 beacons + pull sync)
  rescue-mesh-auxbridge.service aux_bridge.py (115200 USB CDC JSON <-> ESP32-C3)
  rescue-mesh-mavgw.service     mav_gateway.py (DRONE_S CC3D serial <-> UDP :14550)
  rescue-mesh-firewall.service  nftables rules locking down internal ports
Captive portal detection and submission flow

Zero-install victim portal: RFC 7710 captive detection, plain HTTP guidance, and signed local SQLite persistence.

Scroll down or tap to advance
Section 06

Cross-Platform Flutter Client Suite & Mission Layer

6 of 7
  • shared_dart: Unified models (BatteryState, SessionClock, ConversationThread) and Fleet-CA pinning HTTP client shared across all three Flutter apps.
  • Ground Control Center (gcc_app, Desktop):
    • Offline MBTiles Tactical Map & Explicit Modes: Prevents accidental taps during high-stress ops; hides unapproved AI plan drafts from the live operations overlay by safety invariant (draft_visibility_test.dart).
    • Mission Layer & Fleet Simulator: Models MissionState, validates mission placements against UAV specs + radio reach (MissionValidator), supports an OpenAI-compatible tactical advisor returning JSON validated before operator approval, and runs both REAL (DRONE_S MAVLink with SYS_STATUS battery watchdog) and DEMO fleet lifecycles (enforcing a 1.5x return-to-home battery reserve auto-RTL rule).
  • Rescue Team App & Emergency App (rescue_app, emergency_app):
    • Rescuers scan HQ credentials via QR (handling noisy arbitrary barcodes gracefully), push foreground GPS heartbeats, claim survivor tickets, and exchange multi-hop replies.
    • Civilians use local BLE drone proximity radar (with per-drone cooldown deduplication) and dynamically fetch /portal-options synced by content fingerprint from whichever node is in range.
Ground Control Center live feed

Ground Control Center desktop UI displaying fleet status, victim distress queue, and tactical operations map.

Flutter mobile applications

Flutter mobile clients: Rescue Personnel dispatch workflow, BLE drone scanner, and Emergency civilian check-in UI.

Scroll down or tap to advance
Section 07

Automated Verification & Hardware Simulation

7 of 7
Suite / ModuleToolingVerified CoverageKey Invariants Verified
Node Backend (backend/tests/)pytest106 passedlocal_seq clock-skew immunity, boot_id epoch transitions, CLAIMED/REVOKED precedence, HKDF token verification, GET /area-map anonymization, audit log sanitization (test_audit_sanitise.py), sliding-window DoS caps.
GCC Desktop (gcc_app/test/)flutter test94 passedUnapproved AI plan invisibility, MAVLink binary command framing, fleet 1.5x RTH reserve math, mission range/battery feasibility checks, UI empty/gated smoke coverage.
Emergency & Shared (emergency_app/, shared_dart/)flutter test, dart test44 passed (23 + 21)BLE AD payload parsing & cooldown logic, local location ring buffer, offline clock-skew session deadline checks, signed bidirectional BatteryState classification, plus live backend client tests.
Hardware & Multi-Node Integration (tools/)PTY serial, bash loopbackInteractive scriptstools/aux_bridge_pty_test.py & tools/mavgw_pty_test.py validate USB/FC serial framing and MAVLink read-only tapping without hardware; tools/local_two_node_test.sh runs two isolated backend nodes on loopback to assert full DTN convergence.

Discuss this project

Have questions about the architecture or design decisions?

Contact Dineth

Dineth Anjitha

Computer engineering graduate

University of Ruhuna, Sri Lanka

© 2026 Dineth Anjitha

First-party analytics only. No third-party trackers.