May 23, 2013 Hardware adalight, building, electronics, furniture, powertools, welding, wood The Ambilight-Clone

It’s not just consumers that have to keep up with the Joneses, DIY’ers can succumb to envy, too. It seems like everyone is building those awesome Ambilight clones! Here’s mine :)

* For anyone wondering what the hell an Ambilight is, it’s an array of LED lights around the perimeter of a TV that copy the average colors at the edge of the screen. The effect can look as if light is bleeding from the edge of the television, giving it a more dramatic and faux, larger look.

Adafruit’s DIY Ambilight clone in particular, really caught my interest. The Amblight itself seems like a fun way to watch movies and I wondered if I could build a nice rig for the LED arrays on the television perimeter. What really made me break down and finally get on this project was the availability of cheap, individually controllable, RGB LED strings. I bought a few of them for my Cloud Lamp project and decided to buy enough to tackle Ambilight clone as well. Here’s how it went.

Shelf and TV Stand

Initially, the tv was sitting on a single shelf platform built into the wall.

The shelf was just bare plaster and was badly damaged from the previous owners of the home. I decided to build a wood platform onto the top, with a decorative front plate and two shelves on the left side for components. Additionally, there’s a stand for the TV that also serves to hide wires and the hole that goes down through the shelf for the power cord.

The materials all came from Home Depot and the raw wood was fairly expensive, around 300 bucks. The decorative pieces were for chair rails and door lining, I think. The shelving brackets were reasonably priced and pretty nice looking. Hanging the shelves proved to be somewhat difficult, however. On the side furthest from the wall, standard wood screws worked great. On the closest side, however, there were no wood studs that I could find, so I used drywall screws. The shelves won’t hold as much weight as they would with all wood screws, but there’s not much on them, so it worked out OK.

After that the process of making a layer of wood over the bare, plaster shelf top was pretty straight forward. Remember to measure both the front and back of a cubby space. In other words, don’t assume that it’s a perfect rectangle, it probably won’t be. The decorative bezel on the front was fairly easy to mount with small wood screws, but here’s the important part. You need to drill a shallow pilot countersunk hole for the wood screws with a diameter just slightly larger than the head of the wood screw. (Please have a look at Bill Jackson’s comment regarding coutersunk holes, it’s really informative!) That way, they’ll sink into the wood a small amount and be hidden under the wood filler. Also, it won’t split and crack the wood. After that I just needed to fill in the holes where the wood screws went in and the cracks between boards with wood filler. I let it dry overnight, sanded down the wood filler and painted the whole thing with a dark wood stain.

‘Vesa Compatible’ LED holder

The LED rack was built out of two basic materials. A fake, wood-like L-shaped stick, whose actual purpose is a mystery to me, and flat pieces of cold rolled steel. The television has four screw holes on the back which, after a little bit of googling, is called a VESA mount, I think. Though, after some guess and checking, I found to be M6 thin thread instead M8 as I saw online. So if you’re replicating this project, don’t assume the thread type for your television mounts. After using a sharpie to closely approximate the placement of the steel, I welded the steel slats in a ‘Tic-Tac-Toe’ type formation. Then, I used a metal drill bit to make holes for the TV mount and to hold the LED brackets. Following that it was a fairly simple matter to measure out the spacing for the LED holes in the faux-wood.

For each side, I used this formula: ( L+2 / I ) = S where L is the number of LEDS, I is total length of the bracket in inches and S is the space in inches between each LED. Adding two LED’s will allow you to start measuring from the very beginning of the bracket and your last mark should match up with the very end of the bracket. Basically, you can’t drill a hole on the very edge of either side so this will give you even spacing.

Arduino controller and Boblight

Different types of setups will require different software chains. In my case, I’ve got a low-power Acer Revo HTPC, running XBMCBuntu and XBMC v12 [Frodo]; hooked up to a 46” 1080p LCD TV. So the software/hardware chain for driving the LED’s is, The Boblight daemon running, along with the Boblight XBMC plugin, which sends light information over the USB port to an Arduino with firmware from Lady Ada that uses 2-wire serial communication with WS2801 based LED‘s.

That’s the hardware and software, let’s break it down:

Boblight

To get the boblight program up and running under Ubuntu, first make sure you have an SVN client.

sudo apt-get install subversion 1 sudo apt - get install subversion

Next, you’ll go through a standard Linux install:

svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only cd boblight-read-only/ ./configure make sudo make install 1 2 3 4 5 svn checkout http : //boblight.googlecode.com/svn/trunk/ boblight-read-only cd boblight - read - only / . / configure make sudo make install

After that, you’ll need to create the boblight config file. First copy the duemilanove.conf to your /etc directory and rename the file to boblight.conf

sudo cp ~/boblight-read-only/arduino/duemilanove.conf /etc/boblight.conf 1 sudo cp ~ / boblight - read - only / arduino / duemilanove . conf / etc / boblight . conf

Then, edit the file with your preferred editor:

sudo vi /etc/boblight.conf 1 sudo vi / etc / boblight . conf

Your global and three color sections will remain the same. Your ‘device’ section should look like the following block of code:

[device] name ambilight type momo output /dev/ttyUSB0 channels 150 prefix 41 64 61 00 31 64 interval 10000 rate 115200 debug off #turn this on to see what it's doing with the serial port delayafteropen 1000000 1 2 3 4 5 6 7 8 9 10 [ device ] name ambilight type momo output / dev / ttyUSB0 channels 150 prefix 41 64 61 00 31 64 interval 10000 rate 115200 debug off #turn this on to see what it's doing with the serial port delayafteropen 1000000

Possible exceptions will be:

output should be the USB port that your Arduino is connected to.

prefix will change depending on the number of LEDs you have in your setup.

To calculate the prefix, user ‘misake’ in the adafruit forms has written the following processing program, replace the number after ‘prefix’ in your boblight.conf file with it’s output.

int N_LEDS = 25; // Max of 65536 void setup() { byte[] buffer = new byte[6]; noLoop(); // A special header / magic word is expected by the corresponding LED // streaming code running on the Arduino. This only needs to be initialized // once because the number of LEDs remains constant: buffer[0] = 'A'; // Magic word buffer[1] = 'd'; buffer[2] = 'a'; buffer[3] = byte((N_LEDS - 1) >> 8); // LED count high byte buffer[4] = byte((N_LEDS - 1) & 0xff); // LED count low byte buffer[5] = byte(buffer[3] ^ buffer[4] ^ 0x55); // Checksum print("Prefix for "+N_LEDS+" LEDS: "); for(byte b : buffer) print(" "+hex(b)); exit(); } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 int N_LEDS = 25 ; // Max of 65536 void setup ( ) { byte [ ] buffer = new byte [ 6 ] ; noLoop ( ) ; // A special header / magic word is expected by the corresponding LED // streaming code running on the Arduino. This only needs to be initialized // once because the number of LEDs remains constant: buffer [ 0 ] = 'A' ; // Magic word buffer [ 1 ] = 'd' ; buffer [ 2 ] = 'a' ; buffer [ 3 ] = byte ( ( N_LEDS - 1 ) & gt ; & gt ; 8 ) ; // LED count high byte buffer [ 4 ] = byte ( ( N_LEDS - 1 ) & amp ; 0xff ) ; // LED count low byte buffer [ 5 ] = byte ( buffer [ 3 ] ^ buffer [ 4 ] ^ 0x55 ) ; // Checksum print ( "Prefix for " + N_LEDS + " LEDS: " ) ; for ( byte b : buffer ) print ( " " + hex ( b ) ) ; exit ( ) ; }

The number of LED’s and their Orientation will decide what the [light] section looks like. There will be one [light] entry per LED. As an example of a 50 LED array (16 on top and bottom and 9 on the sides) here is a pastebin of my boblight.conf: http://paste.ubuntu.com/5688347/

Boblight XBMC Plugin

The process for downloading the Boblight XBMC plugin is fairly straight-forward. From the XBMC Wiki:

To install this add-on you must do so from the Add-on Manager from within XBMC by going to:

Settings Add-ons Get add-ons XBMC.org Add-ons Services XBMC Boblight Install

Once you’ve installed the plugin, you can reach it’s settings by going to Services -> addons

Here you can set a constant background color for the LED’s in the XBMC menus, or change the settings for movies, music individually.

Arduino Firmware

Once you have your Arduino, plug it into a USB port on your desktop or laptop, then download the Arduino code editor. This part can be done on any PC with windows, mac or linux.

Once you’ve run the Editor, download Lady Ada’s LEDStream.pde firmware from github. Then load it up in the editor, make sure you have the proper board and port selected under the ‘Tools’ menu (It should be Arduino Duemilenove w/ATmega328 for the board; and the port will be different depending on your OS and which other USB devices are connected to your system, but the editor will give you choices) then press the right arrow in a circle icon to upload the sketch. If the upload is complete you will recieve a success message.

Wiring from your Arduino to your LED’s

Finally, to wire up your LED’s you’re going to need a 2-3 amp or higher, 5volt DC converter. The power from the Arduino will not be sufficient for most setups. The good news is, the wiring diagram is incredibly simple and requires no discrete components.

Lady Ada’s Learning system site has a nice, graphical step-by-step diagram that’s worth looking at. But in a nut-shell, here’s the wiring diagram:

Find the ‘input’ end of your WS2801 LED string, it should have female pin connectors and two loose wires.

The red and blue loose wires should connect to your 5volt DC Converter, with Red being positive and Blue being negative.

The blue ground wire on the LED string should connect to a ground connection on your Arduino.

The green should connect to Pin 13 on your Arduino.

The yellow should connect to Pin 11 on your Arduino.

Conclusion

That’s it! At this point, you should have all the software installed and everything connected. Turn on your HTPC, the first thing you should notice is that the LEDs will go through a quick red, green, then blue test pattern. At that point you’ll know if the Arduino is working. Once you’ve booted into XBMC, you should get an onscreen toast saying that it was able to connect to the boblightd daemon. Then, if you’ve set a constant color for the background, in the boblight plugin, the LED’s should now all be at that color. Finally, play a movie and enjoy the fruits of your labor!

Please let me know if you have any questions about the process, I’d be happy to help if I can :)

π