problem with pot and arduino uno

Help with arduino uno and pot

I have a 10 k pot attached to arduino uno
When i turn pot from left to center the value is 124
(Value is between 0 and 255) and when i turn it
from right to center the value Is 135
I need a fix value for center of pot so what should i do?
Thanks for your time

Hi,

How do you know you are (exactly) in the center?

Can you post a pot picture?

Regards

You are experiencing "backlash".

The wiper of the pot is not being returned to the same position each time.

It has nothing to do with the Arduino, it is a purely mechanical problem.

lamineovich:
When i turn pot from left to center the value is 124
(Value is between 0 and 255) and when i turn it
from right to center the value Is 135

analogRead() returns values between 0 and 1023 with 511 or 512 as the centre value. You should solve your problem at that stage and scale your values subsequently.

You can expect some variation in readings and the simplest solution is to treat any value between (say) 500 and 524 (or wider limits if necessary for your particular potentiometer) as meaning "centred".

...R

When you know the direction of the move, you can take into account the observed backlash. When successive values increase, add half of the observed difference (135-124)/2 to the value, else subtract it.

Reliable positioning requires a precision pot with low backlash, or a solution that doesn't suffer from that effect. The cheap trim-pots have a huge backlash, and are intended for adjusting a voltage once only, and mounting on a PCB. Pots for e.g. volume control should perform better, i.e. those intended for front panel mounting with an axis and a case with thread/nut fixation. Twist the wires from the pot to the board, or use a shielded cable, to reduce interference.

Robin2:
analogRead() returns values between 0 and 1023 with 511 or 512 as the centre value. You should solve your problem at that stage and scale your values subsequently.

He is using a logarithmic taper pot.