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.


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 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:

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.
<p>Could at least mention at the start of the post that the Software is outdated and no longer working....</p>
<p>Great work ! How do you do this project with a raspberry pi ?</p>
<p>Wonderful. Almost what I was looking for just added to favorites.<br>Do you know any project that could replace the computer on USB for any HDMI in+out connection?</p>
<p>Do anyone saw that new high quality, high resolution, standalone AMBILIGHT for TV that do not require a PC?</p><p>https://www.kickstarter.com/projects/153779262/lookledtv</p>
<p>Great tutorial. I have tried this tutorial and also bought 50xWS2801 LEDs and i must say the result was worse with WS2801 LEDs.</p><p>The <br> so called better resolution might be more accurate in analyzing regions <br> but they look so wrong and distinct. They just don't produce a nice <br>gradient effect like the LED strips (10cm-25cm) do. I also think WS2801 <br>LEDs are not bright enough (that might be the reason why there are so <br>many youtube videos with 150+ LEDs producing 450 channels! Not enough <br>light).</p><p>On the other hand the WS2801 is really easy to setup. No soldering whatsoever.</p><p>Anyway once again great tutorial.</p><p>Now i will try with 3 TLCs for 48 channels.</p>
<p>Adafruit has something similar to this...</p><p><a href="http://www.adafruit.com/product/461" rel="nofollow">http://www.adafruit.com/product/461</a></p>
<p>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</p>
<p>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 &quot; com1 : Permision Denied&quot;. Any suggestions?</p>
<p>If you are sure about COM PORT that you are using than I guess you need to put it betwen &quot;&quot;. It should look like this &quot;COM9&quot;</p>
​I'm new to this so i have couple of question<br><br>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<br><br>2...Can i use MPS430 Launchpad instead.<br><br>3...What is channel.
Its been a couple years since you posted this, I was wondering how this has worked out? <br>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. <br>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.
<p>I'm getting the same error com8: permission denied. Have you found a solution to this yet?</p>
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. <br> <br>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&quot; 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. <br>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.
Hi, ledtvlight. thank you for this instruction. It was my first project with an arduino, and i felt very happy when run it on my computer. <br>Everything work fine, exept my led often blink. It s tire for eyes, how i can fix this? <br>Would you help me with this problem, please?) <br>I use simple LEDs - 5V/20mA, power from adruino 5V pin. <br>When I use only one LED all works without blinks. <br> <br>
The Arduino board cannot supply enough power. You need a driver.
For me to match the colors as wired in &quot;breadbord diagram&quot; and respecting what was labeled in my led strips I had to change config so that the 1st color (channel) was green, 2nd blue, 3rd red
For me to match the colors as wired in &quot;breadbord diagram&quot; and respecting what was labeled in my led strips I had to change config so that the 1st color (channel) was green, 2nd blue, 3rd red
Could you please write an arduino skech to test if the lights are working, cycling through colors. I would if i could but i dont understand arduino skechs
I have 2 monitors plugged into my pc and so was wondering can boblight react to just one monitor I specify/the main monitor.
I'm getting ready to wire up all of my led sections to the TLC5940 chips and I feel like I'm missing something here. I'm assuming that I wire up the sections based on their positions to the pin assignments in the boblight.conf file. E.g., pin &quot;17&quot; would be the Upper Right-Left section Red channel, which according to the Instructable should be the first channel on the second TLC5940 (I'm guessing pin 1), but the Blue channel for the same section is &quot;16&quot; in the boblight.conf file...is this pin 0 on the second chip? Because elsewhere it says we're not using pin 0 of the TLC5940s. <br> <br>If someone who has this running can give me some quick guidelines on how the sections are wired to the TLC5940s, I'd greatly appreciate it.
I've experienced the same issue with my project and it was Widows 8 causing the incredible latency, like windows 7 aero situation boblight not working effectively with Windows 8. With Win 7, and aero disabled, all is fine now...
everything good. I done this ambilight but Timeout is 15 seconds.I How I to fix it
Within the source code I guess. I don't know what you mean exactly.
hi this is a great bit of kit and i found it really easy to build! thanks. only problem is i'd been tidying all the cables at the back with the HDMI unplugged before plugging it back in when the LEDs were running and they suddenly cut off. i'm guessing i've shorted something out somehow but i've no idea what? any ideas? thanks
Sometimes the backside of your TV is made of metal and connected to ground. Try to insulate and separate your LED-construction from your TV backside.
Hi, <br>I ve been working on this project for a while while waiting my necessary items form ebay. <br>And I wonder if the project will work if I use 470 ohm resistors instead of 390 ohm ones? <br>I will apriciate the answer :) Thank you.
No Problem.
Has anyone tried this project with Windows 8?
Thank you for your rapid response :) . Yes I have and the strip itself works, the arduino is also working( tried a for loop sequence that goes thru all the channels). I think the problem is in the boblight itself, could this be possible? Next I'm trying to see what kind of data arduino is getting from boblight with another arduino tracking it's feed to the tlcs. What kind of tricks do you have in mind when the problem is in the software?
Hi! <br> <br>I started an ambientlight project few months ago. I have done the same steps as you have. My system is working fine except for one strip, it doesn't get the blue signal in. The address of the colour is ucon 22. Every other colour of all the strips work just as they should. The problem is not mechanical and the strip is working fine. Can you help me with my mysterious problem? My arduino is same as yours Duemilanove Atmega328. <br> <br>Thanks
Have you tried the blue channel manually by setting it to 12V without any device just by plugging it into a power supply? If that is working I would try to write a little arduino sketch that only switches from one channel to another and see, if the problem is on your arduino, the devices after your arduino or on your pc.
Hi <br> <br>Was anyone able to get their ambilight working with Mega 2560, I don't seem to get it working even after trying various connection. I am a n00b so would really appreciate any help. <br> <br>thanks in advance
thanks for this tutorial. i have a general question: <br> <br>If i understood you right, then each of your area (each stripe) can have only one color at a time. So your 10 areas shine with a maximum of 10 colors behind the screen? <br> <br>I compared your solution to the adalight project, you posted the link somewhere in the comments. this solution uses 25 single LED pixel which can be controlled individually, so there are at max 25 different colors at the same time? This is done without the need of the TLC5940, just by connecting 3 wires to the arduino. How is that possible? <br> <br>I am am little bit confused. In your project you have to wire each channel to an TLC5940 out. In summary you will have much more LEDs shining which gives you more brightness, but the adalight project gives you an higher resolution with just 3 wires? <br> <br>Maybe you can shed light on this? <br> <br>Thanks
Yes you are completely right. An adalight does the same and even more as you noticed. On adalight every single LED uses its own chip to decode the signal sent by another chip controlled by an arduino. You don't have to do anything on your own. If you only want a TV backlight just use it. But if I just wanted that I could have bought a Philips TV. But I wanted to learn, build, understand and so something on my own, so that's because I went this way.
Great job on this instructable! Very well documented and easy to follow. I am actually going to use this as a basis for my own &quot;Ambilight&quot; unit. <br> <br>Is this unit still functioning as intended though? I see that you installed a cooling fan, but it still seems like the TLC5940 chips would overheat regularly, especially when showing a bright white color. <br> <br>Page 15 of the TLC5940 datasheet shows the power dissipation calculations. In order to stay within the 2.456W allowed by the chip, i would expect that your voltage on each of the 15 channels (per chip) averages out to no more than 1.5V. Is this true? <br> <br>I understand if you don't feel like measuring that right now, but if you can say that it's still working as built, that's good enough for me! Maybe I'm reading the datasheet incorrectly? Thanks for the help.
Hi, sorry I sold my unit and built another one that I sold, too. Both people still use their systems and they never complained about anythin. <br> <br>I don't have any of these on my own any more and I'm not going to build another one. As I say to everyone, if you just want an Ambilight, just build Adalight's solution. If you want to build something and learn about electronics try my tutorial.
I got Boblight to run after I modified output from com3 to &quot;com3&quot;. However, I still don't see any light. I'll need to test more.
Finally got it working! :)<br>I had misplaced a couple wires to the Mega board but now it's smooth and shiny. Still needs some tweaking but at least it works now.
Hi, can you please help me? <br>I've a Mega board and I get no light at all, which ports you used to connect? <br>You used some capacitor with 10uF like someone did some comments below? <br>Thanks in advance.
Hi ledtvlight, <br> <br>First of all I want to say that I love this project and it's my favorite one. =) <br> <br>Ok, now I've everything assembled and I've a problem that I can't figure out. <br>I ordered one Arduino Mega 2560, I read that there is some people with problems with it and I'm one of them. <br>For the reason that the Arduino is not the same of yours, I have connected by a different way. So on the breadboard everything's connected by the same way, but for the reason that your assembly is not working for me, instead I used different connections between Arduino and the breadboard. <br>I opened the folder pinout from TLC librarie and checked the Arduino_Mega.h, so I've tried without sucess this connections: <br>VPRG (Mega pin 50) -&gt; VPRG (TLC pin 27) <br>XERR (Mega pin 10) -&gt; XERR (TLC pin 16) <br>SIN (Mega pin 51) -&gt; SIN (TLC pin 26) <br>SCLK (Mega pin 52) -&gt; SCLK (TLC pin 25) <br> <br>MOSI (Mega pin 51) -&gt; SIN (TLC pin 26) //Just don't get this two connections <br>SCK (Mega pin 52) -&gt; SCLK (TLC pin 25) <br> <br>OC1A (Mega pin 11) -&gt; XLAT (TLC pin 24) <br>OC1B (Mega pin 12) -&gt; BLANK (TLC pin 23) <br>OC2B (Mega pin 9) -&gt; GSCLK (TLC pin 18) <br> <br>What can be wrong? I get no light at all. <br> <br>Thanks in advance!
can i use 1/4 watt resisors or i need to use other? <br> <br>btw, great job
Hello, <br> <br>I believe that I am having a problem with my Tlc5940, but I'm not sure. <br> <br>The problem that I'm having is that every time I try to run the program, my LED strip stays a bright white color. I have tried changing what is on the screen, but this has not helped. <br> <br>I am only using 5 LED strips and 1 Tlc5940, so I have changed all files as described in this Instructable. <br> <br>When I try to run the example sketches for the Tlc5940, I have the same problem. <br> <br>Any help would be greatly appreciated. Thank you
I don't understand how to install it on linux and i don't find the arduino code.

About This Instructable




More by ledtvlight:30 channel LED RGB Ambilight Clone LED TV LIGHT 
Add instructable to: