Adafruit is open and shipping! Let's build back better, together!
0

Ambilight Project needs some assistance.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Ambilight Project needs some assistance.

by Kenobit on Wed Oct 26, 2011 9:33 am

I ordered my strand, I can't wait to build it around my 24'' pc monitor. Awesome demos in this thread.
Kenobit
 
Posts: 4
Joined: Tue Oct 18, 2011 3:28 am

Re: Ambilight Project needs some assistance.

by nahiko on Tue Nov 08, 2011 5:40 am

Hi everyone!!

I have been doing some test with arduino and processing, trying to improve speed for the adalight project
Initially I wrote my owm processing and arduino codes, thinking I would easily beat adalight's smoothness in color transitions.
I was really far on my first attemp xDDD
I tried adalight code and it worked way better.
BUT I saw my problem was that I used the Serial.write once for every color of every LED, so to send to the arduino the colors of the 25 LEDs I used 75 (plus the header (1)) calls to Serial.write in processing.
I advice you that this is sloooooooow, really slow, I guess that calling the Serial.write needs to open the communication, wait till arduino tells processing everything is ok and processing THEN starts sending data. So I made a long array, a 76 position array of byte and just one call to Serial.write. Now it is faaaaast :-D

So, first thing, if you are doing your own code, or modifying anothers code, keep this in mind, call as few times as you can to the Serial.write method from processing.

Another thing, that improves a lot the speed, is something that adalight does not do, so you guys can improve it. The method "Robot.createScreenCapture" is faster as the area/zone to capture gets smaller.
Nowadays, most people have a screen resolution of 1680x1050. In the processing program, you guys are capturing that much, 1.764.000 pixels. It takes a while doing that, and then you just use 25 times (once per LED) areas/zones of 20x20 pixels. So you use, 25 * (20 * 20), what is as low as 10.000 pixels. You waste the time that takes capturing 1.764.000 - 10.000 = 1754000. You are using just the 0,56 % of the image you captured :-S

It is MUCH BUT VERY VERY MUCH faster to capture 25 times, a zone of 20x20 pixels.

- A stupid java program that just makes 25 complete screen captures (using Robot.createScreenCapture) takes about 15250 miliseconds.
- Changing this program to take 25 times 25 captures 186 x 175 pixels big takes about 4800 miliseconds
- Changing it to take 25 times 25 captures 20 x 20 pixels big takes just 300 miliseconds

The zones I capture are 186x175 pixels, that's why I said about that.

Here you have something where you can improve a lot!!


When I finish my code, I will upload it somewhere so everyone can use it, compare it, IMPROVE it. I will be probably also using the FASTSPI_LED library for arduino and ws2081, however, I tell you in advance, I will try to do it configurable, but most things will need to be hardcoded, and it will only work in the same config I have, 1680x1050, 25 leds, and the same positions for the leds as I have, that will be the same as adalight's. You will need to change somethings and make some calculations if you change resolution, position of leds, etc...

Nahiko!!

PS: Sorry for my poor english, I am spanish!!
nahiko
 
Posts: 24
Joined: Thu Nov 03, 2011 7:42 am

Re: Ambilight Project needs some assistance.

by StringCheeseCR on Tue Nov 08, 2011 1:01 pm

Nahiko, great work. I'd definitely be interested in trying this. Anything to reduce CPU/timing issues would be great!

Thanks
StringCheeseCR
 
Posts: 11
Joined: Fri Nov 04, 2011 10:24 pm

Re: Ambilight Project needs some assistance.

by dagthomas on Wed Nov 09, 2011 4:17 am

Just wanted to say I recieved the package, put it together and it worked like a charm. Bought a plastic lid which I attached to the VESA holder and applied everything to that. There are images of it at the end of my vid.

Since everyone is doing films etc, thought I'd show off a little gaming.

http://www.youtube.com/watch?v=Vp0x0F2A6CI

And sorry about the language, its Norwegian :)
dagthomas
 
Posts: 11
Joined: Tue Oct 25, 2011 2:45 pm

Re: Ambilight Project needs some assistance.

by Simtechray on Sat Nov 12, 2011 5:38 pm

Helllo,
Another new user here. Got my kit installed and running but the leds do not turn off when I stop adalight or the colorswirl program. I have to cycle the power for the leds to get them to go off, What am I doing wrong?
My main use will be for gaming so any improvements Nahiko would be welcome. It is running for my game now but it does slow down the gameplay.
Cheers
Simtechray
 
Posts: 3
Joined: Tue Nov 01, 2011 1:09 pm

Re: Ambilight Project needs some assistance.

by pburgess on Sat Nov 12, 2011 6:41 pm

Simtechray: catching the "quit" signal in Processing has been a bit tricky...I've been able to get it under certain conditions (and turn the lights off), but not all. This is something that I'll continue to experiment with. Unfortunately, in the short term, I don't have a fix that consistently handles every case.

I might instead handle this on the Arduino side...if there's no serial activity in, say, 15 seconds or something, turn off the lights. Would 15 seconds be annoying? Could make that shorter or longer.

pburgess
 
Posts: 4067
Joined: Sun Oct 26, 2008 2:29 am

Re: Ambilight Project needs some assistance.

by Simtechray on Sat Nov 12, 2011 9:07 pm

Sure that would work for now, any timeout would be good so I can peek at the code and adjust as necessary. Still learning here ;)
Thanks so much
Simtechray
 
Posts: 3
Joined: Tue Nov 01, 2011 1:09 pm

Re: Ambilight Project needs some assistance.

by mortenholck on Tue Nov 15, 2011 5:17 am

Hi Guys
Excellent work around here....!

May i ask a "stupid" Q..?
I have just ordered the "kit" but i don´t seem to be able to find the software for the computer anywhere.....following a link i found, just turned up a C code....that i´m not able to compile with my Visual Studio.

Does anyone have a link to a compiled exe to run on the computer, or a link to a complete "package" conaining sketches and exe ?? ?
I think i have the Arduino thing down right ;-)

Best regards tinker guys ;-)

/Morten
Denmark
mortenholck
 
Posts: 1
Joined: Mon Apr 11, 2011 3:22 am

Re: Ambilight Project needs some assistance.

by pburgess on Tue Nov 15, 2011 10:48 am

Hi Morten!

Visit this Github repository and click the "zip" icon to download everything.

In order to be cross-platform compatible, the Adalight code runs in Processing, a Java-derived environment which can be downloaded from processing.org.

A little bit of C code is included as an example of basic communication with the LEDs, but this doesn't comprise any of the actual Adalight video-handling stuff. This is a low-level thing that will compile on Linux and Cygwin, but may need some work to get going in Visual Studio...if you need it at all; the Processing code is probably what you want.

pburgess
 
Posts: 4067
Joined: Sun Oct 26, 2008 2:29 am

Re: Ambilight Project needs some assistance.

by hightouch on Sat Nov 19, 2011 9:37 pm

Hey Nahiko, I was curious to hear your progress thus far. I'm trying to do something similar but I'd rather do it on the shoulders of giants than try to recreate it from scratch. Thanks!
hightouch
 
Posts: 1
Joined: Sat Nov 19, 2011 9:34 pm

Please be positive and constructive with your questions and comments.