Go Down

Topic: Dual potentiometer, getting a clear reading of the end states (Read 3917 times) previous topic - next topic


I have a dual potentiometer (i.e. 2 potentiometer of equal resistance controlled by the same pin).
One nice thing is that it has 11 steps (but the resistance varies continuously between the steps, so it is not a bunch of different resistors).

I hooked it up to my arduino and used analogRead to get see what values I got for different steps. Turned out that the first two steps resulted both in 0 and the last two both in 1023.
Hooked it up the multimeter and there are only a few ohms difference between the steps.
Well, I want to use all 11 steps, not 9!

Question: Is there any way I can scale up the difference of the resistance? What do I need and how do I connect it?

My idea is that the difference of ~0.7 ohms and 3 ohms (not exactly these values, but something like that) is easier to tackle than the small difference at the other end, where the multimeter read something like 86k ohm.
So I could use two analog input on the arduino and connect them on opposite sides so the voltage drop moves inversely on the different analog inputs.

It is okay if it has to switch on some circuit to get the precise reading. Like if the input value is less then 3 (out of 1023) it can turn on some digital output pin connected to 'something' to change the scale and make it possible to differentiate.

And I know people like to know what they are helping others to accomplish so a brief description comes here of the project (I will do post a thread when I get the project finished with all the tuning needed):
I'm modifying my dad's lawn mower tractor. Instead of the right pedal for speed (and direction) it will have this potentiometer on the dashboard to control the direction. I had planned to use 3 steps for reverse, 1 neutral and 7 forward. Knowing that the pedal needs some extra adjustment to maintain speed when pulling load changes (i.e. going uphill, downhill or on flat ground) I don't want to loose 2 steps on the potentiometer. In the long run I plan to measure the speed of the lawn tractor and have it compensate for this problem.
The actual control of the speed to the transmission unit is a linear actuator with feedback (in which the analog read value doesn't have the above problems with dead zones) to know the position.


Sep 16, 2013, 01:56 am Last Edit: Sep 16, 2013, 02:00 am by majenko Reason: 1
That sounds like quite a nice find.  I am guessing it is out of something audio...?  It sounds like a "straight line audio taper" - trace 3 in this graph:

Either that or an S-log taper, which unfortunately I haven't been able to find a graph of.
That graph, along with this little quote, is from The Secret Life of Pots - a very interesting read.

When we buy "audio taper" pots, we usually get something like Curve 3. For less expensive pots, manufacturers use a two or three-segment approximation to Curve 2. It's not perfect, but it usually works OK. Curve 4 is the typical resistance versus rotation curve for reverse log pots. In real life - that is, if you ever found one of these in real life - it is usually a two or three segment approximation, too.

If you have an unknown pot, you can figure out what taper it is. You measure the resistance from end to end, then turn the pot exactly to half its rotation and measure the resistance from the counterclockwise lug. The crosses on curves 1, 2 , and 4 show the most probable values. If the resistance is 50% of the total resistance, then the pot is linear. If you measure only 10% to 20% of the total resistance, the pot is an audio taper. If you measure 80%-90% of the total resistance, the pot is a reverse log taper.

There should be a code stamped or printed on the pot somewhere - something along the lines of A10K, B15K or A103 for example.  Having that number can decipher just what it is.


Some of the pots I have used have a "dead zone" near the ends of the travel. The problem you're having is that the "steps" that are marked on the dial don't take the dead zone into account. I don't think there's any way to change this, as it is a function of the physical construction of the pot itself.


Here is a photo of it. The knob is from another potentiometer. I bought a bunch of new unsorted potentiometer and this was one of them.

As you can see I found the stamped text B100K, so now we know that (linear taper). And as predicted, the middle step measured 49,9 kOhm (but max was ~96 kOhm).

On one side I had 0.4 Ohm and 2.9 Ohm for the next step. Measured from the other way, with the lower part of the pot (the one that I've soldered wires to, but I measured directly on the pot) I had the same 0.4 but ~230 Ohm on the next step.

It is possible to detect this inexpensively? Obviously as my cheap multimeter can measure the difference it ought to be possible. But for the application I can't afford buying some expensive multimeter that can connect to a computer which in turn can tell an arduino on which step the pot is.
But the arduino isn't measuring the resistance, it measures the voltage, and as a voltage divider the pot makes the difference between 0.4 and 230 Ohm small compared to the next 96 kOhm.


You should definitely confirm with your multimeter whether the pot is linear or log taper, especially if this is a grab-bag pot. I have found inconsistencies in the labeling depending on country of origin.


You should definitely confirm with your multimeter whether the pot is linear or log taper, especially if this is a grab-bag pot. I have found inconsistencies in the labeling depending on country of origin.

That is what I did when I measured the middle step (6th out of 11) to be 50% of the maximum resistance?


Sep 18, 2013, 09:46 pm Last Edit: Sep 18, 2013, 09:49 pm by DVDdoug Reason: 1
I have something you can try if you are getting any difference at all between steps 1 & 2, and between steps 10 & 11.

Put a resistor in series with each end.   A small resistor at the zero end, and a larger resistor at the 1023 end.    This will reduce the range of the pot... That is, you should have a range that doesn't go all the way down to zero, or all the way up to 1023.  Now since you have about 1000 steps, if there is at least a 1/1000 (0.1%) difference between the steps, you'll get different readings for each step.

Of course, the steps won't be linear/equal, but you should be able to compensate for that (and the fact that the readings don't go all the way to zero or 1023) in software.   The resistors will interact (both affecting all readings) and you'll have to use some trial-and-error to select the values.  Maybe if you pick just the right resistors you can still get use of the full-range from 0-1023.   (Trim pots might work better than resistors.)


That is what I did when I measured the middle step (6th out of 11) to be 50% of the maximum resistance?

Oh, I see. I'm sorry--I missed the significance of that.


Here's an approach:

connect the wiper to an analog pin.

connect a 270 ohm resistor between the wiper and a digital pin.  That pin is normally configured as

You first measure the analog voltage - if it gives a value that implies one of the detents in the middle,
job done.

Otherwise change the digital pin to OUTPUT and drive it HIGH if the analog reading was low, and vice versa.
Reread the analog pin.  It will now have changed enough to discriminate the two end positions if there's
a few ohms involved since you now have formed a potential divider between that resistance and 270 ohms...

Set the digital pin back to an INPUT....

A value much lower than 270 ohms would risk damaging the digital pin, note.

Also as the pot is about 100k, remember to read the analag pin twice if you are reading other analog pins,
to allow the ADC to settle to the relevant ADC multiplexer input.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks MarkT, I used a 330 Ohm resistor (what I had). With that the analog value differed by ~150 so clearly distinguishable. On the other end of the pot it didn't change so much though. But I was only testing with some simple code. I soldered new cables to all 6 pins on the pot. As the ground and output (to analog in) is shifted I hope to have work by selecting to which analog I read when the pot is at either end.


I wouldn't use potentiometer to control speed/direction


I haven't have time to take this project further right now but when I do I will come back to tell if it worked or not.

I wouldn't use potentiometer to control speed/direction

Is there a better way? Any other electromechanical device I don't know of (totally possible)? I want around 10 different settings for a knob and don't have 10 input connections on the arduino to spare for this.


Oct 02, 2013, 12:00 am Last Edit: Oct 02, 2013, 12:09 am by joshuabardwell Reason: 1
A rotary encoder will give you an infinite number of inputs with a single knob. Typically, a rotary encoder would be combined with two buttons or an up/down momentary switch to cycle through the parameters that the knob is adjusting. The total number of inputs would be four--2 for the encoder and 2 for the up/down button(s) or switch. But if your project doesn't have an LCD, a rotary encoder may not work, because absolute position doesn't correspond with parameter value, so you need some way of indicating to the user what the current value is of the parameter they're adjusting.

But really, the number of analog inputs problem can easily be solved with a 4051 analog mux. There is even an analog mux library that makes reading from the mux as simple as reading from an analog pin directly. You get eight inputs with one 4051, mapped to one analog input. You also need three control lines, so your total usage is 3 digital pins plus 1 analog pin => 8 analog inputs. You can build an array of up to 9 4051s to get up to 64 analog inputs with 6 digital pins plus 1 analog pin, and the beauty is that the library supports this transparently. All you have to do is wire it up.

If all you need is 16 inputs, there is an even simpler way of handling it. The 4051 has a chip-select line that causes the chip to be inactive when it is high. So if you had two chips, you could wire the same pin to them using a transistor to make one receive the inverse of the other. So basically, when the pin is HIGH, one chip is active and when the pin is LOW, the other chip is active. This would allow you to get 16 inputs with a total of 1 analog plus 4 digital pins. Again, this is not supported in the library, but it would be a trivial change to make.

Go Up