Is resistor needed for VREF pin when voltage is from divider?

Hello there!

Just starting out, fiddling with an Uno. I would like to use the ADC with EXTERNAL reference voltage but I also would like to be able to swith back to 5V if needed (default).

Docs say, I need a 5K resistor if I want to do that. analogReference() - Arduino Reference

The reference voltage I produce (1V) is coming from a voltage divider with resistors. Intuitively, I'd say I'm all set up but electronics tend to prove me wrong.

Q: Do I need another resistor before the pin and the output of the voltage divider?

Thanks!

If you are using an external voltage divider to get the external reference, you need to take the internal 32k resistor into consideration.

The 5k mention would be redundant.

Measure the pin voltage to GND, use this in your calculations.


BTW

Suggest you stick with:
“ you must set the analog reference to EXTERNAL before calling analogRead()”


Karma for reading the data sheet !

Hmm...

This made me think... If there is an internal 32k resistor, I should be able to use that as R2 in the voltage divider calculations.

VCC -> R1 -> VREF -> R2 -> ADC

So, if I wanted exactly 1 V, the math would be:

VCC = 5V
R1 = 128kOhm
R2 = 32kOhm
VREF = 1V

Though, I need some confirmation, is this actually so?

Yes.

But why not use the internal 1.1 reference voltage ?

“ INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega)”

Where is the 32K coming from? I don't recall reading of that in the 328P datasheet.

“ Warning

Don't use anything less than 0V or more than 5V for external reference voltage on the AREF pin! If you're using an external reference on the AREF pin, you must set the analog reference to EXTERNAL before calling analogRead(). Otherwise, you will short together the active reference voltage (internally generated) and the AREF pin, possibly damaging the microcontroller on your Arduino board.

Alternatively, you can connect the external reference voltage to the AREF pin through a 5K resistor, allowing you to switch between external and internal reference voltages. Note that the resistor will alter the voltage that gets used as the reference because there is an internal 32K resistor on the AREF pin. The two act as a voltage divider, so, for example, 2.5V applied through the resistor will yield 2.5 * 32 / (32 + 5) = ~2.2V at the AREF pin.”

There is no mention of "an internal 32K resistor on the AREF pin" in the 328P data sheet.
I am searched what I believe is the latest from Microchip, DS40002061B, from 2020.
Nor do I recall ever having seen a 32K resistor on any 328P or 2560 based Arduino board.

Phantom resistor then. :confused:


As suggested, the OP should just use the 1.1 internal reference, measure the voltage on the pin then use that measurement in calculations.

Hey, you have nothing to do ;), add a 33k resistor to 5v and measures the pin voltage to see if you get ~2.5v.


Sorry about sending the vortex down south :(.

Hasn't hit us in MA too much. There have been much colder temperatures in TX than here!

The coldest we saw in February so far is -39°C, January was quite warm.

+2°C sun shinning right now :).

Next time, 2022, we will try to give Texas a two week notice :roll_eyes:

-39C! We had a couple of days around 10F, (-12C), but they didn't last long.
A few years ago we had a couple weeks of 5F (-15C), that was pretty cold, froze our washing machine water pipes.
They are wrapped in heat tape now, turns on when temp gets cold enough.

Woooo :slight_smile: That escalated quickly! Surely won't ask about I2C for a while just to avoid puns around TX :slight_smile:

How does one measure voltage on a pin? Is there anything special to do or just the good old multimeter?

A DMM should give you a reasonable measurement, they have reasonably HIGH input impedance.


Edit

For 1.1v, the reference needs to be selected in code.

This discussion might have some interesting information for you.

https://forum.arduino.cc/index.php?topic=547472.0

I often measure the 1.1 reference and write it on the top of the 328 DIP chip.

I measured it with multimeter.

Vout = 1V (from voltage divider)

Hooking that 1V onto AREF pin and setting analogReference to EXTERNAL resulted in no voltage drop on the pin. I guess that 32kOhm resistor really doesn't exist.

“I guess that 32kOhm resistor really doesn't exist.”

I’ll put that information in my pocket ;).

CrossRoads:
There is no mention of "an internal 32K resistor on the AREF pin" in the 328P data sheet.
I am searched what I believe is the latest from Microchip, DS40002061B, from 2020.
Nor do I recall ever having seen a 32K resistor on any 328P or 2560 based Arduino board.

It's second from the bottom in the characteristics table. Took me 15 seconds to find.


Also note that min/max values are not specified, so this value is not controlled. Do not rely on it for any calculations, it's just meant to be a ballpark figure so you know about how much it's loading your reference voltage.

Hmm, ok. I was searching for 32K, didn't think to look for just 32 and units elsewhere.

CrossRoads:
Hmm, ok. I was searching for 32K, didn't think to look for just 32 and units elsewhere.

It also depends on which revision of the datasheet you're looking at. The one I have saved to my computer from years ago has a 50k typical value in the table, which just goes to show you how much they just don't care about controlling that particular value.