Building WLED from Source
Most readers should flash a release (chapter 5). Building your own firmware is for when you want a compile-time option changed — a usermod included, a different default, a board the releases do not cover — or when you simply want to know the release binaries are what they claim to be. This chapter is the guide's lab notebook: it is the one chapter where everything described was done, on the record, for both chip families.
The shape of the build
WLED builds with PlatformIO, the
embedded build tool, driven by one file
in the source tree: platformio.ini.
It names 34 environments — one per
board family and variant (esp32dev,
esp32s3dev_8MB_opi, esp32_eth,
nodemcuv2, esp8266_2m, esp01_1m_full
…). Each environment pins its platform,
framework and partition table; the
project even pins a fork of the ESP32
Arduino platform (the Tasmota project's,
for its IPv6 support), which PlatformIO
downloads as an exact zip. The file's
default_envs is nodemcuv2 — build
with no target named and you get the
ESP8266 build.
Two more things happen inside every build, both worth knowing:
- The web UI is bundled first.
A pre-build script (
pio-scripts/build_ui.py) stops the build if Node.js is missing, installs the UI tooling withnpm ci, and runstools/cdata.js, which minifies and compresses the pages fromwled00/datainto the firmware's header files (chapter 2). Edit the UI, rebuild, and the device serves your UI — there is no other deployment step. - The image is named and filed.
A post-build script moves the finished
firmware to
build_output/release/under its release name —WLED_16.0.1_ESP32.bin— the same name the project's downloads use.
What the lab did
The lab cloned the project at tag
v16.0.1 (commit 29b389df, dated
2026-06-30), installed PlatformIO 6.2.0
in a Python virtual environment, and
ran, one at a time:
pio run -e esp32dev
pio run -e nodemcuv2
The first run downloads the platforms and toolchains — 1.7 GB of them landed in the lab's PlatformIO directory before the second build started. Timings on the lab's shared 2-CPU sandbox (about 17 minutes for ESP32, about 8 for ESP8266) say more about the sandbox than about your machine; the sizes are the portable facts:
ESP32 (esp32dev) |
ESP8266 (nodemcuv2) |
|
|---|---|---|
| Platform | Tasmota-fork espressif32 2024.06, Arduino-ESP32 2.0.18 (IDF 4.4.8) | espressif8266 4.2.1 (Arduino core 3.1.2) |
| RAM used | 81,512 of 327,680 bytes — 24.9% | 46,960 of 81,920 bytes — 57.3% |
| Flash used | 1,298,161 of 1,572,864 bytes — 82.5% | 931,527 of 1,044,464 bytes — 89.2% |
| Image file | 1,304,848 bytes | 935,680 bytes (691,589 gzipped, for OTA) |
| Result | SUCCESS | SUCCESS |
Read the flash lines properly. The
ESP32's 1,572,864-byte budget is one app
slot of the default partition table
(tools/WLED_ESP32_4MB_1MB_FS.csv):
two equal slots of 0x180000 bytes, so
an OTA update can be written alongside
the running firmware and swapped in —
plus about 960 KB of filesystem for
cfg.json and presets.json, which is
why settings survive updates. The
ESP8266's budget is a single ~1 MB
sketch space, and the same source fills
89.2% of it: the older chip is not just
slower, it is fuller, which is the
mechanical truth underneath chapter 3's
buying advice and the three reserved
effect slots "removed because of low
mem" in chapter 9.
Checking the result
A build that prints SUCCESS has made
an image; the lab also checked it was
the image (wled-lab/transcripts/t04…):
the Unix file tool identifies the
ESP32 output as a genuine ESP-IDF
application image (IDF 4.4.8, as
pinned), and strings finds the
release version, the effect names from
the source table (including the last
one, Slow Transition, with its full
metadata string in the ESP8266 image),
the RSVD placeholder, the filenames
/cfg.json and /presets.json, and
the documented WLED-AP / wled1234
defaults — the source's claims, present
in the binary that a board would run.
Changing things, honestly
Custom builds are where compile-time
flags live (WLED_… defines in
platformio.ini's common sections) and
where usermods — the community
add-ons in the source's usermods/
folder — get compiled in; there is even
a usermods environment that builds
the library of them for testing. Two
warnings from the shape of the thing:
your custom build is now your
release — its updater is you — and a
flag that grows the firmware past its
partition (watch the flash percentage;
the ESP8266 starts at 89.2%) produces a
build that succeeds and a device that
cannot take it. The percentage lines
are not decoration. They are the
chapter's whole lesson, printed by the
build itself.