A few months before Christmas, social media channels start filling with instructions about LEDs for home decoration. Popular software is WLED, a program that describes itself as:
A fast and feature-rich implementation of an ESP8266/ESP32 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102!
In layman's terms, WLED is a wonderful piece of open source software that allows users to remotely control and pre-progam amazing displays of LEDS of any length. It does this through a web interface that's accessible to any browser on the same network - and can be implemented with components costing almost no money at all.
Most descriptions of hardware needed will be:
- an ESP32 or ESP8266 onto which the WLED code is flashed
- appropriate LEDs
- a power source.
If you're just running a short strip, power is not really a problem, but if you're extending to many hundreds (or thousands) of LEDS, wiring can be challenging. Voltage injection may be required somewhere along your strips, your project may draw heavy currents, and you always have to be wary of the 3.3v logic limitation of your ESP - compared to higher voltages of your LEDs.
To circumvent the complexity, a few companies offer pre-constructed controllers. Just add power to one side, LEDs to the other, and off you go. A popular one is the QuinLED LED Controller that comes in several varieties to run anything from a single strip, to a multichannel sound & light extravaganza. I started my own odyssey with the QuinLED-Dig-Uno when I got fed up with wires trailing all over my workbench.
You can buy controllers with WLED pre-flashed, but if you have ESPs lying around, you may want to go DIY. Today, it couldn't be easier - no longer do you need the Arduino IDE. Through a browser you can flash straight to your ESP in less than a minute..
This is where it gets interesting
If you're like me, you'll have some ESP8266s lying around the house, left over from the days before commercial companies entered the IoT arena. My board of choice is usually the Wemos D1 Mini because it's small, dirt cheap, and contains everything you need to get the job done. But before the dawn of the Wemos D1 and its ilk, I'd been using the ESP8266 01, that 8-legged temperamental little monster that's impossible to power, and offers a measly two GPIOs.
Then I came across this on AliExpress; a $1 device that purports to control WS2812 addressable LEDS straight from a ESP8266 01. Could it actually work?
I ordered a couple for $2 and waited on the Slow Boat from China.
While waiting, I got started on flashing WLED onto the ESP, using this very-convenient $2 programming board.
At the time, I wasn't aware that older (blue) ESP 01s have 512kB flash memory, and newer ones (black) have 1MB. I just plugged in what came to hand, and set the flasher running.
To cut a long story short, I couldn't get the 512kB to flash. Or rather, it flashed, but it wouldn't broadcast a WiFi access point.
This is the procedure that finally worked for me:
First I found a 1MB ESP in my old component box.
- I used WLED0.14.1ESP01.bin with the ESP in programming mode.
- Once flashed, get out of programing mode and searched for the ESP's WiFI access point.
- Once connected, a window will open to input WiFi credentials.
- I checked Force 802.11g because it's an old ESP 01, but don't know if it's necessary
- The ESP should restart with WLED on your network.
When the little boards arrived from Aliexpress, I checked their input voltage. Could I feed the board 5v without frying the ESP's 3.3v logic? Would the 5v board input drive the LEDs?
With both affirmed, I connected everything up and sat back in amazement. Here I was controlling a 120-LED strip of WS2812s on an ESP8266 01 through WLED. Excluding the strip, the components cost about $3!
Making it Portable
My next step was to see if it would work with a regular LiPo battery. As most readers know, their maximum voltage is generally 4.2v, a bit short of the needed 5v.
Here, I used one of the most useful boards I've come across. This TP4056 boost board not only controls the charge and discharge of your LiPos through a convenient micro USB, but also boosts output up to a purported 27 volts.
I harvested an 18330 battery out an e-cigarette and stuck the rechargeable battery, booster, and ESP inside a small project box. I now have a fully-portable WLED-controlled 120-LED strip that cost pennies to construct.