Let's talk Common Mode Capacitance on Op Amp inputs. - Page 1
Forum section: electronics / projects

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 01, 2025, 02:12:52 am
content: So I'm trying to create a delay with an all pass filter, and I'm finding that using the LM324 or TL072c, adding even small amounts of capacitance (470pf) can cause the slope to invert on a certain type of signal.The signal I'm trying to delay is a noise signal from mains line voltage.It's only about 100-250mVp, but it looks like a triangle wave with 2 peaks and high frequency spikes here and there.It's not the op amps, as buffered output is without error, and I'm finding that even B2 spice shows the inversion.It's when there is either a positive or negative slope, and then a spike occurs and the opamp inverts the output, and then trys to catch up, distorting the output waveform.The all pass filter is a filter that passes all frequencies but changes the input signal's phase, or it give it a delay.It consists of basically an inverting opamp, with a extra resistor and capacitor.The 1st order APF is setup by putting the extra resistor from the input signal to the non-inverting input, and then putting the capacitor from the non-inverting input to ground.This makes the capacitor a "common mode capacitance" or C(cm).What I want to find out is why this slope inversion happens and if I can either get rid of it, or limit it in some way.

author: mawyatt
author_rank: Super Contributor
timestamp: September 01, 2025, 02:27:16 am
content: Schematic and scope pictures required!!Also, consider a faster op-amp.Best

author: moffy
author_rank: Super Contributor
timestamp: September 01, 2025, 11:56:07 am
content: You can use a single say NPN transistor as an all pass filter, make the emitter and collector resistors the same, that's your +/-, suitably biased, then drive an RC with the R connected to one node e.g. emitter and the C connected to the other node e.g. collector, and RC connected together, make the RC 10x greater impedance than Re/Rc and you have a wide BW all pass network, make sure you have enough current to handle the signal.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 01, 2025, 05:53:04 pm
content: mawyatt:Here is a B2 spice sim of the problem, it shows on the right, 3 dual probe oscopes.The top oscope show the waveform and the time delay created by the AFP.This delay is calculated by the equation:T(delay)=tan^-1(W*C*R)/(pi*F)If the capacitance is too great, it smooths out the waveform so that the spike no longer shows.This is not wanted as I need basically the buffered output of the waveform, only time delayed.If the capacitance is low enough, the waveform is not averaged, but the slope is inverted when the spikes in the waveform occur using the APF.Understand that this does not happen when using a simple sinewave.The APF works perfect for that type of waveform.The middle oscope shows that the buffered output of the PWL is without error, the yellow and green traces are overlaping.I have circled the areas of interest that have no distortion.The bottom oscope shows that the AFP output has slope inversion compared to the output of the buffer.I have circled the areas of interest that have slope inversion.This is what I am seeing on the bench on my scope.It's not that choppy due to the PWL output of the sim, but it's basically the same.I hope that helps you help me.moffy:I can't seem to get the BJT delay circuit to work in B2spice with this PWL output.I used values of 1k for the e,c resistances, and 470p, and 100k for the RC across the 2n2222.I checked all points but no delay.Am I missing something?

author: mawyatt
author_rank: Super Contributor
timestamp: September 01, 2025, 06:19:50 pm
content: The APF delay calculation is based upon a sinewave not a pulse or other type waveforms which are composed of an arbitrary number of sine waves all accumulated together. To get the proper result with these waveforms you need to use superposition and get the delay for each sinewave then accumulate them for the final waveform rendering. Waveforms that have fast edges of any type will posses signals (harmonics) with a wide frequency range, likely well beyond where the APF behaves as expected, and even beyond where the op-amp is well behaved, here you can expect a "highly distorted" result not resembling the original input waveform.Here's the clever conceptmoffypresented. We've offset the input by +90 degrees to show the "center" as 0 degrees, which should be ~1, ~10, ~100 and ~1kHz. Works a treat if you get the bias and impedance levels right!!Best

author: mawyatt
author_rank: Super Contributor
timestamp: September 01, 2025, 07:36:09 pm
content: We've added the Pulse and Sinewave responses. Note the APF pulse output "Apparent Inversion" on the edges.Best

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 01, 2025, 08:13:26 pm
content: I understand what you're saying about harmonics of the noise, and how each harmonic constitutes a different delay.That would lead to a distorted wareform due to inconsistant delays, and what you just posted shows basically the exact problem.The signal inverts, not just delayed differently.I'm thinking this is a characteristic of the C(cm) on the non-inverting input of the op amp, not of the filter delay.I don't know though, I'm probably wrong.Moffy's circuit is inverting, but I can't get it to delay.If you can get it to delay, please post the schematic with the inputs, and outputs using an AC squarewave (or pulse), with the traces.It looks like it might be a winner, if it delays.Thanks.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 01, 2025, 11:31:58 pm
content: So I was able to get moffy's circuit to delay, but only on sinwaves.Turns out if you use ac squarewave or the pwl, it has the same problem as the APF.It inverts the output, and it does so without an opamp attached as a buffer.So the problem is in the filter itself for the type of waveform I'm trying to delay.I think I'm going to have to go digital for this one.

author: mawyatt
author_rank: Super Contributor
timestamp: September 01, 2025, 11:49:04 pm
content: Quote from: sourcecharge on September 01, 2025, 08:13:26 pmBTW see post #5, also note that Moffy's circuit has no effective common mode capacitance, so rule that out. Also added a Triangle wave where you can see the delay and note at the peaks where there is a fast direction transition and how the APF distorts this fast "edge".Moffy's transistor circuit inverts and follows both, they are 180 degrees out of phase. The R and C simply vector sum these two for a result that varies from 0 to 180 degrees. We simply added a 90 degree shift in the input so the result would be from +90 degrees (lower frequency where signal is mostly from emitter resistor (follower), to -90 degrees where signal is higher frequency and mostly from collector capacitor (inverted).The result at midpoint is when the frequency equals 1/(2*pi*R*C) and here the phase should be zero as shown.Note without the 90 degrees shift at the input the output phase is -90 degrees as the +signal from the Emitter experiences Vemitter (1/(s+1) ) and the -signal from the Collector experiences Vcollector (s/(s+1)) and the sum is Vin((1-s)/(s+1)) and at s = j then Vin((1-j)/(1+j)) or simply -j or -90 degrees phase.Anyway, hope this helps.Best

author: mawyatt
author_rank: Super Contributor
timestamp: September 02, 2025, 12:59:44 am
content: Quote from: sourcecharge on September 01, 2025, 08:13:26 pmHere's the schematic we are using, see post #4.Best

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 02, 2025, 03:14:40 am
content: Quote from: sourcecharge on September 01, 2025, 02:12:52 amWhat frequency range and delay do you seek here ?Any RC filter is only going to 'delay' over a restricted band, so will be very different for sine vs impulse waveforms.Quote from: sourcecharge on September 01, 2025, 11:31:58 pmYes, given MCUs are so low cost these days, digital would be the best solution for a delay element.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 02, 2025, 07:42:23 am
content: mawyatt, and moffy, thx for your input, moffy's circuit confirmed that it's not the C(cm), it's the actual filter.PCB.Wiz, its the 60hz mains line noise with high frequency spikes, and they have a pulse length of about 1k to 20khz I would say.I was hoping for a 180 degree to 540 degree actual delay, not inversion.Yes, it looks like the APF or any RC filter is going to invert the sharp spikes in the noise.I've never tryied digital signal processing before.My only concern is that I don't code, so I have to use AI to code it.I'm not sure how well that is going to turn out.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 02, 2025, 09:18:04 am
content: Quote from: sourcecharge on September 02, 2025, 07:42:23 amDo you mean 180’ at 60hz ? Are you trying to remove the line noise, or measure it ?What is your actual end goal here ?

author: mtwieg
author_rank: Frequent Contributor
timestamp: September 02, 2025, 12:54:18 pm
content: Quote from: sourcecharge on September 02, 2025, 07:42:23 amThis doesn't make sense. Delay and phase are different things.Implementing a delay is certainly easier with a digital filter. But it's clear that a delay isn't the only thing you need. Maybe if you described why you want to delay the signal...?

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 02, 2025, 07:44:25 pm
content: PCB.Wiz and mtwieg, I mean a delay of 1/2 of the period of 60hz to 1 and 1/2 of the period of 60hz.It was for a sample and hold noise cancellation circuit, and it still could work for sinewaves and for noise signals that don't have to be exact.This was going to be part of an active probe adaptor to a 100kV 1000:1 high impedance (4.3Gohm) 2 foot long passive probe that used about 100 1/4watt radial 40Mohm resistors in series.The C1 capacitance of this probe might be low enough to not need to be compensated for freqency measurement up to 10khz at least.Using B2spice I was able use sinewaves in a DLL using APFs.The theory was to sample the noise, hold it in the DLL, boost the gain by 2, differentiate the original noise with the amplified noise, then divide by 2 with a buffered output.3 pots could change the amplitude, shift level, and phase of the dll, to match the noise from the probe, and using comparitors, the whole thing could be automated relative to a seperate mains line noise signal.I never got around to looping it because I ran into the slope inversion problem, rendering the circuit useless in my point of view.This obviously wasn't the first circuit I tried.Originally, I was using the seperate mains noise signal that wasn't exactly the same as the probe noise.This was in a seperate circuit that did not use a DLL.Using the seperate mains noise signal, I was using pots to adjust the amplitude, level shift, and even some phase compensation, but I was not able to attenuate it down to the op amp's noise floor.For a noise of 250mVpp, I was able to get it down to 10-20mVpp, but this was not good enough for what I intend to do with this probe.If i used the same 250mVpp noise in this other circuit to cancel out itself, it would be at TL072's noise floor of about 1-2 mVpp.I was going to use more precise opamps (opa2189) for the final circuit to get it down below the 1mV or 1V resolution on the 1000:1 probe if I ever made it down to the noise floor.Anyways, it doesn't matter now, as I'm going to use teensy 4.1 to do this for me.With it's 1.2v analog input range, 12 bit ADCs at 2MSPS using interleaving, I should be able to sample and hold the noise with little distortion (0.3mV resolution and 33.333k samples/period of the 60hz noise).I was going to use a multi-period averaging Algorithm triggered by a push button and store the data in the 16mb of psram (each period is about 33kb at 60 hz).The stored probe noise signal would output to the opamp manipulation, differentiate, divide and buffer it.I was going to use the seperate mains noise signal for the teesny to phase lock to with the stored probe noise signal, and use incremetial phase and frequency shifting to adjust the 12bit DAC's output to the probe's noise.This allows the noise cancelation, and keep the probe's signal integrety without dividing it down to the ADC's voltage range.Using HV opamps, the active probe adaptor could be used up to it's max intended measurement.The opa455 could enable 75kv AC, and 150kv DC, as the probe was flat rated at 100kv.What I'm trying to do is use with my high impedance probe for ac measurements of 0.5v-15kv at 10 khz and normal precision op amps would enable this measurement.TL:DRScience!

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 02, 2025, 09:40:13 pm
content: Quote from: sourcecharge on September 02, 2025, 07:44:25 pmUsing a delay assumes any interference repeats exactly, and it will also null your wanted signals as it has no way of knowing what you want, from what you do not want.I'm afraid the whole approach has fundamental flaws in logic.Using a MCU + ADC is a good idea, but you may first want to reject the largest unwanted signals to improve your dynamic range.That means a much simpler 60Hz notch filter, or 60Hz and a few harmonics.Another approach is to get a 'reasonable copy of the same mains signal' minus your signal and use that as a null/cancel signal.That depends on your installation, as you want 'same phase and same distortion' baselines.Another solution would be toget more bitson your ADC than an internal ADC, 10kHz is not fast, so using a higher end Audio ADC with good sampling rates.That gives you more headroom for a software solution, and a simple high pass may be all you need.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 02, 2025, 10:56:23 pm
content: Quote from: PCB.Wiz on September 02, 2025, 09:40:13 pmthe delay was ment to be used in a delayed locked loop.this loop would be offset initially by an inverting opamp.The delays would make up the full phase change to 360 degrees, or 1, 60hz full period.Once the noise was sampled, the noise was disconnected using back to back Nch mosfets, while the output of the dll using the apf, would now be suppling the input to the dll, like a ring oscilator.the dll was then fed into side op amp to create a gain of 2, then that would be fed into a differential input between the dll Gx2, and the noise siganl on the noninverting input of the differential opamp.this nulls out the noise and not the wanted signal.This output is 2x though and needs to be divided, and if doing it properly, needs to be buffered for measurement.Quote from: PCB.Wiz on September 02, 2025, 09:40:13 pmI'm not sure what that means, would you further explain this.If it means trying to decrease the amplitude of the noise by filters, Im done with filters and I'll explain later.Quote from: PCB.Wiz on September 02, 2025, 09:40:13 pmI tryied that, didn't work as well as I had hoped.Quote from: PCB.Wiz on September 02, 2025, 09:40:13 pmThe adc really only has to deal with the 60hz signal because the output will be averaged.After purchasing the teensy, I started to think about the 1.2V range of the adc, and how the 250mVpp buffered signal would fit into the adc range.I thought about using a large metal ground plain underneath the proto board and the 2 foot probe to decrease the peak to increase the head room.After I did this, the buffered noise decreased to about 16mVpp, and then I figured out that it would further decrease to about 2to4mVpp if i physically touched the ground of the trigger input of the oscope.I used the ms8040 mV measurement in Vrms AC and found that this was an actual reading, not the oscope playing tricks.I'm still scratching my head about this...

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 02, 2025, 11:11:02 pm
content: Quote from: sourcecharge on September 02, 2025, 10:56:23 pmIt will always have limitations, as mains has finite source impedance, and any local load changes are likely dynamic too.QuoteI'm still unclear on exactlywhatyou are trying to measure, first you say you want to measure out to 10kHz with some rejection features, and here you say you will average the 60Hz?

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 02, 2025, 11:32:37 pm
content: the noise is 60 hz, the measurement signal that I want noise cancelation on is 10khz.The 10khz from the probe with the 60 hz noise will be used in the differential opamp against the output of the dac.This means I don't have to divide the output of the probe down to fit into the adc range.The probe's input is first grounded, and the buffered probe's noise is sampled with a triggered input to the teensy.The buffered probe signal is then switched from the teensy to the differential opamp non inverting input.*buffered probe noise and measurement signal -> noninverting input (0-15V)*stored averaged noise from the dac (with gain of 2 already in the output)-> 1kohms->inverting input <-1kohms->output of opamp->divider->buffer->outputThis will null the noise, but amplify the 10khz measurement signal by a gain of 2.This needs to be divided and buffered.I hope that makes more sence.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 02, 2025, 11:57:55 pm
content: Quote from: sourcecharge on September 02, 2025, 11:32:37 pmFrom all this, you have gained another 3-4 bits, as you can tolerate MAX 15vp-p common mode, vs 1.25V for your ADC.Hence my suggestion to just use a better ADC eg with 4 more bits than the 12b MCU adc, so you can avoid thetrying to generate a delayed nullgymnastics.

author: mtwieg
author_rank: Frequent Contributor
timestamp: September 03, 2025, 01:48:47 pm
content: In your first post you said:QuoteNow you say:Quote from: sourcecharge on September 02, 2025, 11:32:37 pmThis is complete nonsense. I could literally swap the terms "signal" and "noise" in your posts and they would make the same amount of sense (yes, the term "signal noise" is exactly meaningful as "noise signal").You should take a step back and describe what you want to do,not how you want to do it. Maybe just draw what the original signal+noise looks like, and what you want your circuit's output to look like.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 03, 2025, 03:43:23 pm
content: reply #3 shows the "noise" from the oscope.Quote from: sourcecharge on September 02, 2025, 07:44:25 pmThis describes what I want to do.Quote from: sourcecharge on September 02, 2025, 11:32:37 pmThat's as clear as I thought I could make it.Sorry.Previous Mains line voltage noise = 60hz with high frequency spikesSignal that the probe will be measuring = up to 10khzI can feel your frustration, but I hope this summary cleared things up.It doesn't even matter now, as the situation has completely changed.The noise is 8mVpp now and does not have high frequency spike in it anymore.After I put a large metal sheet underneath the probe and protoboard, the noise has attanuated by more than anything I have already tryied.What's really got me scratching my head is why it further attenuates to 2mVpp if I touch the trigger ground.I'm thinking more sheilding may help.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 03, 2025, 04:49:33 pm
content: so..today, after putting a large diameter grounded aluminum water heater pan overtop of the probe, wires, and protoboard, along with the grounded metal sheet underneath, the noise attenuated farther than I could measure.Somewhere in the 0.5mVpp range, essentially a flat line using the 2mV/div on my oscope.The shielding was the key, no fansy circuits required.I'm thinking about using some metal braid for the wire, metel tube for the probe's end covering about maybe 6 to 8 inches from the back, and a metal inclosure for the opamp.

author: sourcecharge
author_rank: Regular Contributor
timestamp: September 03, 2025, 07:15:18 pm
content: The HV 4.3Gohm probe is only accurate up to about 10hz with 10% attenuation, and 50% attenuation at 30 hz.Works great in DC, no noise at all.Understanding that compensation is very tricky.the equation is:R1*C1 = R2*C2I have an LCR meter that measures at 10khz, but it can't measure R1 because it's too large.The only way I was able to measure R1 is through current measurements.I'm not sure if the meter is accurately measuring C1, becuase it OL on the Rp measurement, but gives 0.46pF for C1 at 10khz.R2 is essentially a Rp to C2.R2 is 4.3Mohms, and C2 is 4.14pF at 10khzI calculated that the capacitance to compensate C2, but it would add Rp due to the compensation capacitors DF to the existing Rp as parallel resistors and therfore drop the R2 so the equation becomes:R1*C1 = 1/(1/R2+1/R(comp))*(C2+C(comp))But R(comp) depends on C(comp) throught the equation:R(comp) = 1/(2*pi*F*C(comp)*DF)Where the DF of these caps are 0.001 or less.so, pluging both of the equations into my ti89 and solving for both:521pF and 30.574067MohmsI'm thinking that I should recheck the R1 resistance at 10khz though using current measurements.