I have a tapered log 10K potentiometer. I would like some function which returns tapered log value to linear values. The potentiometer is a slider. When connected to the Arduino the wiper displays the values ranging from 0 to 1023. Currently if I set the slider to the half way position it displays the value 856 (approx), when I'd expect (or want) the value it to be more like 512 (as it's half way). The quarter way mark for example shows a value in the region of 570, where I'd expect the value to be 256. I hope that this makes sense.

This is about the extent of the code so far :))

  curpos1 = analogRead(potPin);

  • You can search for gamma correction which probably helps you find a suitable formula. – Michel Keijzers Jun 7 '20 at 13:37
  • 2
    If it's a log, you could convert in back to linear by using the exponent. A lot of these pots have just two linear sections in them which approximates a log, (or inverse log in your case). I'd just put a ruler next to the slider; move the slider in small even increments; put the values in excel, and create a plot. You can then see if it's an actual log pot, or just aproximated. You can then, in excel, play with some formulas to get back a linear value. – Gerben Jun 7 '20 at 14:16
  • Or just use a lookup table... – Majenko Jun 7 '20 at 15:24
  • what are you using the pot for? – jsotola Jun 7 '20 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.