Sample and hold (3 discrete samples)

Top-Dog

Joined Mar 1, 2013
36
Hi Guys
I would like to implement a 3 stage sample and hold circuit, but I want to take three discrete readings at about a 1 second interval, and then average the results. Is there an easy or effective way of doing this using only passive components? So far all I can think of is the use of 3 different RC timers triggering 3 different sample and hold circuits and then averaging the final result, but then capacitor leakage will affect the stored voltage, and there is a high component count.

MrChips

Joined Oct 2, 2009
19,728
Build an integrator with a 3-second time constant.

crutschow

Joined Mar 14, 2008
23,736
Using a CMOS switch, sequentially dump each of the three S&H capacitor samples into an op amp integrator circuit that has a capacitor value three times the S&H capacitor. The integrator capacitor will then contain the average of the three samples.

The integrator time-constant just has to be less than about 1/5th second for 1 second between samples (or just connect the S&H switch directly between the S&H capacitor and the integrator summing junction).

The integrator capacitor can be reset with a CMOS switch across it.

You need a CMOS op amp with low offset voltage for the integrator op amp to minimize integration offset drift from both input bias current and voltage offset.

#12

Joined Nov 30, 2010
18,167
Is there an easy or effective way of doing this using only passive components?

capacitor leakage will affect the stored voltage, and there is a high component count.
1) No. You can't even use a difficult method to make a sample and hold using only passive components. That's why everybody seems to be ignoring this part and presenting active circuits.

2) There are plenty of capacitors that will hold a charge within 1% for 3 seconds, maybe even 30 seconds.

crutschow

Joined Mar 14, 2008
23,736
1) No. You can't even use a difficult method to make a sample and hold using only passive components. That's why everybody seems to be ignoring this part and presenting active circuits.

2) There are plenty of capacitors that will hold a charge within 1% for 3 seconds, maybe even 30 seconds.
Yes, I rather ignored his statement about using all passive components since a sample & hold cannot be built without active components.

If the integrated average needs to be stable for a significant time than the integrate capacitor should be a low leakage type such as polypropylene.

Top-Dog

Joined Mar 1, 2013
36
Sorry, I do have access to 'active' components like op-amps, timer ic's etc., but not 'digital' logic components like registers, uControllers.... Yea, that was a bit of a stupid wording error on my part.

So, are there reference designs available for such a circuit? - I have seen lots of concept ideas myself, but never a functional circuit that where the circuit was built to meet a set of specifications, like I want. I am familiar with the idea of using a FET to control the input of the signal to the capacitor, and buffering the input and output signals, but not with an integrator... So how do you go about setting up a circuit like that, and calculating/selecting component values (in more vivid detail)?

I would also ideally like the circuit to only be functional on demand i.e. when it's time to read from my sensor. Is there a way to do this efficiently (in terms of components) without having a whole pulse generator set aside for driving the FET? My original plan was to use a comparator (signal voltage against a fixed bias voltage) to trigger a pulse generator. But how would you turn such a thing off (make it stop taking samples) after 3 samples and hold the average measured voltage?

Ron H

Joined Apr 14, 2005
7,014
What is the frequency and amplitude of the signal(s) you are sampling?
How wide are your sample pulses? Or could you use track & holds, instead of sample & holds?

MrChips

Joined Oct 2, 2009
19,728
As always, it is best to give us the big picture. What are you trying to do?
Why 3 samples? Why not 1, 2, 4, or 8 samples?

Top-Dog

Joined Mar 1, 2013
36
The sensor is a MQ3 gas Alcohol detector. The sensor voltage is going to be effectively a variable DC voltage, as it is in a voltage divider configuration. The number of samples is fairly arbitrary - I just want to sample the DC voltage ~3 times over 3 seconds while the sensor is being used (valid input is the time taken to breath on it).

crutschow

Joined Mar 14, 2008
23,736
That will be pretty hard to build if you don't use any digital components.

Why no digital parts?

Top-Dog

Joined Mar 1, 2013
36
It's part of our teams design requirements not to use digital components. We have come up with effective ways of taking a single reading, but it's fairly unreliable given the quality of the sensor and variance in the readings over the sample time - it's not stable enough. The output doesn't have to be perfect, but it needs to be stable enough to be useful. It might be possible to achieve the desired effect with just an integrator circuit i.e. continuous time sampling for time t, instead of averaging discrete samples. Would this be an effective approach? We are using a single sided 5v source, because that is what the sensor uses, otherwise the unregulated source is 7v.

Last edited:

Ron H

Joined Apr 14, 2005
7,014
How are you going to initiate the sampling (or integrating) sequence? Will you use a manually-controlled switch, or???

crutschow

Joined Mar 14, 2008
23,736
It's part of our teams design requirements not to use digital components. We have come up with effective ways of taking a single reading, but it's fairly unreliable given the quality of the sensor and variance in the readings over the sample time - it's not stable enough. The output doesn't have to be perfect, but it needs to be stable enough to be useful. It might be possible to achieve the desired effect with just an integrator circuit i.e. continuous time sampling for time t, instead of averaging discrete samples. Would this be an effective approach? We are using a single sided 5v source, because that is what the sensor uses, otherwise the unregulated source is 7v.
You could certainly use a simple, passive RC integrator or LP filter (R in series with capacitor to ground) which will give you a running average of the signal. The RC time constant determines the rate of change (smoothing effect) of the filter. You likely with have to experiment with the RC time constant to find the optimum value for your signal characteristics. The filter output can be buffered with a op amp follower circuit to avoid affecting the filter with the following circuit load.

Top-Dog

Joined Mar 1, 2013
36
I was going to initiate it with a comparator testing the sensor voltage against some experimentally determined bias voltage and use the output to switch a BJT or FET and start the integrator/timer ic...

Between readings there might have to be a push-button to short/discharge the caps to reset the integrator - can I do this electrically? Is there a good starting point with either the LPF or RC integrator (choosing the right values, is one better suited in this application)? If I go with one of the above methods I will need to only sample the signal for a fixed time, so that all readings are consistent (i.e. breathing on the sensor longer != higher breath alcohol level), in which case I will need to disconnect the integrator after time t. The signal is already controlled via the comparator and switch, so does that mean I need an RC timer and a logic gate to control the reading time of the signal, or are there better ways?

MrChips

Joined Oct 2, 2009
19,728
An RC low-pass filter is an integrator. You do not need a reset function.

Top-Dog

Joined Mar 1, 2013
36
Do you mean an active LPF (either first or second order), or can it be done with a passive (just an R and C) LPF?

MrChips

Joined Oct 2, 2009
19,728
I mean a passive RC LPF.

Top-Dog

Joined Mar 1, 2013
36
Ok thanks, I didn't realise that. So what affect does adding more poles (increasing filter order) have on an integrator - does it just alter the rate of change for the cap producing the output voltage? And, why don't I need a reset function?

Ron H

Joined Apr 14, 2005
7,014
A passive integrator will weight later samples more heavily than earlier ones.

Top-Dog

Joined Mar 1, 2013
36
How can I 'hold' the output voltage? I want to use the output voltage from the intergrator/LPF to feed an array of comparators to display the output voltage on a LED display. If I use a op-amp intergrator, will the output of the op-amp hold the voltage for driving the comparators for a long time?