A lightweight web-based LED controller for ESP32 and ESP8266 boards.
It serves a clean browser UI from LittleFS, supports authentication, and exposes a small JSON API for state polling and control.
- Async web server for responsive control
- LittleFS-hosted UI with separate HTML and CSS
GET /statusJSON endpoint for current pin statePOST /updatefor LED toggling- mDNS discovery at
esp-led.local - ArduinoOTA support for wireless updates
- Standalone browser demo for quick presentation
If you just want to show the UI without hardware, run the local demo:
python preview_server.pyThen open:
http://127.0.0.1:8000/
The firmware:
- connects to Wi-Fi
- mounts LittleFS
- serves
index.htmlandstyle.css - returns LED status as JSON
- lets you update the pin from the browser
- keeps OTA and mDNS available on the same network
Returns the current LED state:
{"pin":2,"state":1}Sends a state change request to the device.
| Component | Connection |
|---|---|
| ESP board | Wi-Fi connected |
| LED | GPIO 2 |
| Resistor | 220Ω |
| Jumper wires | As needed |
Typical wiring:
GPIO 2 -> LED -> 220Ω resistor -> GND
- Arduino IDE or Arduino CLI
- ESP32 or ESP8266 board package
- Libraries:
ESPAsyncWebServerAsyncTCPfor ESP32 orESPAsyncTCPfor ESP8266
Put your Wi-Fi and auth values in config.h.
This project uses HTTP Basic Authentication over plain HTTP. That is fine for a trusted local network, but it is not encrypted. Do not expose it directly to the public internet.
main.ino— firmware and routesconfig.h— local secrets and settingsdata/index.html— web UIdata/style.css— UI stylespreview_server.py— local browser previewshowcase.html— standalone demo page
MIT