Go Down

Topic: Pulling my hair out trying to drive this led array (Read 2 times) previous topic - next topic


Hey guys,

So, as I mentioned the other day, I'm trying to drive four green 20 segment bar graphs from an Arduino Pro Mini, in a manner not unlike a vu meter.

My experiments with a 10 segment LED bar graph have led me to determine that powering the equivalent of eight of them directly from the Arduino's pins isn't going to work.

For my first experiment, I wanted to see how bright my LED's would be if I lit them one at a time with 20mA of current.  I calculated that with this setup, to update the entire array of 80 leds 60 times a second, I would need to keep each led lit for 208 microseconds. Unfortunately, the results if this experiment were less than stellar, and I ended up with an extremely dim array.

My next experiment was to see how the array would look if I split it into eight groups of 10 leds, and lit 10 leds at a time, putting 15mA of current through each for 2083 microseconds, again for a 60hz refresh of the display.  This would require a total of 150mA of current, which the Arduino can supply, but not sink on a single pin, so I would have one transistor per group of leds through which I would sink that current safely.  That was the plan anyway.  But this test was also a bit of a let down.  The array ended up being only half as bright as I'd like it to be.

At this point, I'm not sure what would be the best direction to go with this.  

One option, I think, would be to use two sets of tansistors, one for the rows, and one for the columns, to source and sink the current.  (Do I need to use two different types of transistor to do this?)  But that option is unappealing because it would require way too much soldering. The last time I tried to solder 18 transistors point to point the resulting board was a mess and didn't work and I never figured out where the problem was.

The other option I have is to use a few IC's to drive the leds somehow.  I'm not sure what the best option for this would be though.

Using a 4017 looks like it's right out.  If I'm lighting the leds one by one, I'd have to pulse them with 120mA of current just to get them to the point I'm at now where I'm putting 15mA through 10 of them at once.  And I'm certain the 4017 can't deliver that kind of current.  I'm not even sure it can deliver 10mA.

I've also looked at the 74HC595 shift register.  I'm not sure if it's best suited to this task though, or if it could handle even the 200mA needed to drive 10 leds at a time at 20mA each, nevermind the 400mA I'd like to put through it to pulse the led's to be brighter since I'd still be multiplexing them and running them 1/8th of the time.  Also, since they only have 8 bits, I'd need two if I were to put them on the rows, and three if I have to put them on both the rows and columns.  (And I don't even know if they can sink current.)

Then there's this that caught my interest just now.  I wondered if there might be an IC which just has a bunch of transistors in it to make my life easier when wiring them up, and I came across something called a darlington transistor array.

Here's one I found which has eight inputs and outputs:

I don't understand why these have two transistors for each pin, unless that just allows them to amplify the voltage more.  I also don't know if they can both source and sink current.

But if they can both source and sink current, and they're set up to work like a switch that I can just turn on and off by applying voltage to the right pin, then these seem like they'd make wiring up my array really simple.  I could just solder them up against each edge of the array and bridge the gap between the pins, (or maybe stick some resistors between if needed) and no crazy mess with 18 individual transistors with pins that have to be bent funny to get them to fit the holes in the perfboard.

Anyway, let me know what you think.  I'd be really happy to hear that I can simply stick a few of those ULN2803A transistor arrays on there with a few resistors on the rows so I can get away with cylcing through 80 leds 10 at a time, and put 40mA through each of them this way.

Ran Talbott

I don't understand why these have two transistors for each pin, unless that just allows them to amplify the voltage more.

Close:  it's to amplify the current.  The first transistor takes a small number of microamps and amplifies that to a small number of milliamps,  and the second amplifies that to lots of milliamps.  It's called a "Darlington",  if you'd like to google for the details.

You're right to be suspicious of the 74HC595:  some people abuse it for driving LEDs,  but it doesn't have the current capacity to do so safely.  You could use them to expand the number of output-only pins for driving ULN2803s,  though.  There are also shift registers like the TPIC6C595 that are relatively cheap and can drive LEDs directly.

You do need different kinds of transistors to drive the positive side if you're going to multiplex the displays,  usually a PNP transistor or P-channel FET.  There are some "high-side driver" chips out there,  but there's never been a "de facto standard" among hobbyists for those like there is for using ULN2xxx chips for low-side drivers.


What about a decoder?  I saw those while researching various chips as well.  Is there some kind of 8-bit decoder I could use to sink large amounts of current?

Wait, you said I need different kinds of transistors on the positive side...

Could you explain why I need different kinds of transistors?  My understanding is that voltage goes in one side, and comes out the other if you apply voltage to the base pin.  In that way the transistor acts like a switch.  

So why can't I just connect the rows and colums to one side or the other of that transistor?  Ie, conect the output of one group of transistors to the rows, with the input going to Vcc, and the input of another group of identical transitors to the columns, to pull them down, with the output going to ground?

What am I missing here?


No that's fine, it will work (with all identical NPN transistors) - the transistors connected to ground sink current and will act as inverters (common emitter) and the high-side transistors are emitter-followers (current amplification only).  Just be careful not to over-drive the LEDs and burn them out - resistors also needed on bases of the ground-side transistors.

Worth trying to find out the pulsed current rating for the LEDs - often a device that's rated at, say 20mA, is spec'd to handle higher current pulses at a low duty cycle.
[ I won't respond to messages, use the forum please ]


Mar 06, 2010, 05:00 am Last Edit: Mar 06, 2010, 05:01 am by scswift Reason: 1
Again, I'm lost.

Mark says using all NPN's is fine.  Rant says I need PNPs to source current.  (Isn't the ULN2803 supposed to source current?)

Which is correct?  And why?

And can I use ULN2803s to both source and sink current? (<- This is what I really need to know!)

As for the pulsed current rating on the LED's, here's the datasheet for the arrays I'll be using:

It seems to indicate that I can pulse them with a maximum of 140mA of current if I am multiplexing 10 leds and pulsing each one for only 100 microseconds, which is like updating the display at 1000hz.

Hm.  I wonder if that 0.1ms is a typo.  I wish these data sheets had more data.  I mean how am I supposed to figure out what other values are safe to pulse at?  I mean if I extrapolate linearly, I might assume I can pulse 70mA for only 0.2ms, or 35 for only 0.4ms and that can't be right.  And is linear extrapolation even the correct way to go about it?  I wish there was a graph!  Though 35 for 0.4s would kind of make sense which lends credence to 0.1ms being a typo.

Hm... Maybe I should look at some of theoir other bargraph datasheets to see if those state something different...  

...well crap.  All their datasheets for the bargraphs use the same template, and say the same thing.  I'd hoped there might be an older one sitting around.

Go Up