Understanding potentiometers

I’m a little experienced with electronics in general and specifically with Arduino. Probably have something like 10 projects under my belt.

Potentiometers are giving me headaches in two ways.

  1. in all projects I always have this first issue:
    A) I hook up ground, +5vdc and wiper (to A0).
    B) values read from [0..1024).
    C) so, assuming the knob is turned fully counter-clockwise I’ll get 0. When I start turning the knob clockwise, I can see the wiper value increase. However, the value reaches 1023 before the knob is fully rotated clockwise. Once the knob is twisted and the wiper reads 1023, there is still play in knob and I can still rotate it, say, pi/8 radians and the wiper value does not change.

This happens to every pot I have. I can’t believe all the pots are bad. What is going on and why can’t I Google an equivalent question? This doesn’t happen to anyone else?

  1. this issue has only occurred in my current project.
    A) the project is a 2-voice tone generator. I’m using a giga and using Mozzi for the sonification. Output works out of the box via the giga’s on board audio out.
    B) I’m using 4 pots here: 2 for frequency and 2 for amplitude.
    C) when I turn the knob on some of the pots all the way clockwise (into that value-equivalence angular region) the values measured by all the pots scales up to 1024 even when I’m not turning them. They all read 1024 (using mozziAnalogRead and analogRead). What’s going on here?

Happy to post my code here but I think both of these issues are general and I’m missing something like a capacitor or something somewhere in the circuit. Any help is appreciated!

So most Arduinos like the Uno, Mega and even the Nano, use 10-bit resolution. meaning 0 - 1023, but if you use say an ESP32, it uses 12-bit resolution so it would go from 0 - 4096 instead. You seem to be using an Arduino Giga, which can be configured for different resolutions. see HERE, I think the default is set to 12-bit, so you would need to adjust your code to read values from 0 - 4096.

  1. This is a mechanical manufacturing issue, balancing cost, range, reliability, and longevity all against each other. If you aim too precisely at ideal, real mechanical tolerances will make it so some of the pots won't reach their limits. So they extend the 0 and full-scale areas with some extra so that the wiper can scan completely on or off the variable area. And they extend that landing(?) area to cover variations in the resistive material, variations in the contact area of the wiper, and the assembly tolerances of the various parts.

You could physically limit your wiper to, for example, between π/8 and 15π/8, at the risk of having your measurements being all above 0 or below 1023 and losing some of the range.

There are a couple of the built-in examples about sensor calibration to deal with issues of mis-matches between ideal ranges and actual ranges:

4095...

2 Likes

Schematics would tell a lot.

1 Like

Tear one of your old pots apart. It may explain a few things.

1 Like

1023 means it has reached 5v. Is it possible that the voltage is above this? If so, you need to add a voltage divider to scale the maximum to <= 5v.

That’s not true in every scenario. Think about the Arduino Due or 8Mhz version of the Arduino Pro Micro or Pro Mini.

Is atmega chip really powered by 5v? If you power Arduino by supplying 5v to raw pin, then actually chip gets something like 4.7volts and them you will see this effect. Which Arduino do use and what is power schematic?

1 Like