Solenoid Valve (12V)

A normally closed 12 V water valve that opens while its coil is powered, switched from a microcontroller through a MOSFET or relay.

  • Coil voltage12 V DC rated; opens down to about 6 V, more slowly
  • Coil current320 mA at 12 V; 240 mA at 9 V; 160 mA at 6 V
  • TypeNormally closed, one flow direction
  • Working pressure0.02 MPa to 0.8 MPa (minimum about 3 PSI)
Solenoid Valve (12V), A normally closed 12 V water valve that opens while its coil is powered, switched from a microcontroller through a MOSFET or relay.
In short

A 12 V solenoid valve is a normally closed water valve: it opens while 12 V DC is on its coil and closes when the power goes, and a typical hobby valve draws 320 mA at 12 V and needs at least 0.02 MPa of water pressure to work (Adafruit product 997, 12 V plastic water solenoid valve). Never connect it to a GPIO: switch the coil's negative side with a logic-level N-channel MOSFET or a TIP120 from a separate 12 V supply, with a 1N400x flyback diode across the coil and the grounds joined (Adafruit product 997).

A solenoid valve is an electrically operated tap. A coil of wire around a plunger becomes an electromagnet when current flows, lifting the plunger off its seat so water can pass; with no current, a spring pushes it back and the valve shuts. The common hobby type is normally closed, so it fails safe: if the controller or the supply dies, the water stops. Adafruit's 12 V plastic valve, a typical example, opens in 0.15 s or less, closes in 0.3 s or less and is rated for at least 50 million cycles (Adafruit product 997).

Electrically the valve is just a coil, an inductive load, which decides how it is driven. It draws far more current than a microcontroller pin can supply, 320 mA at 12 V for Adafruit's valve, falling to 160 mA at 6 V where it still opens, more slowly (Adafruit product 997). So the pin drives a switch, usually a logic-level N-channel MOSFET or a TIP120 Darlington, that connects the coil's negative side to ground. When the switch turns off, the coil's stored energy produces a voltage spike, which a flyback diode across the coil must absorb.

These valves are diaphragm types that rely on the water's own pressure. Adafruit's is rated from 0.02 MPa to 0.8 MPa, the minimum being about 3 PSI, roughly 2 m of water head, and works one way only, from inlet to outlet (Adafruit product 997). That suits mains-fed or pump-fed irrigation; a barrel with a few centimetres of head may not open it fully. Valves are made for water only and are not rated for food use unless the maker says so.

How to wire the Solenoid Valve (12V)

GNDIRLZ44N MOSFET D
VCC9V Battery VCCCoil + from the EXTERNAL 12V
VCC1N4007 Diode cathodeFlyback
GND1N4007 Diode anode

Before you wire it

Do
  • Never drive from a GPIO: switch it with a MOSFET (IRLZ44N) or a transistor/relay.
  • MOSFET needs a gate series resistor + a 10k gate pull-down.
  • Flyback diode (1N4007) across the coil: cathode to VCC, anode to GND (drain/collector side). A solenoid's collapse spike destroys the switch without it.
  • External 12V supply: not the board's rail. Share the ground with the MCU.
  • On/off control (a valve doesn't need PWM).
Don’t
  • No valve straight to a pin, no missing flyback, NO 12V coil off the board's 5V/3V3.
  • Power the coil from its own 12 V supply, sized above the coil current (Adafruit suggests a 12 V 1 A adapter for its valve). An Arduino's 5 V or 3.3 V pin cannot run it.
  • Switch the low side: 12 V to the coil's +, the coil's - to the MOSFET's drain (or the TIP120's collector), the source (emitter) to ground. Use a logic-level MOSFET such as the IRLZ44N so a 3.3 V or 5 V pin turns it fully on.
  • Put a flyback diode (1N4001 to 1N4007) across the coil, cathode to +12 V and anode to the switched side (Adafruit product 997). Without it, the turn-off spike can destroy the transistor.
  • Add about 220 Ω in series with the MOSFET gate and a 10 kΩ pull-down from gate to ground, so the valve stays shut while the microcontroller boots.
  • Join the 12 V supply's ground to the microcontroller's GND, or the switch has no reference.
  • The valve needs on and off only; PWM gains nothing. A relay module is an easy alternative to the MOSFET, with the same separate supply and a diode across the coil.
  • Check the arrow on the body and fit the valve in the flow direction it shows; it seals one way only (Adafruit product 997).
  • The Adafruit 997 valve draws 320 mA at 12 V.

Specifications

Coil voltage
12 V DC rated; opens down to about 6 V, more slowlyAdafruit product 997 (12 V plastic water solenoid valve)
Coil current
320 mA at 12 V; 240 mA at 9 V; 160 mA at 6 VAdafruit product 997
Type
Normally closed, one flow directionAdafruit product 997
Working pressure
0.02 MPa to 0.8 MPa (minimum about 3 PSI)Adafruit product 997
Response time
Opens in 0.15 s max, closes in 0.3 s maxAdafruit product 997
Working temperature
1 °C to 75 °CAdafruit product 997
Actuating life
50 million cycles minAdafruit product 997
Ports
1/2 in nominal NPS (this model)Adafruit product 997
Recommended driver
TIP120 or N-channel power MOSFET, with a 1N4001 flyback diodeAdafruit product 997
Supply voltage
12 V
Dimensions
30 × 55 × 22 mm
Weight
90 g

Common mistakes

  1. Driving the valve from a GPIO pin

    A pin supplies tens of milliamps at 3.3 V or 5 V; the coil wants hundreds of milliamps at 12 V (Adafruit product 997). Always switch it through a transistor, MOSFET or relay.

  2. Leaving out the flyback diode

    When the coil switches off its magnetic field collapses into a high-voltage spike. A 1N400x across the coil, cathode to +, absorbs it; without one the MOSFET or transistor eventually fails.

  3. Too little water pressure

    A pressure-assisted valve needs at least 0.02 MPa, about 3 PSI (Adafruit product 997). A shallow gravity tank may leave it barely open or dripping. Use a pump or mains pressure, or a direct-acting valve made for zero pressure.

  4. Installing it backwards

    These valves seal in one direction only. Fitted against the arrow, water leaks through even when the valve is closed.

  5. No common ground

    With the 12 V supply's ground left apart from the microcontroller's, the MOSFET gate voltage has no reference and the valve chatters or never opens.

Solenoid Valve (12V) questions

How do I control a 12 V solenoid valve with an Arduino or ESP32?

Use the pin to drive a logic-level N-channel MOSFET (or a TIP120) that switches the coil's negative side to ground, powered from a separate 12 V supply, with a 1N400x diode across the coil (Adafruit product 997). digitalWrite HIGH opens the valve, LOW closes it. On a 3.3 V ESP32 pick a MOSFET specified to turn fully on at a low gate voltage.

How much current does a 12 V solenoid valve draw?

It depends on the valve. Adafruit's 1/2 inch plastic valve draws 320 mA at 12 V (Adafruit product 997); larger or brass valves draw more. Read the coil rating on your valve and size the supply and switch above it.

Why doesn't my solenoid valve open?

Check that the coil really gets 12 V when switched, that the grounds are joined, and that the MOSFET is a logic-level type. Then check the water side: a pressure-assisted valve needs at least 0.02 MPa (Adafruit product 997), and it must be fitted in the direction of its arrow.

Can I run a 12 V solenoid valve at 5 V or 9 V?

Adafruit's valve still opens down to about 6 V, drawing 160 mA there, but more slowly (Adafruit product 997); 5 V is below that. Use the rated 12 V for reliable operation.

Should I use a relay or a MOSFET for a solenoid valve?

Either works. A MOSFET is silent, small and fast; a relay module isolates the 12 V side and is simple to wire. Both need the separate 12 V supply and a flyback diode across the valve's coil.

Is a normally closed or normally open valve better?

Normally closed for irrigation and filling: with no power, the water stays off, so a crash or a power cut cannot flood the garden. The common 12 V hobby valve is normally closed (Adafruit product 997).

Build something with the Solenoid Valve (12V)

  • Automatic plant watering

    Open the valve when a capacitive soil moisture sensor reads dry, then close it after a set time.

  • Garden irrigation timer

    Water each zone on a schedule kept by a DS3231 real-time clock, one valve per zone.

  • Wi-Fi controlled sprinkler

    Switch the valve from a phone or Home Assistant with an ESP32 over MQTT.

  • Tank auto-fill

    Fill a reservoir until a float switch or an ultrasonic level sensor says it is full.

  • Drinks or water dispenser

    Dispense a measured volume using a YF-S201 flow sensor to count the litres.

For AI assistants

This page as plain Markdown, for ChatGPT, Claude or your own agent. /components/solenoid-valve.md

What will you build with it?