Linearizing ADC

Thread Starter

weesh

Joined Sep 30, 2011
15
I'm trying to linearize the output of a voltage divider in which I have one potentiometer and one fixed resistor. Before I go into more (potentially useless) detail, is this a common problem to solve?
 

tracecom

Joined Apr 16, 2010
3,944
Maybe your question is over my head, but if you use a linear taper potentiometer with a maximum resistance equal to the fixed resistor, won't the output of the voltage divider be linear?
 

Thread Starter

weesh

Joined Sep 30, 2011
15
Maybe your question is over my head, but if you use a linear taper potentiometer with a maximum resistance equal to the fixed resistor, won't the output of the voltage divider be linear?
The pot I'm using is a Guitar Volume pedal for a variable resistor within the voltage divider. Unfortunately this does not produce a linear result (Ohms law and all) and I'm trying to figure out what the math would be to produce that.

Any pointers or clues are welcome!

Ken
 

mik3

Joined Feb 4, 2008
4,843
Potentiometers used for sound volume are log scaled (the resistance does not change linearly but logarithmically).
 

MrChips

Joined Oct 2, 2009
30,708
How do you know the pot is linear? Measure the pot resistance from end to end. Set the pot to halfway and measure the resistance from center tap to each of the two ends. Compare.
 

Thread Starter

weesh

Joined Sep 30, 2011
15
How do you know the pot is linear? Measure the pot resistance from end to end. Set the pot to halfway and measure the resistance from center tap to each of the two ends. Compare.
I have measured the pot which goes from 0-40K ohms. Assuming the model of a standard voltage divider (R2/R2+R1)*V here's a partial list of voltages produced.

R1 = 10K
R2 = 0-40K
V = 5

0 ohms: 0/(0 + 40) * 5 = 0
10 ohms: 10/(10+10) * 5 = 2.5
20 ohms: 20/(10+20) * 5 = 3.3
30 ohms: 30/(10+30) * 5 = 3.75
40 ohms: 40/(10+40) * 5 = 4

As you can see, the result is non-linear (a logarithmic curve) . What I'm asking is for some advice on compensating for the curve to produce something linear.

Ken
 

MrChips

Joined Oct 2, 2009
30,708
What you have posted makes no sense to me. Can you measure the resistance of the pot from center to each of the two ends when the pot is set to the mid point?
 

ifixit

Joined Nov 20, 2008
652
Hi Weesh,

Can you confirm this is your situation? See attachment.

What you would like to do is to linearize the output (Vout) without changing the guitar pedal circuit. Correct?

Post #9 would be more clear if written like this...

R1 = 10K
R2 = 0-40K
V = 5
Vout = R2/(R1 + R2) * V

R2 Setting: R2/(R1 + R2) * V = Vout(Log)
0 Kohms: 0K/(10K + 0K) * 5 = 0V
10 Kohms: 10K/(10K + 10K) * 5 = 2.5V
20 Kohms: 20K/(10K + 20K) * 5 = 3.3V
30 Kohms: 30K/(10K + 30K) * 5 = 3.75V
40 Kohms: 40K/(10K + 40K) * 5 = 4V

Regards,
Ifixit
 

Attachments

Thread Starter

weesh

Joined Sep 30, 2011
15
What you have posted makes no sense to me. Can you measure the resistance of the pot from center to each of the two ends when the pot is set to the mid point?
It's a GUITAR VOLUME PEDAL, it only uses one side of the pot. That makes it a variable resistor, yeah?
 

Thread Starter

weesh

Joined Sep 30, 2011
15
Hi Weesh,

What you would like to do is to linearize the output (Vout) without changing the guitar pedal circuit. Correct?


Regards,
Ifixit
Yes, that is exactly what I'm trying to achieve. Sorry for being such a "hobbyist" on this forum. ;)
 

SgtWookie

Joined Jul 17, 2007
22,230
If R1 were replaced by a 0.1mA constant current source, the voltage across R2 would vary linearly from 0v to 4v.
E=IR, so if I = 0.1mA, varying R will vary E proportionally.
 

MrChips

Joined Oct 2, 2009
30,708
You still have not confirmed that the pot is linear like I asked you.
However, ifixit has possibly identified the problem. You need to use the wiper (center connection) of the pot as shown in the circuit diagram below.


If you do not have access to all three terminals of the GUITAR PEDAL, then what Wookie has posted could work.
But this is not the only solution. There are many ways to skin a cat. There is no need to linearize the voltage output.

On second thoughts, I have no idea what you are trying to do. If you could elaborate then maybe we can help you a little better.
 
Last edited:

Georacer

Joined Nov 25, 2009
5,182
Your problem isn't that strange.

Let's picture a voltage divider without load. Static resistor R on top, variable resistor X on the bottom, powered by Vcc.

The output formula is
\(V=V_{cc}\frac X{X+R}\)
Obviously, this is not linear in terms of X.

You can achieve a partial linearization following this link: http://cnmat.berkeley.edu/user/andy...tage_divider_circuit_resistive_analog_sensing

I had done something similar last semester, but I can't find my notes right now.
 

Thread Starter

weesh

Joined Sep 30, 2011
15
If R1 were replaced by a 0.1mA constant current source, the voltage across R2 would vary linearly from 0v to 4v.
E=IR, so if I = 0.1mA, varying R will vary E proportionally.
This sounds promising, and at the risk of appearing stupider than I already do, would it be possible to get some pointers to this? Can it be done with discrete components or is an IC?

Thanks again.
 

SgtWookie

Joined Jul 17, 2007
22,230
This sounds promising, and at the risk of appearing stupider than I already do, would it be possible to get some pointers to this?
You don't sound stupid at all. I'll see what I can do about some pointers.
Can it be done with discrete components or is an IC?
Well, it might be done with either. However, it would help a great deal to know what kind of power you have available;
1) Is the circuit battery powered, or a mains powered DC supply? Please describe.
2) I need to verify if you want a voltage level out between 0v and 4v, or did you have another range in mind?
3) How closely controlled do you need the voltage?

If tolerances need to be pretty close over temperature, it would be a lot easier to use an opamp IC along with a few discrete components. If you don't mind it shifting over temperature, it could be done with a transistor, LED, and a couple of resistors - if there is enough "headroom" from the supply.
 

Thread Starter

weesh

Joined Sep 30, 2011
15
Well, it might be done with either. However, it would help a great deal to know what kind of power you have available;
1) Is the circuit battery powered, or a mains powered DC supply? Please describe.
2) I need to verify if you want a voltage level out between 0v and 4v, or did you have another range in mind?
3) How closely controlled do you need the voltage?

If tolerances need to be pretty close over temperature, it would be a lot easier to use an opamp IC along with a few discrete components. If you don't mind it shifting over temperature, it could be done with a transistor, LED, and a couple of resistors - if there is enough "headroom" from the supply.
1) The device is USB powered so it's source is constant and produces 3.3V at the VDD pin.
2) 0-4V would be awesome (but I suspect the max would be 3.3V based on VDD above)
3) I'm reading the voltage back on an ADC so at least 200 discrete points would work. In the host computer, I compute a percentage based on the max and min.

I don't mind if the values shift as long as the range is reasonably close.

And thank you for your help!

Ken
 
Top