Soemarko Ridwan

iOS & Web Developer ⟡ Coffee Addict ⟡ Scuba Diver

ESP32 RGB LED Controller

This is not Project Libra I mentioned in the last post. It’s just a really simple project, I started and finish it in a day. Including the enclosure design and printing it.

A little background, a bit over a year ago I watched this youtube video and thought that it’s a good idea. I love having a night light that’ll lit up a room but not shining into your eyes during the night. However I have a low bed, no way I can put a PIR sensor all around without getting the wires become tripping hazard. So what I’ve done is just getting a cheap LED strip kit (with power supply and remote) and stick it around the bed.

Enters ESP32. I still can’t use a PIR sensor, but turning it on/off everyday becomes a chore. Often I’ve just left it on 24 hours. As you know, I’ve been playing with ESP a lot. Another great thing that ESP has is that it has RTC (Real Time Clock) built in. Along with WiFi, it check with current time with ntp server and will retain time accuracy even after power loss. Which is the example project called “Simple Time”.

This project, as you can see it’s just a remix of 2 guides. Simple Time and RGB LED Controller. All you need is an ESP32 Dev Board, and 3 N-channel MOSFET to run the LED. I just use the 30N06 that I already have plenty of. I added a sweet fade to the sketch so the LED won’t just snap into another color. Oh, and we’ll need a buck converter because the ESP can’t handle 12VDC input.

So, just load up the sketch. Plug everything together. Close the box. Plug everything in. And we’re done. This is one of those project that everything went smoothly. I only need to print the enclosure once. And the code just works. I added the fade later in the afternoon, and everything just went swimmingly.

Github & Thingiverse

Another idea I have was to check for sunset and sunrise time, but I opted against it. What I’d like to add in the future is a light sensor, so the LED strip will only light up when the room is dark.