Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

10x10 LED array.. PIC

Status
Not open for further replies.

PeterDove

New Member
Hi All,

Is it possible to run a 10x10 array of LED's from a 40 pin PIC? What I need is to be able to turn any/all of them on or off at any time. I also want to use software PWM to control the brightness of each one. Anyone got any advice on what chips/configurations to use to acheive this?

Thanks

Peter
 
PeterDove said:
Hi All,

Is it possible to run a 10x10 array of LED's from a 40 pin PIC? What I need is to be able to turn any/all of them on or off at any time. I also want to use software PWM to control the brightness of each one. Anyone got any advice on what chips/configurations to use to acheive this?

Thanks

Peter
You cannot turn all on or off individually, you would need 100 i/o for that. But you may make it lok like that. Turn them on column by column with ten outputs and lenght of pulse on the other ten will control brightness of individual LEDs. You will not be able to use builtin PWM, because it works only on one or two pins, but it should be easy to write your own for ten pins.
Jirka
 
Wouldn't individual control of the brightness of each LED require PWM on each channel?
 
The PIC can handle a simple display,doing the multiplexing and using drivers such as discrete transistors or ULN2003 to provide enough column drive current.

It can also handle PWM brightness of the whole display if the display refresh frequency is high enough.

BUT it would be too hard to do PWM of individual leds as far as I know.
Also, making a bright display, whilst limiting the port/led currents gets more difficult as the matrix size increases. eg. as in this case each led is only lit for a 10th of the time.

I think you need to use a dedicated chip with individual led PWM such as the MAX6974 and daisy chain enough of them to drive the display (each one can handle 24 or 48 leds) or the MAX6972 (16 to 32 leds each).
They are only supplied in a small TQFN package though.
 
It would not be so hard to bitbang 10 PWM channels, of course it depends on what other tasks is expected of the PIC. Also you would need lots of RAM, 100 bytes to store values for each LED for 256 levels of brightness and one dedicated timer.
Additional hardware would depend on the size of LED's. I am sure driver transistors would be needed for columns, but if LED's are small enough PIC can drive segments directly.

I would run program something like this:
1 Reset timer and start it
2 Turn Led's column one ON
3 Compare value's in RAM to timer
4 Turn Led's with lower value OFF
5 Do other tasks

Repeat steps 2-5 255 times every 10us for a total of about 26ms then do whole thing again for column 2 to 10. This will give you refresh rate of 30Hz, same as TV, aproximately and leave about 50% of Pic capacity for other tasks, depending on type and speed.With fewer levels of brightness it would be easier.
Jirka
 
picasm said:
The PIC can handle a simple display,doing the multiplexing and using drivers such as discrete transistors or ULN2003 to provide enough column drive current.

It can also handle PWM brightness of the whole display if the display refresh frequency is high enough.

BUT it would be too hard to do PWM of individual leds as far as I know.
Also, making a bright display, whilst limiting the port/led currents gets more difficult as the matrix size increases. eg. as in this case each led is only lit for a 10th of the time.

I think you need to use a dedicated chip with individual led PWM such as the MAX6974 and daisy chain enough of them to drive the display (each one can handle 24 or 48 leds) or the MAX6972 (16 to 32 leds each).
They are only supplied in a small TQFN package though.

Thanks, I have had a look at quite a few of those type of optios and microchip does a similar thing but in a PDIP package so I will have a go using that.

Peter
 
Jirka46 said:
It would not be so hard to bitbang 10 PWM channels, of course it depends on what other tasks is expected of the PIC. Also you would need lots of RAM, 100 bytes to store values for each LED for 256 levels of brightness and one dedicated timer.
Additional hardware would depend on the size of LED's. I am sure driver transistors would be needed for columns, but if LED's are small enough PIC can drive segments directly.

I would run program something like this:
1 Reset timer and start it
2 Turn Led's column one ON
3 Compare value's in RAM to timer
4 Turn Led's with lower value OFF
5 Do other tasks

Repeat steps 2-5 255 times every 10us for a total of about 26ms then do whole thing again for column 2 to 10. This will give you refresh rate of 30Hz, same as TV, aproximately and leave about 50% of Pic capacity for other tasks, depending on type and speed.With fewer levels of brightness it would be easier.
Jirka

Thanks Jirka - this is pretty much what I had come up with though implementing it will be fun. Going to build a very small 5x5 array now and test the idea. As soon as the port extender/LED driver chips arrive I will be able to either increase matrix size or be able to increase brightness by less multiplexing.
Peter
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top