Note: This post was previously titled ‘Philips Hue Fiber Optic Light’. It was changed based on some feedback on HackeNews. I forgot to mention the words DIY, Hack or Clone in the title.
After making a Philips Hue clone, I realized that it would look really nice with a Fiber Optic light. I found a cheap $3 light on AliExpress. It arrived yesterday and seems to have rather decent build quality, for $3 that is. Here’s how mine looks.
<img src="http://AdityaTannu.com/images/fountainlight2.JPG" align="middle"alt=Fountain>
Next thing I did was of course a teardown…
- Looks like there’s three LEDs in there, one each of R-G-B.
<img src="http://AdityaTannu.com/images/fountainlight3.JPG" align="middle"alt=Fountain>
- Here’s how the optic fibers look like.
<img src="http://AdityaTannu.com/images/fountainlight4.JPG" align="middle"alt=Fountain>
- Opening up the base revels a rather simple circuit, board, button and battery, thats it.
<img src="http://AdityaTannu.com/images/fountainlight5.JPG" align="middle"alt=Fountain>
- Looking under the board, there’s not much.
<img src="http://AdityaTannu.com/images/fountainlight6.JPG" align="middle"alt=Fountain>
- Hmm, I think I can make this better.
<img src="http://AdityaTannu.com/images/fountainlight7.JPG" align="middle"alt=Fountain>
- Oh look, a NodeMCU board fits in perfectly in the battery compartment!
<img src="http://AdityaTannu.com/images/fountainlight8.JPG" align="middle"alt=Fountain>
- Let’s remove the LEDs so I can put some NeoPixels on there.
<img src="http://AdityaTannu.com/images/fountainlight9.JPG" align="middle"alt=Fountain>
- I just need this board as a base for the NeoPixels
<img src="http://AdityaTannu.com/images/fountainlight10.JPG" align="middle"alt=Fountain>
- Here’s my shoddy soldering job, I hope it works.
<img src="http://AdityaTannu.com/images/fountainlight11.JPG" align="middle"alt=Fountain>
- Some electrical tape to prevent shorting
<img src="http://AdityaTannu.com/images/fountainlight12.JPG" align="middle"alt=Fountain>
- Everything seems to work! Let’s put it all back in.
<img src="http://AdityaTannu.com/images/fountainlight13.JPG" align="middle"alt=Fountain>
- Here’s the final result
<img src="http://AdityaTannu.com/images/fountainlight1.JPG" align="middle"alt=Fountain>
- Let’s see it in action!
Turn On/Off and set any color with Siri.
Set brightness with Siri.
NeoPixel animations possible too, but not the best fit for hte HomeKit use case.
Powered with a phone charger using a micro USB cable.
OTA programmabe, in case something breaks, the micro USB cable works too.
Fibert optic light: There are cheaper ones ~$1-2, but I needed some space to put in the ESP8266 board and NeoPixels.
NodeMCU V1.0 board: Even the Wemos D1 Mini will do.
Micro USB Cable: These braided ones are very flexible.
Phone Charger: You can use practically any phone charger you might find at home. I got some dirt cheap ones. All I wanted was something small with a USB port on it.
The ESP8266/Arduino side of things is rather easy here. Setting up the HomeKit part using HAP-NodeJS needs some work. I have a detailed post on how to do that here. If you’re not interested in in HomeKit, you can also host a html page on the ESP8266 and control the NeoPixel colors using websockets.
Whenever this accessory recieves either On/Off or Hue, Saturation and Brightness values from an iOS device, it publishes them on MQTT topics
FountainLightBrightness. I originally wanted to name this ‘Fountain’ but Siri kept confusing Fountain with Phone, so I had to go with something discreet.
On bootup the ESP8266 connects to Wifi and subscribes to MQTT topics
FountainLightBrightness. Whenever it receives a value on these topics, it sets the NeoPixel strip with those values.
HomeKit treats lights as single color lamps. However, NeoPixels can do more. It would be nice to sneak in some color fading. It’s technically very easy to do but Siri (HomeKit API) doesn’t really let you specify anything other than Hue, Brightness and Saturation. When you say Turn on the light, HomeKit just sends an ‘on’ command. We could interpret this command as a trigger to start a fading animation. However, since we’re constantly listening to MQTT messages over WiFi, it would be better to use the DMA controlled esp8266_ws2812_i2s library for this. For some reason this didnt work today for me, will give it a try some other day. Note that the NeoPixels data pin needs to be connected to GPIO03 or RX pin of the ESP8266 for this library.