0
\$\begingroup\$

As I am trying to learn basic circuit design I would like to build and simulate simple models to test my conceptual understanding. One of the first designs I am trying to tackle is to use an analog input pin on a microcontroller, but it is not clear to me how the pin itself should be modeled (and indeed thus how it behaves in a real circuit).

Can I think of an analog input pin as behaving like a multimeter set to read DC voltage, with the negative lead attached to ground? And does it, like a multimeter, have some large internal resistance?

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

As a basic approximation, yes, the input is similar to a multimeter. If you want to take this further for high speed or high accuracy signals, you will find that most microcontroller ADCs use a Successive Approximation Register Architecture to read the voltage. These take some time to read the analog signal, so there needs to be a method to hold the signal on the pin.

A sample and hold circuit is normally used to take a sample of the signal. This involves connecting the input to a small capacitor (pF range I believe) via an op-amp buffer. The measurement is then taken against the voltage held on this capacitor. For a higher accuracy approximation, we can look at the input as the input to a op-amp, configured as a voltage follower. This will be a very high input resistance as it will be a gate of a mosfet, with some capacitance becoming more significant at higher frequencies

So as a simple approximation, a large resistance will be reasonably accurate. For a more complex model, a small gate capacitance with some series resistance from the switch, and a very small inductance from the package and wires connecting to it,

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for these links! I don't know if or when I would have independently figured out the need for a sample and hold circuit otherwise… \$\endgroup\$ Commented Dec 15, 2011 at 11:27
  • \$\begingroup\$ Just to clarify, you don't have to build one, there will be one inside the microcontroller. It's only if you want to model the pin that one needs to worry about it. Glad it was useful! \$\endgroup\$
    – D_Weight
    Commented Dec 15, 2011 at 15:51
1
\$\begingroup\$

I believe the goal of any voltage measurement, including an ADC, is to minimize the effect of the measurement on the voltage being measured. To accomplish this the measurement device should have a low impedance. Like with most models you can start with the most idealized basic model. If it serves your purposes, i.e. it predict well your use of the device within the domain of interest then it is a good model. I first order model could simply be of the measurement probe going through a resistor (Rs) to ground. The resistance, Rs, could be taken as being very high, even infinite, (i.e. an open circuit) for some measurements. The thing being measured, i.e. the output, can be modeled as a (thevenin equivalent circuit) the output pin with a resistor (Rth) in series with voltage source which then goes to ground. For DC signals you get a voltage divider formed with Rth and Rs. i.e. this model could predict some voltage drop at the measurement node due to these resistances. This is why in general you want low output impedance (i.e. low Rth) and high input impedance (i.e. high Rs). For example if either Rth is zero or Rs is infinite you always measure Vth. You can refine your model further for higher speed AC signals, there capacitance and inductance come into play and need to be accounted for. In general this probably gets very difficult to model and requires specific details about your output and input circuitry. You likely would still have the same voltage divider, but, then it would become frequency dependent and the Rth and Rs would be Zth and Zs respectively, i.e. they would be impedance, not just simple resistances. I think you would only need this much detail in very high speed circuits. If you say you are trying to learn basic circuit design so I don't think you will bump into this type of circuit yet. For basic low speed circuits you probably probably assume that Rs is infinite.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.