Go Down

Topic: Arduino Uno ADC input inpedance (Read 1 time) previous topic - next topic

carpenterbee

Just starting out on the Arduino Uno v3.  After playing around with a 10k pot wired from 5V to Gnd, with the wiper attached to A0, some of the results are a bit puzzling to me. I'm wondering just what the input impedance of the ADC portion of the Arduino presents to the outside world. I'm seeing much more effect on the variable voltage divider created by the pot than I would have expected.

Also I'm starting to think that the A0-5 pins might just be one ADC being multiplexed. I would get very jiggly readings on analogReads until I introduced a delay of 100 miliseconds in the loop. I guess I was expecting much more from this inexpensive chip than it was prepared to provide.  LOL

Thanks;
Walt E.
North Carolina
Walt
North Carolina

CrossRoads

"the A0-5 pins might just be one ADC being multiplexed."
That is correct.
Often, ones does two readings back to back on a channel to give the voltage more time settle going into the mux & sample &  hold circuit for the ADC to actually work on.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

carpenterbee

#2
Jul 30, 2012, 08:13 am Last Edit: Jul 30, 2012, 08:11 pm by Coding Badly Reason: 1
Well, here's my problem.  I got rid of the 10 k pot just in case it was flaky.  I replaced it with two 220 ohm resistors in series across the 5V and ground of the arduino. With the A0 pin not connected to the junction the junction measures close to 2.5 volts as expected.  When the A0 lead is connected the voltage across the bottom resistor drops to .4 volts!!!! To say I'm bumbfuzzled about this result would be a mild understatement. Obviously something is going on here that I'm not aware.

Resistance of both resistors measured with Fluke 77 at 221 ohms. Same fluke was used to measure the DC voltage at the junction of the resistors.

This is the simple sketch I'm running on the arduino:

Code: [Select]
#include <LiquidCrystal.h>  // I have a LCD connected to display the result

LiquidCrystal lcd(12, 14, 11, 7, 8, 9, 10);

int sensorPin = A0;    // select the input pin for the
int sensorValue = 0;  // variable to store the value coming

void setup()
{
lcd.begin(16,2);
lcd.setCursor(0,0);
}

void loop()
{
 
sensorValue = analogRead(sensorPin);
 lcd.clear();
 
 lcd.print(sensorValue);
 delay(100);  
}



I must be making some mistake with this sketch.  I can't see it. LOL

Walt
North Carolina


Moderator edit: [code] [/code] tags added.
Walt
North Carolina

dxw00d

Code: [Select]
LiquidCrystal lcd(12, 14, 11, 7, 8, 9, 10);

int sensorPin = A0;    // select the input pin for the
int sensorValue = 0;  // variable to store the value coming


From pins_arduino.h
Code: [Select]
static const uint8_t A0 = 14;

You have defined your lcd to use analogue pin A0.

carpenterbee

Interesting.  I just started learning how to use the LCD library yesterday.  The example that I got somewhere (hehehe, that's the problem) the author wondered why pin 14 was used, as it had no effect on LCD operation.
I just changed the sketch to A5 and everything works as it should.  510 of 1023 on the LCD and 2.5 volts at the center of the divider with the Fluke 77. So I guess I've got to figure out how to properly use the LCD library now.  LOL
And my ignorance of the Arduino must be showing also as there is no Pin 14 silk screened on the board. So I'm wondering how you figured this one out.  In any event, thanks a lot.

Walt
North Carolina
Walt
North Carolina

Grumpy_Mike

The analogue pins A0 to A5 can be used as digital pins if you call them pin 14 to pin 18 in your code.

carpenterbee

Wow, thanks Mike.  I haven't programmed in over 20 years.  Getting old isn't for sissies.  LOL
Thought I'd take it up again as a hobby in my old age. Maybe I should try boxing.  heheh

Walt
North Carolina
Walt
North Carolina

Leon Heller

The ADC inputs are intended for source impedances of 10k or less.
Leon Heller
G1HSM

carpenterbee


The ADC inputs are intended for source impedances of 10k or less.


Thanks for the info Leon. My callsign is k4wde
Walt
North Carolina

MarkT


The ADC inputs are intended for source impedances of 10k or less.


Indeed - higher impedances may cause inaccuracy when switching between different analog inputs in successive analogReads() due to the sample-and-hold capacitor needing to charge fully in 1.5 ADC clock periods (by default the ADC clock has a period of 8us).

If you are reading a slowly varying signal from _just one_ analog pin, you can get away with much higher input impedances as the sample and hold capacitor doesn't have to track fast input changes.  The actual input impedance at DC is extremely high, measured IIRC in the Gohm range!

The 10k limit is designed to keep the inaccuracies down to less than one LSB - a higher input impedance can be tolerated if you don't need 10 bits of resolution - if only 8 bits required then 40k input would do for instance and you would ignore the 2 LSBs.
[ I won't respond to messages, use the forum please ]

dc42

The datasheet quotes the analog in put resistance as 100 megohms typical. The real problem with using source resistances greater than about 10K is that the sample capacitor take a little time to charge through the source resistance. Unfortunately, whoever wrote the analogRead() code chose to set the multiplexer to the required input in one instruction and start the ADC conversion in the very next instruction. If a delayMicroseconds() call is added at this point, it works reliably with higher source resistances, e.g. a 10us delay is good to 100K ohms source resistance. You can go still higher using a larger delay, although then the 100Mohm input resistance will reduce the accuracy.

If the input voltage you want to measure varies only slowly, another way to handle high source resistances is to connect a capacitor of 10nF or 100nF between the analog input pin and ground.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up