So I found some great little RGB flood lights on amazon and upon looking into the guts of them, I realised that you can hook them straight up to an arduino and esp8266 and control them using PWM.
I now use two of them in my living room as accent lighting and have them set for certain scenes.
I use openhab running on a raspberry pi to control them and I can even control them with amazon Echo (US), though that is slightly beyond the scope of this instructable I hope to find time to write that up!
Hope you enjoy, this is my first instructable for a very long time so please let me know what you think.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather Parts
The parts list is as follows:
6. A selection of resistors (I used 10K, but really you can make do with whatever)
(I have attached links to multiple sites as prices change regularly so please do shop around and be sure to check amazon vs ebay)
Full disclosure: I do earn a tiny commission if you buy through the links above but I would never recommend a link to a product that I haven't used myself. This project was not designed to be a money maker. Thank you :-)
Step 2: Disassemble Flood Light and Identify RGB PWM Inputs.
This particular flood light is a simple screw together design.
The chassis comprises of three aluminium sections that all unscrew.
Removing the top section that holds the lens in place reveals the PCB with the LED array and control circuitry.
The first thing that I did was to identify which of the transistors controlled which colour array.
Hopefully the manufacturer does not have too many variations between board revisions, which would mean you can copy the image above, and solder wires directly to them. I have colour coded for Red, Green and Blue to make it easier for you. Interestingly though the transistor controlling the red LED was connected to the existing microcontroller via a resistor, so I left this in the circuit.
It is also important for this step to remove the existing control components from the PCB with a hot air gun and some tweezers, as can be seen in the picture above. It wasn't absolutely necessary to remove the infrared receiver, but I thought I could use it in other projects.
Next just solder on some wires to the PWM pins going to the transistors and poke them through out to the other section of the light chassis, which is where we'll go to next.
Step 3: ESP8266 and Power Wiring
I have attached a schematic for this part as it says what you need to do much more clearly than I ever could.
Basically wire your red, green and blue LEDs to pins 12, 14 and 15 of the ESP8266 via a 10K resistor.
Then wire up the ESP power circuit as per the schematic, in the picture it shows that I have soldered it directly to the power supply/driver board for the LEDs but I did end up changing the orientation and didn't manage to grab another picture.
The idea here is to keep everything as compact as possible, as it will need to fit inside of the chassis.
To achieve this I spliced the resistors inline with the wires and covered them with heatshrink.
Please avoid my mistake and don't solder the resistor directly onto the ESP. I found this made them more difficult to work with than if I had done a true inline splice (as in wire-resistor-wire-esp rather than wire-resistor-esp).
Also the photo does look slightly different to the schematic, I didn't use pin 15 originally and this was a mistake as pin 15 is great at pwm. Love that pin. It rules.
Step 4: Program It!
Using your preferred method, write the code for your ESP!
You can really choose to control it however you want, and there are amazing people out there doing amazing things with the ESP.
MY particular route was to use a MQTT home server in the form of openHAB that the light would then log on to and listen for colour commands. Using this method also allows me to use amazon Alexa and google home for control extremely easily. (As I said before, I hope to be able to write instructables for that process as I've had a great time doing it but am currently spending most of my free time building a new website (that will probably involve tutorials for those pieces any way)).
I have attached the code for that to this 'ible, above (or below, wherever it appears).
I must say, I used to only develop in arduino IDE for ESP8266 but since I have started this particular project I am definitely being converted over to Lua scripts, they are great and a much less stressful time when uploading and debugging etc.
Once upon a time, I did write a program in arduino that did the following:
ESP boots, can't connect to wifi, starts access point mode
client connects with phone, automatically opens browser with colour control page (basic html)
in the page, there was also an option to connect it to your router.
Once it was on the network, any control system could be programmed to send http requests pretty easily.
If I can find that code somewhere I will upload it, but have recently built a new PC so that file could be on any mixture of drives around the place.
Step 5: Cram It All Back Together!!
In order to insulate all of the pieces, I wrapped them all with PVC electrical tape.
Be ESPecially careful with this step, I did burn out one of my voltage regulators when not paying proper attention.
Also I find keeping the wires longer makes this step much easier because of all of the twisting involved screwing everything back together.
Step 6: Place the Lights Around the House and Enjoy!!!
Place the lights in your preferred location, plug them in with the 12V power supply and away you go!!
If you don't like the prism effect of the lens, it can be easily removed, this gives a less focused, more general glow. Flipping the lens back to front had some pretty great effects too.
In the pictures you can see that I have used it to accentuate my nixie clock that I love so much.
Thanks for reading!
Participated in the
Invention Challenge 2017