blog: Book shelf backlight

I wanted my bookshelf to have kind of a fireplace background lighting - slightly pulsing yellow-orange light:

I chose to separate the LED slats into 4 groups, 2 slats each, so that the maximum distance between the ESP32 data out and the last LED would be small and I wouldn’t run into problems due to the difference between nominal (5V) and actual (3.3V) data logic level.

I used a perfboard to hook up four 3-pin connectors to the ESP32, which itself rests in a socket rather than being soldered to the board. The LED slats get their power directly from the 5V and GND pins and their data from GPIOs 19, 18, 5 and 17 - all right next to each other. I flashed WLED to the ESP via the web installer, made it connect automatically to my WLAN, configured the 4 LED outputs at Config > LED preferences, made a preset for the fireplace animation, et voila, done.

I can now control the book shelf backlight via smartphone or computer command. For the latter I also configured a convenient mDNS name (Config > WiFi Setup). I can then post partial JSON of the desired state to that address:

curl -X POST http://bookshelf.local/json -d '{"on":true, "ps":1}' -H "Content-Type: application/json"

… which turns on the LEDs and switches to preset 1.

Posted in diy
2023-08-09 20:28 UTC