The Arduino Water Sprinkler Controller is a centralized controller for a three 9v water sprinklers (electrovalves). The electric scheme is specific for the type of electrovalves I own (Gardena 1251-U Valvola Cordless 9V) but could easily modified to drive other type of electrovalves, provided that are bistable.

Table of contents


  1. Bistable electrovalves
  2. Gardena 1251-U electrovalve
  3. Arduino controller
  4. Activating electrovalves
  5. Wiring everything
  6. The code
  7. Final touches

Bistable electrovalves

A bistable electrovalve is a valve which preserves its state once it is activated. Generally it needs a positive impulse for a short time period (in the order of ms). Once it is opened, it stays opened even when the impulse ends. Then a negative impulse (perhaps of a different voltage and a different amount of current) closes it. It is less power consumptive w.r.t. monostable valves, since it requires voltage only for very short amount of time when state change are require. From the other way, monostable valves, require to receive power as long as it is required to stay opened.


Gardena 1251-U electrovalve

The Gardena 1251-U electrovalve is a bistable electrovalve which can be controlled manually or through a standard RCA controller. The electrical specifications provided by the productor are the following:


State Voltage Current Duration
ON 7-9V 207-210mA 250ms
OFF -1.6V 50mA 60ms

Given these requirements an Arduino could be used to drive as many electrovalves as allowed by the output ports of the used platform.

The 1251-U electrovalves are generally coupled to a battery powered controller which is installed on top of the electrovalves and is programmed using a programmer which once programs the controller, could be removed. The solution is shown in the following circuit:


Arduino controller

When I bought my house, I found a water sprinkler installation using these electrovalves. However, the former owner did not provide me with the programmer, so I had to activate the valves manually. This is not convenient when I am not at home. Moreover, the levers for manual activation are very consumed and are nearly broken. For this reasons, instead of buying it for about  €70 (around $85) or risk to broke my valves, I decided to build my own controller, which could be programmer with a timer and/or manually, using buttons instead of levers.

Since electrovalves are similar to DC motor from an electric point of view, I decided to use a motor shield attached to the arduino. It can be used to control up to 4 electrovalves. The bill of materials for controlling three electrovalves follows:

1x Arduino UNO or similar (Uno-like form factor is preferred to attach the shield)
1x Arduino motor shield (v1 or v2 does not matter) 
1x ds3231 i2c clock breakout board
3x Diodes
3x 150 Ohm resistors
3x Momentary (normally closed push buttons), better if water proof.
1x ON-OFF switch, better if water proof
3x RCA connectors
3x RCA male-male cables
1x 9v power source (batteries could be used but I suggest to use a power adapter)

Some jumper wires


Activating the electrovalves

Since the activation and deactivation of the electrovalve requires opposite voltage, the drivers in the motor shield helps to provide positive and negative voltage. However, since the rates and currents are different, simply attach the ouput of the DC motors of the motor shield is not sufficient. A strategy to vary the voltage and current of the output (9v 210ma for opening, -1.6v 50mA for closing) is required.


Using this circuit, assuming the + terminal is at top, when a positive 9v voltage is applied, the top branch acts as a short circuit and the current flows freely through the diode and activates the valves, while when a negative 9v voltage is applied, the top branch acts as an open circuit and the current must pass through R1, the voltage drops to -1.6v and the current is limited according to the specification. Actually another resistor should be applied in series with the diode, but since the valve opens even without using it, I decided not to include it.

This is the main brick of the system.

The second part of the circuit is the wiring of the ds3231 breakout board, which is done using the standard i2c arduino bus wiring, using 4 wires, Vcc to arduino 5v, GND to GND, SDA to A4, SCL to A5, as shown in figure:

The last part is related to the wiring of the buttons for manual activation and the ON-OFF switch for operating the controller in programmed or manual mode. They are wired using the usual input pullup configurations for arduino digital inputs.



Wiring everything

Replicating the blocks for the required number of electrovalves, leads to the following diagram:


Note that RCA connector and cables are added between the electrovalves and the motor shield outputs. Since most of the digital pins are used by the motor shield, pushbuttons are wired to A0, A1 and A2, while ON/OFF switch is wired to A3. A4 and A5 are used for i2c communitation with the clock module.


The code

Once the circuit and wiring is complete. It is now time to write down the arduino sketch. The program has to:

  1. Allow to choose to operate either in manual or programmed mode, depending on the ON/OFF switch position
  2. If in manual mode, pressing a pushbutton opens the corresponding valve, pushing it again, closes it.
  3. If in programmed mode, the user can choose a time for opening the valve and how much time should be left open.

 Upon these requirements, I wrote the sketch to control the sprinklers that you can download from sprinkler_controller.ino. In order to set your favourite activationa and deactivation times, you should edit the arrays in variables start_hour, start_minute and open_time, where open_time is expressed in minutes.

Also note that, before using the code, you should program your ds3231 RTC module, you can use this guide


Final touches

For installing the controller in place, I used an IP66 electrical box attached to the wall in a repaired place, then I passed the RCA cables in a buried trace leading to the electrovalves box. I powered the controller with a 12v stabilized power adapter, so I added a 9v voltage regulator before wiring it to the controller. Since I generally water the garden late in the evening, the power adapter is connected to a light controlled switch. In this way the controller is powered only from the evening.


That's all. If you have questions or doubts, please leave a comment or send me an email. Thank you!


+1 # Jan Rychtář 2017-01-15 10:39
Hello, nice blog :-)
I have questions:
1) What type of diod do you use?
2) How do you connect to Gardena 1251-U Valvola Cordless 9V (any adapter)?
3) Could you add some photos about this project?
Thanks Jan
Reply | Reply with quote | Quote
0 # Roberto Gallea 2017-04-07 07:49
Hi Jan,
thanks for yout comment and sorry for the delay, here are some info about your requests:
- I used 1N4007 diodes
- Gardena 1251-U Valves have RCA plugs, so I used standard RCA cables
- Your request is reasonable, but unfortunately, I decided to write this guide after I installed it, so it is not easy to take picture right now.
Reply | Reply with quote | Quote

Add comment

Security code


Roberto Gallea, Ph.D  


I am Roberto Gallea, I am a Ph.D. in computer science working at the University of Palermo, Italy. I am involved in all kind of technological stuffs, both software and hardware, applied to a wide range of fields, such as multimedia, medical imaging, computer vision, digital arts and others.

My main objective is to become a full-time teacher in academic or high-level education contexts.

In addition I would like to collaborate with (digital) artists for achieving unique performances, based on movement.

I am member of IEEE, EMBS, SPS and ACM.



Subscribe to the newsletter to be informed about news regarding this site

Joomla forms builder by JoomlaShine

By subscribing to our mailing list you will always be update with the latest news from us. We never spam.

Copyright © 2008 - 2016 All rights reserved.