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.