Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: saftysign on Jun 06, 2018, 03:20 pm

Title: How can I effectively drive multiple LEDs with multiplexing?
Post by: saftysign on Jun 06, 2018, 03:20 pm
I am interfacing my microcontroller (AVRmega32U4) to a 4x4 LED array. There are 2 control lines to operate columns (passed to a 2 to 4 demultiplexer) and 4 control lines to operate rows. I bring a column high and a row low to illuminate a specific LED. I pull either the column low or the row high to turn off an LED.

This design works fine for around up to 4 LEDs at once. However, when I try to light all 16 at once with this strategy, the LEDs are noticeably less brighter (they're on a 1/16 duty cycle after all!).

What are some ways to more effectively light larger numbers of LEDs in this array? Say, 10+?

I am considering writing a lot of code to handle the different situations, but that will consume more space on my microcontroller than I am comfortable with. I was considering adding another micro with 16 control lines to manage these LEDs, one at a time, but this seems like a lot of overhead to introduce.

I could not upload the image

Title: Re: How can I effectively drive multiple LEDs with multiplexing?
Post by: Grumpy_Mike on Jun 06, 2018, 05:42 pm
Quote
I am considering writing a lot of code to handle the different situations,
Don't do that. Use the method everyone else does and have a memory buffer and just display that. Then all you need to do is to write the appropriate numbers into the memory to get any display.
See http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html (http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html)
Title: Re: How can I effectively drive multiple LEDs with multiplexing?
Post by: bos1714 on Jun 06, 2018, 05:50 pm
This design works fine for around up to 4 LEDs at once. However, when I try to light all 16 at once with this strategy, the LEDs are noticeably less brighter (they're on a 1/16 duty cycle after all!).
Could it be possible that there isn't enough power for all 16 at once?
Title: Re: How can I effectively drive multiple LEDs with multiplexing?
Post by: Grumpy_Mike on Jun 06, 2018, 06:30 pm
Yes but you never have all 16 on at once. That is what multiplexing is all about, you have a maximum of four LEDs on at any instant.
Title: Re: How can I effectively drive multiple LEDs with multiplexing?
Post by: Shuzz on Jun 15, 2018, 10:01 am
There are 2 control lines to operate columns (passed to a 2 to 4 demultiplexer) and 4 control lines to operate rows.
Then you should have a 4:1 multiplex, which should actually be bright enough, even with crappy LEDs.
You really should follow Grumpy_Mike's advice and reserve a memory buffer to control which LEDs are on, then offload the display to some timer interrupt and be done with it.

Also, read the link that Mike posted carefully and try to understand how a LED matrix actually works.

Alternatively, if this all proves too hard for you to implement, you could consider using dedicated drivers like the TLC5916 or some such. No shame in that, and it would definitely solve your brightness "problem"... ;-)