Introduction: 3 TLC Ambilight Clone
An ambilight clone is modifying your computer monitor, to work like an ambilight tv by phillips. Heres a link to the wiki artilce about ambilight https://en.wikipedia.org/wiki/Ambilight
The clone only works on a computer, it doenst work with regular tv output, you will have to do that a different way, if you are not using a computer. The boblight software only runs on linux or windows, so you will need a linux or windows computer to use this ambilight clone.
There are many components to make a complete, and usable system, but there are many ways to get the same results. The way that I did it, was based on another instructable, found here:
They used 12v LED strips, TLC 5940, and arduino, which is what I wanted use, but I didnt like the way that they did it, which is why I did mine differently. I didnt like the heatsink, or running the parts near their limits, so I added another part, and 6 more zones for better resolution (from 10 to 16). 16 zones works out to 3 chips even, so it spreads the load a lot better, and only adds 1 more TLC chip and 1 resistor.
Im using an arduino, but this can be modified to use whatever microcontroller is supported by boblight. You could do this with more or less TLC5490 chips, if you want to change the number of zones, or LEDs. You can do this with a different LED driver too, like the ws28xx based serial LED drivers, or even LED strips with controllers built into the LEDs or strips. You can probably even do this with shift registers. Im using the TLC5940, they do 12 bit color depth, the control the current, they use few parts, and are a fairly elegant solution to driving a bunch of RGB LEDs.
You can modify this to use different LEDs, Im using LED strip because its easy to make a nice tidy straight line of LEDs, but there are lots of types of LEDs that will also work.
In this instructable, I will attempt to provide as much detailed information as possible, in effort to make it easy for you to change parts to adapt to your materials. If you understand the concepts, then you should be able to get the same results, even with different parts.
This is going to require a fair amount of software to make all this magic work. You may already know some parts of it, that will make things easier for you, but you will probably still need to figure some things out. Im using an arduino, and you have to have the arduino IDE installed on your computer, so that you can upload programs to the microcontroller, if you are already using arduinos, then you already know about that part, if not, you will want read up on arduinos and their basic use. You will also need the arduino code (library) for TLC5940 chips, and you need to configure for your specific use. You will need to install and configure the boblight software too, and unless you do it exactly the way that i do it, you will need to learn how to make a boblight config file that will work for your setup.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Components and Options
In this segment, we are going to focus on building the hardware, discussing some options, and doing a little math.
The main components of this project are:
ICs and a few resistors.
Prototyping circuit board
The following are gory details about components, If you just want to build my design, and dont care about how it works, skip ahead:
For my build, im using LED strips, they have resistors built in, but no controllers, they run at 12v, and they light up every LED the same color. They are the simpler type of LED strips, but you should make sure that you get a strip with RGB LEDs in a 5050 package, and not the strips that use separate red, green and blue LEDs. You can get waterproof, or non waterproof, it doesnt matter much. The waterproof ones will clean up easier, if you clean the back of your TV, but they may take a bit more work to solder. These strips can be cut into individual segments or used in groups of segments. Each segment needs 20mA per channel (R,G, and B), if you want to use 3 segments per channel, you need 60mA per channel. This means that the bigger your tv, the bigger you want the strips to be, and the more current you will need to run them. LED strips also come in a variety of density, 30 and 60 LEDs per meter are the more common, This will work with any density, but I like the 60/meter and that is what I used. You could even use dream color/horse race LED strips, they use 10 wires to control 3 groups of 3. It will require cables with 10 conductor, but it would use less cables, which might be nice in real big setups, but terrible in smaller setups.
The last LEDstrip option that I can think are the individually controllable LED strips, Those will work great, however the way you do it is very different than this instructable, so Im not going to include it, or the numerous other individually addressable LED options. You also need to have common anode LEDs, but every strip that I have run across is common anode. its not impossible to use common cathode LEDs, but you wont have an easy time doing it with LED driver chips, and definitely not the TLC 5940.
Im using TLC 5940 chips, they run 16 channels and do 12bit PWM(you can interpret that as lots of colors). Im using 3 of them, which makes easy math, 3 chips will do 16 RGB channels (or zones in this case), but you can do this with less, or more chips depending on how many RGB zones you want.
You could also build it with your whatever LED driver that you like best, but you will need to modify the circuit and software to work with your parts. One of the nice things about using a constant current LED driver is that you dont need to add resistors to your LEDs. These LED strips do have resistors for 12v, but if you use something other than LED strips, you wont have to add resistors, which is a big feature of using a driver chip. Even though the strips have resistors, the LED driver is still a good option, because controlling they control the current, and because they can handle a fair amount of current (120ma/channel), and the chip can dissipate quite a bit of energy, which you need when lighting several LEDs on one channel like we are doing with the strips. I would say 5 segments at 100mA is probably about as much as i would want to run them at. You could run anywhere from 1 to 5 segments per channel with this chip, My TV is 32", and 2 segments works, but I think I can fit 3 segments per channel, and my chips are set to run at 40mA using 1K resistors to set the current. There is a formula to calculate the resistor size, for the desired current level. 1.24 (31.5/R) If you plug in 1000 for R, you get 0.03906 or just under 40mA. If you want to run 100mA you probably want some 390 ohm resistors. I should also point out, that you can underdrive your LEDs, it means you get more LEDs, but it comes at the cost of intensity. The more current you drive each channel, the more overall current you need, which is something you will need to think about in the next hardware component, power supply.
My setup uses 48 channels at 40mA, which adds up to nearly 2amps (1920mA) a small wall wart is not going to be enough current for this, you will need to find some 12v somewhere, I used my computers power supply since its always going to be used at the same time, and it has 5 and 12v built right in. I tapped into the CD/DVD players power connection, since it rarely gets used anyway. You could do something similar, or you could just by a small 12v power supply, but make sure it can deliver enough current for your setup, and its fairly easy to estimate the current needs if you know how many channels you have, and how much you have set each channel for. If you go and run 100mA per channel, and use 48 channels like I am, you are going to need a 5 amp charger, That will also work for any setup smaller than 48 channels at 100mA, just not bigger.
Cables, Wires, and connectors.
12v LED strips typically have 4 conductors, they usually say "+ R G B", The + gets 12v, and the R,G,B get wires connected to the LED driver chip. We can use any kind of wire, they are short distances, and any will do, however ethernet cables have 8 conductors, which is ideal for running 2 channels. You could also use 4 conductor phone cables, USB cables, or even ribbon cables if you like.
I had some dead electronics so I salvaged a barrel connector/jack from a dead router, but I didnt have any connectors for each channel. and I soldered them right to the circuit board, but connectors would be a good idea, and i plan on fixing mine, when parts come in. I took and old computer fan that is wired to IDE power connectors, cut the fan off, and soldered wires connected to the barrel jack. It plugs between the power supply, and the CD/DVD drive, to supply power to the LED circuit. The arduino gets power and data via usb, a standard USB cable works fine, but you need one long enough to reach to the back of your TV. I have colored wires, so i used wires with the same colors in the TLC examples, but you can use any wire for building the circuity, they are short, so scraps work great.
Im using a nano, I like them, they are a nice small package, that includes usb, voltage regulator, and all the good stuff. You can use any microcontroller you like, but one that has usb built in saves you the hassle of adding that circuit, and making it work. You can also roll your own arduino, buy the chip, program it, add the various parts that you need right on the prototyping board. You might even be able to run this off a attiny, with additional hardware.
My parts list looks like this, yours may vary some, depending on how you build yours.
TLC 5940 (3)
1k Resistor (3)
Power connector from old CPU fan, and barrel jack and connectors
Ethernet cable (many feet)
12v LED strip with 5050 RGB LEDs.
Step 2: Build It
Get your parts together, and lay them out on your board the way that you think will work best. I laid the microcontroller in the middle, and put the LED drivers around the 3 sides of the board, sort of an upside down U shape. This setup puts the LED driver outputs near the outside edges of the the board, which help keep the wring tidy, and relative to their placement on the back of the TV. You can do it any way you like, they are wires, so they are flexible.
I started by tacking the TLC chips in, I used some coins to raise the part off of the circuit board, and soldered the leads on the corners of the chips. My hope is this helps the chip dissipate heat, without adding heatsinks.
I put the microcontroller on he board, and tack it on a couple corners to hold it in place.
In the fourth image, you can see that I've soldered the TLCs in, and soldered in ground and power wires.
Flip the board back over, and start with the resistors, and daisy chaining by hooking up the purple wires, then the blue, green and yellow ones It should end up looking something like the 5th image. You dont have to put the wires on the top side, typically they are put on the bottom, but I did it this way, so that you can see the circuit with the parts.
Now put the board down and focus on the cables and LEDs. My setup uses 8 sections of ethernet cable, each cable runs 2 segments of lights. To help keep the wires organized, I came up with an insulation color code scheme. I put the blue/orange pairs for the first RGB channel, and the green/brown for the second. The solid blue/green wires are +12v, the strip blue/green are G, The solid orange/brown are R, and the strip orange/brown are the B. Orange/Blue are the odd number zones, and green/brown are the even number zones. You should do it however makes sense to you, the important thing is that the wires go to the right place, not what color the insulation is.
The bottom and the top wires will be the shortest, and the sides the longest, you can make the cables as long as you want, just so that they are long enough. I started by cutting out 8 sections of cable that were longer than I needed. I stripped a few inches of cable insulation off one side, and less than an inch on the other side.
Separate and untwist out the wires, and put them in their new groups. I take my time and straighten them out as well as i can, because it makes it easier to solder, I want to reduce the chance of bad solder by doing a real good job preparing the parts. When the wires are organized, you need to strip the insulation off the tips of the wires on both ends. As you strip one section, tin the wires before you move on to another section. I dip the wires in flux, then briefly touch them against a blob of molten solder on my iron. The sixth photo shows 3 different length cables, prepped and ready for soldering
Cut your strips into 2 segment sections, and tin the solder connections. If you keep all your strips in the same direction, then the + R G B lines will always line up in the same place, making it easier to get the wiring right the first time (you will likely get some wrong, but we will resolve that in testing) like in pictures 7 and 8.
Solder your strips onto the cables, use the ends with a couple inches outer insulation stripped off. You should end up with a pile of 8 cables of 3 different lengths with LEDs soldered the same way on all of them. The last picture shows completed LED cables, and a diagram of where the LEDs mount around the TV.
Its important to use the right length cables, the bottom 2 are the shortest, the top 2 are a little longer, and the 4 on the sides are the longest. if you are soldering the cables right onto the board you really need to get them right, but if you are using connectors, you just need to make sure you get the wires on the connectors in the right order.
Last but not least is wiring up the power connector, and the +12v bus, this should connect to all the + lines that go to the strips. The LEDs get 12v, but the rest of the circuit runs on 5v from the USB.
When you have it all connected, it should look like the first image, sort a gangly LED octopus kinda thing.
You will need to power this thing with 12v, if you bought a 12v power supply, you are done, if you are powering it from your computer, you will need to make the power cable that plugs into the computers power supply, and run the cable out to the TV.
Step 3: Program It
This project uses a lot of software to make all this happen, some of it you may already know, feel free to skip over parts that you are already familiar with.
Arduino IDE is the first thing that you need, since Im using ubuntu, its as easy as opening a shell and typing:
sudo apt-get install arduino*
If you have an unnatural fear of shells, and prefer to use synaptec, or the software center, and search for arduino, you should find what you need.
When you have it setup, you will probably want to hook up a usb cable, and test that it is working on your computer.
Start by setting up the IDE for your arduino by clicking Tools, then Board, then the board that you are using (Nano with 328). Then check to see if your usb port is showing up by clicking Tools, Serial port, and selecting your port (mine is /dev/ttyUSB0.)
Once you have that set, go ahead and open the blink sketch, and run it by clicking File, Examples, 1.Basics, then select blink. and try to upload it. If it uploads(should display "Done uploading." then you have everything setup, and working.
You need to setup your IDE to work with this chip by installing the library. This is the arduino website about the library, and how to install it. You dont
You need to edit this file as root, type this command, and when prompted, type in your password:
sudo nano /usr/share/arduino/libraries/Tlc5940/tlc_config.h
Scroll down a few pages, past the line that says you can start editing, find NUM_TLC and change it to 3, like below.
#define NUM_TLCS 3
hold control(ctrl) key, and hit x to exit, then y (to accept changes), then enter (to save it as the same file name.)
If for some reason you dont like terminal windows, and nano, you could also use gedit, or kedit. like below
sudo gedit /usr/share/arduino/libraries/Tlc5940/tlc_config.h
Now with that setup, you should be able to run some of the TLC test programs. Click File, Examples, TLC5940, then select CircularLightBuffer, and upload by clicking the upload button. If you have set it up right, you should start seeing it light up the strip, starting at zone 1 and go around to the last zone. try out other examples, until you are confident that its working properly. You may have wiring problem, and the testing should show if you have any. Once it passes test, move on to the boblight software,
Follow the instructions here to install boblight on ubuntu:
When it gets to the part about making a config file "Fourth step configure boblight for your controller:
Skip that part, and use my config file. Download it or copy as root to /etc/boblight.conf with sudo cp boblight.conf /etc/boblight.conf
Now open the boblight TLC arduino code by with the arduino IDE, by file open, then change to your home directory, then to the boblight-read-only, then arduino, then boblight_arduino_tlc5940/, and select boblight_arduino_tlc5940.pde, and click open, then upload it with the upload button. I've also included this file for download, if you cant find yours.
Now test it by starting boblight server, then running a couple tests to make sure its working right by opening a shell and typing boblightd and hit enter. You should see a bunch of text scroll by, and end with "Ambilight: setup succeeded". Open another shell, and type this:"boblight-constant ff0000" this should turn them all red. You have thi break the program with control-c to exit, then you can repeat this with 00ff00, and 0000ff to test green and blue.
The last thing to test is that it runs the ambilight program by running boblight-X11 program. To make this easier, you can make a script that runs boblightd &, thenn runs boblight-X11.
Now you just have to mount the strips on the back of the TV, and tidy up your cables.
If you chose to make a setup using more or less than 16 zones, or use different driver chips, then you will need to learn how to edit you boblight.conf which is a little tricky, so I will try to explain what i can.
Boblight.conf is broken into 2 main parts, the global and device config, then the zone data. heres the global/device part for my setup:
prefix 55 AA
You can see the /dev/ttyUSB0 line is for my usb port, yours may not be the same.
The channels is 48 because you need 48 channels to do 16 RGB zones, If you want to do 4 TLC chips for 64 channels, you only get to use 63 of them for a total of 21 RGB zones. If you go real big, and use 6 TLC chips, you can do 32 zones, with 96 channels.
The prefix and rate are set in arduinos pde file, so you need to change both files if you change them in this file.
If you are not using tlc5940, the prefix is probably different too. Rate, and bits may be different in your setup also.
If you are doing a different number of zones, the bottom half of the boblight config will need to be dramatically changed, I used a website to generate my code, this was the website.
I was not lighting the area in the front, so I had to make 2 tables, then modify them to make one table that was setup for my lights. I did one table with 16 zones, and another with 18 zones, then took 2 zones out of the 18 zone table, but replaced the data from bottom lines from the 16 zone table. I had to do that to make the zones even, but missing the 2 middle ones on the bottom, since i wasnt going to try to light that area.
Here is a sample from my config for one zone
color red Ambilight 1
color green Ambilight 2
color blue Ambilight 3
hscan 18 34
vscan 85 100
The hscan and vscan numbers determine the area for the zone, this is where it figures out the color to light the LEDs on that strip. I used a spreadsheet to do all my data manipulation, but you could just use a text editor.
Step 4: Addendum -modifications Required...
I thought that i was done, I had it installed and working, but I had problems.
The main problem that i had was the heat from the back of the TV and LEDs kept making the glue gooey, and the LED strips kept falling off the back of the TV. Since I had soldered the cables directly to the circuit board, I didnt want to permanently afix the LEDs, or it would be very difficult to work on. I had ordered some sip connectors, and I used them to make the LEDs separate from the circuit board. This actually took quite a lot of effort, and is how I should have done it in the first place (I didnt want to wait for the connectors).
The first photo you can see new connectors on the board. I started with the socket for the nano, then I put sip connectors next to the TLC chips, and soldered tiny jumpers from the TLC outputs to the connectors in a meaningful way (leaving a space for the +12v for each pair of LEDs, i put them at the ends of the connectors, but there are 2 that need +12v in the middle of the connectors. Each cable has 2 +12v wires, but they can be terminated to 1 connector pin.
After soldering the connectors on, I needed to replace the wiring that was soldered directly to the nano, that only took a few minutes, but you should be careful to get it right. see the second picture for topside wiring.
the third picture shows the cables plugged into the connector. I could have used heatshrink on each wire, then some around the connector and maybe some rtv inside the heatshrink to make things real secure and waterproof, but I didnt bother, since it will probably not get much activity, or chances to break.
The fifth picture is the nifty power cable that I made from an old CPU fan. this connects inside the computer, to an older IDE hard disk or CD/DVD. If you dont want to use your computers 12v power supply, you can buy a 12v power supply and use it instead. You will want a pretty decent sized power supply, 5amps will be ok of you only use 2 segments, but 3 or 4 or 5 segments will require 10amp, or bigger.
While I had the LED strips taken off the TV, I decided that I had enough room to expand my strips from 2 to 3 segments, this also meant that i had to change the resistors that set the TLC current level. I change from 1K to 620 Ohms (470 + 150). This changed the current from 39mA to 63mA, which is a little high, but that is being spread across 3 sets of LEDs, so they are 21mA each set, which is a tiny bit high, but probably ok.
The last picture shows the new LEDs and cables being superglued to the TV.
I've checked out the chips, and they seem to be just fine at 63mA, not overheating, its about 1/2 of the maximum so i expect no problems at that level, but if you run them over 100mA you may need a heatsink like described in the other instructable.
One last note about the hardware that may be of value is that this project can use a lot of re-purposed or re-used materials. i had some LED strip segments from a failed project that I used to extend the 2 segment strips into 3 segment strips. I could easily have used all recycled LED strips they are sort of modular, and can be cut or soldered back together to make whatever size you need. The cables were made from a broken ethernet cable, and a lot of the wiring was done with scraps of small wires. The 12v power cable was made from parts from a CPU fan, and the power connector/jack from a broken wifi router.
Here is a short video of the tv in action. The video quality is poor (cell phone), but the light is awesome.
Participated in the
Make It Glow Contest