How to calculate current (sink/source) into pins - (model?)

I've read that the pins, specifically the duemilanove, have a current limit (sink/source) of 40mA. How can you calculate this current. What is the model for each pin?

http://arduino.cc/en/Main/arduinoBoardDuemilanove
From what I read (see above link - Input and Ouput), the internal circuitry of each pin consists of a pull-down resistor (~20k-50k). Now, below is an illustration of what I imagine this to look like, but then again that is why I am asking this question.


Also, is the 5V pin also characterized by a 40mA limit? I know the 3.3V pin is 50mA, but I could not find similar information regarding the 5V pin.
I have read somewhere that there is also a totalized limit of 200mA altogether but cannot find the source. Is this true?

I have read somewhere that there is also a totalized limit of 200mA altogether but cannot find the source. Is this true?

Read this
http://playground.arduino.cc/Main/ArduinoPinCurrentLimitations

When the pin is configured as an input, almost zero current flows in/out of the I/0 pin. (The input impedance/resistance is around 100 megohms.)

Current is calculated as Voltage/Resistance ([u]Ohms' Law[/u]).

In your circuit, any significant current flowing through the pull-down resistor is flowing through the external "Arduino Read" connection, not through the input pin. A 20K pull-up resistor pulled-up to 5V has 0.25mA (5/20,000 = 0.00025A) flowing from the power supply through the resistor... The current comes from the power supply, not the input pin.

If you connect a resistor to an output pin, then the current flows out of (or into) the I/0 pin, and you can use Ohm's law to calculate it.

DVDdoug:
When the pin is configured as an input, almost zero current flows in/out of the I/0 pin. (The input impedance/resistance is around 100 megohms.)

Current is calculated as Voltage/Resistance ([u]Ohms' Law[/u]).

In your circuit, any significant current flowing through the pull-down resistor is flowing through the external "Arduino Read" connection, not through the input pin. A 20K pull-up resistor pulled-up to 5V has 0.25mA (5/20,000 = 0.00025A) flowing from the power supply through the resistor... The current comes from the power supply, not the input pin.

If you connect a resistor to an output pin, then the current flows out of (or into) the I/0 pin, and you can use Ohm's law to calculate it.

I know how to calculate current in a circuit. The problem of calculating current can become difficult in more complex configurations that a simple one-step linear current-voltage relationship. My question was about the model for the arduino pins. The square box in the OP picture is suppose to represent the header port on the arduino. I read that there existed a 20k-50k internal pull-up resistor (disconnect by default?). My diagram was an attempt to illustrate what I thought it may look like. My question was aimed at answering this question definitively. The "Arduino Read - FTDI USBtoTTL" represents the actual portion of the circuit that reads the voltage directed into the pin.

The Pull-Up resistors are off by default. Arduino pins should be limited to a maximum of 40mA source or sink. That is normally only an issue when using a pin as an output.

In addition, the total current through both the Vcc and Ground pins must not exceed 200mA.

There are more limitations, based on which AVR and which pin. The link given above is an excellent resource.

Yes, calculating all this can be very complex.

sherrellbc:

DVDdoug:
When the pin is configured as an input, almost zero current flows in/out of the I/0 pin. (The input impedance/resistance is around 100 megohms.)

Current is calculated as Voltage/Resistance ([u]Ohms' Law[/u]).

In your circuit, any significant current flowing through the pull-down resistor is flowing through the external "Arduino Read" connection, not through the input pin. A 20K pull-up resistor pulled-up to 5V has 0.25mA (5/20,000 = 0.00025A) flowing from the power supply through the resistor... The current comes from the power supply, not the input pin.

If you connect a resistor to an output pin, then the current flows out of (or into) the I/0 pin, and you can use Ohm's law to calculate it.

I know how to calculate current in a circuit. The problem of calculating current can become difficult in more complex configurations that a simple one-step linear current-voltage relationship. My question was about the model for the arduino pins. The square box in the OP picture is suppose to represent the header port on the arduino. I read that there existed a 20k-50k internal pull-up resistor (disconnect by default?). My diagram was an attempt to illustrate what I thought it may look like. My question was aimed at answering this question definitively. The "Arduino Read - FTDI USBtoTTL" represents the actual portion of the circuit that reads the voltage directed into the pin.

Your answer would be in the datasheet for the 328P chip in the electrical section named:

29.4.8 Pin Driver Strength

There are graphs that show the output voltage Vs current flow (at two different Vcc cases 5vdc and 3vdc) for an output pin set low and high respectively. My math skills won't allow me to convert those slops to a math model, but I think you can see the relationship.

Lefty