Strange ADC Aref behaviour

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... well strange to me.

I built an external precision 5V reference (temperature-compensated) using a LM336-5. This reference was running off its own power source, because of the system design.

I noticed that when Vcc was removed from the micro using this reference, that the reference voltage was pulled down to about 1.6V. Found a thread here, which suggested that it was not a good idea to have a voltage on a pin, when there was no supply!

So, I thought why not put a 1K resistor in series to "limit current". Now the ADC readout increases about 4%. A close look at the datasheet suggests that Rref is 32K. And 1K in series with 32K would make about this much difference. However, the voltage on the Aref pin did NOT change. Even going up to a 10K series resistor and the ADC reading increasing by 13% only dropped the 5.00V reference down to 4.995V on Aref. I do not understand what sort of load the Aref pin is applying to my reference circuitry to give this sort of behaviour.

I will change to a 2.56Volt reference (LM336-2.5) fed from Vcc on micro to get around the initial problem, but can anyone explain what is happening inside the micro "looking" into the Aref pin?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it possible to turn off the reference when the MCU is turned off?

What happens in the turn-off state is that you are supplying power through the over-voltage protection diode on the ARef pin. That happens when ever the pin voltage is above (about) Vcc+0.4V or so. Since Vcc = 0 when the MCU is unpowered, the external reference is supplying power through that diode into the Vcc network through the MCU and out to the rest of the board.

Reducing the reference to 2.56V that can be powered by Vcc and thus shut off when Vcc is shut off WOULD "fix" the problem. So would a reference with an enable/disable pin.

As far as what is going on when you add a series resistor, that is harder to say. Atmel (as is the case with most semiconductor manufacturers) tends to be pretty non-commital about real internal circuitry. For one thing, I they say "it is THIS way", and you design relying on that, and they choose to change the internals, then you could be SOL, even if the spec'd performance does not change at all.

All that said, I think that you are getting caught by the pulse nature of the load that the ADC puts onto the reference. That is why a 100nf external cap is recommended when you use the internal reference. That 32K Rref is likely present ONLY during a conversion. Your duty cycle is probably low enough that the averaging meter does not see it. But, if you were to look at that pin with a good scope, you probably could see it.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Tue. Feb 18, 2014 - 08:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

However, the voltage on the Aref pin did NOT change.

I suspect it did--for a brief period. Didja look at this voltage with a fast [enough] 'scope?

What happens when you put a small cap next to the ref pin for the ADC to sip from?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, I didn't consider that the Aref pin would behave like the other ADC input pins.

Thanks, to both of you. I'll confirm with my 'scope.

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This issue came back and bit me again. The big picture ... as I wanted to improve the precision of the ADC readings I built a 2.5Volt temperature-compensated buffered reference using a LM336-2.5 followed by an LM358 "low-noise" buffer, as per the LM336 app note. The LM358 is suppose to be able to source a min of 10mA at a 2.0V output. I only have 5.0Volts on its supply, so that assumption might be incorrect.

My ADC routine takes two measurements (actually 8 samples on each channel) one after the other and I turn the ADC on and off for each measurement.

Initially, I only had a 10nF cap on the Aref pin and was supplying it directly from the IC o/p. However, evidently the LM358 is only capable of driving a max of 50pF or "you lose your stability margin". So, I put a 1K resistor in series, before the Aref bypass capacitor.

Then I noticed that my ADC readings changed significantly (3%) from the initial case. Re-reading the above I see a 100nF is recommended. That improved things a bit, but still quite a bit different than the initial case (no 1K resistor).

What I see on the 'scope with 1K series R and only a 10nF to ground is a 75mV drop in Aref during both sampling periods. I can see when the second channel is called as I get a very short pulse positive going pulse. Even with a 1uF mylar I see Aref decreasing expotentially down about 30mV and then down to 50mV during the 2nd channel measurement. Perhaps a delay between the two channels would allow Aref to "recover".

It took 47uF to get close to the initial case. Maybe, 10uF would do.

I know this is an error of about 3%, so I might be asking too much. If I am, I will read more about taking high-precision ADC measurements.

But, if I have over-looked something I would appreciate being told.

Thanks,
davef

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The LM358 would be pretty bad as it sinks more than it can source.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How are you writing to ADMUX? Only one write to select the input and ref or multiple writes?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
// ADC #defines   
   #define ADC_ON  (ADCSRA |= (1<<ADEN))
   #define ADC_OFF (ADCSRA &= ~(1<<ADEN))
   
   #define ADC_SELECT_CHANNEL0 do{ADMUX &= ~((1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (1<<MUX0));}while(0)
   #define ADC_SELECT_CHANNEL1 do{ADMUX &= ~((1<<MUX3) | (1<<MUX2) | (1<<MUX1)); ADMUX |= (1<<MUX0);}while(0) 


ADC_SELECT_CHANNEL0;
ADC_ON;
averaged_ADC_value = get_ADC_value();
ADC_OFF;

ADC_SELECT_CHANNEL0;
ADC_ON;
averaged_ADC_value = get_ADC_value();
ADC_OFF;

Aref is selected initialised once and does not chamge.

js,
Yes, I know the LM358 is getting a bit old, but I don't think that has anything to do with this problem. I don't understand your comment, do you mean it CAN sink more than it can source. It don't think it has to sink any current only source. This reference is running all the time and does not change.

It appears that when the ADC is turned ON it consumes significant power from the external reference. A 75mV drop with a source R of about 1K is 75uA. Maybe, that is to be expected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
do you mean it CAN sink more than it can source.
Yes, not symmetrical.

But I had it upside down :oops: it can source 20mA but sink 8mA, it's a long time since I used it but I remember the trick of putting a 4K7 to ground in order to get a symmetrical sine-wave signal output.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you turn the adc on, how long do you wait for it to settle? Do you discard the first conversion?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js,

When that part is AC coupled and required to handle larger AC signals the 4k7 is required to increase the bias current in the output stage.

Kartman,

I don't wait, well not that I know of. Should you?

As per common practice I discard the first reading, then take 8 readings and average them, on each channel.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since you say the reference voltage dips when you enable the adc, then i'd suggest you wait until the voltage stabilises.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But it stays low for all 16 conversions. I have looked for a input current spec for the ADC and am not able to find anything.

Perhaps, I need to take the hint about the LM358 and up-grade to a modern rail-to-rail op-amp that can cope driving the recommended 100nF cap on the Aref pin ... without any resistors in the path.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman,

After same more tests I see what you mean. I dropped the series R down to 100 Ohms and with a Aref cap of 1uF the voltage drop is 8mV and it takes about 2-4us to stabilise. This means that the first 2 or 3 of the 8 readings would be a bit off.

The 8mV change is 10 times better than the original 80mV, but I will try a 5us delay after turning the ADCon().

Thank you for the hints.

Cheers,
davef