Linear potentiometer

Thread Starter

pjreijiri

Joined Aug 19, 2015
97
Hello Guys,
I am working on a project where I am using a linear potentiometer to measure distance. I connect the output on the pot to the analog input on the arduino with a pull down resistor (2400 ohm, I just picked it randomly) so when the wiper is not touching the pot I would not get random jabber.
The thing that I am having is that there is linearity over the whole pot. On the first 10cm i have a relation between the raw value and reference value of y=a*x where a is increasing from 1.25 to 2. from 10cm to 20 cm a is 2, then from 20 to 30cm a is decreasing from 2 to 1.25.

Is there a way to have a linear function? maybe change the value of the pull down resistor or am I missing something.

The linear pot is 30cm with a resistance of 10Kohm.

Any thoughts?
 

OBW0549

Joined Mar 2, 2015
3,022
Is there a way to have a linear function? maybe change the value of the pull down resistor or am I missing something.
Forget the pulldown resistor; it's making the pot output nonlinear. Connect one end of the pot to +5V and the other end to GND. Connect the arm of the pot to the analog input of your Arduino. That will give you an analog value which is linearly proportional to distance (assuming your pot is linear, of course).

If you want to use a pulldown resistor to cover a possible situation in which the arm of the pot loses contact with the ends, use a large resistor like 1 MΩ or more.
 

WBahn

Joined Mar 31, 2012
24,854
Could you sketch your circuit?

In your results, what is y and what is x? Are these voltages? Resistances? Positions?

My guess, at first glance, is that the non-linearity is being introduced by the pull-down resistor. Since your pulldown resistor is only a fraction of the size of the pot, it will have a significant effect. See if a 100 kΩ resistor will work (eliminate the jabber). If not, reduce it only enough to deal with the jabber.
 

WBahn

Joined Mar 31, 2012
24,854
Here's what I expect your response to look like (if I'm envisioning your circuit correctly). You can see that anything over ~50kΩ should give you good results, though whether they are "good enough" depends on your needs.

potlinearity.png
 

Thread Starter

pjreijiri

Joined Aug 19, 2015
97
Thank you guys, I put 1Mohm resistor and it worked like a charm. I have accuracy less than 1mm and maybe less because I am using a measuring tape as a reference.
 
Top