# Controlling a matrix of LEDs

Hi,

I am trying to determine what would be a feasible approach to controlling a matrix of 32x32 LEDs where each LED can have variable voltage input e.g. 0 to 6V. Would something like this be possible using an Arduino? Thanks.

People normally use PWM to control Led intensity, rather than voltage level.

Hi oric_dan, thanks for the reply. Would I be able to control each node in the matrix individually using PWM?

Let's say the input is in the form below:

## Column Row Intensity%

01 01 90 01 02 50 ' ' ' ' 1024 1024 80

Is this possible? And if so can you please point me to a tutorial/example perhaps.

Thanks.

Aha, now that's trickier. However, it will still be light-years easier to do this with PWM than building 32x32 = 1024 individual analog intensity controllers.

All in all, this is gonna take a LOT of hardware. Typically, people will set up a 2D array, say 8x8, and then scan the rows and columns to turn on Leds say 8 at a time. The problem with this is that if you don't update the Leds fast enough, then the intensities flicker. You have to update 50-60 times per sec to preclude flicker.

However, you're probably not gonna find a single microcontroller with 32 PWM channels, and fast enough to handle the entire 32x32 array. I would probably look at doing this with a small network of controllers, say 16, with each controlling one 8x8 array.

Nevermind, didn't realize it was 32^2 LEDs.

Is this possible? And if so can you please point me to a tutorial/example perhaps.

Yes it is possible but I don't think any one has done it because the results would be poor. Do you know how to drive a matrix? This link shows to what you need to do:- http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html Now let's do some sums. In a 32 x 32 matrix you have one row on at any one time. You have to refresh this at a rate of at least 30 times a second to avoid flickering. So that means you must do a row 960 times a second. Now if you want to superimpose PWM over that you up the rate by the power of the number of PWM bits you want to use. Let's say you want 16 levels of brightness then this is a 4 bit PWM so the refresh rate goes up to 960 X 16 = 15360 times a second. That is about one row in 64uS, this is the same rate as a video signal so it is just about on but there will not be much time to do anything much else.

The other thing is that the on / off ratio is 32 to 1 making the LEDs dim in the first place without dimming them further with the PWM.

An other alternative is to use the ShiftPWM library http://www.elcojacobs.com/shiftpwm/ But that many shift registers need buffering correctly.