Go Down

Topic: Streaming Pixel Data to Arduino (Read 3429 times) previous topic - next topic

gavspav

I've built a 512 pixel led array, using WS2801 modules and I'm wondering the best way of streaming data to it.

Each pixel receives 24 bits to drive its RGB led's so I think the whole matrix needs 1536 bytes a frame.

If I assume a frame rate of 25 fps thats 38400 bytes per second, so I'd need a serial baud rate of at least 307200, more if there are some extras involved with the serial communication.

This is probably too much for my Uno but I have a Teensy 2.0 here which I believe allows much faster communication.

Is it realistic to drive this size of array? There are solutions out there such as PixelController and Glediator but I haven't got them working with my set up yet.

Has anyone got any experience/tips/hints they'd be willing to pass on?

Thanks,




runaway_pancake

Contrary to your subject title, you want to stream pixel data from the Arduino.

Somebody has done this, and he's posted his demo here and at hackaday, too.
But I can't remember his handle (faulty memory).
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

gavspav

#2
Mar 31, 2013, 11:54 am Last Edit: Mar 31, 2013, 11:57 am by gavspav Reason: 1
Yes I do also want to stream data from the Arduino to the lights but this is not the part that is giving me problems (not yet anyway!).

I actually want to stream data TO the arduino from a computer eg pipe low res video to the arduino and then on to the led array.

What I am finding difficult is a way of reliably sending this much data at the required rate and reading it quick enough without it getting scrambled, lost or stuttering.

Hope that is a bit clearer.

CrossRoads

For that many bytes, you may need a uC with more SRAM.
Lets consider a few things:
The WS2801 will update and then hold the brightness you send it after data stops coming in for 500uS.
The clock frequency can be up to 25 MHz - the fastest a 16 MHz arduino can send out is 8 MHz using SPI set to fastest rate.
1536 bytes can be read from an array and sent out in about 1725uS, + 500uS for the update to occur at the WS2801, for 2225uS, or 2.225mS total,
for a 444 Hz refresh rate, way faster than you need, which for25 Hz is a new frame every 40mS.
So, you have about 37mS to send data over and load up the array for the arduino to then send out to the WS2801s.

37mS/1536 bytes = 24uS/byte which is a data rate of 41,513 bytes per second if I have the math going right.
So sending bursts of data over at 115,200, loading it into an array as you go, and then sending the array out to the WS2801s would seem a feasible approach.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

gavspav

Ok I have connected my matrix to a Teensy 2.0 running the Adavision LedStream.pde sketch from here]https://github.com/adafruit/Adalight/blob/master/Arduino/LEDstream/LEDstream.pde

It works and I get around 22 fps - though that's probably got more to do with the processing screen capture patch (also part of adalight) feeding it than anything else.

Its a great start anyway. I'll keep the thread updated with any progress.

fungus

Sending the data to the LEDs isn't the problem.

The problem is: Where does the data come from?

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Tom Carpenter



37mS/1536 bytes = 24uS/byte which is a data rate of 41,513 bytes per second if I have the math going right.
So sending bursts of data over at 115,200, loading it into an array as you go, and then sending the array out to the WS2801s would seem a feasible approach.



41513 BYTES/s is larger than 115200 BITS/s. You would need a minimum of 416kBaud - say 500kBaud to transmit that data rate using an 8N1 Serial link.
~Tom~

gavspav

Well for me the data is coming from this processing sketch which is capturing the screen:
https://github.com/adafruit/Adalight/tree/master/Processing/Adalight
I changed the pixel info to match my set up and display the whole screen.

I'm trying to write a max patch that will do similar but for some reason it isn't working for me at the moment.
I can't seem to send 1536 bytes reliably from MaxMsp. That is my current problem!
Maybe I'll just stick with processing.


gavspav

@tom Yes I noticed that but then I switched to the Teensy which ignores the serial rate and communicates at full USB speed.

Not sure how fast this is. 12Mb/second? Fast enough anyway.

Go Up