30 Channel LED RGB Ambilight Clone

104K99104

Intro: 30 Channel LED RGB Ambilight Clone

This instructable is my new approach on an ambilight clone. It all developed from my first try. Here you can find the old instrucable, which is OUT OF DATE and only linked for historic purposes. You will not need anything explained in the old instructable.

Enough about that old one.

At the end of this instruction set you will have a low cost (?) ambilight clone, with as many channels as you like. I will, for instance, show you how to build a 30 channel LED TV light, which adapts to the colors of your screen. If you are impatient, checkout the last step of this tutorial to see the very low quality video.

Hardware you will need:

- LED RGB SMD strip
- Microcontroller (Arduino Duemilanove Clone for example)
- (Two) TLC5940 PWM Unit
- maybe a cooler or a heatsink
- 12V power supply
- a few resistors

- electronic stuff (cables, soldering iron, breadboard, ...)

Software it takes:

- Boblight
- Windows or Linux
- Programming Software for your micro controller

Skills you will need:

- ability to solder
- maybe the skill to think a little bit technically, so you don't ask that many questions here in the comments :-)

This project is perfect for users that didn't have to do anything with electronics yet, but want to make something useful and uncomplicated to get started with.
I promise, this project is realizable for everyone who has got the attendance to follow my instructions step by step. It is really easy and if you only have some electronic skills and this is not your first project, it is even easier and you can modify it as you like.

So let's get started...

First of all, I want to explain the main principle of the completed unit.

1. You connect a computer to your TV and to the ambilight unit via USB.
2. You start the Boblight software
3. You start a movie.
4. Boblight analyzes your screen image and calculates some mean values of specific areas of your screen
5. Boblight sends these color-values via USB to your ambilight unit.
6. The micro controller within that unit takes the received color-values
7. According to the values the micro controller changes the LED strip colors

Steps 4 to 7 will be repeated up to about 50 times / second until you tell Boblight to stop.

STEP 1: LED Strips

I will stay in metric scale, because it is much better than this crappy inch, feet and mile thing. You can convert centimeters to inches by dividing by 2.54, but I guess you know that    ;-)

Before we can start soldering all the stuff together we have to order it. Let's start with the LED strips responsible for the illumination. We need to control the color of the strip. By adjusting only three colors (Red, Green, Blue) it is possible to create many many colors. Your TV works similar. Google for RGB if you want to know more about that. So we will need LED strips which have got 3 channels. One for color red, one for color green and one for color blue. If you power up the red channel, the strip will glow in red, if you power up the red and the blue channel it will be pink or something (mix of blue and red). By adjusting the voltage of the channels it is possible to create all the colors we need.

There are so many different RGB LED strips out there: 60 LEDs per meter, 30 LEDs per meter, common anode, common cathode, waterproof, length of 3 meter, length of 5 meter, etc.

Common anode or common cathode?

You HAVE to take common anode (all 3 channels share 12V) because of the TLC5940 and that is really important. You could destroy the TLC5940 chip if you try to connect it to 12V.

Waterproof?

As long as your TV isn't waterproof and you don't want to use your new ambilight under water, there is no real necessity to buy waterproof LED strips. It may be better because of insulation issues. You will tape the strips onto the back of your TV so make sure, you either buy waterproof strips, or the back of your screen is not conductive, because otherwise you could get in big trouble as soon as the contacts of the strips short curcuit. My screen backside is not conductive, because it is painted, so I decided to save the money and use non-waterproof strips.

60 or 30 LEDs per meter?

Another question is, how many LEDs you want per meter. The TLC5940 chip, which will control the color of the strips, is capable of serving 120mA per channel. I would not exceed that value.

I measured 15 LEDs on one strip. Here are my results: If you power up all three channels completely,  the strip takes 240mA and glows completely white. The red channel takes 90mA, green and blue 75mA each. 90mA is close enough to 120mA maximum, and we still have a little buffer of 30mA. So the TLC5940 chip is capable of driving 15 LEDs on one channel without getting too close to the maximum.

Now back to the question what to buy.
If you want to use a strip with 60 LEDs per meter, the maximum length of one strip is 25cm, because than you have exactly 15LEDs. If you decide to buy a strip with 30 LEDs per meter, you can double the length of one strip to half a meter to have 15 LEDs. Shorter strips, of course, are always possible. It's not just a question of current flowing, but of brightness. Maybe your room is often dark and you don't want that many LEDs shining behind your tv. In such a case 30 LEDs per meter would be completely okay and you don't have to pay the extra price for 60 LEDs per meter. To get to the point, I used strips with 60 LEDs per meter, because I ordered them to compare both solutions.

After all of your ordered LED strips arrived, one of the first things you have to do is to cut the LED strips into smaller pieces and solder cables to the ends.

Here is my setup:
I have got a 127cm (50") TV screen.

The outer dimension:
Width: 118cm
Height: 74cm

I wanted to have 10 areas all in all so I had to cut the whole long thing (5 meters) into 10 shorter strips. The question was how long shell they be? Just to get an idea, I attached an image so you can see where I taped the strips to the backside of my tv screen after I finished the project. As you can see, one piece has to have the length of 25cm to make sure there is enough light, small distances between two strips and they do not overlap. That corresponds to the results I measured for the maximum current. So at the end I still had 2.5 meters of LED strip left, which was resold on ebay.

Power Supply

As already precalculated each one of these strips takes 240mA on full white light. If you multiply that value by 10 strips, we get 2.4A.That is pretty much in my opinion: About 30 Watt.
I ordered my 12V power supply from Ebay. It can serve up to 5A and only costed 9 euros. Now I have a nice security buffer and the device doesn't overheat.

Soldering cables to the strips

My strips can be cut every 3 LEDs (so 5cm) and there are premade solder joints. Look at the second image I attatched to this step just beside the letters B R G on the strip. Sometimes there is even some solder on it so you don't need to care about that. If not, just take a needle and make a small hole into each of the joints and the solder will hold really good.

Just solder one cable to each channel and one cable for common anode (12V). Every strip has to have four cables. I used old network cable because it was long enough to cut it into pieces and has got 8 cables in it. That is very good because we need 4 cables per channel and I wanted to make pairs to cut down the number of cables behind my tv. The cable also has got a nice coating so I only have one bigger cable instead of 8 individual ones per pair. Now I have got four pairs of strips and two single (bottom). Make sure your chosen cables are long enough so the controller unit doesn't float behind your screen.

You can either leave the other side of the cable as they are and solder them directly to the controller unit or solder some pins to it so the strips are exchangeable, if one gets destroyed. That's up to you.

STEP 2: Controller Unit

The controller unit consists of two pieces.

Microcontroller

The micro controller, in my case an arduino duemilanove, receives the color values from your computer via USB (serial). The sketch running on the arduino is only a few lines long. It waits for enough data on the serial stream, reads one synchronization byte and than 30 bytes for the channels' color values.
The next step would be to control the colors of the led strips.

Problem

That is done with a technique called PWM. For those of you who are interested in the technical details, just search for it on wikipedia. One of the problems is, that the arduino only has 6 PWM channels. That would be enough to control 2 strips (RGB x 2 = 6 channels), which is not much. Another problem is that the PWM pins of the arduino are not capable of serving the 'high' currencies we need. So we will expand the number of PWM pins to as many as we want (almost) by adding some TLC5940 chips. Each one of these chips will add 16 PWM pins to your arduino, by giving up a few of the 6 you already have. But that's no problem, because the new pins are better. They have a higher resolution and can serve higher currencies, which is more than a fair deal.

As I already explained, I have got 10 LED strips. Each one of these strips has got 3 channels. So all in all I have to control 30 PWM channels. Therefor I used two TLC5940 which give me 32 (16x2) PWM pins.

There is one really good thing about the chip. There are already prewritten libraries for arduino and after some experiments and wrong soldering I found out how to connect the chips to the arduino.

Actually there are a few suggestions on how to connect the chip, but the one I attached to this image works perfectly together with the library you can download a few steps later.

Connecting the TLC5940

You can operate many of these chips in series. For example, if you want 96 channels, you have to connect 6 of the chips in series. In my case, as already said, two chips are enough. Look at the pictures how I connected all electronics. The hardware setup is based on this project page.
One side of the TLC5940 chip is connected to the micro controller and to ground or 5V. The other side consists of 14 output channels. There are two more output pins on the other side of the chip. The most outer pins are output pins 0 and 16. We only need 15 channels per chip so pin 0 will not be used.

Pin 20 of both TLC5940 chips are connected to ground with resistors with a resistance of 390 ohms. That pin is to limit the current flowing through each channel. It's just a reference pin, but pretty useful. According to the datasheet there is one equation to calculate the resistor's value:

I = 1.24 * (31.5/R)

By choosing R = 390 ohm we get

1.24 * (31.5/390) = 0.100153846

Exactly 100mA and that is okay, because the red channel only takes 90mA on full power, green and blue even less. But if we mess up something, the chip doesn't get destroyed because of high currencies.

STEP 3: Heatsink, Enclosure, Cooler

Temperature

Of course I tested the setup on a prototyping breadboard before soldering everything together and made some tests. I wanted to know if the chip can take full white light on all 15 channels for a longer time. So I illuminated my room with 5 LED strips fully on for a few minutes and measured the temperature with my IR-thermometer and with one of my best tools, my hands. It was a little bit hot but didn't get any hotter after one minute or so.

Heatsink

I decided to add a heatsink to the unit. Because I didn't have any dedicated heatsink for such chips, I just cut one of my old broken XBOX 360 heatsinks into two pieces. After that it was still a little bit oversized, but ok. I added some heat transfer paste to the chip and screw the heatsink tightly on top. Do not forget the paste if you want to use a heatsink, because if you do so, the solution is useless.

Enclosure

Because all of the devices are sensitive I put all of them into an enclosure and fixed them with hot glue. Because the enclosure was too tight for the big heatsink I removed it.

Cooler

Instead of the heatsink I wanted to add something else because inside of the closed plastic casing everything would get even hotter. I had a small 12V cooler laying around at home and connected it to 12V directly. The fan was way too fast and too loud to be on all the time I use my system. So I connected it to 3.3V of the arduino and that works very good. It is really quiet and after I added some holes to the case the air can flow through it.

STEP 4: Software

Download the zip-file attached to this step. It consists of boblight for windows users, a boblight config file to use with my setup, the sketch for the arduino and a library necessary to run the sketch correctly. Linux users, like me, will be able to find the software by themselfs, I assume.

Arduino

You have to get my sketch on your micro controller. Therefor go to the arduino download page and download the current version of their software.

From my zip file take the TLC5940 library and copy it to YOUR_ARDUINO_FOLDER/libraries to make it available to the arduino IDE. The library is taken from the official homepage of the library.

Take the ambilight.pde sketch and upload it to your micro controller.

The first byte sent from the computer and received by the arduino is always 0xFF to synchronize. Bytes 2-4 are the values to set channels 1-3. And so on. After 16 bytes have been sent, the first TLC5940 has set all of the 15 RGB values for the first 5 LED strips. So the next 15 bytes are meant for the second chip, channels 1-15, to set the other half of the strips.
Channel 0 of both chips are not connected because they are needless (I said that before).

Boblight

Boblight is by far the best solution to get fast readings from your screen and configurate how to deal with it.
Change the file boblight.conf just as you need it. Open it with any text editor and see how it is designed. Change the values to your needs.

Maybe I can help you a little bit. Look at these lines from the file:

[light]
name  upper_right_left
color  red     uCon 17
color  green   uCon 18
color  blue    uCon 16
hscan  50 75
vscan  0 20

What they mean:

_______________________
name  upper_right_left

The light has got the name upper_right_left. That's one specific strip. It is the second from the right on the top of the tv screen as the name says. It's the left one of the two right on top of the screen. A little bit complicated, but I think you get it.

----------------------------------------
color  red     uCon 17          

This line says, that the byte for the red color is sent as byte number 17. That means it will set channel 1 of the second TLC5940. The sync byte (in boblight.conf it's called PREFIX) is not counted in boblight.

----------------------------------------
color  green   uCon 18
color  blue    uCon 16

Just the same for the green and the blue values.

----------------------------------------
hscan  50 75
vscan  0 20

This says what area of the screen belongs to the strip. It's from 50% to 75% horizontally. So just from the half of the screen to 3/4 from left to right. The second line tells us, that only the upper 20% (from 0 to 20) will be analyzed. And, as already said, it is the second from the right on top of the screen.
---------------------------------------

All of the other strips are specified similarly.

To run boblight, first start the daemon (boblightd) and then the screen-analyzer (boblight-getpixel on windows or boblight-X11 on linux).

I hate to say that, but Windows Vista and Windows 7 users have to disable their aero theme while using the system because one function boblight uses (getPixel()) is not supported in combination with aerothemes. Deactivate the theme by right clicking on your Desktop. Then choose 'Personalize' and click on 'Windows 7 Basic'.

Redo that after your movie has finished.

Change the source code

For those of you who want to take more or less TLC5940 chips, do not forget to change the number of your chips in tlc_config.h in the TLC library and change the source code of the sketch and the boblight config file, of course. The preconfigured number of TLCs in the library I attached is two, because I changed it.

STEP 5: Prices

In the old instructable a lot of questions have been asked about the prices of the components I used. For this new update I ordered EVERY single thing from ebay. All the prices include shipping.

The Power Supply, as I said, costs 9 euros.

Five meters RGB LED strip with 60 LEDs/m were sold for 30 euros. I resold two meters for 12 euros because I only needed 2.5 meters for my setup. So I only payed 18 euros. You can save some money by using LED strips with only 30 LEDs per meter.

Both TLC5940 chips together costed 3.50 euros.

The Arduino Duemilanove I bought is just a clone, but it's completely okay and it works perfectly. It was 15 euros from Hong Kong.

I already owned all of the other things I needed, but I assume they do not cost more than 10 euros.

All together the price is 55.50 euros.

The two images I attached shell give you an idea of the resolution the system can offer. All 10 lights have slightly different colors. With my incredible painting skills I also added a few stripes to show you how I taped them to my tv.

Also notice the last picture showing the strips in reality taped to the back. Quick and dirty :-)

Here's a video of the system running. Due to my smartphone lense and the overall qualaty of the video it doesn't look as impressive as it really is.

http://youtu.be/JPVVrqVc2go

104 Comments

Could at least mention at the start of the post that the Software is outdated and no longer working....

Great work ! How do you do this project with a raspberry pi ?

Wonderful. Almost what I was looking for just added to favorites.
Do you know any project that could replace the computer on USB for any HDMI in+out connection?

Do anyone saw that new high quality, high resolution, standalone AMBILIGHT for TV that do not require a PC?

https://www.kickstarter.com/projects/153779262/lookledtv

Great tutorial. I have tried this tutorial and also bought 50xWS2801 LEDs and i must say the result was worse with WS2801 LEDs.

The
so called better resolution might be more accurate in analyzing regions
but they look so wrong and distinct. They just don't produce a nice
gradient effect like the LED strips (10cm-25cm) do. I also think WS2801
LEDs are not bright enough (that might be the reason why there are so
many youtube videos with 150+ LEDs producing 450 channels! Not enough
light).

On the other hand the WS2801 is really easy to setup. No soldering whatsoever.

Anyway once again great tutorial.

Now i will try with 3 TLCs for 48 channels.

Hi, GREAT TUTORIAL! I folowed everything as you said. I'm also using 30chanen, 10 stripes, 25cm per stripe, 2xTLC5940NT, arduino uno...Now I'm stocked on the step where I need to connect RGB stripes on out pins...but I do not know which one of my strip should be connected on first 3 pins of the first TLC5940NT...which one of my strip is going on out pins 4,5,6...and so one? Please help me, I will be greatefull! THX

So I have everything setup and the sketch has been uploaded to the Arduino Uno. When I try to run boblightd.exe I get a error message " com1 : Permision Denied". Any suggestions?

If you are sure about COM PORT that you are using than I guess you need to put it betwen "". It should look like this "COM9"

​I'm new to this so i have couple of question

1...Do i need RGB LED strip with specific ICs or any RGB LED strip would work and if there are couple ICs please mention them. For Example :- 3528 or 5050

2...Can i use MPS430 Launchpad instead.

3...What is channel.
Its been a couple years since you posted this, I was wondering how this has worked out?
Im trying to build a similar setup, but I plan on using 3 5490s for 16 RGB channels (48 channels). Im using 12v strips with 2 sections of 3 LEDs from 60LED/meter strips. It should be 40mA @12v per channel. im hoping to avoid heat sinks. I too chose to use ethernet cables, they are so very convenient for this.
My parts list is pretty easy, 3 TLCs, 3 1k resistors, and 1 10k resistor, 8 sections of ethernet cable 16 sections of 6 LED strips.

I'm getting the same error com8: permission denied. Have you found a solution to this yet?

com8 sounds like a windows thing, I cant help you with that, I dont know about the permission denied, but maybe you have something else on com8, not the microcontroller.
There were no other comments listed when I posted my comment. Now its showing lots of comments, and I can see that the author no longer has their unit.

I did get mine built, and I ran shorter strips at 40mA. I did have a lot to trouble getting this code to work with my setup, but I was able go through the boblight files, and get things working. I set mine up on a 32" tv, and used much shorter strips, running lower current, and have no heating issues. I may re-do the strips to 3 sections running at 60mA, because I think it will look better, and hopefully, it will not run too hot.
Thank you much, very well explained, easy to follow for my fist project, extremely happy with outcome on breadboard, only problem i had was using Boblight, figuring out how to get every color lit the same on every strip was daunting. Cudos my friend, Awesome tutorial.
Can i alsow play videogames?
Hi. I am new to electronics and i have one question.
Are this 390 resistors necessary for project to work? I can't find them, and online shopping sites don't ship to my country.
I fixed my problem. I was connecting to pins 13 14 and 15 not pins 1 2 and 3. For anyone that is wanting to test out just the hardware on their device there is a basicuse.pde in the tlc5940 folder under examples. It will flash RGB on all leds hooked up to the TLC5940. It also works with 1 or 2 TLC chips automatically.
Hello I am having some trouble testing this out. I have all the parts and I am trying to test out just one TLC chip that has two LED strips hooked up. I have tried this in linux and in windows. I don't get any errors in boblightd all seems to be fine there. In linux it is outputting the RGB colors in the terminal that it is setting but the LEDs don't come on at all. When i first plug in the arduino the LEDs flash if I don't have the 10k resistor hooked up but other than that I get no activity. Do you have a sketch that tests the hardware? Or any other advice?
I uploaded the basicuse.pde from the TLC examples folder and the LEDs work. So I am not sure what the issue is.
More Comments