0
\$\begingroup\$

I'm trying to linearize the output of an audio tapered potentiometer. Right now, I'm using ADC on a Beaglebone to read the value of a 250k potentiometer with 3.3V. I get a value between 0 and 1, but it is scaled such that the rate of change of the potentiometer's value increases dramatically as the knob is turned to the right - it looks something like an exponential curve.

I was wondering how I could convert the value of the audio tapered potentiometer to that resembling a linear one. Can I just do something with logarithms?

\$\endgroup\$
2
  • \$\begingroup\$ Since 2 answers have invoked taking a logarithm, I'll comment here that such a log compensation needs to very careful at low amplitudes. Since the log of 0 is minus infinity, any uncorrected zero error will produce large errors at very low settings. \$\endgroup\$ Commented Feb 7, 2016 at 17:01
  • \$\begingroup\$ Use the correct (linear) pot. \$\endgroup\$
    – Ecnerwal
    Commented Feb 7, 2016 at 21:14

2 Answers 2

4
\$\begingroup\$

The best answer is to use a linear pot in the first place.

Yes, you can correct the logarithmic nature of the audio taper pot to get linear pot position. However, you will lose resolution at the low end since the output voltage varies slowly with pot position there compared to the high end.

You will have to experiment to determine the compression range of the audio taper pot you have. The easiest way to linearize it in firmware is to use a lookup table. Linearly interpolating within one of 32 segments should be good enough. This will approximate the exponential pot function as a 32-segment piecewise-linear function. In practise, you can probably get away with fewer points than that. Maybe just outright measure 8 points, put them into a table, then linearly interpolate between those.

\$\endgroup\$
2
\$\begingroup\$

While I think it would usually be easiest to simply swap-out for a linear potentiometer; Yes, you can take a logarithm of the audio pot's output & that should give you a fairly linear output (depending on the accuracy of the potentiometer's exponential output).

In case you're interested in a more in-depth explanation, or in building an analog circuit to save your CPU having to calculate the logarithm, this pdf article might be of interest.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.