Using AREF as a voltage sensor source , on NANO (ATmega328) board

Recently I needed to measure a simple "balance" between two photo resistors (CADMIUM cells). basically both cells in series with one side grounded, the other tied to a voltage source, and the midpoint into an A/D input. I purposely chose cadmium cells that are on the "insensitive" side (5549 I believe), and am sure that the combined resistance of both cells in series will never drop below about 8K. Further, wanting to absolutely minimize the current flow through the divider, I chose to configure AnalogReference(INTERNAL), so that I would only need to supply the divider with a 1.1 V source.

So the natural question is, why can't I drive the resistive divider with the actual AREF pin. And here's where the conflict begins between what is written and what is actually measured. I understand from some spec quotes that this pin is primarily brought out so a capacitor can be added to increase stability. Spec further states that this pin should only be measured with a high impedance voltmeter. Sounds like a pretty wimply source voltage, but here's what I found...

I configured my NANO board for Internal as above, and connected a fully open 100K linear pot from AREF to Ground, with a DVM in parallel. The AREF terminal output was about 1.076, with or without the 100K load. Not quite the 1.1 specified but there was no change taking the 100K out of the circuit. I then replaced the pot and slowly rotated it to increase load. At just under 9K the voltage dropped a somewhat insignificant amount, to 1.075. From there on there were additional small decreases, down to about 1K, at which point I measured about 1.062V. Below 1K, there was a VERY steep decrease.

I tried this test on a few boards, both powered by 12VDC on the VIN, and again with just USB power.

At this point I conclude:

  1. There appears to be some buffering on the VREF output. It certainly did not behave like a simple case of a 1.1V source in series with a high impedance.

  2. Up to a load of 10K, the VREF output seems at least as stable as the 5.0V regulator output with a proportional load.

  3. Since a 1.062 drop from an initial no-load voltage of 1.076 equates to less than a 2% difference, I have to conclude that a load on VREF (to ground) greater than 1K (lets say 2K-4K for margin) makes VREF probably useful in cases like the simple "balance" network I described, with a worst case load of 4K.

Finally, I also tried dead shorting the AREF (something I'd never try with the 5V output), and left it that way for several hours. After tat, as soon as the load was released, the AREF voltage wen't right back to normal.

So this is a case of the part's behavior seeming to exceed what the spec indicates. I should also not that I have been doing this for well over a year without any problems. I'm second guessing myself now because I've never seen an example of anyone using AREF as an actual voltage divider-sensor source. But can anyone confirm what I've found, or offer any reason (beyond what the spec says) why I should not continue doing so? The Spec certainly does not seem to go into this as pros or cons.

I've written to Microchip on a support case about this to see what they say. But I'd rather ask the community too.

I'd say you've demonstrated you can "get away with it" and it should be fine for a one-off hobby project.

If you were "going into production", I'd recommend you follow the chip manufacturer's recommendations/specs and buffer the output.

  1. There appears to be some buffering on the VREF output. It certainly did not behave like a simple case of a 1.1V source in series with a high impedance.

Most solid state outputs don't behave like resistors. And for example, you "impedance match" (dropping the voltage in half) you are usually well-beyond the current specs and in danger of frying something.

DVDdoug:
I'd say you've demonstrated you can "get away with it" and it should be fine for a one-off hobby project.

If you were "going into production", I'd recommend you follow the chip manufacturer's recommendations/specs and buffer the output.
Most solid state outputs don't behave like resistors. And for example, you "impedance match" (dropping the voltage in half) you are usually well-beyond the current specs and in danger of frying something.

Thanks, and what you're saying is obviously the safe way to go. But I'll be curious to what Microchip reports to me. My "bad" for sure. Having tried this a year back and experiencing no trouble, I went ahead and cut a handful of PC board. Now, never having seen an example of what I'm doing got me thinking I'd better go further here and see what the actual limits are.

Of course I never intend to load the output during intended use, to the point of dropping the voltage by half. This was just my "stress" test, as was the short circuit test. But if the intended load is a solid 10X away from the point where drops are observed, its at least worth looking into before I rush to changes.

I could easily switch to AnalogReference(DEFAULT), and use the on-board 5V regulator for my divider source. That would only require one trace cut and another added on the next run. But if I desire the advantage of the lower current draw you get with about 1/5 the voltage, I'd have to add an OP AMP buffer (and probably a rail-to-rail type since 1.1V is pretty close to the negative rail). There is also another unintended benefit! I've seen that a momentary short on AREF has no observable affect. Short is removed, readings are restored. On the other hand, a short on the 5V regulator would, at the very least, force board to restart.

I'm not being lazy, but its just reasonable to want to see is a current design is truly sound before I rush to re-design. Surely someone else has tried what I've done and can share their experience too.

NEVER use the Aref pin to power things.
There are easier/safer ways to reach your goal.

Try this:
Connect a (10k) resistor between the 3.3volt pin and the Aref pin, and make sure you set Aref to EXTERNAL in setup().
Connect the two-LDR voltage divider between Aref and ground (they are not powered by Aref, but by the 10k resistor).
Connect the center of the voltage divider to an analogue pin.
Write code that subtracts ~512 from the measured result.
Leo..

Wawa:
NEVER use the Aref pin to power things.
There are easier/safer ways to reach your goal.

Try this:
Connect a (10k) resistor between the 3.3volt pin and the Aref pin, and make sure you set Aref to EXTERNAL in setup().
Connect the two-LDR voltage divider between Aref and ground (they are not powered by Aref, but by the 10k resistor).
Connect the center of the voltage divider to an analogue pin.
Write code that subtracts ~512 from the measured result.
Leo..

If you have two very variable photo-resitive sources, which may totqal anywhere from my calculated 4K up to meg ohms in dark conditions, and I power this voltage divider by a 10K, the voltage at both the midpoint and the feed point is going to vary anywhere from the 3.3V down to less than half that, and no fixed subtraction will give me a useful result. I need to power my divider from a stable reference. If I were going to do what your suggesting i would just power the divider from the 5V regulator. Knowing that my divider's total resistance never will drip below 4K, it would only be a 1MA draw.

But as for the first assertion, "NEVER use the Aref pin to power things", my question here has been "why not"? With all the cautions I've seen in the spec, I've never seen any words saying "NEVER" power "ANYTHING" from that pin.

I'm just saying "Power things" is a relative term, right? If I'm talking about trying to "power" an electric motor or incandescent lamp, I wouldn't argue. But if I've already proven that the resistive load I'm looking to drive is an order of magnitude above the point where it would affect my measurement, and it doesn't harm the MCU, why is this a hard fast "no"?

You don't seem to understand ratiometric behaviour.
Absolute voltage on the LDR voltage divider is irrelevant if the Arduino takes it's Aref from that same voltage.
If the LDR:LDR ratio stays the same, A/D value also stays the same (ratiometric A/D).

What could be an issue is the high LDR dark resistance.
I would recommend a high value resistor (<=10Meg) across each LDR, and a 100n ceramic cap across each LDR.

The low "bright light" resistance is only an issue if LDR divider voltage (= Aref) drops below ~1volt (because of the 10k current limiting resistor).
But you said LDRs won't drop below 8k in your original post.
Leo..

Wawa:
You don't seem to understand ratiometric behaviour.
Absolute voltage on the LDR voltage divider is irrelevant if the Arduino takes it's Aref from that same voltage.
If the LDR:LDR ratio stays the same, A/D value also stays the same (ratiometric A/D).

What could be an issue is the high LDR dark resistance.
I would recommend a high value resistor (<=10Meg) across each LDR, and a 100n ceramic cap across each LDR.

The low "bright light" resistance is only an issue if LDR divider voltage (= Aref) drops below ~1volt (because of the 10k current limiting resistor).
But you said LDRs won't drop below 8k in your original post.
Leo..

Ah, but by that same logic of ratio-metric behavior, you can see where i was happy using the AREF for the voltage divider! After all, if AREF is both the divider source AND the AD/D reference, it would seem that even if I loaded the poor AREF down to a horrible 50%, the ratio would stay the same!

I'll report back because currently a Microchip engineer is investigating this for me, to actually quantify an acceptable loading on AREF for this type of measurement. My request was to assume a worst case load of 4K which amounts to 250 microamps at 1.1V), and an 'acceptable AREF droop of 2%. I'll be curious what they conclude.

OH and yes... inconsistency of dark resistance it i always a problem with LDRs, and I inevitably have to add some kind of shunt limit resistance across them. nature of the beast! :slight_smile:

Since this was important to me (a PC board had already been cut based on my assumption), I took the time to enter a support ticket about it at Microchip. An engineer kindly did some digging for me, and the findings may prove helpful to others considering my use of the AREF pin. (Some of this is a copy of info I posted on stack exchange)

So now, having had the benefit of a support ticket and subsequent discussion with an engineer at TI on this subject, I can confidently offer a qualified YES to my own question. It turns out my case is probably the only one that would be within these qualifications:

  • In the case where the RATIO between two hi-resistances is the ONLY thing needed from an A/D measurement, it is acceptable to use AREF and GND for the applied voltage, provided the load is low (see item 2). The main reason is that any droop in the AREF caused by the added load would not affect the ratio.

  • The use of AREF for such a situation should still ensure limiting any load on the AREF pin to about 91uA. For the 1.1V (INTERNAL) source selection, that equates to about a 12K load. The number is based on a reverse calculation that would cause a 1 LSB difference in analog readings, IF other analog inputs are expected to be used for other non ratio-metric measurements.

  • Using the AREF pin this way makes it even more important to add a capacitor from the pin to GND.

  • Apparently there is no danger of harming the chip in any way, should the AREF pin become shorted.

I will comment that the engineer responding to my support ticket understood I was trying to avoid a PCB change, but recommended a different approach if I had occasion to make other board changes anyway. His recommendation was to use the EXTERNAL Analog reference option, using the available 3.3V pin for AREF voltage, and using a digital output to supply my voltage divider. The idea here is that I would still have the benefit of short circuit protection, and since I was concerned about power saving, I could switch the Digital output pin to a low state until readings needed to be taken, observing sensible delay for settling time.

A good suggestion indeed, but my reason for following up on my own question here is because under the constraints given, using AREF as described in my OP is acceptable, will not affect the ratio measurement, and could not harm the chip.