DIY IoT LED Strip (Part 1)
April 10 2018My friend started maintaining Kodi plugin on GitHub which connected to Philips HUE LED strip and emulated Ambilight. (Ambilight is awesome feature on some Philips TVs. The TV has LEDs on the back which illuminate its background with the color that is on the screen.) I really liked that, but you need the Philips HUE bridge and HUE LightStrips, which seem overpriced to me. Since I already had LED strip at home I decided to build my own IoT RGB light that can be controlled from phone, PC or Kodi plugin ;)
For base of the project I choose ESP8266 / NodeMCU 0.9. It's perfect for this task and I wanted to do something with it for some time. The LED strip needs to be driven by MOSFET transistors. Instead of looking for the right one in the wast amount of options, I found similar project and used the same one. (I recommend reading that article if you want to make your own light but you don't know much about electronics, it explains the basics very nicely.) Then it's just linear voltage regulator with some capacitors, connectors and 12V power supply. I bought 1 Amp wall adapter. That's more than enough for 160cm of LED strip that I am using.
The circuit is super simple. You can see it on the schematic bellow or download the Fritzing file from my GitHub. I've build it to size of project box I already had, It could be made much smaller. Also the heatsink on the voltage regulator is probably not necessary, but I already had it so I've put it on there.
Now to the programming. For programming of the microcontroller I used Arduino IDE. Adding support for ESP8266 is easy, more info here. The code is pretty simple, I used WiFiUdp library for the discovery process and ESP8266WebServer for rest of the communication. You can see it here. I was lazy to implement proper REST API so I created my own inspired by it. It's called ZIP (Zbenyho IoT Protocol), it's simple and completely lacks any security... by design. :)
At the same time I stared coding application for Android. And that was more complicated. At least for me, because it was basically the first time I programmed something in Java. For me the code looks quite bad, that's mostly because I don't like Java. But hey it works... most of the time. Sometimes it crashes on startup and sometimes there is couple seconds delay between input and actually sending packets. Anyway, as you can see there are controls for color (hue, saturation and brightness), brightness override - that's for dimming the light when it's controlled from different source and options to rename the light and change white balance - this set's the maximum intensity of color channel. I need to come up with better solution for color correction.
And that's everything for now. You can find project page on GitHub and other useful stuff in the links bellow.
UPDATEIn the meantime I've discovered Mozilla IoT project and decided to not continue with my own application, instead I will reprogram the microcontroller to be compatible with the Mozilla solution.
LINKS