3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to make a Linux powered garden sprinkler system.

How to make a Linux powered garden sprinkler system.
             Everybody knows that gardens need water. I used a garden hose and sprinkler last summer and it provided adequate results. It did prove to be a challenge to remember to turn on the sprinklers in the morning or turn them off after about 30 min. This happened several times last summer and because of it I went looking for an automatic solution.  

1. The Idea -- use a standard electric sprinkler valve and garden hose adapters to control the flow of water using a parallel port based C program in Linux. Scheduling accomplished by running a cronjob.

2. The Parts-- Gather the parts.

3. Build the Electronics -- Assemble the parts.

4. Plumbing-- Use the Thread Tape

5. Software -- Install linux compile some software and create a yard fountain. (see below)

6. Scheduling -- sudo Crontab -e

7. Other Notes-- more thoughts on the project.
 
Remove these adsRemove these ads by Signing Up
 

Step 1The Idea...

The Idea...
«
  • IMG_1303.JPG
  • IMG_1306.JPG
  • IMG_1308.JPG
  • IMG_1307.JPG
  • IMG_1303.JPG
  • IMG_1304.JPG
  • IMG_1306.JPG
I have the hardest time remembering to turn on the sprinkler for my garden. I went looking for a solution.

The plan is to use a standard electric sprinkler valve two garden hose adapters a relay and old 12v power supply to control the flow of water from and old linux computer.  This will allow the fine tuning of watering time using cronjobs.

« Previous StepDownload PDFView All StepsNext Step »
35 comments
Jul 18, 2010. 12:25 PMjinchuuriki says:
What programming language is this? I do not know anything about it.
Jun 26, 2011. 8:37 AMdcathey says:
It's crontab entries (see /etc/crontab or files in /etc/cron.d) for further examples. The comment "# m h dom mon dow command" provides the basic format:
m - minute after the hour
h - hour of the day
dom - day of month
mon - month of year
dow - day of week (0=sunday)
command - shell command to execute

So the first entry will execute "/usr/bin/parcon 1h 2h 3h 4h 5h 6h 7h 8h" at 7:30 every monday, wednesday, and friday
Nov 5, 2010. 3:00 AMme99 says:
qoute: "Never leave home without a towel anyway"



42!
Jul 18, 2010. 12:23 PMjinchuuriki says:
Awesome tutorial, no wonder I became a certified Linux engineer, now I remember why. :
Jun 24, 2010. 1:18 AMgaluise says:
Regarding using TTL (transistor-transistor level) outputs to drive a relay directly. I would agree with Rob. I'm not only posting to agree with Rob, but figured I would offer the advice I learned in engineering school: You would want to use something like a darlington arrray. This would provide enough source current to close the relay and would isolate the computer from any back emf from driving an inductive load like a relay. They come in a relatively cheap package. I can recall using a ULN2003 chip (which contains 7 of these) when building a few projects back in college. The ULN2003 itself is able to source 500ma (600ma peak) worth of current itself. So depending on the needs of the relay this chip would probably suffice. I also have to agree with Brandon (the author) as the diode will protect the computer from back emf. Probably not so much of a problem with a PC's parallel port. However, when we tried driving an inductive load directly from an embedded systems chip. The reactance of the inductive load caused the microprocessor to malfunction in unpredictable ways. It would just act like it "lost it's marbles" so to speak. :) Just my 2 cents as well. I figure it might be useful to someone who comes along to read. -Greg
Jun 12, 2010. 4:32 AMComputothought says:
I made this cable to make it easier to hook things tot he parallel port. http://www.instructables.com/id/No-solder-parallel-port-break-out/
May 24, 2010. 8:01 AMhafkensite says:
 You could use some internet service, or rain/temperature sensor, to determine the amount of water that should be sprayed.
May 23, 2010. 8:29 AMCracknel says:
I'm a mess in electronics.
Could you tell me how to hook up the Omron G5V-1 relay??
I would really like to build that circuit to control a 12V LED lamp from my PC.

May 24, 2010. 5:21 AMCracknel says:
You have to replace
#include <asm/io.h>
with
#include <sys/io.h>
to compile parcon.c

And my computer doesn't have enough power to switch the relay :(
May 24, 2010. 2:57 AMCracknel says:
Thanks :)
May 20, 2010. 7:51 AMtbuskey says:
I like it.

I think most sprinkler valves are based on 24v.
I was using X10 to control my valves.  I'm switching to Irrigation Caddy which is a networked controller controlled by a web browser.

Beyond your initial project, I'd look at drip irrigation.  It's better to water the roots then the leaves and it uses much less water.

I'd also add, at the least, a vaccum break upstream of the valve(s).  It keeps water from being sucked back up the hose when the valves shut.  It's required in some communities.  It should be less then $5.
May 21, 2010. 1:56 PMmtnredhed says:
Actually what you have is *half* a lawn sprinkler valve.  The other half is the vacuum breaker and it's required (or other backflow preventer) to meet code in the USA.
May 20, 2010. 9:16 AMtbuskey says:
Yep, 24VAC.  Good to know that 12VDC will work.
May 20, 2010. 9:09 AMmtnredhed says:
It's an interesting example of a linux controller, but given how cheap the dedicated controllers are which include the valve power and 8 positions, I'm really wondering, why?

I have thought about using linux to include moisture sensors AND valve control where you have different plantings requiring different levels of moisture.
May 21, 2010. 10:24 AMCrucio says:
I think it's a great project for the learning experience, and it's definitely much easier to edit a crontab than to figure out how to program a water controller--an arduous task you have to re-learn each time you need to make an adjustment.

However, I, too, would advise against using this, simply because of the amount of power that's being wasted for something that's used 30 minutes per day.  (Less, if you only count the amount of CPU time required to send the on/off commands.  The rest of the time is spent idle.)

Different story, if you're adding functionality to a computer that's on for other purposes during the day anyway.

P.S. Cron can be adjusted to the start of a minute, not second.
May 20, 2010. 10:26 PMandrew_h says:
 I'd really advise against using a parallel port to directly run a relay.  They are not designed to source a lot of current and the port can easily be damaged.  Either use the port to drive transistors to then drive the relay or use something like a ULN2803A which is a darlington transistor array specifically designed for this sort of application.  If the current draw of the solenoid is under 1A you can even drive it from the 2803 directly without a relay.
May 20, 2010. 1:07 PMrobthepyro says:
Perhaps I don't know what I'm talking about but I'm pretty sure that "wireing two pins and ground together in parallel" is a bad idea. basically you risk damaging your P-Port by drawing far to much current with out current-limiting resistors, secondly reverse emf feedback from the coil could be bad for the P-Port

I believe the correct method for doing this is to connect your P-Port pin to an opto-isolator through a current-limiting resistor and have the opto-isolator switch the relay (possibly supplied by the PC's 12v rail) along with a diode for reverse emf protection.

Just my 2 cents, use it/ dont use it :)
~Rob.

May 20, 2010. 10:20 AMbahi says:
Awesome, LINUX POWER!
May 14, 2010. 1:22 AMdeligh says:
 Great Instructable. I think it can be used to water different plants with different watering needs. 
PS. Please try to use commas in your writing :) It will help us in reading.
May 13, 2010. 9:34 PMzubain says:
This is a wonderful way of using the PC to control various devices. Is there any way one can use windows XP to do this?
May 13, 2010. 10:16 PMzubain says:
Thanks for your help. This seems too complicated for me right now. Presently I am using a simple electrical timer and an electrical solenoid valve to do my watering.
May 12, 2010. 9:54 PMComputothought says:
In case it does not compile make this one change: #include <asm/io.h> should be replaced with #include <sys/io.h>

You can also add additional chips (cheap) so you can add more relays, but the programming gets a bit more complicated. Most good robot books tthat support the pc can give you more details.
May 13, 2010. 7:10 PMComputothought says:
I had some problems with some other programs that used the same include and this project forced me to find an answer, This article was a blessing in disguise for me.
May 13, 2010. 7:02 PMComputothought says:
People throw away old pc's all the time not knowing what a powerhouse of control they can be.  As the old saying goes: it's not the size, but how you use it. 
May 13, 2010. 4:58 PMyoyology says:
 Great 'ible!  The only change I would make (if I were still a homeowner watering my own garden) would be to check the weather somehow.  Perhaps polling CAP/XML for permission to water based on current conditions.  One of my pet peeves is sprinklers running in the rain.
May 13, 2010. 4:16 PMbodie says:
 Sweet ible.  I've seen something similar done with the arduino, but this is the first i've seen using straight serial communication.  You, sir, are an evil genius.
May 13, 2010. 1:44 PMRelientOwl says:
Wow,I wish I could have understood most of that.Looks Cool!!!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
14
Followers
2
Author:bkimmons