A while ago I saw a 5m roll of RGBW LED strip lights at Aldi. The pack included the 5m of lights, along with a 12V power supply and an IR controller for effects.
My reading online told me that it should be relatively simple to connect up some MOSFET transistors to an ESP8266 module so that the different LED colours could be controlled independently. The ESP8266 has WiFi of course, so with the correct software this should integrate easily with my home automation system (Home Assistant).
This post documents my build.
The LED strip was a special buy at Aldi, but there are plenty of products like this available. e.g. This is an Arlec one. It is 3m and has only RGB, but the concept is similar.
I found this great page on Adafruit describing a suitable circuit. https://learn.adafruit.com/rgb-led-strips/usage
They suggest using IRLB8721 MOSFETs. Their circuit is for an Arduino which uses 5V logic, but they suggest that these transistors switch on at about 2.2V, so they are fine for the ESP8266's 3.3V logic.
To test this I bought a few and set up a test circuit on a breadboard.
My reading online told me that it should be relatively simple to connect up some MOSFET transistors to an ESP8266 module so that the different LED colours could be controlled independently. The ESP8266 has WiFi of course, so with the correct software this should integrate easily with my home automation system (Home Assistant).
This post documents my build.
The LED strip was a special buy at Aldi, but there are plenty of products like this available. e.g. This is an Arlec one. It is 3m and has only RGB, but the concept is similar.
I found this great page on Adafruit describing a suitable circuit. https://learn.adafruit.com/rgb-led-strips/usage
They suggest using IRLB8721 MOSFETs. Their circuit is for an Arduino which uses 5V logic, but they suggest that these transistors switch on at about 2.2V, so they are fine for the ESP8266's 3.3V logic.
To test this I bought a few and set up a test circuit on a breadboard.
My test circuit used only the red channel, and my code used PWM to change the value of one of the pins every couple of seconds. The red LEDs got brighter and dimmer as expected.
Initially I had included a 5V voltage regulator chip. The ESP8266 board I'm using works fine with 5V, but I didn't think it would like the 12V that the LED power supply put out. As it turns out, this board can actually work fine with up to about 20V (it has its own onboard voltage regulator), so my final design omitted the voltage regulator.
The next step was to build something more permanent. I ended up using some prototyping board.
I bought a 12V barrel connector at Jaycar that connects to the original power supply that came with the LED strip. It connects to the Vin on the ESP8622 board. The digital outputs from the ESP8266 connect to pin 1 of the MOSFETs (the "base"). I used red, green, blue and white wire to remind me of which channels these will go to on the LEDs. If you only have an RGB strip, then you don't need the white channel.
Here is the completed board.
The negative wire from the power supply goes to pin 3 of the MOSFETs (the "emitter"), and then pin 2 of the MOSFETs (the "collector") goes to the LED strip. I re-used one of the joining connectors that came with the LED strip to connect them to my prototyping board. The end that connects to the LED strip is also hot-glued so it won't come unclipped.
If I had thought about it a bit more I would have put some kind of connector in the middle. The LEDs are going to be mounted on the skirting board in my lounge room, so this means the circuit board has to be right next to them. Oh well.
My software is a post in itself (coming soon). There are a couple of great examples of code for ESP8266 that uses MQTT to do PWM control for LEDs. I was able to enhance someone else's code to get something that works well.
For now, here's the final product in use.
I have a bit of an overrun on the right, which I have now trimmed to size.
I am very happy with the finished product. It integrates well with my home automation system (letting me set colour and brightness), and it is extremely reliable.
If you are thinking of making something like this yourself, on top of the LEDs and power supply you'll need:
- ESP8266 module. I paid about AU$5 for mine.
- IRLB8721 MOSFETs. These were about $2 each. You need one per channel, so for a single colour LED strip you only need 1. For RGB you need 3. For RGBW you need 4.
- A barrel connector to suit your power supply. About $2.
Note that some LED strips that you can buy come without power supplies. It is probably worth getting some that come with a suitable supply, as otherwise finding a cheap 12V supply with a suitable current output might be difficult.