Pages: [1]   Go Down
Author Topic: Arduino Uno ADC input inpedance  (Read 1623 times)
0 Members and 1 Guest are viewing this topic.
Eastern Carolina
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Learning uP
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Walt
North Carolina

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26524
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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.
Logged

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.

Eastern Carolina
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Learning uP
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
« Last Edit: July 30, 2012, 01:11:40 pm by Coding Badly » Logged

Walt
North Carolina

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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:
static const uint8_t A0 = 14;

You have defined your lcd to use analogue pin A0.
Logged

Eastern Carolina
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Learning uP
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Walt
North Carolina

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33408
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Eastern Carolina
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Learning uP
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Walt
North Carolina

St. Leonards-on-Sea, E. Sussex, UK.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 301
Ancient developer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Leon Heller
G1HSM

Eastern Carolina
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Learning uP
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks for the info Leon. My callsign is k4wde
Logged

Walt
North Carolina

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11718
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Pages: [1]   Go Up
Jump to: