Quick query about Common Anode 7 segment displays and transistors.

I very recently bought an Arduino Uno to brush up my rusty electronics skills, and am starting out with a relatively simple timer project.

I've successfully wired up a common anode 4digit 7segment display to my Arduino and have got it scrolling text, but I've noted that around the web a lot of people are connecting/switching their anodes with transistors. I understand this is to prevent too much current draw on the pins of the Arduino. In my case the draw per segment is only 20mA (and I have resistors on each segment), so as long as I'm only turning one digit on at a time, I shouldn't have a problem?

As I say, my skills are a little rusty, so just need some advice before I'm confident enough to move on with the project.
Regards
Tom

In my case the draw per segment is only 20mA (and I have resistors on each segment), so as long as I'm only turning one digit on at a time, I shouldn't have a problem?

That is right, you seem to be doing well. Cheers.

But one digit = 7 segments = 140mA...??

MarkT:
But one digit = 7 segments = 140mA...??

That's what I've seen written in various places around the web.

Correct me if I'm wrong, but with a single common anode digit displaying the number 8 you have your anode pin supplying a maximum of 5V and 40mA to each of the LEDs in the digit (as they are parallel). Each of the LEDs in the digit is wired back to individual pins on the Arduino, supplying a maximum of 5V and 40mA to each pin, as long as you only have one digit on at a time. (In practice a series resistor on each segment reduces these values further.)

As I say, I only have very basic knowledge of this stuff so I may be missing something.

The arduino doesn't supply a maximum of 40mA, that is the maximum amount of current you can draw before damaging it. Keeping it down to 20mA is sensible. So yes 7 segments at 20mA = 140mA. This is close to the limit of directly sourcing current through an arduino (200mA total through all the pins).

You MUST put current limiting resistors on each of the cathodes:-

http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

If you want more digits you have to source the current from either the 5V rail or an external supply and control it with an arduino.

Grumpy_Mike:
The arduino doesn't supply a maximum of 40mA, that is the maximum amount of current you can draw before damaging it.

Sorry, that's what I meant when I wrote "supplies a maximum of 40mA", probably should have added "before damaging it", but it was late. :slight_smile:

Keeping it down to 20mA is sensible. So yes 7 segments at 20mA = 140mA. This is close to the limit of directly sourcing current through an arduino (200mA total through all the pins).

As I figured earlier 7 segments at 20mA is fine, as it doesn't exceed each pin limit (of 40mA). I just didn't know that the Arduino has a limit of 200mA total current.

You MUST put current limiting resistors on each of the cathodes:-

LEDs

If you want more digits you have to source the current from either the 5V rail or an external supply and control it with an arduino.

I do have resistors on the cathodes otherwise I'd have probably exceeded that total already and blown something up :stuck_out_tongue:
By more digits, I'm guessing you mean more digits lit simulaneously? Surely I could connect as many digits as I wanted (pins permitting) and continue to turn one on at a time? Obviously if I want more segments, then I'd be close to pushing the 200mA total.

if I want more segments, then I'd be close to pushing the 200mA total.

Only if the all the segments were on at the same time. You can multiplex them, (rapidly turn them on an off) not only to save pins but also to save current. However, multiplexing will make them dimmer and you can have exactly the same effect by dropping the current through the segment. Have you tried seeing how bright they are at 10mA? It won't seem half as bright because the eye has a log response.

Grumpy_Mike:

if I want more segments, then I'd be close to pushing the 200mA total.

Only if the all the segments were on at the same time. You can multiplex them, (rapidly turn them on an off) not only to save pins but also to save current. However, multiplexing will make them dimmer and you can have exactly the same effect by dropping the current through the segment. Have you tried seeing how bright they are at 10mA? It won't seem half as bright because the eye has a log response.

Yeah, my 4 digit display is multiplexed so i'm already rapidly turning individual digits on and off.

When you mentioned switching down to 10mA you reminded me that all my calculations were done to get 20mA thro each segment, but I didn't have enough resistors near 150ohm, so I ended up using 330ohm resistors instead. So I'm actually drawing nearer 10mA per segment already, and the brightness is fine. So I guess I can run a few more segments (or decimal points) without worrying about the total current draw being exceeded.

Cheers for the advice so far.