Linearizing ADC

Discussion in 'General Electronics Chat' started by weesh, Sep 30, 2011.

  1. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    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?
     
  2. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    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?
     
  3. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    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
     
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Potentiometers used for sound volume are log scaled (the resistance does not change linearly but logarithmically).
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Use a linear pot, and your problems will be solved I think
     
  6. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    Like I mentioned, the 2nd pot is a guitar volume pedal, off the shelf and is linear. Do I need to do a logarithmic function of some sort to make it linear?

    Ken
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    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.
     
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    If the pot is loaded. You may see this kind of behavior. I think we need a schematic to give more help here.
     
  9. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    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
     
  10. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    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?
     
  11. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    The easiest solution is to change the log pot with a linear one.
     
  12. ifixit

    Distinguished Member

    Nov 20, 2008
    638
    108
    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
     
  13. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    It's a GUITAR VOLUME PEDAL, it only uses one side of the pot. That makes it a variable resistor, yeah?
     
  14. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    Yes, that is exactly what I'm trying to achieve. Sorry for being such a "hobbyist" on this forum. ;)
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    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.
     
  16. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    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.

    [​IMG]
    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: Oct 3, 2011
  17. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    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.
     
  18. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    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.
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You don't sound stupid at all. I'll see what I can do about some pointers.
    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.
     
  20. weesh

    Thread Starter New Member

    Sep 30, 2011
    15
    0
    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
     
Loading...