Go Down

Topic: Arduino based Ambilight for you computer :) (Read 31657 times) previous topic - next topic


The problem with RGB or VGA is that if you also have to divide the screen
If you want to get good Ambilight you extend the screen with the colours projected on the wall.
So you have to divide the screen where each side gets the colour of that portion of the screen.
Thats not posible with the RGB output from your Tv set without additional hardware to devide the screen as far as I know.

Yeah, that was the conclusion I came to after a while.


Is there anyway for the script to avoid averaging the black bars on widescreen movies?


Yes, define the screen portion that you need.

I'm curently developing a version with 4 the sides from the screen giving sepate outputs.
In that version I have a pixel offset feature,  with that you can skip the black bars.

By the way most of the work must be done in Processing, not on the Arduino


@chnics "Royboy, are you still interested in this project and looking to improve it or do you see yourself as done and going for the next challenge?"

My aim was to quickly create a platform which is easy to understand and modify. My job is done here :) I am quite happy with it :) It will at most take a person a day of coding and a week of shipping materials to extend this to screen borders and so on. So good luck to everyone who wants to extend this further! And please post your code somewhere where everyone can find :D

It is another weekend and thus time for me to work on something else :p


Feb 19, 2011, 09:57 pm Last Edit: Feb 20, 2011, 01:43 am by fkeel Reason: 1
edit: just tried this myself. 9.6 volts works just fine...

Has anyone tried powering these strips off 9.6 volts? I assume it should work, but the LED's will simply be dimm. Does that make sense? Can anyone who has a working setup and a 9v battey lying around quickly give this a try and tell me the results? I would like to incroporate this into an excisting project and dont have 12v available...

Well, if someone has the equipment to quickly check this out for me, it would be apreceated.




I tried that initially. My 9V battery couldn't drive even one channel.


Feb 20, 2011, 04:46 am Last Edit: Feb 21, 2011, 12:42 am by fkeel Reason: 1

Edit: I got this to work

I have the plus end of 9.6Volts (1600 mAh) connected to the power in of the LED strip and the minus connected to the ground of my arduino. I have the Red Green and Blue channels directly connected to digital pins 9,10,11.

In the arduino code, I inverted the values send to PWM (i.e. blue = 255 - Serial.read();)

and tada. It works like a charm.

Hey Royboy, maybe you can help me. I have now officially butchered your project, and it "almost" works. Now I am a completel lay person at this and I am having the trouble finding the error.

I have 9.6Volts (1600 mAh) connected to the power in of the LED strip. I have the Red Green and Blue channels directly connected to digital pins 9,10,11. The ground of the battery is connected to a ground pin in the arduino.

This setup works (and makes me feel like a butcher). I can do RGB as well as CMYK and White using simple on & off. However, when I run your code, it does respond to the screen, but in a slightly random manner. Almost as if it where ouputting inverse values. (gets bright on a white background and dark on a black one etc.) One of the things I have tried is subtrackting 20 from all the values, which, for some mysterious reason improves the result (as in, black will dimm them, white makes it bright, yellows and blues are spot on, rest is random again.)

edit: the values that processing sends out are correct. something is going wrong on the arduino end.

Any Idea why it should have this issue?

I have had problems with this particular arduino board before, I suspect it might simply be bad. On the other hand, what I am doing seems rather unrefined, though I just cant find a reason for it not to work. (not that I actually know what I am doing.)

any ideas would be apreceated.




Alright I looked at the ULN 2003 datasheet: http://focus.ti.com/lit/ds/symlink/uln2003a.pdf and the thing is that the first thing the chip does is that it performs a logical NOT on the input. Thus a +5V signal into the chip creates a 0V output signal and a 0V signal creates a 12V output signal in my setup. Now this is wonderful because the led is bright when the difference between the +12V common anode and the output signal from the chip is 12V. a.k.a. The led is bright when the output signal is zero cause by a 5V signal from the arduino.  In your case this is switched because the if the arduino outputs a 5V, the difference voltage is 9.6-5 = 4.6 and the leds are off. while when your arduino output is a 0V, the difference voltage is 9.6V and your leds are on! So basically the whole ON/OFF of the leds is the opposite in your setup than my setup.

Now by doing (255-Serial.read), you are completely switching the ratio of the ON and OFF time in one duty cycle. So what the ULN2003 chip switches for me, you do the switching in your code instead; ending up with the correct result :)

I hope my explanation is understandable.


yep. that explains it. and thanks for posting this - whil I figured out how to solve the problem, it still confused me...

btw. could you explain your reasoning for using the ULN2003 chip?

anyway. thanks for posting this project - as you see, you inspired me to mess around with this myself and I learned some things which have become really handy in another project I am working on right now.




What code modifications would be needed to make it so that if processing wasn't sending it any data, the strip would slowly pulsate blue, but when processing started sending data again, it would become an ambilight again?


check the processing webpage for the exact code. Its a sample matter of doing

if serial is available, do amblight
else, pulsate blue.

you want this implemented on your arduino.

check the arduino reference material on "serial" & "if", and for the pulsating you may want to use a "for2 loop. its trivial, you should be able to figure it out...

If you need more help, tell me, and I'll give you more detailed instructions.


Would it be a serial.available that would serve this purpose?


I just made a new version of this, based on the original code.

This one got four rectangles where it gets the average color within. This makes the processing of the picture a bit faster, because it skips all the pixels outside of the boxes.

The form size is based on the screen (1/5th of the real size) and the rectangles inside are in scale to the settings with border (there are definable borders on all four sides of the screen), and to the size of each box.

captain-slow.dk | non contagious!


Already working on an update, want it to have more options, and work even faster than it currently do.
captain-slow.dk | non contagious!

Go Up