At some point in the past few months I realized that home automation and intelligent house systems are actually becoming a thing. By "becoming a thing" I mean that it's no longer a concept seen only on The Jetsons or schlocky Disney movies (if you know what I'm talking about here please by all means comment)--making our residences smarter is a process that is getting cheaper and easier, and this is something that excites me immensely, as I love the idea of computers integrating with physical objects and having a tangible effect. I was psyched, therefore, when I first discovered the Hue lighting system created by Philips. It consists of a central hub and wireless LED bulbs that fit in existing sockets that can be set to any color or brightness desired. It's a brilliant idea! But it has a few flaws, and I want to try and fix them.

The first problem is price. There's one reason for this, and it's that Hue is being sold through Apple despite being manufactured by Philips. Why? Beats me, but it ups the price to the point where the starter pack is $200. The second problem is hardware-related. Bridges contained in the starter pack only work with the bulbs supplied in that starter pack and with single bulbs you buy (which themselves cost--wait for it--$60 each). Third is software problems; the timer feature reportedly is somewhat useless for the long-term, and the iOS app is (again, reportedly--I sure as heck haven't shelled out $200+ for the things) poorly designed and gimmicky. All the same, I love the concept; customizable lighting is a wonderful idea and has very useful applications. For instance, increasing the color temperature as night falls, the same concept that is employed by tools like f.lux, can be implemented in an entire house. You can wake up slowly by having light gradually increase--even if you're sleeping in a central closet. Wild rave parties. In case you can't tell by the way I'm raving about it, I'm a pretty big fan of this idea, and the drawbacks to Hue are quite a shame.

But wait! You're a strong independent crafty innovator who don't need no enjoys electronics--why don't you try to make your own system?

Why hello again internal narrator! You certainly are around a lot these days. Anyway, good idea! I decided to see what it takes to make a reasonably comparable home lighting system. Hardware choice was first up on the list. The obvious choice would have been an Arduino; a dedicated microcontroller and the design of the chip would have been perfect for dimming of an RGB LED, the light source I'd decided to use. However, I was apprehensive of the fact that Ethernet Arduino shields are crazy expensive, and so instead I decided to go with the Raspberry Pi. This not only could tackle the same hardware functions as the Arduino, but with an added OS on top that made interfacing easy. Plus, RasPis are a heck of a lot cheaper. The board with the LED was constructed using Adafruit's RasPi Perma-Proto kit, their RasPi GPIO Cable, and a few resistors I had sitting around (here's the LED from Sparkfun if you're interested).


After the hardware was wired up, I tried to find the best way to access the RasPi's GPIO pins. There are several libraries available for multiple languages, but I decided on raspberry-gpio-python, because it was a lot simpler than the equivalent C++ library or using shell commands to directly write to the pin files. Finally, I had to figure out how to get a web interface up and running, something that would untether control from the device itself. I looked around for various libraries that connected a Python script and PHP, but didn't find anything too simple. In the interest of time, then, I went with an intermediary. The web interface takes either a choice of presets or raw color values and stores them in a database running on the device, and four times a second the Python script checks the database, pulls down the color values, and lights up the LED.

![](/content/images/2015/11/led1.jpg) ![](/content/images/2015/11/led2.jpg) ![](/content/images/2015/11/led3.jpg)

It's working pretty well so far, and it's nice to have the concept implemented, but there's still a lot I'd like to do with the project. The first problem to tackle is lighting; the LED I'm using doesn't do the best job diffusing the individual colors together, and therefore the actual color can only be seen when looking at the LED head-on. Second, I'd like multiple lights to work with the RasPi acting as a controller. To implement this, I'm considering giving each LED its own board complete with a small ATMega microcontroller, receiving input from the RasPi but controlling the LED on its own. This would also fix a small but noticeable bug: when very dim, the LED flickers quite obviously. I think this is because the RasPi isn't as devoted to microsecond timing as microcontrollers are. Finally, I'd like to try and make the system wireless, which would involve either Bluetooth or ZigBee chips and some mobile power circuitry. I'm hoping to turn it into a bigger project, and I'm planning to put the code on GitHub for anyone who's interested.

So there you have it! Another project that I'll be tinkering around with in the coming future. What do you think? I'd love to hear your feedback, so please drop a comment below. Thanks for reading!