I have a stun gun (http://www.amazon.com/VIPERTEK-VTS-989-Heavy-Rechargeable-Flashlight/dp/B00FPE6UN2) which I am using to create a large 1/2" electrical arc through the air to remotely ignite a butane-based torch with a 4ft flame.
The stun gun runs on its own isolated battery, and is optocoupled to an Arduino Pro Mini (with Atmel Atmega328 microcontroller) in order to trigger the stun gun ignitor, as well as open the solenoid flow valve.
My 5V power to the Arduino comes from two switching power supplies diode ORed together through some Schottkys. I have a 2200uF cap I added to the power supply output after the "OR" diodes. There is a dedicated battery for the switching power supplies to the Arduino, separate and not connected in any way to the stun gun's battery.
I have added a 1W 5.1V Zener diode reverse-biased from Arduino Vcc to GND to attempt to clip off unwanted positive and negative voltage spikes that come from the stun gun arc.
However, the power supply is very clean until I fire the stun gun to light the torch. During this period, my O-scope shows transients up to 10+ V and down to -5 or less V, even with the Zener diode in place.
Note that the sparks are occurring at a rate of ~30 sparks/sec, and I'd guess (I'd need to verify via more background research to be more sure) that the voltage at the arc electrodes is 40kV~80kV.
Sometimes my microcontroller completely glitches in very unexpected ways. Ex: stun gun ignitor locks "ON" even when my code has no place where it remains on, LED heartbeat stays "ON" even though I have no place where I command the LED to stay solid and not blink, LED hearbeat keeps blinking indicating it is receiving commands properly but solenoid valve will no longer respond, etc etc. Reset fixes these problems. I think they are EMP-pulse related, or something happening inside the chip with bitflips or something, not code related. I am an experienced coder on these chips, but I am not experienced dealing with large electrical arcs and stun guns, and mitigating EMF and EMP noise.
1) How can I remove/reduce unwanted EMF/EMP noise from this large spark gap/stun gun ignitor? +10 to -5V sounds REALLY bad for the microcontroller, to me, unless it's an artifact of measuring with my oscillocope and is not really present like that on the chip, with the Zener in place.
2) will configuring the Watchdog timer fix my problem and consistently force auto reset during lockups, or is it possible for the watchdog to lock up too? I'll try it regardless, but additional info beyond my knowledge bank is helpful.