Skip to content

The Moving Parts

WLED is one program, but it helps to picture it as five parts that each hold one kind of truth. When something surprises you later — a setting that survived a reboot, an effect that looks different on two strips — one of these parts is responsible.

The firmware itself

Everything runs from a single firmware image on the chip's flash memory. This guide's lab compiled that image from source (chapter 13), so its size is a measured fact, not a brochure number: the download you flash is a .bin file of about 1.3 MB for ESP32 — chapter 13 gives the exact figures for the two boards it built. The firmware contains the web server, the effect engine, the network code, and the web pages themselves, all baked in. There is no separate "app" on the device.

The effect engine

The heart of WLED is a library called WS2812FX, which is the part that decides, dozens of times a second, what colour every LED should be right now. It owns the effect list, and the list is long: the source code's effect table has 220 slots. Of those, 216 hold a real effect you can pick — the rest are slots deliberately left empty, marked RSVD in the code, so that the numbering never shifts and a preset saved years ago still points at the effect it meant. Three of the empty slots (numbers 169, 170 and 171) are old 2D effects the source says were removed and "should be added back".

Effects are not just names. Each carries a small line of metadata describing its controls. The one for Blink reads, in the source:

"Blink@!,Duty cycle;!,!;!;01"

The name, then the sliders it offers (speed, a duty-cycle control), then its defaults. The web page and the phone app build their sliders from these strings — which is why every controller for WLED shows the same controls for the same effect. Chapter 9 is about effects and the 72 built-in colour palettes.

The buses: outputs to the strips

A bus is one output: a pin, a strip type, a count of LEDs, a colour order. WLED can run several buses at once — up to 3 outputs on an ESP8266 and up to 10 on an ESP32. The bus manager also keeps the power books: it estimates how much current the current picture would draw (its built-in estimate assumes 55 mA per LED at full white) and feeds the automatic brightness limiter, which dims everything rather than let the total pass the budget you set. That budget ships at 850 mA — chapter 4 explains why you will change it.

The filesystem: cfg.json and presets.json

Settings are not scattered through the firmware. They live in a small filesystem (called LittleFS) in the flash, in plain JSON files you can read, back up, and restore:

  • cfg.json — the device settings: its name and mDNS address, your Wi-Fi network, the access point it offers when it cannot connect, the hardware setup (how many LEDs, on which pins, the power budget), the sync and integration switches, timers, and the update password. Chapter 13's lab notes list its real keys, read from the code that writes it. Treat the file as a secret: it holds what the firmware needs, including network credentials in recoverable form.
  • presets.json — your saved looks. Up to 250 presets, each one a stored copy of the light's state (or, for macro presets, an API command to run). Chapter 10 takes it apart.

Because the truth lives in files, backing up a WLED device is copying two files — the built-in filesystem editor at /edit is one way to reach them.

The web pages, baked in

The control page you open in a browser is not fetched from the internet. It is a set of ordinary web files — in the source they live in a folder called wled00/data (index.htm and friends, plus a dozen settings_*.htm pages) — that are compressed at build time and packed into generated C header files — html_ui.h, html_settings.h and html_other.h for the main pages, with sibling headers for the side rooms — inside the firmware. In this guide's build, the main control page's source (203 KB of HTML) minified and compressed to under 40 KB on its way in. The build script that does this (tools/cdata.js) runs on every compile, including this guide's. It is also why the interface works with the internet cable pulled: the page was already in the chip.

The doors in

The last part is the set of ways to talk to a running device: the web page and the phone apps (which use the same doors), the JSON API (chapter 11), an older one-shot HTTP API, MQTT messages, sync messages between WLED devices, and realtime protocols fed by other software. They all end at the same state machine — which is why a change made in any one of them shows up in all the others.