Computerised Sprinkler Controller
Is your town on water restrictions? If so, and you like to dabble in Linux and electronics, this project might be for you. In Canberra, water levels in the dams are very low due to lack of rainfall for a number of years. This project will help your region minimise water but still keep that expensive garden alive through the use of a smart watering system. Automatic sprinkler systems can be used only for certain days at certain times with weeper hoses or drip irrigation systems. Under level 2 water restrictions, you may water for up to 2hrs on either odd or even days of the month between 19:00 and 04:00. There has even been a bonus day at the end of the month. I'd like to see any other sprinkler controller that can handle those conditions!Hardware
This page describes 2 hardware designs. The first uses an old PC and the parallel port I/O card shown below. Further down you will find another version of sprinkler controller that uses a ethernet based I/O card that can be placed anywhere on your LAN.
You will need the following hardware:
- An old PC running Linux.
- A parallel port card.
- A 24 volt AC power supply (plug pack).
- A sprinkler solenoid.
- A suitable parallel printer cable.
Mount your Linux system somewhere close to power for the PC, the plug-pack and the sprinkler cables. You will not need a screen if you have a network connection from another PC. Plug in the IO card, power it up and then boot the Linux box. Watch the LEDs to see what happens to the IO card during boot. Test the card by running the driver using:
./kv -t
You should see the relays cycle through every binary combination.
Software
The following dot points describe the sprinkler controller features.
- The Linux crontab controls the start and stop times.
- Watering is restricted to even days and the last day of the month.
- If watering is permitted, the system uses the Linux text mode web browser 'Lynx' to access the Bureau of Meteorology to see how much rainfall has occured in the last 30 hrs. If more than 10mm has been received, watering is skipped.
- The controller emails status reports which are useful for early implementation monitoring until you are sure that all is working as expected.
Note that I had to use a C driver application to control the IO board as I couldn't get Perl to directly talk to the parallel port. The code is provided below.
After you compile the driver and hook up the IO board, type kv to see the options. There is a test mode that cycles all of the relays. The extract below shows the result of running kv with no parameters.
+ Display Example...One thing to watch with this project is the operation of the relays during a system reboot. My board actually turns all relays on for a couple of seconds so you should test this to ensure you don't have any problems before putting the system into production. This could be embarrassing if the relays are controlling your garage doors instead of the sprinklers.
Ideas
Please let me know if you go ahead and make this or have suggestions on improvements.
You may like to consider using the Linux on a floppy or one of the following embedded systems and I/O cards for this project.
You may also like to check out the PicoServ embedded web server for this project.
If you want to add more smarts to ensure optimal watering based on evaporation rates, have a look http://limnosun.limnology.wisc.edu/evap_protocol.html
The formula on this site for evaporation rate is:
E = (Rnet ? S + Q + Ao) / [(1 + B + (Cp/L)*(Ts ? TA)], (1)
Links
Shower Filters Shower filters and designer shower head water filter fixtures.
Code
Click on the links below to download software to make this work.
- The parallel port driver application (written in C). This contains some signal handling code that may be useful in other projects.
- The Makefile to compile the 'C' port driver (see below).
- The Perl controller application.
- Some crontab settings (see below).
- Please send an email to Acacia Lateral Technologies. if your would like a copy of some smarter Perl code that runs of a text file rule base for more complex control settings such as "SUNRISE+0200" etc.
# Make file to compile driver application new: gcc -W -O -o kv kv.c # cron settings # Turn on/off sprinklers (it manages odd/even days, rainfall etc) 0 19 * * * /io/check_rain.pl start 2>&1 >/dev/null 0 21 * * * /io/check_rain.pl stop 2>&1 >/dev/null
The Elexol Ether I/O 24 Hardware Solution
You may also like to try putting the hardware shown above together. Just purchase the parts from Electronic Solutions and download the code from the link below. This company offers very quick response, great service and support. Highly recommended!
Follow these steps...
- Get these cards from Electronic Solutions.
- Download the Perl based code to control the system over your network or over the Internet. I setup my DHCP server to allocate a fixed IP based on the MAC address.
- You can either use DHCP, or if you prefer a fixed IP, setup your DHCP server to allocate a fixed IP based on the MAC address of the card.
- Call the Perl IO code to control or read from the device. It uses port 2424 over UDP.
Click here to check out the list of other projects.
You may also like to click here to check out the list of Artificial Intelligence projects.
If you would like to get any further information on this or any of the other projects shown on this web site, please send an email to Acacia Lateral Technologies. or place a comment in our Guest Book
You might also like to submit your idea to our Free Ideas page for the benefit of other like-minded soles.