Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Detect increasing or decreasing pot output

  1. Dec 5, 2016 #1
    I want to detect whether potentiometer output voltage is increasing or decreasing and convert this to a digital signal.
    the circuit must be able to sense tiny voltage changes (order of 10mV) and with high speed.
    all im interested is if Vout increases or decreases not by how much
    increasing V =high output
    decreasing or stable V =low output
    how can i achieve this?
     
  2. jcsd
  3. Dec 5, 2016 #2

    Nidum

    User Avatar
    Science Advisor
    Gold Member

    Easiest is convert the incoming voltage signal to digital as first operation . Then use some simple software to compare latest sample with previous sample . Usually best to do comparison using values averaged over several sequential samples rather than just spot values .

    Any of the low cost single board computers available now with on board ADC could be used to do this .

    Just for interest this was done in older times using an analog drift comparator . Using only op amps and RLC circuitry the short term average value of the test signal was compared with the rolling longer term average .
     
    Last edited: Dec 5, 2016
  4. Dec 5, 2016 #3
    is there any alternative to adc, i dont want to use a microcontroller.
    will a data slicer opamp circuit do the job ?
     
    Last edited: Dec 5, 2016
  5. Dec 5, 2016 #4
    will this circuit work , how do i improve it

    ads.png
     
    Last edited: Dec 5, 2016
  6. Dec 5, 2016 #5

    berkeman

    User Avatar

    Staff: Mentor

    You should be using feedback in pretty much any opamp circuit. Look up "opamp differentiator" to find what you are looking for... :smile:
     
  7. Dec 5, 2016 #6

    Baluncore

    User Avatar
    Science Advisor

    Your example circuit will oscillate and amplify any supply noise.

    A differentiator circuit will detect the slew rate of the voltage from the pot. It will not detect slow changes of absolute voltage.
    You need to use a window detector. https://en.wikipedia.org/wiki/Window_detector
    The LM339 is a comparator with a positive internal feedback of a few mV.
    It also has open collector outputs that can perform a negative-logic wired-OR function.

    Window_1.png
     
  8. Dec 5, 2016 #7

    davenn

    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    well, for a start, the DC voltage from the pot isn't going to go through C1

    you said you wanted a digital signal ... that isn't going to produce it
    You need an ADC chip followed by a microprocessor to work on that data or use a PIC or micro of your choice that has an ADC built in


    D
     
  9. Dec 6, 2016 #8

    Baluncore

    User Avatar
    Science Advisor

    My previous post assumed you wanted to detect any change. "detect increasing or decreasing pot output".
    This circuit only detects a rising voltage.
    If you must do it with analogue then you must also specify how you will signal that the voltage is stable. In this circuit you press a momentary switch to load the input set voltage into C1.
    How the circuit works.
    If not yet buffered, this circuit uses op-amp U1 to buffer the potentiometer output voltage.
    Q1 and R1 with the +5V supply makes a current sink of about 440uA. The 440uA flows through resistor R2=47R and so drops about 20mV from the buffered input voltage.
    That slightly lower input voltage is compared with the set voltage. If the input rises by more than 20mV then the comparator U2 output goes high. U2 must have very low input bias current so it needs to be a CMOS or JFET input comparator or possibly an op-amp.
    Changing the value of R2 will set the rise above the set voltage before detection. R2 can also be adjusted to compensate for the offset voltage of U2. Maybe R2 should be a 200 ohm trimpot.

    window_2.png
     
  10. Dec 6, 2016 #9
    Below is the LTspice simulation of my take on a circuit.
    It uses an opamp differentiator circuit to convert the slope change into about a 1V step signal to minimize offset effects. This goes to an opamp comparator circuit to give the desired positive pulse output for a positive slope on the input, and zero volts otherwise.
    upload_2016_12_5_14_57_45.png
     
  11. Dec 6, 2016 #10
    That circuit won't detect the polarity of the voltage change.
     
  12. Dec 6, 2016 #11

    Baluncore

    User Avatar
    Science Advisor

    True, my first circuit actually detects both polarities of change, then ORs them together. If you separate the outputs you get two independent outputs, one for a rise, the other for a fall.

    You wanted to detect a tiny step change as small as 10mV but you have not specified what positive slew rate you want to detect. Is it +10mV/second?
     
  13. Dec 6, 2016 #12
    positive slew rate is +10mV/0.1s = +100mV/s
     
  14. Dec 6, 2016 #13

    berkeman

    User Avatar

    Staff: Mentor

    It would help us a lot if you would post what the heck you are trying to do. In engineering, we start with specifications on the circuit performance. You are making us guess what you want to do, which is not a good thing. I will close this thread until you PM me what your goal is and what your circuit specifications are. I will re-open the thread then so you can post that for others to be able to help you better.
     
  15. Dec 8, 2016 #14

    berkeman

    User Avatar

    Staff: Mentor

    After a PM conversation, the thread is re-opened. The OP will post more information to help us help him with this project... :smile:
     
  16. Dec 8, 2016 #15
    project details --
    pot rotating clockwise (from any initial angular position)=high output
    pot rotating anti clockwise (from any initial angular position)=low output
    pot not rotating (stable at any angular position)=low output
     
  17. Dec 8, 2016 #16
    my rotatory pot has stops
     
  18. Dec 8, 2016 #17

    berkeman

    User Avatar

    Staff: Mentor

    So talk about using an opamp differentiator circuit followed by some other circuitry. What would that look like, and how would you design it to reject noise and have the desired logic level output?
     
  19. Dec 8, 2016 #18

    Baluncore

    User Avatar
    Science Advisor

    I have three specific questions.
    What sense of rotation increases the pot output voltage ?
    Do you want to detect the positive or the negative voltage changes from the pot ?
    Does the detected situation produce a high or low voltage output from the circuit ?
     
  20. Dec 8, 2016 #19
    resistance of pot is 50k
    that will require the addition of a buffer at the pot output to handle the maximum equivalent pot output impedance of 12.5k.
    The modified circuit is shown below:
    The added buffer at the pot output is configured as an inverter since the LM324 has a maximum output of about 9V when used as a non-inverting buffer and a 10V supply.can i use lm358 in place of lm324?

    upload_2016_12_6_21_11_45.png
     
  21. Dec 8, 2016 #20
    pot rotating clockwise (from any initial angular position)=increasing voltage = high output
    pot rotating anti clockwise (from any initial angular position)=decreasing voltage=low output
    pot not rotating (stable at any angular position)=stable voltage=low output
    i want to detect the positive voltage changes from the pot
    detected situation produce a high voltage output from the circuit
     
  22. Dec 9, 2016 #21

    Baluncore

    User Avatar
    Science Advisor

    Attached is an LTspice model. Strip the .txt extension to run the simulation.

    To make model plots easier I redefined power supplies (0V,+5V,+10V) to (-5V,0V,+5V).
    Use any op-amp you have. Op-amp inputs are close to mid-supply.
    You could even use comparators in place of the op-amps.

    A "Threshold" of about 10mV is set by R2 with the 200 ohm trim-pot, R3.
    Mid-position is about 10mV.
    The offset voltages of U1 and U2 are also eliminated from the threshold value by the setting of R3.

    Slow changes in pot voltage are followed in C1.
    When stable, the voltage at bottom of C1 = "tracking", will be close to the "threshold" voltage.
    Slew rate of "tracking" is limited by 5V/R1 = 50uA, with C1 = 500uF, it sets 100 mV/sec.

    C2 and R4 quieten the U1 op-amp output when pot voltage is stable.
    Otherwise U1 produces a +/-5V signal while following a changing pot voltage.
    C2 and R4 are not needed if a comparator is used for U1.

    Any positive pot voltage step over 10mV will be immediately detected by U2 going high.

    Any pot slew rate rising faster than +100 mV/sec will outrun "tracking".
    Once that "tracking" error has accumulated to greater than 10mV, the output of U2 will go high.
    Note that for slowly rising voltages, eg for +120mV per sec, it will take 0.5 sec before detection.

    50uA will flow in C1. It needs a simple non-inverting follower or buffer from the pot to C1.
    Since the input voltage might be close to +5V, a rail-to-rail op-amp is probably needed for the buffer.
     

    Attached Files:

  23. Dec 9, 2016 #22

    Svein

    User Avatar
    Science Advisor

    I start thinking digitally...

    I would use a sample-and-hold (to save the "previous" value) and then (using a comparator) compare it with with the "present" value.
     
  24. Dec 9, 2016 #23

    Baluncore

    User Avatar
    Science Advisor

    I use a “hold” that is slew rate limited to follow at a maximum of 100mV/sec, then I compare that with the “present” value.

    Where would your digital sample signal come from? and how often?
     
  25. Dec 9, 2016 #24

    Svein

    User Avatar
    Science Advisor

    That is in the realm of digital design. It is not hard.

    On the other hand, here is a circuit that I have used in the past:
    upload_2016-12-9_10-28-1.png
    The R1-C1 combination is a noise filter, the R2-C2 combination acts as a time delay circuit. The values given are just examples, modify them at will.
     

    Attached Files:

  26. Dec 9, 2016 #25

    Baluncore

    User Avatar
    Science Advisor

    For a stable input signal, would the output be high, low or would it drift ?
    How could you calibrate it to only detect positive slew rates over +100mV/sec ?
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted