Connect with us

Sample and hold circuit

Discussion in 'General Electronics Discussion' started by cincysinner, Aug 12, 2011.

Scroll to continue with content
  1. cincysinner

    cincysinner

    4
    0
    Aug 12, 2011
    I am trying to build/design a circuit for a midi controller that takes a signal from a transducer being struck and that then triggers a midi controller (which is a separate piece of hardware I've purchased) to fire a message to the computer.

    To boil this all down more simply.... I need a circuit that will sample a variable amount of voltage, in say, a 10ms time window, then will "take" the peak voltage and produce a perfect (or nearly so) square wave that is output to the controller.

    This is the key part I need a straight up and straight down signal that lasts, say 5ms. After that I need the capacitor c1 to discharge briefly so it is reset to 0V.

    I have taken the circuit linked below and mocked it up in LTSpice and have done quite a bit of experimenting.
    http://schematics.dapj.com/2005/01/simple-sample-and-hold.html

    I am using a 555 timer to "throw the switch" on the 4066 such that the capacitor c1 is sampling for 10 ms and then allows that peak voltage to be "seen" for 5ms by midi controller (the output on the right).

    The heart of the problem is that I get a nice clean on/off signal but the c1 capacitor stays charged. e.g. say my peak signal is 5v on one sample but the next time the input signal could only 1V; so the capacitor needs to be reset between samples.

    It is not a simple as putting a resistor in there to slowly drain off the cap because that gives me a nice "on" square wave but it will slope down on the right side of the signal as it "slowly" discharges to 0V. i.e. it is not a square wave.

    So basically I am hoping to find a clever way that when the 555 pulse drops to 0V, and thus turns off the 4066 "switch", that I can briefly short the capacitor c1 to ground before it starts taking on a charge again.

    My thought was perhaps I can charge up another capacitor when the 555 signal is high and then use that capacitor in some way that when the 555 signal goes low, I can short that c1 capacitor to ground briefly (which is however long it takes this "new" capacitor to discharge).

    I can't seem to find an elegant way of making this work without introducing using of another 4066 switch and another 555 timer. It seems like there has to be a simpler way of doing this....


    I've been beating my head against the wall for a week now and I would appreciate any advice or suggestions!

    Thanks....
     
  2. duke37

    duke37

    5,364
    771
    Jan 9, 2011
    You sample for 10ms and then want to hold it for more than 5ms.
    I would suggest that the first 555 which triggers the 4066, when it turns off, also triggers a second 555 which activates a spare switch in the 4066 to short the capacitor to ground.
     
  3. duke37

    duke37

    5,364
    771
    Jan 9, 2011
    I have had another thought on this, you could use a 4049 quad nand schmitt trigger instead of the 555s. I attach a very rough sketch of the idea, To get a time constant of about 10ms, C = 1nF and R = 100k.
    The input will need to have trigger pulse of longer than 20ms, this will be necessary also with a 555 circuit.
     

    Attached Files:

  4. cincysinner

    cincysinner

    4
    0
    Aug 12, 2011
    The input pulse (from the transducer) is fairly short...it peaks quickly and rings for a bit until it decays off... depending how it is hit, that can last between 5 ms to 10 ms in length.
     
  5. duke37

    duke37

    5,364
    771
    Jan 9, 2011
    What sort of pulse is coming from the transducer? If it is an AC signal. you will need some kind of rectifier to store it for a short time.
    I do not see the need to discharge the capacitor if your signal circuit can feed charge into the capacitor and also take charge out.
     
  6. cincysinner

    cincysinner

    4
    0
    Aug 12, 2011
    It is AC so I do have a schottky diode that rectifies the signal.

    I am not entirely sure what you mean but the transducer feeds an opamp that amplifies the signal (in my case). So there is no path for the capacitor to discharge.

    I've attached a schematic from ltspice of what I have thus far... Sorry it is a bit of mess, been tinkering around with it alot.

    The simulated transducer is in the upper right and the output to the midi controller is on the far left (label).

    It is also worth mentioning that I will ultimate need about 30 of this signal conditioners. I am a novice with electronics but I am starting to wonder if a programmable microcontroller is the way to go. I do computer programming for a living so that would be right up my alley :)
     

    Attached Files:

  7. cincysinner

    cincysinner

    4
    0
    Aug 12, 2011
    One other thing... I did look at the schmitt trigger but that is not exactly what I want.... It will create a nice square wave but I need the voltage level of that square wave variable based upon the maximum voltage produced the transducer and sampled by capacitor C1
     
  8. duke37

    duke37

    5,364
    771
    Jan 9, 2011
    Keeping with the logic that you show in the diagram. there are some suggestions.
    1. Use the op-amp as a amplified diode. A single 1N4146 would replace the two Shottkys.
    2. The 4049 is intended to replace the 555, turning two switches in sequence on and off in the 4066.
    3. You could use a microcontroller to do the timing but 30 of them would be a bit much. You will need some means of starting the storage process, a starting pulse will need to be longer than the measuring time or the sampling will be attenuated. In my diagram, a short pulse into the transistor will discharge the collector capacitor which will take time to recharge and can be made slow enough to stop pulse attenuation.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-