Arduino nano resetting after solenoid valve fires
Using a zener diode should solve your issue while keeping the speed fast enough. Since solenoids have inductivity fast switching causes the solenoid do demagnetize into the circuitry. You should definetly use a flyback diode when working with induction load. Zener should do the trick well.