Current sourcing and sinking on Digital Output Pins

Interfacing hardware, sensors, output drivers, chips.
Post Reply
BobW
Posts: 11
Joined: Tue Jun 02, 2009 6:19 am

Current sourcing and sinking on Digital Output Pins

Post by BobW » Mon Jun 08, 2009 9:35 am

I'm sorry, but I have not been able to find the answer to this question on the web.

Am using BBB w/ Arduino Duemilanove / Atmega328.

What is current sourcing capacity of an individual digital output pin
(that is: pin connected to resistor connected to LED connected to ground)?

Also what is current sinking capacity of an individual digital output pin
(that is: +5V connected to LED connected to resistor connected to pin).

I have successfully illuminated LEDs connected to ground.
Now I want to use a seven segment LED display that has the seven anodes tied together.
So I need to sink the current into the output pins.
Or else use transistors in between.

I would be grateful for any advice on this.

BobW.

teedeeus
Posts: 7
Joined: Tue Jun 02, 2009 11:32 am

Re: Current sourcing and sinking on Digital Output Pins

Post by teedeeus » Mon Jun 08, 2009 10:19 am

BobW wrote:I'm sorry, but I have not been able to find the answer to this question on the web.

Am using BBB w/ Arduino Duemilanove / Atmega328.

What is current sourcing capacity of an individual digital output pin
(that is: pin connected to resistor connected to LED connected to ground)?

Also what is current sinking capacity of an individual digital output pin
(that is: +5V connected to LED connected to resistor connected to pin).

I have successfully illuminated LEDs connected to ground.
Now I want to use a seven segment LED display that has the seven anodes tied together.
So I need to sink the current into the output pins.
Or else use transistors in between.

I would be grateful for any advice on this.

BobW.
The source and sink current on the digital pins of the atmega168/328 are 40ma per pin. It doesn't make a difference if it's sourcing or sinking the current. I would not recommend pulling 40ma out of every digital pin though - that's would probably burn out the chip.

It's never recommended to "push the envelope" - if you need more than 20ma of current I'd recommend some sort of a buffer or transistor driver.

More info can be found here: http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove

paul
Site Admin
Posts: 764
Joined: Mon May 12, 2008 4:19 pm

Re: Current sourcing and sinking on Digital Output Pins

Post by paul » Mon Jun 08, 2009 11:52 am

The datasheet lists 40 mA per pin source or sink. I did a quick test with and LED and mearsured about 43 mA source, but didn't check sink.

The datasheet also lists

DC Current VCC and GND Pins................................ 200.0 mA in the "Absolute Maximum Ratings* section - this rating is always confusing to me though. At times it can mean the maximum source or sink - applied from and external source to the pin/package. In this case though I'd guess it's a total package current draw from the power pins. This figure usually depends on the case and cooling though. Anyway, something rough to go on.

You can always put your finger on the package and see how warm it is - that's always a good indication of power draw in the package and overall thermal issues.

Paul

floresta
Posts: 93
Joined: Mon Jul 28, 2008 6:52 pm
Location: Western New York, USA
Contact:

Re: Current sourcing and sinking on Digital Output Pins

Post by floresta » Mon Jun 08, 2009 11:54 am

BobW:

You get the answer to questions such as this from the data sheet, in the 'Electrical Characteristics' section. Of course it helps if you have a background in Electrical Engineering in order to understand that information. The 40 mA per pin that 'teedeeus' mentions is an absolute maximum rating which you really should avoid.

What you have to watch out for is the fact that there is also maximum combined rating when several pins are active at the same time. The combined rating is 300 mA for all pins, but they are subdivided into groups and the division is not the same for sourcing as for sinking.

Here is my interpretation of the data sheet information in terms of the pin designations used by the Arduino and its derivatives. Perhaps someone could double check to see if I got it right. Remember that pins A0 - A5 can also be used for digital I/O as D14 - D19.

Sinking;
D0 through D4 ............................... Total current = 100mA
D5 through D13 ............................. Total current = 100mA
D14 through D19 ............................ Total current = 100mA

Sourcing:
D0 through D4 plus D14 through D19 .... Total current = 150mA
D5 through D13 ............................. Total current = 150mA

Don

floresta
Posts: 93
Joined: Mon Jul 28, 2008 6:52 pm
Location: Western New York, USA
Contact:

Re: Current sourcing and sinking on Digital Output Pins

Post by floresta » Mon Jun 08, 2009 12:02 pm

Paul and BobW:
DC Current VCC and GND Pins................................ 200.0 mA in the "Absolute Maximum Ratings* section
It looks like I missed that one. That would have to be considered along with the info I gave previously. Also, the 300mA figure was obviously incorrect as the 200mA figure quoted by Paul would override it.

Don

BobW
Posts: 11
Joined: Tue Jun 02, 2009 6:19 am

Re: Current sourcing and sinking on Digital Output Pins

Post by BobW » Mon Jun 08, 2009 12:22 pm

This is very helpful.
Thank you.

What I am going to try now is to multiplex six 7-segment LEDs directly off the output pins.
With 1K ohm resistors connecting each of the seven segment lines (tied together) to D2-D7 (current sink), I will cycle (at 30Hz) thru each display's anode which I will have connected to D8-13 (current source).

If I need to free up another output pin later, I suppose I will encode the digit selection value as binary over three pins and decode it with external ICs.

At 9 volts, current should be approx 54 mA max, at any instant.
Plenty low.
Hopefully, the segments will be bright enough on this 25% duty cycle.
If not will try smaller resistors.

BTW, I am not an EE. I am just and old geezer hobbiest, and would welcome any suggestions or criticisms.

Thanks again.

BobW

paul
Site Admin
Posts: 764
Joined: Mon May 12, 2008 4:19 pm

Re: Current sourcing and sinking on Digital Output Pins

Post by paul » Fri Jun 12, 2009 11:27 am

If you test the current with a meter I bet it will be much lower than your calculation, so you can use much lower resistors such as 220 ohms and get some extra brightness to make up for multiplexing. I'd also go for faster multiplex speed to get rid of flicker.

Paul

Post Reply