In a previous article, I’ve showed how to make RGB-light controller that can be controlled via WiFi. It works, but have some several flaws:

– You need Raspberry Pi, or other linux – based machine to control it;
– Raspberry Pi, if it have non-squashfs based OS, can not survive a number of suddendly power losses;
– If you have several devices, controlling then from phone with HTTP-way can be complicated;
– It is non-trivial to make some centralized remote control for lots if devices like this.

Let’s try to make another device, that will be free of that flaws!

First – why ESP32?
This board is pretty small, cheap, and requires (relative) low amounts of power, and no external radio components required – just apply power, and it will work with your WiFi network!

I’ve using WeMOS ESP32 board – you can easilly find one on Aliexpress.
ESP32 does have hardware PWM, so you will need only MOSFET’s for control LED strips. This is big advantage of ESP32 vs ESP8266 – on last one, there is no hardware PWM module, and if you will try to use ESP8266 – you’ll have brightness fluctuations, especially when ESP8266 performs WiFi operations.

In this project, we will use RGBW LED strip – it have traditional RGB crystals, plus white (warm white) one. So we will use 4 PMW channels, and we will need 4 FETs.
Schematics of PWM driver channel in this project will be really simple:

Resistor R2 used to protect FET from staying in half-opened state in case of some problems with ESP32, or accidental disconnect FET from ESP. Resistor R1 used to protect ESP’s pin from accidental shorting to ground.
Since ESP32 have 3.3 volt on pins, you’ll need to use logic-level FET’s with that will have full-open gate voltage about 3V, or less. Something like IRLR8726PBF will fit.

You’ll need 4 channels for RGBW strip, or 3 for RGB. Schematics of channels is 100% equal. In my case, RGBW driver board looks like this:

Firmware for ESP32 is available on my GitHub (press here for download) . Please note – it is under development, and may be a little raw. Use Arduino + ESP32 to compile and flash this.

You’ll need some enclosure to this device. I’am recommend to look at IKEA’s lamps – you’ll find there lots of cheap enclosures, which will make your device looks better. As for me, I’ve used glass lamp, and device looks like this:

For power supply of your ESP32, you can use USB from your PC, if this lamp will stays on your desktop – in this case, you can take +12V from your PC also (I stays on this variant for now – I can reflash ESP’s firmware without any cable reconnections). In another case, take a look to 12V to USB converters for car’s lighter socket. They’re cheap, widely avaiable, and will fit our needs.

Now about control.
This device is controlled through MQTT – so you’ll be need some MQTT client. For testing, I’ve used this android client. For now, we have 4(5) mqtt tags, one for each channel, in format 0x00 – 0xFF, (and I plan to add additionally one tag for writing all channels brightness in one time, in format WWRRGGBB, where WW – white channel, from 0x00 to 0xFF, RR – red channel, and so on).

For now, my control panel for this device looks like this:

Use android mqtt client is obviously not very usable – so I plan in next articles show integration of this device with open-source smart-home software, probably OpenHAB.