Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.
In this guide, I will be showing you how to use dumb LED strips, i.e., non-individually addressable options, with ESPHome. LED strips with just two pins can't be controlled in the same way as the popular WS2812B and SK6812 chips, instead you will need to rely on pulse-width modulation (PWM).
Using individually addressable LED strips for accent lighting is a fun thing to do. Having them display every colour imaginable and even animating them using the options in ESPHome can really liven up a smart home. However, most of these LED strips have a downside, which is why many avoid them as their main lighting: their light quality isn’t superb. For some people, that can be an absolute deal-breaker.
Then there’s also the fact that colourful lights are mostly nothing more than a gimmick. Once you’ve played around with the colours for a couple of nights, you are more than likely to just stick them to white. That’s a problem too because RGB strips which don’t have a white channel aren’t capable of displaying a very nice white colour, which makes them an eyesore when used for the main lighting. That is why many don’t go for the flashy RGB strips and use just plain white LED strips with a high CRI.
The colour rendering index (CRI) of an LED strip is a measure of the ability to reveal the colours of various objects faithfully in comparison with an ideal or natural light source. As a result, it is absolutely crucial to have lights with a high CRI (usually 95+) for video and photography work. And some generally like having good quality light in their home because it makes things look more natural.
The problem with high CRI LED strips
Most addressable LED strips, such as those containing the popular WS2812B or SK6812 chips, won’t list their CRI. That is because it likely isn’t very high and the producer hasn’t even bothered to measure it to reduce the price even further. That is a trade-off you have to live with when buying cheap addressable LED strips. There aren’t many high CRI addressable LED strips, and those that do exist don’t come cheap. YUJILEDS, who make LED products for video and photography work, is a provider of such strips and just 5 meters will cost you around $300.
Luckily, there is an alternative. “Dumb” or traditional LED strips don’t allow you to individually address the LED chips and on their own can’t be dimmed (there are ways around the latter issue, as you’ll see further on). They only have two pins to deliver power and none for commands. The other issue is that these lights will only ever display a single colour temperature, so you can’t adjust it as the sun goes down. But you will find loads of traditional LED strips with a high CRI available for sale at reasonable prices.
In certain places, such as the kitchen, you will never need a light which can change its temperature. And for those places, a high CRI traditional LED strip is the best light source.
Dimming traditional LED strips using ESPHome
There are two ways of dimming traditional LED strips: you can either use a voltage regulator and reduce the voltage to dim the LEDs, or you can use pulse-width modulation (PWM). I’m not confident if there is a way of easily implementing voltage regulation using ESPHome, but PWM will work without any hiccups.
Voltage regulators will also produce a lot of heat, meaning that they need to be cooled either passively or actively. PWM works by very rapidly turning the LED strip on and off (pulsing). You can adjust the brightness level by adjusting the percentage of the time the LEDs are on to the time they are off.
That nicely brings us to today’s featured ESPHome project. Why reinvent the wheel when someone has already done what you are trying to do? GitHub user eoncire built themselves some nice under-cabinet lighting in their kitchen using high CRI traditional LED strips which are controlled by an ESP32. The firmware for the ESP32 was, of course, written using ESPHome.
What you need to control high CRI LED strips
This project requires a few parts. Besides the usual equipment needed for electronics projects, such as a soldering iron, you will also need an ESP32, a MOSFET, and a resistor. I will list some of the gear which can be used for this ESPHome project below.
An ESP32 board is used for this ESPHome project for two good reasons: many ESP32 boards will have a voltage regulator onboard, allowing it to be powered off of a 12V power supply. As the LED strip also needs 12V, the same power supply can be used without a down-regulator relator for the strip and the ESP32 board.
Another advantage the ESP32 has over the ESP8266 is that the PWM output on the ESP32 is hardware-based. Additionally, multiple GPIO pins on ESP32 boards are PWM capable, so you can use the same board for multiple zones.
A MOSFET to handle PWM pulses
The next piece of hardware needed is a MOSFET. MOSFETs work as a switch, the MOSFET controls the voltage and current flow between the source and drain. I’m not going to claim that I know anything about how MOSFETs work in detail. All I know is that a MOSFET is needed to handle the PWM pulses coming from the ESP32 board. You must get a MOSFET which will work at 3.3V, as that is the voltage the GPIO pins run at.
As with any electronics project, you will need a power supply capable of powering all the components. Make sure you calculate exactly how much power your LED strip requires and buy an appropriate unit. You can also use multiple power supplies for multiple strips, as the creator of this project does.
Finally, you will need a few extra bits and pieces such as a breadboard or prototype PCB, a 10k ohm resistor, jumper wires, a soldering iron, and some screw terminals to attach the wires of the LED strips.
A list of all the hardware the creator used is available on GitHub. You will also find their schematics and how they wired it all together.
Creating the firmware using ESPHome
With all the parts hooked up, it is time to create the firmware for this project using ESPHome. The creator has made his publicly available on pastebin. The firmware is pretty straightforward and uncomplicated. Using the LED_C PWM output in ESPHome. It uses the ESP32 LEDC Output function. When tied into Home Assistant, the strip will appear as a dimmable light.
A very basic ESPHome project
Let’s face it, the ESPHome projects I’ve highlighted so far have been nice-to-haves or perhaps even gimmicks. But this one fulfils a real basic purpose in the modern smart home: it provides a high-quality and dimmable light for everyday activities such as cooking and preparing food, which nicely integrates with Home Assistant.