# Electrical Conductivity Circuit - Filtering Out Noise Generated By Oscillator?

Discussion in 'Analog & Mixed-Signal Design' started by Mahonroy, Aug 10, 2016.

1. ### Mahonroy Thread Starter Member

Oct 21, 2014
200
5
Hey guys,
I am thinking this might be a trivial question, but wanted to double check to make sure I am going about this correctly. I found this schematic online a while back and decided to use it. I'm sure there are probably some improvements that could be made. Here is my version of it in eagle:

I took oscilloscope readings right up next to the analog-to-digital converter chip (ADC) and there are very steady/even spikes about 1.55 volts in amplitude, and between 1.6 - 1.7 kHz. Up to this point I have just been taking multiple readings via the ADC chip, then averaging them together to get the average voltage value. This has been working out well, but I would like to filter these spikes out before sending it into the ADC chip - mainly because once the spikes go over 3.3 volts it starts to change the curve since 3.3 volts is the cutoff for the ADC.

What is the best way to turn these spikes into a nice steady voltage reading for the ADC? Would I just do a low pass RC circuit? I used this online filter calculator:
http://www.ekswai.com/en_lowpass.htm
I put in 1uF for capacitor, 120 ohms for resistor, and it gives me 1.33 kHz, so this means anything of higher frequency will not get through correct?

Although... will this just smooth the signal out to the bottom of the oscillation and not give me the average voltage value?

2. ### #12 Expert

Nov 30, 2010
16,704
7,354
Conductivity doesn't change in a millisecond, and if it did you couldn't read the meter.
Filter that signal noise down to 0.1 Hz.

3. ### Mahonroy Thread Starter Member

Oct 21, 2014
200
5
Ok so there is no harm in filtering way beyond the 1.6 kHz?

So in that case I would run the signal through a 100K resistor, and then a 10uF capacitor to ground? Would this condition the signal to be in the center of the oscillation (e.g. average), or would it condition the signal to the bottom or top of the oscillation?

4. ### #12 Expert

Nov 30, 2010
16,704
7,354
I can't see where you put the 1 uf cap and 120 ohms, so I can't tell where you're filtering.
What I can say is that I used to do QC on commercial conductivity meters and their RC time constant was 0.975 seconds. 39K and 25 uf

5. ### SLK001 Well-Known Member

Nov 29, 2011
852
243
Why don't you try triggering your ADC with the spikes, since they are periodic? The spike will occur, triggering an ADC convert while in the "clean" region of the input signal. This way you won't have to worry about time constants over averaging your signal.

6. ### #12 Expert

Nov 30, 2010
16,704
7,354
Change R15 to 39k.
Change C32 to 25 uf.
Remove C33.

7. ### Mahonroy Thread Starter Member

Oct 21, 2014
200
5
Thanks for the idea. I think it would be better practice to condition the signal. The spikes are going above 3.3v which is not good.

I have not put those caps in yet because I am speculating about them currently. The signal going to the ADC is labeled as "Photon_A2", this is where I want to condition the signal. I am suggesting to put in the 120 ohm resistor in series, then the 1uF cap to ground (removing R15, C32, C33, these were here originally to help filter out the signal, but did not seem to do much good).

I am under the impression that this suggestion would not work... because for a low pass RC filter doesn't the resistor need to be in series, and the capacitor across ground?

8. ### #12 Expert

Nov 30, 2010
16,704
7,354
It worked in a \$1000 conductivity meter used in thousands of sewage systems in several countries, but you can try it your way.

9. ### SLK001 Well-Known Member

Nov 29, 2011
852
243
Any "conditioning" of the signal will distort the actual signal that you want to measure by biasing it upward. With your conditioning, the signal will have the 3.3V spikes added to it. Actual best practices would be to mitigate the spikes at the source.

10. ### #12 Expert

Nov 30, 2010
16,704
7,354
You can add about 1.5K between D2 and R15 so the spikes won't cause a high peak voltage to integrate on the capacitor during diode conduction, but SLK001 has the right idea. Stop the spikes before they get to the precision rectifier.

11. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
The circuit in post #1 is a 1.6 kHz sinewave oscillator followed by unknown gain and a half-wave rectifier driven into heavy saturation. This seems perfect for producing 1.6 kHz "spikes", so I guess I don't understand the question.

TS - what is your understanding of what this circuit does, and how?

ak

#12 likes this.
12. ### #12 Expert

Nov 30, 2010
16,704
7,354
Thanks, AK. I was having difficulty figuring out how that circuit works with any predictability, and I still assume that if I can't read a circuit, it must be my own fault.

13. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
That's interesting - I assume the same thing...

14. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
Note that the output of the rectifier opamp is *not* going to be the entire positive half-cycle of the driving sinewave, only the tips. In very round numbers, the R15-C32 time constant is 10 times that of the Wein network, so the capacitor ripple will be approximately 10% (-20 dB) of the sine waveform amplitude.

ak

15. ### Alec_t AAC Fanatic!

Sep 17, 2013
5,977
1,136
Assuming a limit situation, with a 5V amplitude sinewave driving the final opamp, this is the output when the mods suggested by #12 in posts #6 and #10 are incorporated :-

16. ### #12 Expert

Nov 30, 2010
16,704
7,354
That's a nice, smooth output, but is it valid data? That part is beyond my ability to predict right now.

17. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
Seems like a lot of work to replace 2 resistors.

ak

18. ### Alec_t AAC Fanatic!

Sep 17, 2013
5,977
1,136
The opamp supplies are +-5V, therefore the absolute maximum generated sinewave amplitude from IC5A is slightly less than 5V. R10/12 reduce this to about 2.5V, then it's amplified by an unknown factor which might well cause clipping of the sine. Thereafter there's a unity gain buffer before the rectification stage. If clipping occurs then that should actually aid the smoothing process, but LTspice says it does raise the smoothed output voltage slightly; so perhaps the added 1k5 resistor should be increased to, say, 2k2?

19. ### Mahonroy Thread Starter Member

Oct 21, 2014
200
5
Thanks a lot for the replies and sorry for the late response!
I believe you, the reason why I was confused was because the form of a RC low-pass filter circuit is generally like this:

And I am confused how the RC low pass filter relates to this:

Thanks for the model. Would you mind showing what it looked like before the switch for comparison? That looks like a nice smooth output and would probably work out great.

I have been looking up other "ec meter circuit" in google, and I am seeing a lot of really similar designs, only they are utilizing the remaining 2 op-amps on the chip and incorporated a bridge-rectifier type of filter? Along with an "active low pass RC filter"? So I'm wondering if I only implemented part of the intended design?

Here is an example:

Thanks again for the info!

20. ### AnalogKid Distinguished Member

Aug 1, 2013
4,701
1,300
Because that is not all of the circuit. It is fed by an opamp/diode "active rectifier" circuit. The circuit's output impedance is in series with the parallel R-C, and combines with the R to form a Thevenin-equivalent impedance, and that affects how fast the capacitor charges up during the positive half-cycle. During the negative half-cycle, the diode disconnects the opamp circuit and the cap discharges through R. So the R affects both the charging and discharging rates, but in different ways, and this equates to changing the filter corner frequency.

ak