# How to stabilize a Comparator op amp from static currents?

With huge gaps in my knowledge I will try my best to explain: This circuit uses two inductive loads L1 and L2 (10 Ohm/0.08mH and 11 Ohm/0.02mH) with ground at each end, and with a common signal going to a a general purpose op amp used as a comparator. Enters the (+) input via a 10K Ohm resistor. Equally, there is a 10K Ohm resistor (closely matched) at the (-) input of the comparator. The output of the comparator then fed to the digital INPUT of an Arduino AVR with approximately 100K internal pull up/down in PULL DOWN-LOW state when resting. Disregard the details of L3, it is a completely separate circuit also in the milliVolts, not mains.

The two inductive loads L1 and L2 are induced by L3 ( which creates an AC voltage/current in the low milliVolts. The normal resting output of the comparator is HIGH near Vcc (3.3V). When the AC current induced in L1 and L2 in the form of an AC sine wave enters the (+) of the comparator the output of the comparator swings from HIGH to LOW (to ground). Everything works as expected.

The problem is that the everytime I move around the static electricity seems create a current or voltage that would trigger the comparator to LOW even without any inductive load present at L3 or even if I remove L3 physically away from L1 and L2.

L1 and L2 are located several feet away from the comparator too, but the final circuit will have short connections (1 inch or less) from L1 and L2 to the comparator. I have this on a breadboard with wires so that does not help, but is there any way to stabilize the circuit?

I was looking at some circuits that introduced hysteresis to the comparator, but I am concerned this could reduce the sensitivity too much and may miss some of the smaller signals created by L3. Is there any other way to stabilize this circuit?
I rather not use the op amp as an amplifier, i.e. the (-) input of the comparator as the inverting signal input. Because the strength of the inductance coming from L3 varies a lot. Using the op amp as a comparator seems to work every time with weak and strong signals, except for the static electricity from my clothes seem to cause enough imbalance between the comparator's inputs that it changes states. Thank you for any advice!

==================================================

This is a follow-up based on the suggestions:

Thank you again for the suggestions. Sorry for the lengthy write up.

Checked out the cool link with the electrostatic charged comb detector. There is no doubt that the same thing is happening here to some degree.

What I did: Instead of shielding the wires, I disconnected all the wires from the input side of the op amp during the various tests. In lieu of shielding I covered the breadboard with aluminum foil all around and alligator-clipped it to GND while all input (except the two 10K input resistors) to the op amp were removed. Still picked up considerable static from the air.

Then connected it all back to normal settings. Connected the Oscope at 10x probe.

Supply voltage: 3.3V from Arduino pin. (Arduino CPU is supplied by 3.3V also) Ground: GND pin on Arduino

"Resting" AC signal at the opm amp output: Vpp= 120-240mV Mean= 3.28V (steady) Freq: *** When it senses my body/clothing movement at op amp output saturates: Vpp =3.7-3.96V Mean= 1.6-3.16V (spike down) Freq: 27Hz-51Hz

Added 6.8uF ceramic capacitor from Vcc to GND at the op amp Vcc input. No change.

Checked the ground for L1 and L2 and it's good. The diagram shows ground at the L1 and L2 location, but in the physical setup there is an audio stereo cable that is used to return the signal back to the breadboard and connects to GND.

Removed the cable that runs from the breadboard to L1 and L2 leaving the op amp floating (except the two 10K on each op amp inputs) and the amount of jump decreased on the output when I moved: Vpp = 680-840mV Mean: 3.24V (steady) No Freq reading triggered

Then I took away both 10K input resistors to the op amp (+In) and (-In) left the op amp pins unconnected to anything and was getting at the op amp output a fairly steady Vpp = 120-160mV Mean= 3.28V at resting, but when I move around my body it still went Vpp= 640-840mV Mean = 3.28V No Freq reading was triggered.

Then added back the L1 and L2 connections cable and added a 0.1uF capacitor from ground to the L1 and L2 junction. Still saturates the output fully when I move around my body.

Tried adding the 0.1uF capacitor in parallel with the 10K resistor that is connecting the L1 and L2 junction and the op amp (+) input together. Here I could see a change: it did not saturate anymore the output when I moved around, but still larger V swings. Vpp= 160-640mV Mean= 3.28V (steady) Freq not triggered

Then removed the 0.1uF capacitor all together and replaced the 10K resistor going to (+) op amp input with a 10 Ohm resistor, while I kept the 10K resistor on the op amp (-) input in place. This looks like helped a lot where it did not saturate anymore the output when I moved. But reduced sensitivity where I was not able to get always a clear signal when L1 and L2 were induced externally.

Then replaced the 10 Ohm resistor on the op amp (+) input with a 100 Ohm resistor and now it either triggered again when I moved around or wasn't sensitive enough.

Next replaced the (+) input resistor with a 1 MOhm and left the (-) at 10K. This worked for larger external signals on L1/L2 but not for smaller ones.

Tomorrow, will experiment some more. I am sure a setup as an op amp vs comparator would work, but that would introduce sensitivity adjustment issues again.

Are you certain that L1 and L2 are grounded to your supply common? Use an ohmmeter to make sure that you see zero ohms to gnd/common, when measured at the other side of the 10K resistor connected to (+)inp pin of the op amp. (Also, it's possible that this circuit is oscillating at high frequency, because the long input wire is too close to the op amp output line. Your body-motions would affect the oscillations, like a "proximity sensor" burglar alarm. Hard to detect oscillations without using a scope to look at the output pin on the op amp.)

If the L1-L2 signal ground isn't missing, then notice that the (+) input of your op amp is electrically floating, at least for AC signals. You've accidentally built an "e-field detector" or Electrometer, because the high-freq AC impedance of L1 and L2 are significant, and the Z(inp) of the op amp is extremely large. For this reason, the connecting wire behaves as a floating capacitor-plate, or an "e-field antenna," where the rest of the circuit is the other half of the antenna. It should pick up all sorts of 60Hz interference, nearby AM stations, distant thunderstorms, charges on moving clothing, etc.

High-impedance amplifiers can easily pick up voltage-signals right out of the air. That's why our old traditional audio amps use a 300-ohm input impedance, rather than the many megohms of an op-amp input pin. (Always use 300-ohm dynamic microphone cartridges, not 30K-ohm crystal microphones.) With 300ohms, far less issues with shielding and AC hum!

Easy fix: your long connecting wire needs to be a piece of shielded coaxial cable, with the shield connected to the power-supply common terminal. Or, squash a long strip of aluminum foil around the long wire, and alligator-clip the foil to supply-common. (Or, even replacing your long wire with a twisted-pair, with one side connected to common, should be an improvement.)

Easier fix: place the op amp physically close to L1 and L2 (within a cm,) so your "e-field antenna" becomes very very small.

Harder fix: connect either a resistor or a capacitor in parallel to the input signal (connect it between the supply-common connection and the L1 - L2 junction.) The added component will tend to "short out" these unwanted voltage-signals. But without knowing the operating frequency, it's hard to guess the correct value for the added R or C, but you could try a 10-ohm resistor or a 10uF capacitor.

If adding one of these componets reduces the sensitivity of your circuit too much, try larger R (or smaller C.) But note that some good shielding would be better strategy (eliminating the unwanted signal, rather than trying to short out the bad signal while still passing the good.)

Heh, looks like a LVDT differential transformer or "inductive position sensor." If true, then also go google up some keywords: LVDT Arduino

PS

Below is a circuit with a similar antenna effect, this time done on purpose: a tiny 2cm "e-field antenna" on a single FET, which controls an LED. During low-humidity conditions, it can respond to a plastic comb running through your hair ...from FOUR METERS AWAY. (Imagine how sensitive it would become if the little antenna was far longer than just 2cm!!)

See my ridiculously sensitive charge-detector
http://amasci.com/emotor/chargdet.html

• Wow! Thank you @wbeaty. I think I understand the possible reasons thanks to your post. I will try the suggestions you outlined. I do have an Oscope (SDS 1102CML) that I used for some basic measurements and that should help me as well. Will report back! Commented Apr 17, 2020 at 4:11
• It seems that because of the breadboard setup, the dupont wires, and the long unshielded sensor cables, the comparator-type setup, I cannot eliminate the noise to a decent level. I will try one more thing and make it into a positive feedback comparator that adds some envelope to the signal before it saturates fully.. If that doesn't work, I will need to build a prototype circuit board with components soldered using minimal length leads near the IC, a short shielded cable, and decoupling capacitors. The expected frequency envelope of the circuit is between 500hz to 75Khz. Commented Apr 21, 2020 at 4:40
• wbeaty was right, the easier way to clean up the signal is to shield the path. I used aluminum foil temporarily to cover the breadboard and also attached the ground to the foil. It cleaned up the "resting" signal (no trigger). Weaker signals (triggered) still need some work. I think once I solder a trial-PCB (hopefully in a few days) with short leads, proper ground, shielded cable, the weak signal trigger will fall in place as well. Commented Apr 23, 2020 at 4:28