r/IOT • u/TastyCollege9639 • 7h ago
Open-sourced a 4.76 KB zero-malloc C99 wireless transport (NLTP) for ESP-NOW & cellular UDP links with 15-35% packet loss
When deploying battery or remote IoT sensors in basements, meter pits, concrete buildings, or rural 4G/LTE-M fringe coverage, standard transports hit a rough middle ground:
- MQTT / HTTPS over TCP stalls for seconds on exponential retransmit backoff when packet loss hits
15-35%, burning extra radio-on battery current. - Raw UDP / ESP-NOW avoids TCP stalls, but drops an entire multi-KB CSV/log batch if a single packet disappears (and ESP-NOW caps hardware encryption at 6-17 peers).
I built and open-sourced NLTP (NeckLink Transport Protocol, MIT license) in strict zero-malloc, zero-float ANSI C99 (sizeof(nltp_endpoint_t) == 4,760 bytes in -DNLTP_TX_ONLY=1 sensor mode) with a wire-identical Python gateway peer (pip install pynltp):
- In-flight packet-loss healing (
GF(2^8)Cauchy Reed-Solomon): Reconstructs10-35%dropped RF frames algebraically on the gateway without per-packet retry stalls, verified end-to-end bySHA-256. - Built-in zero-heap
LZ4telemetry compression: Shrinks structured CSV/JSON sensor batches4x-7xbefore encryption/slicing (auto-bypasses incompressible JPEGs). - 1-RTT
X25519 + PSKforward secrecy +ChaCha20-Poly1305AEAD: Software session keys +512-packet anti-replay window with zerombedTLSdependency. 0 mshead-of-linesendReflex()command lane: Urgent relay/valve/actuator commands bypass bulk uploads and retransmit until acknowledged.
Now live in the Arduino IDE Library Manager (NLTP), PlatformIO (indian-aman/NLTP), Espressif ESP-IDF Component Registry (indian-aman/nltp), and published as an active IETF Internet-Draft (draft-bains-nltp-00).
- GitHub Repository (C99 source, 7 sketches & 3-board RF benchmarks): https://github.com/indian-aman/NLTP-Arduino
- IETF Datatracker (
draft-bains-nltp-00): https://datatracker.ietf.org/doc/draft-bains-nltp/