What is the equivalent circuit of an analog/digital output pin when it is connected to a larger circuit, so that I can use the classical formulae to calculate voltage/current?
I always consider the digital output pin in HIGH state as some kind of +5V battery with some internal resistance. Is this correct?
I know that Arduino does not really have a true DAC analog pin but other boards have. I am more interested in the true DAC output. What would that look like in a circuit. I can hardly imagine a battery with varying voltage and I don't know how to calculate the current.
There are many types of Arduino, they are not all the same and so the equivalent circuits won't be the same. Some do have true DAC(s). To answer your questions, we need to know which type you are asking about.
The diagram in section 13.2 of the ATmega328 datasheet shows the circuit for each digital pin.
When driven as an output pin there is an NFET active when the pin is low, pulling the pin to ground,
when pin is high a PFET pulls it up towards Vcc.
These devices have roughly 30--40 ohms of on-resistance. This will vary from pin to pin somewhat,
from device to device somewhat, and also vary very definitely with supply voltage, increasing as the
supply voltage drops.
A fairly high proportion of the chip area is taken up by these output FETs to give them a low on-resistance,
the internal FETs in the processor will have several kOhms on-resistance as they are much smaller.
When you look at a photo of a CMOS die you'll see all the "pads" arranged around the edge, comprising
a wire-bond area (the real pad) and associated driver circuitry including two large FETs.
The switch is a good analogy... Think of it as a "constant voltage" (5V when high) with a maximum current specification of 40mA. Any resistance less than 125 Ohms will result in excess current and you can potentially damage the Arduino.
The voltage isn't exactly 5V or constant -
The [u]ATmegaDatasheet[/u] says output high is at least 4.2V at 20mA and Vcc = 5V. Output low is 0.7V or less.
That's how digital works.... It's either high or low. Or if something is wrong it may be in-between and undefined. But if everything is designed correctly things almost never go wrong. Computers almost never get a data error in the digital electronics (it can happen on a hard drive or during data transmission).
That's how most electronics works... The voltage is (approximately) constant (independent of the load) as long as everything remains in-spec. The current depends on the load and if you draw excess current bad things happen.
The datasheet shows you the equivalent circuit but it doesn't have the kind of detail you're looking for.
MarkT:
. . . These devices have roughly 30--40 ohms of on-resistance. This will vary from pin to pin somewhat,
from device to device somewhat, and also vary very definitely with supply voltage, increasing as the
supply voltage drops. . .
The approximate resistance can be estimated from the plots in "35.7 Pin Driver Strength" section of the ATmega328 datasheet. There are plots for 3V operation and 5V operation and for the range of ambient temperature. The voltage plots are approximately, but not exactly, linear functions of current which is to say the swiitch plus resistance approximation of post #2 above is pretty good within the recommended operating range. When I worked through this, I got something on the order of 40 Ohms, consistent with the posts above.
I am more interested in the true DAC output. What would that look like in a circuit. I can hardly imagine a battery with varying voltage and I don't know how to calculate the current.
I missed this earlier, rather buried in your post - if you ask several questions is best to number them so they can be addressed individually.
The answer is it depends on the type of DAC. Some will look like a constant resistive impedance, others will have
a low impedance output, being buffered on chip. Microcontrollers have voltage output DACs, but you can
encounter current output DACs sometimes if using other chips (typically high frequency or high resolution).
Imagine a battery with a varying voltage, that's a reasonable analogy for a voltage signal. So long as the
load you impose on the signal has a much higher impedance than the DAC itself you don't have to worry.