+ Reply to Thread
Results 1 to 13 of 13

Thread: "Latching" analogue voltage

  1. #1
    bh00 Newbie
    Join Date
    May 2006
    Posts
    62

    Default "Latching" analogue voltage

    Hi,

    Is there a chip or device that would 'latch' an analogue signal between 0-5v in a similar way a digital latch or D-type would work?

    Basically I have only one pin of a microcontrollre that can generate pwm, and this way I can use it to control and hold many circuits at different levels by clocking the different 'analogue latches' to update them.

    Thanks


  2. #2
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    Default

    Yes it is called a sample and hold. It is a switch which provides a low impeadance path to a capacitor. When the switch is opened the impedance to ground which would discharge the capacitor is very large. As a result the capacitor "holds' the voltage.

    Hope this helps

  3. #3
    bh00 Newbie
    Join Date
    May 2006
    Posts
    62

    Default

    Thanks, so we're looking at sometihng like this then? What kind of values of a capacitor would be good?

    Whats the most efficient way of generating the analogue voltage from the pwm pin anyway - I think I need a capacitor charging through a resistor from the pin right - again, what kind of values are suitable?

    How easy is it to get that opamp to have a gain of 2, so the actual output varies from 0v to 10v?
    Attached Images

  4. #4
    Styx Good Styx Good
    Join Date
    Dec 2003
    Location
    UK
    Posts
    1,724

    Default

    Quote Originally Posted by bh00
    Thanks, so we're looking at sometihng like this then? What kind of values of a capacitor would be good?

    Whats the most efficient way of generating the analogue voltage from the pwm pin anyway - I think I need a capacitor charging through a resistor from the pin right - again, what kind of values are suitable?

    How easy is it to get that opamp to have a gain of 2, so the actual output varies from 0v to 10v?
    not sure abt the 1st bit,
    but for the gain of two use a non-inverting OPAMP arrangement,
    This way you will get

    1) non-inverted gain
    2) a gain of two
    3) a high-input impedance
    Nothing is impossible.
    Once a problem is realised, the rest is just details



  5. #5
    Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent Papabravo Excellent
    Join Date
    Mar 2006
    Location
    Michigan, USA (GMT-5)
    Posts
    2,892

    Default

    Superficially yes. The choice of values depends on the frequency components you expect on the input signal. It would also be common to put a resistor between the switch and the capacitor so that closing the switch would not subject the input signal to the voltage on the capacitor.

    You may recognize the combination of the R and C as a single pole low pass filter. If I was you I would put the 3dB point at 2 or 3 times the highest frequency you expect on the analog input. Ten times the highest frequency component would be better; that way you can adjust your sampling window and be assured that the input will charge the capacitor up or down to the desired value.

    In picking components I generally pick a power of ten for the capacitor eg. .01 uF, .1 uF, or 1 uF, and then I pick the resistor because there is a much wider selection of resistor values than there is capacitor values.

    To get a gain of 2 connect the minus input to the middle of a voltage divider from the output to ground with equal value resistors. Remember to have a supply voltage greater than the output range so you don't run into common mode problems.
    Last edited by Papabravo; 10th May 2006 at 09:24 PM.

  6. #6
    Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent
    Join Date
    May 2003
    Location
    Idaho, USA
    Posts
    6,724

    Default

    Keep in mind that PWM is a digital signal. The only thing analog about it is the duty cycle. You can't use a sample and hold to "latch" a PWM signal. You can average the PWM signal with a lowpass filter, but you now have a DC voltage. This does not have some of the advantages of PWM.
    Also, a sample & hold will droop. It will not hold indefinitely like a latch will. You will have to refresh it fairly frequently.
    Last edited by Roff; 10th May 2006 at 11:10 PM.
    Ron


  7. #7
    Dr.EM Newbie
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,014

    Default

    A sample and hold system is detailed in this datasheet:

    http://cache.national.com/ds/LM/LM13700.pdf

    I have not tried it yet, but presumably it works.
    Angry!? I'm absolutely electrolytic!

    Music web page:
    http://www.music-playground.net/artist/drem/

  8. #8
    Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent Roff Excellent
    Join Date
    May 2003
    Location
    Idaho, USA
    Posts
    6,724

    Default

    Quote Originally Posted by Dr.EM
    A sample and hold system is detailed in this datasheet:

    http://cache.national.com/ds/LM/LM13700.pdf

    I have not tried it yet, but presumably it works.
    Due to the fact that the Darlington emitter follower (which has bias current) in the LM13700 is used as the buffer for the hold cap, this is not the ideal part for a long-term S&H. A CMOS op amp is probably the best choice for a buffer.
    Ron


  9. #9
    Dr.EM Newbie
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,014

    Default

    Very well, I shan't bother trying it then

    I have tried this design with absolutely no success:

    http://www.musicfromouterspace.com/a...leandhold.html

    But just noticed these too:

    http://www.musicfromouterspace.com/a...nth/sandh.html

    http://www.musicfromouterspace.com/a...ampleHold.html

    May try one out, but probably not so let me know if either work if you try them.
    Angry!? I'm absolutely electrolytic!

    Music web page:
    http://www.music-playground.net/artist/drem/

  10. #10
    Russlk Newbie
    Join Date
    Nov 2003
    Location
    New Hampsire, USA
    Posts
    2,457

    Default

    The really simple way is to filter the PWM to DC as Ron suggested, feed it to an ADC and latch. Use an R-2R ladder for the DC output.
    see my website: www.geocities.com/russlk

  11. #11
    dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent dknguyen Excellent
    Join Date
    May 2006
    Location
    Alberta, Canada
    Posts
    6,029

    Default S&h

    I found this S&H circuit: Seems pretty simple. its a capacitor, op amp and transistor. There is also a more complicated one I dont quite understand.

    its on page 13 of the document:
    http://www.phy-astr.gsu.edu/nelson/AN-31.pdf

  12. #12
    Russlk Newbie
    Join Date
    Nov 2003
    Location
    New Hampsire, USA
    Posts
    2,457

    Default

    The S&H with two transistors has feedback to Q2, holding it at the capacitor voltage so its leakage does not contribute to discharge. Q1 provides isolation between the source and the S&H circuit.
    see my website: www.geocities.com/russlk

  13. #13
    bh00 Newbie
    Join Date
    May 2006
    Posts
    62

    Default

    Thanks for the replies, there are some good looking solutions here, hopefully I'll get time to give them a go soon!

+ Reply to Thread

Tags for this Thread