Goes unresponsive intermittently

Nobody mentioned optoisolators yet, but they may help, too.