Drivings LED with limited pins

Mar 10, 2014 61 Replies

All,



I want to be able to toggle 23 separate LEDs in my application. The design challenge is that I only have about 17 pins available on my SoC.



What are some options for this?


1.) Use another microcontroller with 23 available pins with some digital interface (spi/i2c) and then send over data to toggle the appropriate pins?


2.) Ideally I don't want to have to do additional firmware development on a second microcontroller.



Thank you for any ideas.


-Mike


Multiplex them (14 pins), or use a shift register (3 pins.)

John Larkin Highland Technology, Inc jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

You could drive 24 individual LEDs with 12 pins and 3 resistors, but perhaps only 8-10 of them should appear to be on at once.

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Google "Charlieplexing".

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

Unless I'm missing something, 10 pins (5 rows, 5 columns) would be enough IF you can time-interleave them.

ign challenge is that I only have about 17 pins available on my SoC.

interface (spi/i2c) and then send over data to toggle the appropriate pins ?

n a second microcontroller.

The simplest sort of multiplexer would only be able to turn one LED on at a ny one time (a opposed to toggling any one of 23) but it would only use 10 lines for a 5x5 matrix. You'd connect the anode pins of groups of five LEDs together to a common current-limiting resistor, and connect each of the fi ve resistors back to five PNP open collectors, any one of which (but only o ne) could be turned on to connect to - say - +5V.

Similarly the cathode pins of groups of five LEDs (one from each of the fiv e different anode groups) would be connected together to one of five common NPN collectors, any one of which (but only one) could be turned on to conn ect to the

0V rail.

The shift register solution is more elegant and more flexible, and might be cheaper - 3 x 74HCT595 plus 23 current-limiting resistors is probably chea per than five discrete PNP transistors, five discrete NPN transistors, five current limiting resistors and ten base drive transistors. Even the part c ount is almost the same

I wonder how John was going to use his 14 multiplexing lines - a 4 x 6 matr ix is still only ten lines, a 3 x 8 matrix is 11 lines, and 2 x 11 is still only 13. I may be missing something here.

Bill Sloman, Sydney

esign challenge is that I only have about 17 pins available on my SoC.

al interface (spi/i2c) and then send over data to toggle the appropriate pi ns?

on a second microcontroller.

any one time (a opposed to toggling any one of 23) but it would only use 1

0 lines for a 5x5 matrix. You'd connect the anode pins of groups of five LE Ds together to a common current-limiting resistor, and connect each of the five resistors back to five PNP open collectors, any one of which (but only one) could be turned on to connect to - say - +5V.

ive different anode groups) would be connected together to one of five comm on NPN collectors, any one of which (but only one) could be turned on to co nnect to the

be cheaper - 3 x 74HCT595 plus 23 current-limiting resistors is probably ch eaper than five discrete PNP transistors, five discrete NPN transistors, fi ve current limiting resistors and ten base drive transistors. Even the part count is almost the same

trix is still only ten lines, a 3 x 8 matrix is 11 lines, and 2 x 11 is sti ll only 13. I may be missing something here.

the OP needs 23 so 2x11 won't do, 2x12 = 14 pins, 24 leds

-Lasse

Matrix.. A 5 x 5 = row and col scan. This will give you 25 LEDS using 10 IO's

Jamie

2X TLC5926/TLC5927:

formatting link

John Fields

If you can talk I2C, you can use a port expander like the MCP23017; that gives you 16 pins to work with, requiring 2 pins from your SOIC (and a simple matter of the I2C software). The MCP23017 is popular with the Arduino crowd, so you can find plenty of sample code using it. You'd need to do some amount of multiplexing to get 23 LEDs on 16 bits, or use multiple port expander chips as they also come in an 8-bit version.

For a simpler approach take a look at the 74HC595 -- 8 bit serial input shift register with latch and tri-state outputs. Each output will deliver 30mA max, so if your LEDs will run on that, you're in luck. Three of these in a row and you're in business.

That should be 7 pins and 3 resistors!

--sp

Best regards, Spehro Pefhany

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

For 23 leds

12 x 2 multiplexing would allow 24 LEDs

Arrange the LEDs as a 4 x 6 matrix. You can use 6 row drivers and 4 column drivers or vice versa. One of the drivers needs to be more powerful, as it could be driving all 4 or 6 LEDs on at the same time. The other driver needs less power, can often be done with the bare micro's I/O pins, and needs a series resistor. This requires a constant updating, but at a pretty low rate, could be done by a keyboard scanning routine. It only takes 10 pins and probably one driver chip and some resistors.

Jon

56 LED's can be driven from one microcomputer port.
formatting link
Many thanks, Don Lancaster voice phone: (928)428-4073 Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552 rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com Please visit my GURU's LAIR web site at http://www.tinaja.com

Multiplexing, Charlieplexing, or an external shift-register based led driver.

Neither the pheasant plucker, nor the pheasant plucker's son. --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Also if you use NPN emitter followers you can then omit the base resistor.

ditto PNP followers

doesn't that setup allow upto 5 LEDs to be lit simultaneously? and by scanning any combination to appear lit.

If you only want to light one led at a time the microcontroller's outputs are probably strong enough.

23 pins would be a 2x12 matrix: it's easy enough to build an inverter using the column drivers 2x12 gets the most brightness if you need several leds to simultaneously appear to be lit, and if you can drive the rows directly with the microcontroller outputs it saves on parts.
Neither the pheasant plucker, nor the pheasant plucker's son. --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

On a sunny day (Mon, 10 Mar 2014 15:34:48 -0700 (PDT)) it happened Mike Miller wrote in :

OK no problem, 32 LEDs:

formatting link

6 pins and one resistor if you choose the right LEDs
Neither the pheasant plucker, nor the pheasant plucker's son. --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

17 pins are a lot. The simplest solution are 3 8-bit registers like 74HC574. You need 11 pins; 8 for the data and 1 for any clock to the register. Drawback is that you need 23 current limiting resistors. Advantage is that it is static and you dont need a periodical routine for multiplexing.
Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de HTML mails will be forwarded to /dev/null.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required