Arduino Sprinkler Valves + Wifi + Twitter
This is my first post so… be brutal !
I have a small yard with a very odd shape, well… L-shaped really and not enough pressure at the tap to be able to water it in one go. So I had to create 3 sprinkler sub systems that can only be turned on one at a time.
I sourced 3 Gardena valves but refused to cough up the extra cash for their dull ‘computer’ (not sure why they call it a computer btw). Besides, controlling the valves from a browser was the bear minimum I would expect and Gardena does not offer this functionality. (My friend) dd-wrt even allowed me to re-use an old router of mine and made the whole thing wireless…
Arduino time, I say…
As a bonus, I inserted at the end of this instructable my scripts that automagically turn the sprinklers on and off, check the weather forecast (so I don’t water the lawn if it is going to rain soon) and log their activity on twitter.
Here are the parts I used for this project:
– various pipes / hose adapters (from Gardena)
– 3 x 24v Irrigation Valve (from Gardena)
– 1 x arduino board
– 1 x ethernet shield (www.nuelectoronics.com )
– 1 x relay board (which I had lying around, a smaller board / a relay shield – with at least 3 relays – would have been sufficient)
– 1 x 220v -> 24vAC transformer (from ebay)
– 1 x 10vDC adaptor (a recycled phone charger)
– 1 x router (Buffalo WHR-G125) with dd-wrt (http://www.dd-wrt.com )
– 2 x momentary push button
– 1 x power switch
– a couple meters of ethernet cable.
Step 1: The Water Part.
The valves are very simple to use. They are closed by default and get magically opened by powering their solenoids with 24v AC.
I found this transformer on ebay for not very much. 230v AC -> 24v AC (did I mention I am in Europe ?), that will do.
Step 2: Arduino + Ethernet Shield
I used an arduino (atmega328) with an ethernet shield from www.nuelectronics.com.
3 digital pins are controlling 3 relays that let the 24v AC through.
A 4th digital pin is used for the ground for convenience sake, really (the connector that came with the relay board conveniently had 3 relays + ground on 4 adjacent pins… if that makes sense…).
An old cell phone charger gives me 10v DC which I get to the arduino through the Vin + GND pins.
Finally, I added a couple of push buttons for manual control. I use the Analog input trick (different resistor values give different analog reads for each button). In the end I only used one of them.
Step 3: Schematics
– arduino ethernet shield.
– 3 relays on the digital pins (the actual connection to the relays is not as simple-minded as this diagram as I use a whole relay board).
– 2 push buttons.
Step 4: Relay Board
The relay board needed a little bit of juice and could not be powered by a 9v battery.
The power adapter I found delivers 10v 05.A and that’s plenty. As a bonus it also powers the arduino.
I used an ethernet cable to link the relay board to the valves.
Due to popular demand here is a little bit more on “relay boards”:
A relay is a mechanical switch that can let through a voltage that is not compatible with your typical microcontroller voltage. In my case I needed my arduino to open and close a switch on my 24V AC circuit (the one that controls the valves).
The “controlling side” of a relay is driven by a transistor connected to the microcontroller pins. I connected my arduino pins (ground + 3 pins) to the input connector of the board which in turn connects me to said transistors.
It turned out that the Arduino pins were not powerful enough to drive the relay coils so I also connected an external power supply to the board. The arduino pins control the transistors bases and the power going through the transistors and the coils comes from the optional external power supply (otherwise it comes from the arduino pins themselves).
This is a very standard setup and relay boards (also known as relay modules), whether they propose one, two or more relays, will always offer the following:
– control pins (ground + 1 pin per relay) to connect to your arduino.
– external power supply pins (ground + Vcc) to be used if necessary.
– 3 connectors per relay : you use the middle one (Common) and one of the other two whether you want the controlled circuit to be normally open (NO) or normally closed (NC) when the relay is not powered.
I sourced the 8 relay board on ebay (search for ‘arduino relay module’, sort by price, get the cheapest one that fits your needs, i.e. that can let through enough Volts & Amps – usually they have different V&A combinations for AC and DC -).
Read more: Arduino Sprinkler Valves + Wifi + Twitter