Analog input impedance

Started by alfthornton, April 30, 2015, 02:53:49 PM

alfthornton

I'm brand new to Moteinos, so sorry if this has already been addressed or is obvious, but I couldn't find a direct answer.

I'm putting a voltage divider together for input into the analog I/O pins and would like to know the effective input impedance I'm dealing with.  I read on the specs that I should expect 30mA of DC current on each I/O, but that seems kind of high if it is referring to all I/O pins. is that regardless of input voltage?  Also, am I safe to assume that the analog values are 0:3.3VDC, and that the high digital input should be 3.3VDC?

My experience is in industrial PLC's, so any guidance or clarification would be greatly appreciated.  And again, if this has already been answered in some FAQ please let me know where I can find that.

Thanks for your help!

TomWS

From the ATmeag328P datasheet, table 29.20, ADC Characteristics see attached lines.  Net: Analog input (when setup properly) is 100M ohm input resistance.  However, note that there is some input capacitance to the Comparator so, after changing the Mux to select a new input, if the source resistance is high, then you need to allow enough time for the capacitor to charge to a sufficiently close level to meet your accuracy needs.

I also included the ARef (RRef) input resistance because its relatively low value tends to trip people up when they use external ARef.

If you want to know how to calculate the setup time for a given source resistance, there are plenty of articles around for this...

Tom


Felix

#2
I don't know the impedance question answer.
For pin input impedance please consult the Atmega328 MCU datasheet, that might contain what you're looking for.
I did a brief search in there and the most relevant reference I found is this:

The ADC is optimized for analog signals with an output impedance of approximately 10 k or less. If such a
source is used, the sampling time will be negligible. If a source with higher impedance is used, the sampling
time will depend on how long time the source needs to charge the S/H capacitor, with can vary widely. The user
is recommended to only use low impedance sources with slowly varying signals, since this minimizes the
required charge transfer to the S/H capacitor


Yes - the analog highest 1024 1023  10-bit reading corresponds to 3.3volts.

Regarding the DC current, that is a figure that was picked up from a source I cannot recall, but it might refer to a 5V system, which would mean I have the correct those figures to reflect a 3.3V system. Please do not assume you can draw 30ma or 20mA from all the pins at the same time. You should generally not try to source or sink a lot of current directly through the atmega328 pins. *However* i must say the chip can source quite a bit of current, and two digital pins working together can turn ON a signal relay like this one which is used in the GarageMote project to open/close the garage opener.

I hope this puts you in the right direction.

TomWS

Quote from: Felix on April 30, 2015, 03:34:35 PM
<snip>

Yes - the analog highest 1024 10-bit reading corresponds to 3.3volts.

<snip>
Actually, to be precise, the highest reading is 1023 and corresponds to an input voltage = VRef, the reference voltage selected for the ADC.  The default selection is AVcc (typically 3.3V but not always), but can be selected to be the 1.1V Voltage Reference or an External voltage fed into the ARef pin.  The digital value read will be:

  val = Vin * 1023 / Vref, with val maximum limit being 1023.


Tom

Felix

You are of course correct, 10 bits is 1024 positions, and in 0 indexed systems it goes from 0-1023. My brain was missing when I typed that ;)

TomWS

Quote from: Felix on April 30, 2015, 10:15:32 PM
You are of course correct, 10 bits is 1024 positions, and in 0 indexed systems it goes from 0-1023. My brain was missing when I typed that ;)
Easy to do, and generally not vital whether one uses 1024 or 1023.

The thing that I felt most important to convey was that the reference isn't always 3.3V, either due to varying power sources or a different selection for VRef.  I think that the ability to select different VRefs is very powerful and is probably underutilized because the source tends to be stated as 'always 3.3V'.

Tom

Felix

Thanks for filling in, yes - the AR pin can be used to feed a different reference voltage, and that's a great feature.

alfthornton

Thanks guys, you answered my question perfectly.