Skip to content
PLEN
Abstract visualisation of servers, single-board computers and a job queue

Case study

How ESP32–SBC communication became smaller, faster and safer.

ESP32–SBC case study: latest-state telemetry, bit-packed frames, ACK/retry control and a local watchdog, with measured results of 75→28 B, 20→9 B and 30→60 Hz.

Kamil Kosiorek „Kosior”Author: — owner of Vis-Sol, author and process owner

Rev. 1 · 2026-08-21 · 09:30

Case study / embedded communication

A practical redesign of telemetry, control and spatial-data channels for a 30 Hz decision loop. The result was a 60 Hz loop, smaller messages and a local emergency watchdog.

75 → 28 B

20 → 9 B

30 → 60 Hz

Download Communication Kit ↓

IMU · encoder · range

SPI / GPIO

real-time I/O + watchdog

SBC / LINUX

planning + decision loop

PWM / CAN

local STOP on timeout

Three channels with different reliability and timing requirements.

Measured in one target architecture.

The values below describe this implementation and workload. They are not a universal network-latency guarantee for every ESP32, SBC, operating system or radio environment.

Initial state: one communication path for different jobs

Telemetry, control commands and larger spatial information shared assumptions about frequency and reliability. A telemetry frame was about 75 bytes, a control frame about 20 bytes, and the SBC decision loop ran at 30 Hz — one cycle every 33.3 ms.

fixed binary frame, sequence and timestamp

small reliable command with acknowledgement

from 33.3 ms to 16.7 ms per cycle

Diagnosis: reliability and frequency are not the same requirement

Fresh telemetry loses value quickly, so a late packet is often worse than a dropped one. A drive command is different: ordering and acknowledgement matter. Spatial data is heavier and changes more slowly. Treating all three streams identically created avoidable overhead and coupled independent failure modes.

No backlog: telemetry should deliver the newest state, not the history of a queue

In a real-time path, FIFO can preserve samples that are technically valid but already obsolete. If the receiver stalls briefly, replaying t−3, t−2 and t−1 only delays arrival at state t. An older telemetry sample may therefore be skipped so the receiver can operate on the newest valid frame.

Before: queue and replay

sample → serialize → queue → transport → queue → parse → decision

After: latest-state / no backlog

sample → current frame → transport → validate → current state

Latest value, sequence number and data age. Stale samples are not replayed.

Ordering, ACK and bounded retry. Commands are not treated like disposable telemetry.

Map / spatial data

A separate lower-rate stream prevents heavier transfers from blocking fresh state.

ESP32 to SBC communication architecture after the redesign
ESP32 to SBC communication architecture after the redesign

Rev. 1: freshness, reliability and update rate are separate protocol requirements.

ESP32 to SBC communication before and after removing telemetry backlog
ESP32 to SBC communication before and after removing telemetry backlog

Before and after: queued stale samples versus operating on the newest state.

Decision: separate the channels

High frequency, compact binary frame, sequence number and timestamp.

Small ordered messages with explicit acknowledgement and retry policy.

Larger payloads at a lower, independent update rate.

ESP32 enters a safe STOP state when valid control expires.

Fixed frames and bit packing: the parser reads offsets instead of interpreting message descriptions

The 75 → 28 B and 20 → 9 B reductions are not merely compression. The representation changed to a fixed binary frame with known-width fields and bit-packed flags. The receiver reads predictable offsets and validates version, sequence, timestamp and checksum.

READY, ERROR, LIMIT, ESTOP and SENSOR_OK can use individual bits instead of separate textual fields.

Marker, version, sequence, timestamp, flags, payload and checksum occupy predictable positions.

Fewer bytes, copies, serialization steps and parsing work on the critical path.

Fixed ESP32 to SBC binary frame with bit-packed flags
Fixed ESP32 to SBC binary frame with bit-packed flags

Fixed fields, bit flags and predictable offsets reduce parsing work.

Why the watchdog stays on the ESP32

The Linux computer can restart, stall or lose its link. The emergency reaction therefore cannot depend on the same path that may have failed. ESP32 tracks the age of the last accepted command and stops outputs locally after the configured timeout.

WATCHDOG / PSEUDOCODE

if (now_ms - last_valid_control_ms > CONTROL_TIMEOUT_MS) { drive_left = 0; drive_right = 0; state = SAFE_STOP; }

Result and interpretation

Smaller frames reduced serialization and parsing work, while independent channels prevented large or reliable transfers from blocking fresh telemetry. In the measured system, the decision loop increased from 30 Hz to 60 Hz. The key improvement was architectural: each data class received the transport and failure policy it actually needed.

Reference firmware, SBC code and protocol notes.

The attached package contains an Arduino example, a Python SBC package, tests, protocol documentation and a license. Review constants, pins and safety thresholds before use on hardware.

Download ZIP ↓

Four design rules

  • Separate fresh data from reliable commands.
  • Use compact, versioned binary frames.
  • Measure sequence, age and timeout.
  • Keep the final safe reaction local.

ESP32 firmware, Linux SBC application, telemetry, drive control, spatial data and a safe-stop watchdog.

Implementation questions.

No. It was selected for fresh telemetry where sequence and age are tracked and a newer packet is more useful than a delayed retry.

No. It is the measured result of this architecture and workload. Hardware, operating-system scheduling, transport and payloads must be benchmarked in the target system.

It is a starting point. Pins, framing, timeouts, validation and safe states must be adapted and tested for the actual device.

See also: Custom business applications

← All case studies

Is there a process that eats up your team's time?

Describe it in your own words. We will come back with a concrete first step, scope and price.