Rheostat as Voltage Divider and AREF

I have a 1Meg pot that is wired in as a rheostat on a 5v circuit.

I need to monitor this "rheostat", and I know that i need to add in a 1Meg resistor to create the voltage divider so the Nano (or Uno) can measure it.

So effectively, instead of measuring 0-5v, it'd be measuring 0-2.5v

So with a Nano or Uno I'd only be seeing 50% of the normal analogRead range.

This is working OK, and I can do the analogRead on it.

My question:
If I was to add in second voltage divider and connect that to the Aref pin, so the reference voltage is 2.5v, then will that give me the full 1024 range of the analogRead for this rheostat?

to me, that seems to be the purpose of the aref pin, but I've never used it before.

1 Like
  • Use a TL431 current reference to get 2.5v

sounds easy enough.

So my theory (and hope) is correct, in that using the aref pin at 2.5v will get me the full range of the analog read (0-1024) for the rheostat, yeah?

I read somewhere (a few weeks ago) that on the Nano the aref pin doesn't do anything as it doesn't go anywhere, but I find that hard to believe. Maybe it was in reference to a Nano clone.

The Nano has an internal 1.1V reference you can divide down to. That won't require any extra parts besides the resistors.

Some remarks:

  • Don’t use the voltage reference. The supply voltage probably comes from your PC via USB, and may vary from 4.75V to 5.25V. Using a fixed voltage as VREF means you need to know the supply voltage.

  • The input VREF has a not negligible input resistance that will affect a voltage divider.

  • You’ll need to calculate the ratio between the rheostat and the series resistor, and that is independent from the supply voltage.

  • The value of the series resistor determines where in the range you’ll get the best accuracy.

  • Choose a series resistor with a low tolerance, preferably 0.1%.

In my book 0.1% is a high tolerance resistor. A low tolerance one would be say 20%,

That is way too high and will cause interference pickup problems. It will also cause slow reads, that is it will take several reads of the same pin to get to the stable value.

The analogue input circuits of an Arduino are optimised for a 10K input impedance.

No. If you use a 1K resistor you can read from 0V to 4.995V
No need to mess with Aref

Read the following diagram (Fig-1) to see the position/role of AREF-pin as Input/Output of ATmega328P MCU of the UNO/NANO Board.

AREF-pin will work as input line if you include the following line in the sketch:

analogReference(EXTERNAL); //user supplied external voltage (range: 1.1V - 5V) will be connected with Vref-pin of ADC. K1, K2, and K3 (sofware switches as conceptual level) will be opened.

If you execute one of the following lines, the AREF-pin is an output pin and will show the voltage (5V or 1.1V) that appears on VREF-pin of the ADC.

analogReference(DEFAULT);   //5V is connected with Vref-pin of ADC
analogReference(INTERNAL);  //1.1 V is connected with Vref-pin of ADC


Figure-1:

1 Like

This might work:


In setup():

analogReference(EXTERNAL);

Use a 5 or 10 turn trim pot.

@Grumpy_Mike Tolerance means margin. Low tolerance means better accuracy.

@JCA34F Two thinghs wrong with your schematic:

  • The 3.3V is a fixed voltage, the measurement is done from 4.75-5.25V.

  • VREF has an input resistance that is not negligible.

I know AREF has a ~32k pullup to Vcc with analogReference(DEFAULT), but does that apply to (EXTERNAL)?

My impression was that that was a pull-down resistor of approximately 30kOhm, and on-chip resistors often show a high tolerance (like the pull-up resistor: 20 – 50kOhm). But I never have been able to find it in figures or schematics. Anyway, if the voltage applied to AREF if ‘hard’ enough, it isn’t relevant. When a voltage divider is connected to AREF it will affect the actual voltage (in my opinion unpredictably).

When the reference EXTERNAL is used, the ADC will use the actual voltage at AREF as reference.

INTERNAL reference is the 1.1V internal voltage source.

DEFAULT reference may be 5.25 to 4.75V if the USB is connected.

The circuit from post #10 works fine on a Nano clone.
Want details?

I translate post #10 to this:

AREF is set to 2.5V with a multimeter.

Suppose R1 = R2. You expect at A0 2.5V, thus an ADC reading of 1023.

If the 5V actually is 5.25V the voltage at A0 is higher, the reading will still be max: 1023.

If the 5V pin actually is 4.75V the ADC reading will be: 972.

And that is the problem I try to point out.

Got your point.

Try telling Farnell
https://uk.farnell.com/c/passive-components/resistors-fixed-value?st=resistors+high+tolerance

You searched for ‘resistors high tolerance’ and found resistors 5% and 1%.
Try searching for ‘resistors low tolerance’, you’ll find resistors 1% and 0.1%.
https://uk.farnell.com/c/passive-components/resistors-fixed-value?st=resistors+low+tolerance

Thanks for all the feedback.

Just to give some addition info, I am attempting to make an "adapter" for the old Atari2600 Paddles. so I am working off of its existing DB9 pinout.

They are using 1meg pots that are wired as rheostats, so only the PWR and Wiper are connected. I do not want to have to open them and add the missing ground wire.

So on the Nano, I've added a 1meg resistor to GND at the pin for the wiper, so now it is a voltage divider and the ADC can measure the voltage.

When I use a meter and I measure the output, I am getting 2.5v - 5v, and the analogRead gives values from 512-1023 as the knob is turned.

So I cannot use a aref of 2.5v since my output will always be over 2.5v, and I can't get a full range of 0-1023 from the analogRead.

For my project, I need to divide this pot's output into 16 distinct regions, or segments, and I will do something different depending on which area the read falls into.

and I am actually looking for analogRead values between 600-1020. This means each segment of the read's output that i am testing for is only about 25 or 26 wide.

all my code is working good for all that, but the readings from the various Paddle sets that I've tested all appear to be a bit jittery, and I need to try and get more stable readings.

Currently I am doing 4 reads and taking the average, and working off of that average, and it did help a little bit, but not quite enough.

I was going to look into the various oversample codes that are floating around, or i may need to use a 12bit ADC that will give my 4x the resolution, so each of my segments will now be 100 wide and hopefully the jitters will be less.

I’m getting back to the original post.

  • The AREF pin on the Nano (classic) works exactly the same as on the UNO, it’s the same microcontroller.

  • The AREF pin can be used, but not with 2 resistors, you need to compensate for the input resistance at AREF.

The info that you want to you use existing Atari paddles leads to the next schematic:

The reading of the ADC is not linear with the resistance of the rheostat, but you can calculate the resistance value and with that the position of the knob. Averaging 4 consecutive readings is a good idea. Capacitors will also make it less jittery.

To be honest, the ADC of this microcontroller was not designed for resistances this high, but that’s what you’ve got in those paddles.
All in all you might consider modifying the paddles or build something yourself.