Step 4: Software
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.
ambilight.zip1 MB
Remove these ads by
Signing Up



































Visit Our Store »
Go Pro Today »




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.
I've a Mega board and I get no light at all, which ports you used to connect?
You used some capacitor with 10uF like someone did some comments below?
Thanks in advance.
Actually I do not know what your problem is. Can't you find the source code of boblight? If so, use this svn and compile it yourself.
svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only
If you are using Ubuntu (incl. LinuxMint) or Backtrack just search for it in your repositories:
sudo apt-cache search boblight
Or just use the software center.
According to your problem finding the arduino code:
It's located in the attached zip-file within the main folder and called ambilight.pde. Arduino changed its file extension after my project was finished to *.ino, so *.pde is the old file extension.
I hope I could help you and you enjoy my project.
Actually I do not know what your problem is. Can't you find the source code of boblight? If so, use this svn and compile it yourself.
svn checkout http://boblight.googlecode.com/svn/trunk/ boblight-read-only
If you are using Ubuntu (incl. LinuxMint) or Backtrack just search for it in your repositories:
sudo apt-cache search boblight
Or just use the software center.
According to your problem finding the arduino code:
It's located in the attached zip-file within the main folder and called ambilight.pde. Arduino changed its file extension after my project was finished to *.ino, so *.pde is the old file extension.
I hope I could help you and you enjoy my project.
I fix the problem "error com1 channels 30" by add "" between "com1 chanel 30"
Now i have an other error message : wrong channel value 5 for device uCon on light left_lower.
Can someone tell me that it's a probleme or the error message appears because i don't have the TLC5940 chips connected and the led strip.
I just have the arduino for now, i didn't want to buy LED strip already. I want to test the boblight and be sure it work.
I hope its not too late too...
The only thing I changed in the config file, is the number of the Com connection. The rest is the same as what I find it in the zip.
I thank you for helping me.
here is the config file:
[global]
interface 127.0.0.1
[device]
name uCon
output "COM7channels 30"
type momo
interval 20000
prefix FF
rate 115200
[color]
name red
rgb FF0000
[color]
name green
rgb 00FF00
[color]
name blue
rgb 0000FF
[light]
name left_lower
color red uCon 5
color green uCon 6
color blue uCon 4
hscan 0 20
vscan 50 85
[light]
name left_upper
color red uCon 1
color green uCon 3
color blue uCon 2
hscan 0 20
vscan 15 50
[light]
name upper_left_left
color red uCon 8
color green uCon 9
color blue uCon 7
hscan 0 25
vscan 0 20
[light]
name upper_left_right
color red uCon 11
color green uCon 12
color blue uCon 10
hscan 25 50
vscan 0 20
[light]
name lower_left
color red uCon 15
color green uCon 14
color blue uCon 13
hscan 0 33
vscan 80 100
[light]
name upper_right_left
color red uCon 17
color green uCon 18
color blue uCon 16
hscan 50 75
vscan 0 20
[light]
name upper_right_right
color red uCon 20
color green uCon 21
color blue uCon 19
hscan 75 100
vscan 0 20
[light]
name right_upper
color red uCon 22
color green uCon 24
color blue uCon 23
hscan 80 100
vscan 15 50
[light]
name right_lower
color red uCon 25
color green uCon 27
color blue uCon 26
hscan 80 100
vscan 50 85
[light]
name lower_right
color red uCon 28
color green uCon 30
color blue uCon 29
hscan 67 100
vscan 80 100
output "COM7channels 30"
This section is not correct. I just used it with Linux and didn't test it out at all on windows, sorry. It has to be
name uCon
output "com7"
channels 30
as you could read in the other comments posted.
When I start bobligh.exe, no more error messages but the boblight windows is just a black windows, like a msdos command window.Is this normal?
I'm asking you because I built a first ambilight system, base on boblight, two years ago. But the boblight has a graphic integration .
I search about boblight deamon, and ii look like my config file is correct.
But I wonder if it can work fine with your arduino programe too?
Thanks for all your help. This is really nice of you
Here, the first part of my combine config file, the rest is exactly the same as yours.
[global]
timeout 20
interface 127.0.0.1
port 19333
interpolation on
proportional 5.0
saturation 3.0
value 10.0
valuerange 0.0 1.0
use yes
method average
threshold 20
[device]
name uCon
type momo
output "com7"
rate 115200
channels 30
interval 20000
prefix FF
[color]
name red
rgb FF0000
gamma 1.0
adjust 1.0
blacklevel 0.0
[color]
name green
rgb 00FF00
gamma 1.0
adjust 1.0
blacklevel 0.0
[color]
name blue
rgb 0000FF
gamma 1.0
adjust 1.0
blacklevel 0.0
And I correctly placed "channel 30", I have the same error message.
This is not a problem obviously.
I tried to change the number of "uCon" for left lower . Same error message, just the number is changed.
I tried to change left lower config with left upper to get an increase of number on the script.
But steel not working.
I assume the code is good until "light". Because anything I put after light appear as an error. Do you have any idea ?
I tried on linux but too much complicated. I'm note very familiar with linux.
I don't understand how you make it run on linux, because the boblight.exe file that you provide in the zip is a windows program???
Does anyone know what I could try to get Boblight on?