Feeding Aref from an LM385

I need a really precise Aref, so I tried hooking up an LM385.

I have an 820 Ohm resistor from the LM385's cathode to Vcc (currently 5V, but I plan to build the final version of the project on a 3.3V Arduino Pro), and bypassed it to ground with a .1uF mono.

Per the recommendation, I connected it to Aref through a 4.7K resistor. Much to my surprise, I discovered there's a 200mV drop across that resistor, so the AVR is acutally seeing about 2.3V on Aref, instead of 2.5V

I've tried this on 3 Arduinos (all MaxSerials from Fundamental Logic, but with different AVR chips), with the same results.

I can go ahead and shrink the resistor to 500 Ohms or so to reduce the error, and adjust the software scaling factors for the ADC readings. But I'm puzzled by the "use a 5K resistor" advice that seems to introduce significant errors into systems using an external reference.

Are my results the product of some weird concidence? Or is the "accepted wisdom" actually bad advice?

Thanks,

Ran

Per the recommendation,

So where did you read this then? There is nothing in the data sheet to suggest this.

The recommendation is in the Arduino reference: http://arduino.cc/en/Reference/AnalogReference?from=Reference.AREF

About halfway down the page, it says "It is a good idea to connect external voltages to the AREF pin through a 5K resistor", and goes on to explain why. The rationale makes sense in a development/debugging environment, where the system might spend a lot of time in its default configuration (due to bugs, or while new firmware is being downloaded). And maybe even in a production environment, if the Aref pin is capable of sourcing enough current to fry the LM385 during a relatively-long system start-up.

I guess if you set the analog reference via
analogReference(EXTERNAL);
BEFORE you call the analogRead() function, you do not need any resistor.
But if you forget this and you have something other than VCC connected to the AREF pin, your atmega168 chip might get damaged I guess.

This is just an opinion, never tested it and it is always a good idea to include a resistor on the AREF pin for protection. But of course, there will be a voltage drop across this resistor then...

The LM385 is available in an adjustable version. You might try that one and adjust the output so that the reading at the Aref pin is where you want it, with the protection resistor in place.

http://www.national.com/mpf/LM/LM385-ADJ.html

Ok I got it the data sheet says:-

If the user has a fixed voltage source connected to the AREF pin, the user may not use the other
reference voltage options in the application, as they will be shorted to the external voltage. If no
external voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as reference
selection.

So the series resistor will limit the current between the external Vref and the internal supply.

If you are getting a voltage drop like you said it is likely that you have switched one of the internal Vrefs on, probably the 1.1V and it is this difference that is causing you to see a voltage drop. In which case it is doing it's job.

So in answer to the original question, look at your software to select the correct Vref.

I've dug into the datasheet and the library code, and here's the story.

The AVR chip's power-on default is to use an external reference. So the library's naming of Avcc as "DEFAULT" is a little misleading, and you don't need to worry that the AVR might try to fry your external reference during system initialization.

analogReference() doesn't actually change any hardware settings: it just sets an internal variable that's used to select the reference as part of the hardware "start conversion" command when you call analogRead(). So bohne's suggestion is correct: if you call analogReference() before your first call to analogRead(), there won't be a problem with the library catastrophically reconfiguring the hardware on you.

By CMOS standards, Aref is a pretty low-impedance input: the data sheet says it's typically about 30K. So putting a 5K resistor between your external reference and Aref will produce a significantly different voltage at the AVR's reference input.

In summary: feeding Aref through a series resistor may be "a good idea" if you're likely to run software in the Arduino that would select an internal reference, but it's a bad idea if you can avoid that risk and need/want to use a precise external reference.

Ran

I've been trying to implement an Aref switchable between Default, Internal & External and have been stumped. And according to Atmel:

If the user has a fixed voltage source connected to the Aref pin, the user may not use the other reference voltage options in the application, as they will be shorted to the external voltage.

Looks like it'll have to be all internal, or all external...

QS