Spot welder

Hi all, hope this is a good place to post my issue. I'm using a arduino nano to drive a mosfet that drives a solenoid. The idea is the arduino when triggered, sends a 25ms pulse to the fet that causes the solenoid to flick, hence generating the spot weld burst. The arduino is being powered by an external 7.4v battery pack. The spot weld is using a 12v lipo. Now here's the issue... In 1 in 20 welds, the arduino appears to go into a locked hi state (led on pin 13 stays on) and this causes the nickel to burn... Not sure why this happening. Any ideas on how I can incorporate a fail safe so the arduino can't ever get into this lock state? It's definitely the arduino at fault not the solenoid. I'm using d7 as a trigger pin and d13 as output. Thank you.

Show us a good schematic of your circuit. Show us a good image of your ‘actual’ wiring. Give links to components. Posting images:

Use CTRL T to format your code. Attach your ‘complete’ sketch between code tags [code]Paste your sketch here[/code]

Any project involving electric welding is going to face heavy EMI issues - everything needs good shielding and screening, and sensitive electronics needs to be well away from the action.