# Are I/O pin internal resistances equal to the Thevenin resistance?

I'm trying to find the Thevenin resistance of an I/O pin for the ATmega644. I see on the datasheet that there is a 20-50 kohm range of internal pull-up resistance. So with that, I can create a circuit modeled thus (ignore all values):

The voltage source is from the GND and I/O pin and the resistor in the diagram is the pull-up resistor. I only care about this pin when it is HIGH so I am assuming that the Veq=Vcc. Thus Req is the pullup resistance when high.

Am I missing something here? I'm looking for the output Thevenin resistance.

-
Are you using the pins as inputs, as open-drain outputs with the internal pullups enabled, or as active drivers? –  Kevin Vermeer Jan 24 '12 at 0:15
@KevinVermeer I'm just using the pins for LEDs –  mugetsu Jan 24 '12 at 0:17
When using an internal driver (MOSFET) to drive the pin the impedance is ~~~= Vlow/Ilow. This will typically be say 1v at 10 mA or 0.5 V at 1 mA or 0.01V at 0 mA. ie output impedance varies depending on how hard you try to pull against it as it is a dynamic device. Above Is would be 1/.01 = 100 ohm, 0.5/.001 = 500 ohm, 0.01/0 = infinite. Realistically you could use 100 ohms. You cannot use a simple single Thevenin value as it depends on load. But when being pulled high it is indeed 2k. Note that you say can't drive LED when low but it is already driving the 2k and would drive a LED to V+. –  Russell McMahon Jan 24 '12 at 0:35
Maybe it is just me, but I feel like you might be going down the wrong path with something. What exactly is it that you are trying to do? Why do you want to know the thevenin equivalent? –  Kellenjb Jan 24 '12 at 2:07

The information you gave specifies the Thevenin equivalent when the pin is configured as an input. Veq will be the same as Vcc and Req will be the pull-up resistance from the datasheet. The input capacitance might also be important, depending how you use the input.

When you configure the pin as an output, the equivalent circuit will change. Req will be much lower. Veq will depend on whether the output value is high or low (and Req probably depends also).

When calculating the Thevenin equivalent circuit, its good to remember that Veq is the open-circuit output voltage; and Req is given by Veq/Iss, where Iss is the short-circuit output current.

# Edit

Microcontroller data sheets don't always give you everything you need to know to answer your question. Here's the closest thing to relevant lines from your datasheet (p. 316):

This says that with a 5 V supply, if the load is 20 mA or less (the negative sign indicates current going out of the pin) the high level voltage will be at least 4.2 V. You can guess that the open-circuit output voltage will be very close to 5 V (or you can measure it on a demo board to be sure). That implies the Req is no higher than (5.0 - 4.2) / 0.020 = 40 Ohms.

In any case, these estimates are all very rough. They all depend on the assumption that the output driver has linear characteristics. In reality, the behavior is likely to have substantial nonlinearities, so its better to design using the specs that are guaranteed in the datasheet, rather than make guesses about Thevenin equivalent circuits.

For example, if you design your LED load to draw less than 20 mA, you know that you'll get at least 4.2 V out of the output pin. That should be enough to choose your LED current limiting resistor, or tell you that you need an external transistor buffer to drive your LED.

Also, be sure to check Note 3 after the quoted table in the datasheet where it gives some limits for total I/O current in case you are driving multiple LEDs from different pins.

-
sorry i forgot to specify that I'm looking for the output thevenin resistance. So it looks like my solution above is wrong. I would assume that I should only care about when Veq is high, since when it's low it can't drive an LED or have much of a current. In this case would Veq still be Vcc? –  mugetsu Jan 24 '12 at 0:23
When configured as an output you can get a rough estimate of the Thevenin equivalent from the rules in my 3rd paragraph. Use the specs for the open-circuit output voltage and the short-circuit current to determine the Thevenin equivalent circuits for the high and low cases. For the low case they'll give a max current when the output is shorted high instead of when its shorted to ground, and you'll need to work out the Req from that. –  The Photon Jan 24 '12 at 0:37
Note that the short-circuit current for an output is not necessarily the same as the maximum current to avoid damage... –  The Photon Jan 24 '12 at 0:39
my datasheet gives me the voltage and current for the output high i/o pins, am I right to assume that these are the open-circuit output voltage and short-circuit current, respectively? –  mugetsu Jan 24 '12 at 0:59
can you give a link to the data sheet (edited in to your question would be great)? –  The Photon Jan 24 '12 at 1:36