Technology Apr 18, 2026 · 6 min read

Why Does Your LED Installation Feel Disconnected?

Why Does Your LED Installation Feel Disconnected? You spend three weeks building the installation. Fifty ESP32 boards. Fifty LED strips. Every board programmed, every strip tested. You hit run. The waves move across the first ten boards in perfect sync. Then the delay kicks in. By board...

DE
DEV Community
by 張旭豐
Why Does Your LED Installation Feel Disconnected?

Why Does Your LED Installation Feel Disconnected?

You spend three weeks building the installation.
Fifty ESP32 boards. Fifty LED strips. Every board programmed, every strip tested.
You hit run.

The waves move across the first ten boards in perfect sync.
Then the delay kicks in.
By board thirty, your "wave" has become a "stagger."
By board fifty, it looks like chaos.

This is not a code problem. It is a distributed systems problem.

Working vs Synchronized

A single ESP32 running one LED strip is predictable. You control the timing, you control the refresh rate, you control everything.

Fifty ESP32 boards are fifty independent systems. Each has its own clock. Each has its own WiFi latency. Each has its own interrupt latency from handling other tasks.

The moment you go from one board to many, every assumption from single-board development breaks.

Why Single-Board Thinking Fails

When you program one ESP32, you think in loops and delays. delay(100) gives you 100ms of certainty.

With fifty ESP32 boards, delay(100) gives you 100ms plus/minus up to 500ms of clock drift between boards.

The reasons:

Clock drift. Every ESP32 has a slightly different crystal oscillator frequency. After running for an hour, two boards can be off by 50ms or more. Your "simultaneous" animations are now playing at different speeds.

WiFi latency variance. UDP broadcast might deliver in 5ms on a good day, or 150ms under load. TCP guarantees order but adds 20-40ms per hop. Neither is predictable enough for sub-frame sync.

Interrupt latency. When board 23 is handling a sensor read or processing MQTT messages, its LED refresh cycle gets delayed. You see this as a "stutter" that moves unpredictably across the installation.

Single-board programming gives you the illusion of control. Multi-device installations take that illusion away.

Three Architectures for Multi-Device Sync

LED matrix project with colorful animated display, real maker installation
Photo by LED Architectural Machine project via Hackster.io

Architecture 1: Master Clock Broadcast (WiFi UDP)

One ESP32 is the master clock. It broadcasts a time-synchronized pulse over UDP every frame boundary.

All other boards listen for the pulse and start their animation frame on receipt.

Master ESP32 → [UDP broadcast: "frame 1234"] → All slave boards
Slave boards receive → start frame 1234 simultaneously (±1ms)

Best for: Installations where all boards are on the same WiFi network, under 30 devices, latency tolerance of 10ms.

Weakness: WiFi is not real-time. Under heavy network load, you get jitter.

Architecture 2: Wired Bus with Shared Clock

Use a hardware bus (RS485 or custom single-wire protocol) that carries both data and a shared clock signal.

All boards derive their timing from the same physical clock edge. Drift becomes physically impossible.

Master ESP32 → [Clock + Data on RS485 bus] → All boards see same edge

Best for: Installations where wired infrastructure is acceptable (permanent installations, stages, architectural lighting). 100+ devices with sub-millisecond sync.

Weakness: Requires additional hardware and wiring. Not suitable for temporary or wireless installations.

Architecture 3: Per-Device Timing Compensation

Each board maintains its own clock but periodically re-syncs to a master time source using NTP or custom time packets.

Between sync intervals, boards run free and compensate based on measured drift rate.

Board 23: clock drift = +3ms/hour, compensate by subtracting drift
Board 41: clock drift = -7ms/hour, compensate by adding drift

Best for: Large-scale installations (100+ devices) where you cannot achieve tight enough sync with pure broadcast. Achieves 5-15ms accuracy across 500+ devices.

Weakness: More complex code. Requires drift measurement and compensation logic.

The Latency Trap

Here is the trap most makers fall into:

They measure latency from the master to board 1 (5ms) and assume this is the system latency.

It is not. The system latency is the latency to the slowest board, under worst-case conditions.

When WiFi congestion hits, board 1 still gets 5ms. Board 50 gets 180ms.

Your installation was designed for 60fps (16.6ms per frame). At 180ms latency to the slowest board, you are effectively running at 5fps — and it looks broken.

The fix: design for the worst case, not the average case.

This means:

  • Choose your sync architecture based on the maximum device count, not the typical count
  • Test under load (run the WiFi router at full bandwidth while testing)
  • Build in 2-3x the latency margin you think you need
  • Consider a watchdog: if a board hasn't received a sync pulse in 2x the expected interval, put it into a safe state rather than letting it drift indefinitely

FAQ

Q: WiFi MQTT vs UDP broadcast vs wired sync — which is best for large installations?

A: Under 30 devices on a dedicated WiFi network, UDP broadcast is simplest and achieves 5-10ms sync. Over 30 devices or on shared WiFi, wired RS485 bus becomes worth the infrastructure cost. MQTT is useful for coordination (start/stop/scene change) but too slow for frame-level sync. The architecture choice depends on your installation's permanence and scale.

Q: How do I measure and compensate for latency differences between devices?

A: Add a ping/response measurement from master to each slave at startup and periodically during operation. Record round-trip time, divide by 2 for one-way latency. Store per-device latency offsets and subtract them from each device's timing. For RS485 or wired bus systems, measure from clock edge to data latch at each board using an oscilloscope or logic analyzer — you want to measure physical timing, not estimated timing.

The Next Step

Before you scale to fifty boards, start with two.

Connect two ESP32 boards over UDP. Run the same animation on both. Use one as master, one as slave. Measure the actual sync accuracy with a high-speed camera (120fps or higher).

If you cannot get two boards to sync within 10ms, fifty boards will not save you.

Design for the experience first. Get the two-board baseline right. Then scale.

Product recommendations for multi-device LED installations:

ESP32 Dev Board (×50 for large installations) — The foundation. Pick one with stable WiFi and adequate GPIO. (Amazon)

RS485 TTL to RS-485 Module — For wired bus architecture. Enables long-distance, noise-immune communication between boards. (Amazon)

5V 10A LED Power Supply (×2 for 50+ board install) — Large installations draw serious current. Budget 10A per 300 LEDs, and plan for voltage drop across long cable runs. (Amazon)

I earn from qualifying purchases.

Article #002, 2026-04-18. Content Farm pipeline, Run #002.

DE
Source

This article was originally published by DEV Community and written by 張旭豐.

Read original article on DEV Community
Back to Discover

Reading List