Driving a 7-segment 4-digit LED display

Hi all,

A while back I bought a stack of ATA3491BW 4-digit 7-segment displays, on the cheap from Sparkfun because they'd got the wrong item... These are common-anode displays, and one has to cycle rapidly between individual digits to build your display. No problem! An Arduino, a couple of SN74HC595, some resistors and a bit of code, and it all works nicely.

The problem is brightness...

Each segment is rated up to 20mA (10mA recommended). So if all 7 segments (plus the "dot" on two of the digits) is lit, the power consumption (at 10mA) is, quite obviously, 80mA. It could be as high as 160mA if cranked up to its maximum rating.

As far as I can deduce, the 75HC595 is only able to output a maximum of 70mA. So that's not enough straight away.... never mind! I added a PN2222A (or equivalent) to each anode drive, so now the display will get all the mA it needs.

This brings me to the meat of the problem. I'm also using a 74HC595 to sink the current at the other side of the display. And although I've read the datasheet for the '595, I'm struggling to find out how much current per leg, and how much current overall, it can sink. I think it's 70mA again.... which means I still can't get full brightness from the LEDs.

I therefore have 2 questions:

  1. If the limit is 70mA, can I use transistors (specifically... can I use the same PN2222A NPNs) to provide the current a path to ground which isn't through the '595; and if so, how should I wire them?

  2. If I can't use transistors, what would the panel suggest (short of buying an actual LED driver... I'm trying to do this with components I've already got & reasonably on-the-cheap) to increase the total current drive capacity? Can one "piggyback" '595s to double the current capacity?

Thanks all.

Please see partical schematic attached, it shows the key wiring details.

Just for the avoidance of doubt: The circuit works fine, I'm just not convinced the LEDs are as bright as they could be. And I'd like to avoid cooking my '595s...

First off you are driving the anodes with transistors in the common emitter emitter follower mode. This means the output on the emitter can only ever be 0.7V less that the voltage at the base. These transistors need to be PNP transistors wired with the emitter to +5V and have a base resistor on them.

Then you need transistors in the cathodes. You can use NPN transistors this time, but you also need to include base resistors. As the current limiting resistor is in the collector circuit then this can be altered to give what ever current you want.

Thanks for the reply Mike, appreciate it. Transistors give me headaches....

I don't have any PNPs to hand, could you recommend something suitable? I've been poking around the 'net looking for transistor stuff, and I have a feeling the KSP2222s I have (bought because they were dirt cheap) are more suitable as signal amplifiers than digital switches, although they seem to work fine in the latter role.

Apologies, this is going to make me sound ignorant, but I have to ask... If I'm using the NPNs in common emitter mode, the max output @ 5v is therefore ~4.3v. My LEDs require 3.1v +0.05/-.10; is that a problem? Will the common-collector NPNs at the cathodes still work properly?

I've read a few explanations of transistors, both on the 'net & in the Art of Electronics book, but it's not really going in :frowning:

I don't have any PNPs to hand, could you recommend something suitable?

How about 2N2907A

KSP2222s I have (bought because they were dirt cheap) are more suitable as signal amplifiers than digital switches,

No normally the other way round, you can get switching transistors that are poor at signal amplifiers.

If I'm using the NPNs in common emitter mode, the max output @ 5v is therefore ~4.3v.

But you will not always get 5V from an output pin of a processor being driven from 5V. The data sheet for this processor says that the output voltage can drop to 4.2V with a 20mA current. That gives you 3.5V.

My LEDs require 3.1v +0.05/-.10; is that a problem?

Yes it is because it affects the current regulation you get with a simple resistor. You do not have enough voltage left across the resistor to make it effective, even if you factor this into your calculations. Using a transistor gives each anode the same voltage to work off.

Good one on transistors

Thanks again. Reading the transistor link now, so far, so good!

2N2907A - Yipe! £2+ each.... (from Farnell anyway). PN2907A looks pretty similar, except in a plastic case, and is a far more reasonable 15p each.... and KSP2907ATA @ 12p.... Thanks for the lead, though, unless there's a specific reason to get the 2N version, I'll be going for probably the KSP (to match my 2222s :D)

Grumpy_Mike:
But you will not always get 5V from an output pin of a processor being driven from 5V. The data sheet for this processor says that the output voltage can drop to 4.2V with a 20mA current. That gives you 3.5V.

Aye, but I'm putting the MCU output into the base, and drawing the power from the supply rail, which is always at (or damn near) 5v? It's quite possible I'm missing something fundamental here, if so my apologies (I'm not questioning your wisdom, I'm questioning mine).

Again, thanks for your assistance, I will change the NPNs to PNPs when they arrive, and add the NPNs to the cathodes.

I'll post a link to a short video of it doing its thing later, once I've located a micro-SD card adapter...

, I'll be going for probably the KSP (to match my 2222s)

Sounds resionable.

Aye, but I'm putting the MCU output into the base, and drawing the power from the supply rail,

Yes but you always draw some current from the Arduino's output to get the transistor to work. You should have a switch.

Could not the NPN emitter-follower be used for the digit select scheme with the transistor bases pulled-up to +5V?
The outputs would be 4.2V (5V - V_BE).

He could but that is not what he has done. Anyway the transistor is not fully saturated with an emitter follower so it is simply the wrong way to do things.

Going against the grain here...

but have you thought about using a MAX72xx chip instead?

It will multiplex the leds so fast you'll think see all the leds lit up.. (but really they are just being turned on/off so fast you save on the current requirement/needs)

Os use TPIC6C595 or TPIC6B595 to sink current from the segments, can handle 20mA per segment no problem.

The circuit works fine, I'm just not convinced the LEDs are as bright as they could be. And I'd like to avoid cooking my '595s.

You probably won't "cook" your 595s even with currents that are "moderately" over-spec.
And the key question probably shouldn't be "are the LEDs as bright as they can be?" but rather "are they bright enough?"

As it happened, I cooked my '595s when I stuck the 5v regulator in & fed them 24v.... seems the regulators don't match the data sheet, and they were too feeble anyway. Plus 24-5v is such a big step, I've ended up using a buck converter.

TBH, they are "bright enough" as they are, provided I can get a suitable screen to go over them. I figured I'd like to drive them to the max, but no more, after all brighter is better...

Anyway, my PNP transistors have arrived this morning, so tonight I'll be re-jigging the breadboard (again) to use the correct tool for this job.

Or use TPIC6C595 or TPIC6B595 to sink current from the segments, can handle 20mA per segment no problem.

If I had any here, I'd use them.... If this were a commercial product I was making, I'd use the MAX driver suggested elsewhere.... Other than the encoder, I was hoping not to have to buy any components for this project, as it happens I've had to buy some PNP transistors and a few sundries (switches, mains inlet, 24v PSU), but beyond that, it's all from stock.

So... just before I let the magic smoke out, can someone please reassure me that I've got my transistors & resistors the right way around now?

Many thanks!

Yes that looks right. I would add a 10K between the base and emitter of the 2907 as well, to make sure it turns off.

OK, this is odd.

So I wired up 1 digit & 1 segment (basically, as per the schematic in my previous post - ignore the pinouts, it's an EBC transistor, not BCE as pictured). Applied voltages, to be greeted by a red-hot transistor & a nasty electrical smell.... When I reversed the transistor, so the emitter faced the LED & the collector was attached to the voltage, it worked as it should do.

I definitely haven't read the datasheet incorrectly, I'm sure, and all the pictures of PNP transistors show the emitter connected to V+, not the collector. The transistors are the right part number.

Any idea why they only work when wired bass ackwards?

AdeV:
OK, this is odd.

So I wired up 1 digit & 1 segment (basically, as per the schematic in my previous post - ignore the pinouts, it's an EBC transistor, not BCE as pictured). Applied voltages, to be greeted by a red-hot transistor & a nasty electrical smell.... When I reversed the transistor, so the emitter faced the LED & the collector was attached to the voltage, it worked as it should do.

I definitely haven't read the datasheet incorrectly, I'm sure, and all the pictures of PNP transistors show the emitter connected to V+, not the collector. The transistors are the right part number.

Any idea why they only work when wired bass ackwards?

Don't be silly. You obviously got something wrong. Maybe you have an NPN not a PNP.

I definitely haven't read the datasheet incorrectly,

Yes you have.

basically, as per the schematic in my previous post - ignore the pinouts, it's an EBC transistor, not BCE as pictured

Your schematic did not show any pin out information so you can't say that it did.

Do you understand that a schematic symbol has no relationship to the physical part?

Well, obviously something is wrong. I will re-examine the wiring tonight. Unfortunately I left the phone with the photo on it down at the workshop yesterday.

Mike - if you look at the picture I showed of the schematic, it includes the transistor pin numbers on the "legs". These are incorrect on the schematic, they are numbered E=1, B=2, C=3, according to the data sheet, available here: http://www.mouser.com/ds/2/149/KSP2907A-1010790.pdf I do not have the "AC" part.

Assuming I'm not mis-remembering this wiring error or whatever; I have nevertheless come across a definite discrepancy between datasheets & components just recently: I have a handful of 78L05 100mA voltage regulators: the Vin and Vout pins are categorically and absolutely definitely reversed compared to the data sheet, I have proven this empirically.

The same component may be available in several different pinouts, you have to check the datasheet for the
actual version you have - manufacturer and whole part number need to match... Dozens of manufacturers
make 78xx and 79xx style voltage regulators, and for instance some might produce a version thats pin-compatible
with a completely different regulator chip, in order to be used as a replacement for it.

Some common TO92 transistors are available in multiple pinouts for instance, although in general this
is uncommon, you have to be wary.

MarkT:
The same component may be available in several different pinouts, you have to check the datasheet for the
actual version you have - manufacturer and whole part number need to match... Dozens of manufacturers
make 78xx and 79xx style voltage regulators, and for instance some might produce a version thats pin-compatible with a completely different regulator chip, in order to be used as a replacement for it.

Some common TO92 transistors are available in multiple pinouts for instance, although in general this
is uncommon, you have to be wary.

This is the regulator in question: http://uk.farnell.com/webapp/wcs/stores/servlet/ProductDisplay?partNumber=1467763

The datasheet can be downloaded from that page. However, Vout and Vin (for the TO-92 package) are the wrong way round. I did check the part number actually printed on the part, but I'll check again to be sure to be sure.