switch on a long wire end causing microcontroller to shutdown
At 100 meters of 18awg cable, i think it the wire starts to have enough inductance to have the system start experiencing inductive kick backs when the switch opens up. A small capacitor across the SW1 can be an effective snubber. Also add some decoupling capacitors across V+ and V- of your MCU.