RGB Lamps

March, 2012

A Hack-a-day post lead me to this wonderful blog about building a WiFi enabled RGB lamp inside an Ikea lamp.  I was so inspired that I decided to build two – one for each of my kids.  My idea was for it to be a customized night light for their rooms.

First, I assembled the components.  The OpenElectronics RGB Shield and WiFi Shield took the most time to arrive since it had to be shipped from Europe.  I have an Ikea down the road, so getting the lamps were easy.  I carefully selected the Red/Green/Blue LEDs from the wide variety at Mouser.com.  I assembled all the electronics without delay – quick and easy.  I mentioned earlier that I’m not a big fan of wireless communication due to the lack of reliability, but I thought this would be a pretty good application for a WiFi shield, so I went along with the configuration recommended in the blog.

Next, I don’t speak Italian, so it took me a while to understand what the Arduino sketch provided in the blog was doing.  I made some tweaks to personalize the web page for each kid’s lamp, and started testing.  I found that the fade feature was not working very well, so I pulled that logic out of the sketch.  Upon testing, the lamps were highly responsive to color changes and looked good.

Of course, I’m all about integration with Watchdog, so I took it a step further and added some functionality into NetChecker to automatically turn on/off the lamps (since I knew no one else would).  I built logic that communicates with the lamps via simple HTTP Post transactions.  With some tweaking of the Arduino sketch, I was able to achieve 2-way communication with each lamp without much trouble.  I used my existing daylight sensor to determine when to turn on/off the lamps so I never have to worry about daylight savings time or the change in seasons.  Also, at my wife’s request, I added a feature that dims the lamps to 50% in the middle of the night to promote deeper sleep.

The whole project was done over a weekend, and seemed to be working well, but I soon became discontent:

  • As you can see in the pictures below, the strands of 3 LEDs create hot-spots of light on the lamp.  I was really hoping for a more uniform glow, so I added some translucent over the top of them to diffuse the light.  It was better, but still not great.
  • There were major issues with the WiFi communication.  The Arduino would need to be rebooted at least once every 24 hours – there was some kind of memory leak going on in the code.  The chip on the WiFi shield was discontinued (doh!  Should have done my research before buying), so I had to turn to the community for help.  There were many good suggestions which I applied and was able to achieve a bit more stability, but it the WiFi connection was still very unreliable for long periods of time.  I attempted to put retry/reset logic into the sketch, but failed.  My short-term solution was to add a timer to the power supply of the Arduino which forced a reboot every day.

In order to address the concerns above, I made some major changes to the design:

  • I researched and found a very cool RGB LED strip at Sparkfun and decided to try it.  Sure enough, I was able to replace the LED strands with this strip and it worked perfectly.  I used the adhesive backing on the LED strips to coil the strip around the lamp pole.  This gave me the more uniform glow I was looking for.
  • I purchased some other WiFi shields and continued to be disappointed.  I was watching AdaFruit’s show-and-tell broadcast and someone mentioned the use of a NetGear WNCE2001 device which converts a wired Ethernet port into a WiFi port.  Having had good luck with basic Ethernet shields, I decided to try to use it with the NetGear device to get WiFi capabilities.  Long story-short, it worked very well and I’ve had excellent stability with the WiFi connection through this approach.  I no longer need to power-cycle the lamps, so they can stay on 24×7.


530451_415650531795510_474017835_n 546924_415650488462181_969052870_n

525535_415650398462190_1215702887_n  The triple stack of electronics taped to the bottom of the lamp pole:  An Arduino Uno, An Ethernet Shield, and the RGB Shield.

564069_415650358462194_1937368693_n  Testing the RGB light strands.  It was not easy to find 3 sets of LEDs that had equivalent brightness and viewing angle characteristics.

404051_415650451795518_45980703_n  The web interface for controlling the color served from the Arduino.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s