A diode clamp across the solenoid (not shown) might not be a bad idea. Vary R1 to acheive reliable closing of the valve and to keep current to ~90 mA through the solenoid. The converter will draw 260 mA from the 5V source. The MOSFET (IRLD014) is a logic-level, 4 pin DIP package. A 5V logic high from the CPU will actuate the circuit, with less than 1mA at the gate.
🔗 External reference