--- type: concept tags: [link, ble, redundancy, design, esp-now] updated: 2026-09-21 --- # Link Redundancy: wired + wireless Stated goal (user, 2026-09-21): connect B to A "through some serial or BLE, or maybe a combination of both as redundant in case the wired connection is lost." This page is the design space. **Nothing here is decided or verified** — every item is `(unverified)` unless labelled otherwise. ## Why redundancy matters more once B drives gauges Today a lost link only blanks a secondary display. Once B drives the cluster's tachometer and coolant gauge ([[patrol-gauge-outputs]]), a lost link means the driver's primary instruments go dead or, worse, freeze at the last value. The failover policy on B must therefore also define what the gauges do during an outage (drop to zero, hold with a warning, or sweep to a "no data" position). ## Transport options | Transport | Pros | Cons | Notes | |---|---|---|---| | **UART TTL, direct wire** (today) | trivial, 23 bytes @ 5 Hz is nothing | 3.3 V single-ended over a car harness is noise-prone and has no ground-offset tolerance | Fine on the bench; questionable in a vehicle over more than a few cm | | **RS485 pair** | differential, automotive-grade noise immunity, tens of metres; **A already has an SP3485 on its terminal block** | B has no transceiver — needs a 3.3 V MAX3485/SP3485 module on IO1 (+ a free GPIO if the module lacks auto-direction) | This may already be what is wired — see the physical-layer question in [[controller-link]] | | **BLE 5 GATT** (A = peripheral notifying, B = central) | both boards have BLE 5 `(source: waveshare-wiki-esp32-s3-lcd-1-3)`; connection-oriented, so B gets an explicit disconnect event; notify payload of 23 bytes fits one packet | connection setup/reconnect takes hundreds of ms to seconds; BLE stack costs RAM on both ends (NimBLE is the lighter choice on Arduino-ESP32); A's Core 0 already runs Wi-Fi scanning + CAN + UART, and Wi-Fi/BLE coexistence on one radio can add jitter | The user's stated candidate | | **ESP-NOW** | connectionless, ~ms latency, no pairing state, trivially broadcast the same 23-byte frame; both are ESP32-S3 so it is a one-call API | Wi-Fi-based, so it shares the radio with A's Wi-Fi scanning; no link-layer "disconnected" event — liveness must come from the existing 1 s timeout | Worth benchmarking against BLE before committing; simpler failover semantics | ## Failover design sketch 1. B keeps **one** packet consumer. Every transport (UART, BLE/ESP-NOW) feeds validated `automotive_data_t` frames into the same queue, tagged with a source id. 2. Deduplicate on `packet_id` + `timestamp_ms` (both already in the payload) so a frame arriving on both paths is applied once. 3. **Prefer wired** when both are alive; fall to wireless when the wired path has been silent > N ms (N smaller than the display's 1000 ms lost-link threshold, e.g. 400 ms = two missed frames). 4. Show the active source on the display (small glyph) so a silently degraded wire is noticed on the bench, not in traffic. 5. Gauge behaviour during a total outage is a separate decision → [[open-questions]]. A-side implication: A must transmit on both paths simultaneously, always — not "switch to BLE when UART fails", because A cannot tell that B stopped hearing it (the link is one-way). Simultaneous transmit is cheap at 5 Hz. ## Open decisions - BLE vs ESP-NOW for the wireless leg (latency, reconnect behaviour, RAM on A). - Whether the wired leg becomes RS485 end-to-end (probably yes if the run is longer than a dash-panel jumper). - Whether B should ever talk back (ACK/heartbeat) — would let A alarm on a dead B, at the cost of the current one-way simplicity. ## Related [[controller-link]] · [[patrol-gauge-outputs]] · [[esp32-s3-lcd-1-3]] · [[open-questions]]