[dorkbotpdx-blabber] another LED array question

Paul Stoffregen paul at pjrc.com
Mon Dec 15 13:20:07 EST 2008


I would try a big 120 bit shift register, probably built out of 15 
TPIC6C596N chips, which costs about $16.

The AVR can shift out 8 bits in 17 cycles, so running at 16 MHz in 
theory the whole shift register could be updated 62754 times per second, 
if you didn't have to do anything else.  In practice, I'd imagine 
getting between 1/4 to 1/3 of that if you're writing in C.  If you're 
willing to do a bit of assembly (or copy mine from the recent LCD 
project) you can write to the SPI data register exactly every 17 
cycles.  Just copy the code 15 times.

I'd probably go for 32 levels of light (not necessarily linearly 
distributed).  If you're reading bit patterns from a table and putting 
them out to the shift register, you can do a lot better than PWM.  For 
example, if you want 50% brightness, shift out 1,0,1,0,1...  if you want 
40%, shift out 1,0,1,1,0.  The patterns could go in a lookup table 
(which can be any distribution of intensities that "look" even to the 
human eye even if they're not linear) that you index by the desired 
brightness, so each time you build another 15 bytes to shift out, you do 
120 lookups and shifts and probably some other simple stuff.  Even if 
you only manage to get all 15 bytes computed and shifted out 1000 times 
per second (only 1/60th of the theoretical max) if you scatter the bits 
like that there shouldn't be any visible flicker, except maybe at very 
low brightness where it's only 1 or 2 on and many off in the pattern.

The other (much harder) idea that comes to mind is actually building 120 
PWM timers inside a FPGA!


-Paul



>
> i'm sizing up a project for LIGHTBAR that involves an array
> of 40 RGB LEDs, each of which i want to control in complete
> gradations of brightness, and i want them to be arrayed
> on an 8x5 matrix inscribed on a sphere, approximately.
> so that's 120 variable-brightness or PWM pins i need to
> be able to control.
>
> i'm considering using blinkMs, since the wiring and programming
> would both be significantly simpler.  but the cost goes through
> the roof if i do that. (i'm asking thingM to give me the blinkMs
> for free, but that trick almost never works.  =)
>
> is there something like an analog shift register that i can
> interface to a dorkboard, that will let me set these 120 different
> pin voltages individually, rapidly, easily?  is there some
> clever textbook solution to such a problem that i should know about?
>
> and will i ever figure out anything myself, or will i just keep
> bothering all of you busy people?
>
> seasons blinkings,
> -m-
> ---
> HELP!  A Bear is Eating Me!
> http://helpabeariseatingme.com
>
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
>



More information about the dorkbotpdx-blabber mailing list