Archive for June, 2014

OK, sat down over the weekend and did a bit of pseudo code for the watering program.

Easy when you think of it:

  1. Grab command line to see what watering schedule to run
  2. Load system config so I understand my hardware
  3. Load the designated watering schedule
  4. Set up a loop to run all of the zones, if zone is not active or does not have any more water time go, loop to next zone, else:
    1. Check the global gauges to see if we can water, if not exit program with reason
    2. Check zone gauges to see if the zone can be watered, if the zone gauges say no water, zero the zone and go back to the top of the loop
    3. Determine how long to water, either to the limit of the soil or for the full zone time
    4. Start watering the zone
    5. Sleep for the determined time
    6. Stop watering the zone
    7. Go back to the top of the loop and keep doing it until all water delivered to all zones or we are bumped by gauges.
  5. Shutdown any specific hardware as necessary (make sure the water and the pump (if you have one) are off.)
  6. Exit program with status

Now there are some nuances there, logging and other bits but really that is it.  Overly simplistic and lots of detail to pay attention to but at the highest level no need to check things second by second.  And if for some reason I determine I have to check things more frequently than at each zone change I can by using threading but I don’t currently see the need for it.

So the first thing I decided to have a look at is what format are my data files?  Gave that a lot of thought, XML, YAML, JSON or some home cooked format.  After careful consideration of both the input web program and the watering program I decided on JSON for a bunch of reasons, its light weight, there are standard validation tools that can easily tell me if the file if formatted correctly, and its easy to write a json file from web software and their are a bunch of parsers under open source licenses so I don’t need to reinvent the wheel.  Finally it’s pretty easy to hand craft a json file and get it correct so I can get the watering program done and tested without the web front end.

In some ways I don’t love JSON, the pure form does not support comments in the file.  Several parsers do support C and C++ style comments but its not part of the standard as best I can tell.  Of course some people don’t believe in comments so it matters not to them but I do like them..  Oh well the rest of the file format I like well enough.

The other thing I thought about was possible devices attached to the sprinkler system to determine if I should actually water now, or things on the Internet I can reach out to, they are:

  1. Weather report
  2. Temperature gauge (don’t water if too cold)
  3. Rain moisture gauge (don’t water if raining right now)
  4. Rain metering gauge (don’t water if we got enough water in the last day, tricker as we have to have something monitor this all the time)
  5. Wind gauge (don’t water if the wind is blowing too hard, you will just water the neighbors yard)
  6. Ground moisture gauge (one for the entire yard or one per zone, if the ground has enough water now why add more?)

Additionally some things you need to know are:

  1. How many zones are active in the system
  2. Does the system use a pump to pressurize the water, if it does you need to turn it on for each zone to water
  3. Do you want info logged about how much water is put out and what was skipped (if anything because of gauges)

The metering rain gauge is bothering me, I thought I’d only need a web front end and a watering program but to track a metering gauge will require monitoring it all the time.  So I guess that will call for a daemon program that watches the gauge if you have one and accumulates water over time so you can decide if you need to water at all. Hmm, I think I leave that to last, or maybe someone else will code that since I don’t even have such a gauge, though I know they exist.

On to the next step coding the load the config.json file into memory and parse it.  Language well that will be “C” since I prefer that over Python.  IMHO Python is nice for proof of concept and quick one off scripts but I really prefer “C” for the watering program.

So, now that I have a test platform (and I still have a system in my garage that is watering the grass) its time to think seriously about the design of the software and how it will work.

The OpenSprinkler Pi has at least two open source projects one written in python and one written in C/C++.  Both of them model the OpenSprinkler Arduino software, in fact I think both can be run on both platforms.  That makes the software usable across more installations BUT at a large cost, loss of flexibility and security. The app has to run on the least powerful hardware the Arduino.  The Arduino is an  8-bit Atmel AVR microcontroller,  just bare metal is it were.  There are no OS services running on such a device. So the current app’s have to do everything on the Arduino, be a web server, serving the programming interface and have a thread that runs all the time to execute the scheduled waterings.  Simply because there is no other way for it to work on an Arduino.  Now don’t get me wrong, I like Arduino’s, and I use them for simple tasks and data gathering, they are great but they are simple devices and sometimes you need more.  Of course being an Arduino it sort of limits the damage that can be caused by crackers, you can’t reflash it remotely (at least I’m not aware of being able to reflash it remotely) so it’s going to limit what you can do with the device if you can crack it.

However the RPi is a different can of worms in this regard.  Linux on the RPi is very powerful, it is after all a fully fledged computer, not just an embedded bare metal device. Running a unified single application that has to run as root (to control the RPi GPIO pins) opens potential security holes, because on the RPi if you crack it, you can easily reprogram it to do anything you want.  Best practices on the Internet for web servers is you run them at the lowest level of authority so that in the event someone cracks the web site they can’t get control of the entire system.  Imagine if you have a single program running as root and a cracker gets control of it they could run up your water bill into thousands of dollars by turning on your sprinklers every night from midnight to 06:00 AM and turn your Internet connection into a spambot or worse.  You might not notice the damage until you get your water bill, or my my case a citation for illegal water usage!

Nope, a web server needs to have as little permissions as possible, so what can we do to address this. Well we can break the program apart, the “user interface (UI)”, “the scheduler (TS)” and a “watering program (WP)” to take the watering times and lengths and actually water the grass.

OK so the “UI” is run on a web server, check, low permissions, write data files and tell the “TS” when things need to be run.   This is not a complex program but it does require study as interfacing with humans is a skill that not all programmers have.  What makes perfect sense to a developer can be gibberish to the average human.  You need to present the information needed in a way that makes sense and builds on each step.  There could be some configuration sections that only the installer of the system needs to set, and other screens that the average homeowner needs to use to water the grass.

Next you need the “TS”, here on Linux you don’t actually have to write anything, you have cron.  Cron is a time-based job scheduler in Linux and Unix-like computer operating systems.  It can schedule jobs minute by minute, with the addition of at least one handy dandy script to enhance  cron (cron-last-sunday) you can schedule quite intricate requirements.   If you need more than that can do, you can add your own special purpose script to assist cron.

Finally the “WP here you potentially do need root access (there are ways around even needing root here but that is a topic for another blog entry).  The “WP” can only do what is in it’s data files it does not interface to the public so to speak.  The first thing the “WP” should do when it is invoked by the “TS” is quickly validate it’s data files to tell if the data files are corrupt, if they are it does nothing harmful, it simply stops.  It can however send an email to you saying “I did not water the lawn today because my data files don’t make sense.

No harm done, all that happened is the lawn did not get watered so no water wasted and all is well. If you carry a smart phone you will see that email within minutes of when the watering was supposed to start.  You can go see what the heck happened to the data files potentially fix them and still get the lawn watered in the correct time slot.  And finally the “WP” can only read and not write to the data files, so the only thing that can change the data files is the “UI”.

With the single program broken up into three (3) smaller separate bits we get higher security, something that is much easier to debug and we save time as we don’t actually need to write the “TS” program, we have it and its well tested over years of time and 10s of thousands of servers.  So 1/3 of the project is already written for you, now that is a score! ;-D

So now what, do I focus on the “UI” or the “WP”.  I’m going to focus on the “WP” because I can focus on what it is supposed to do, water the grass the way I want to water it: when (per zone), how much water (per zone), absorption rate (how much water can be applied before it runs off)(per zone).  Other things the “WP” can be aware of is a rain gauge (global), local weather reports (did it rain yesterday, is it raining now, does it have a high probability of rain tomorrow and how much is expected)(global), moisture gauges in the soil (is the soil already wet enough, or does it become wet enough while the water is being applied)(per zone or globa depends on how you install them).  Oh and lets not forget a temp gauge, because if it’s near freezing you don’t want to water then either.  And somebody I know wanted to add a wind gauge as he does not want to water if it’s too windy, as it will simply blow the water away and never get to his lawn.

As you can see the “WP” can be really simple: turn on the water per zone for x time.  Or it can be very complex: Turn on the water per zone but if the duration is longer than the absorption rate then only water as long as the ground can absorb it, cycle on to the next zone until it’s reached its absorption  limit and keep doing that until all zones are watered then loop back and put the remainder of the water in each zone, oh yea don’t do it if it’s raining now, or rained more than an inch yesterday or it’s expected at more than an 80% chance of an inch of rain tomorrow, and don’t water if its near freezing or the wind is blowing too hard. Whew, that is really really complex and yet easily within reach with an RPi as the controller, not so much with an Arduino.

Really if all you need is the simple instance, an Arduino is perfect for the job, it’s only when you get really complex do you need a bigger computer.

Once again I’ve written a really long blog entry when I meant to write a short entry, oh well, I’m done for now.  So a question, Ideas anyone, what features do you want in your sprinkler controller?

So I finally hooked up the opensprinkler hardware version 1.4 (OSPi) with my RPi and the Adafruit LCD Plate.  I tried a few things, I purchased the hardware without the RPi connector installed with the intent of using a stacking connector instead. That sort of worked, I had to cut the bottom of the case open with my dremel tool, was expecting that.  But there is a problem with this: The stacking pins are so long that the case has to be mounted on the wall with large offsets to allow enough room under the case to install a ribbon cable.  So it will work, but not really what I want to do.

Next I tried to add a pin header to the OSPi, on version 1.4  they routed all 26 pins of the GPIO to the top left corner of their board, nice.  So I installed a pin header and that worked nicely (sort of), but the RPi won’t plug in anymore, the Audio jack now hits the pin header I just installed. Whoops! So since I don’t need the audio out in this application, I decided to unsolder the audio jack. Fine that works the RPi will install the ribbon cable fits under the RPi.  So then using the dremel tool again, cut a slot for the ribbon cable to exit the case. That works.  So then I tried to put the cover back on the OSPi case.  Another Whoops, the RPi is now too high for the case to close, why?  The stacking header is some taller then the standard header.  So we have another fail. Time to remove the RPi and just install the ribbon cable and route it out of the case. Finally was able to seal the case with the supplied screws, with only the OSPi in there.

When I assembled the LCD Plate I did not use the standard 26 pin socket that it comes with, instead I installed a stacking connector so I could connect a RPi and something else to the LCD.  So the RPi is at the bottom of the stack, the LCD Plate is next and the ribbon cable is plugged in on top.  So now everything is assembled together.  I’m going to have to be creative to make a case for the RPi and LCD Plate, the ribbon cable sticks up above the display but that I “think” I can work around.  I’ll worry about that later.

OK, plug the RPi into the monitor and keyboard (which normally won’t be used but hey I”m testing stuff right now ;-P ), and plug in the micro USB connector for power.  Yea, the RPi lights up, no magic smoke being released anywhere.  Score.  Next I look at the OSPi and it’s powered up too, at least the 5V DC section is.

So I run a quick python program to  check the I2C port, as there should be at least 2 things hanging off it, the RTC @ device 68, and the LCD Plate at device 20 so time to run:

i2cdetect -y 1

The result looked like:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Yep both there 20 is the LCD and 68 is the RTC.  Next setup the RPi to use the RTC, easy instructions are avalible with the OSPi. 🙂 Then run the LCD Plate test code and yes it is working fantastic.

Now I need to test the rest of the OSPi hardware, the sprinkler control section.  Thats going to be a bit harder, I don’t want to go buy a bunch of sprinkler control valves, that is expensive so what can I hook up that can: 1) Work on 24vac 2) See a visual to tell it is working. 3) Is cheap since I only need it for debugging code.  Hmmm, first thought is light bulbs, they run on AC but have you ever tried to find 24VAC light bulbs? Turns out that is both hard and expensive.  BUT 12V light bulbs are plentiful and pretty cheap < $10 will buy 8 low voltage yard light bulbs.  But can I rig 12 VAC lights to a 24VAC source? Not likely 12lights will turn into a fuse at 24V and blow out.  Could add a big honking resistor and waste a lot of heat but thats just stupid and adds cost.  Wait will the OSPi work on 12VAC?

Yep turns out the OSPi will work off of 12VAC for testing, it needs an AC source of 24VAC to run sprinkler zone valves but the internal DC2DC converter that makes the 5VDC power for the RPi is happy from 9VAC – 24VAC. Perfect  Off I go and I buy 8 light bulbs, a circuit board to mount them on, and a 12VAC wall wart.  Solder up a test board with the lights and plug up the 12VAC transformer to the OSPi.   Sure enough, the OSPi powers up fine, makes 5VDC to run the RPi and all is good.  Finally 🙂

Well spoke a bit too soon. 😦  I ran some test code to turn on zone 1 light, it lit for a split second and the RPi rebooted!!!!  What the heck?  Turned out the wall wart was too low an amperage transformer, worked fine just running the OSPi, RPi and the LCD but turn on a 4W light bulb and the voltage drop was too much for the regulator.   So plugged in both the 12VAC transformer and the micro USB connector so the RPi and the LCD and the 5VDC side of the OSPi got juice from the micro USB. Tried it again, yea, it works finally I have a functioning test platform, with a slightly butchered case.  Let the coding begin.

When its really hooked up in my garage it will be supplied from the mondo 24VAC wall wart so that won’t be a concern.

OK, it is the 3rd Monday of June and like clockwork, the water came on and all worked as expected with a simple cron entry.

But lots going on that will generate a longer blog entry soon, the rayshobby / open sprinkler folks have some really nice hardware in the opensprinklerPi hardware.  So I don’t need to design my own board, I can use their open hardware project.  That said I don’t care for any of the software that currently runs on it, it looks like a clone of the existing weekly software that comes on any < $300 USD controller.  Yes you can program it via a web browser and/or a mobile device but it still lacks monthly levels of control.  Also the layout of the hardware restrict adding displays easily.  I added a header and will use a 26 pin ribbon cable to remote the PI and display from the opensprinklerPi hardware.  More about that later.


Have a nice day, I am since I no longer have to worry about my lawn getting watered on the correct day…..

So carrying on with my sprinkler controller project I need an easy way to run things on the 1st Monday of a month and the 3rd Monday and only then.  Hmmm, I can do that with cron by looking up the dates and entering each day but that is a manual process to look that up and then enter 24 entries in the crontab…. Must be a better way so I go surfing the Internet and what do I find but a nice bash script called run-if-today.  You feed it the day of the week and what week of the month you want the entry to run. Perfect  makes the crontab 2 lines vs 24 lines!

# m h dom mon dow command
00 06 02 06 * sudo /home/pi/bin/
00 06 16 06 * sudo /home/pi/bin/
00 06 07 07 * sudo /home/pi/bin/
00 06 21 07 * sudo /home/pi/bin/
# etc, on and on until the end of the year


# First monday of month jobs
00 06 * * 1 run-if-today 1 Mon && sudo /home/pi/bin/
# Third monday jobs
00 06 * * 1 run-if-today 3 Mon && sudo /home/pi/bin/

Much better, it will run forever on the first and third Monday. Yea.

So credit where credit is due: I found this on github cron-last-sunday it’s under an MIT license and Copyright (c) 2014 Manuel Gutierrez.  Nice work.  I had a friend Debianize the script into a nice easily installable Debian package, which I need to figure out where to stash it so others can install it on their RPi, because it really simplifies using cron for certain conditions.


It Works :-)

Posted: June 2, 2014 in Uncategorized

OK, it’s Monday morning here in the Dallas area and for the first time in over a year the sprinklers came on automatically.  The new system I installed yesterday worked as expected.   I don’t have to worry about remembering to get up and press a button at 06:00 AM on the first and third Monday of the month anymore.  All good. 

A New Project

Posted: June 2, 2014 in Debian, General, Hacking, Hardware, Raspberry PI, RPi, Software
Tags: ,

A New Project – Water Sprinkler Controller

I find myself starting a new project not necessarily because I want to but because of our local three year drought and the need to water my lawn under Stage 3 watering restrictions. Unfortunately, my sprinkler controller finally gave up the ghost. Sounds simple doesn’t it? Simply order a new controller off of ebay, amazon or head down to the local big box hardware store Lowes or Home Depot and buy a replacement. After all there are at least 5 or 6 different units that one can buy for under $100 USD.

Ah, well that is where the drought comes in, and the Stage 3 Watering Restrictions. You see, because of the drought we are only allowed to water every other week on a specific day; on top of that we are not allowed to have any run off into the street. This presents several problems to an off the shelf sprinkler controller: 1) Everyone I’ve found for under $300 works on a weekly pattern, and does not have a specific calendar day or the ability to water every other Monday at 06:00 and be done by 10:00 and if not done kill the water anyway as it’s a $200 fine the first time you water past 10:00 AM and $1000 the second time, progressively getting more expensive; 2) Our soil is mostly clay and water soaks in slowly. So you really need to water in short cycles, wet the ground and then move on to the next zone and keep doing it until you have gotten enough water into the ground without run off. Now some of the $300 units can do this but still don’t have the monthly scheduling ability.

So I’m stuck, either I fix this with a new unit that does not really do what I need thereby forcing me to go into my garage every time I have to water and set off a manual cycle, which seems a bit ridiculous. If I’m going to spend the cash to get a new system I want it to be automatic, not be stuck in the same manual cycle I’ve been in for more then a year as there is no end in sight in terms of the drought1. My other choice is to do the entire thing manually with jumper wires and stand in my garage for 2 hours manually activating each zone by hand and then switching to the next zone as needed, yea, like I have so much spare time in my life that I’m going to do that every two weeks!!!!

1And as it turns out my grass is nicely green even with the watering every 2 weeks so even of the drought breaks I’m unlikely to go back to the weekly watering schedule, I mean why waste water and money (I have to pay for city water to water the grass).

What Features do I want/need

So seems like the only think I can do at this point is to hack something together and make my own sprinkler controller from scratch. 🙂 So what do I want in a sprinkler controller1:

1Your list might vary from mine but this will be an open source project and as such feel free once the code is “over the wall” to add other features or accelerate some.

  1. Friendly user interface, web based so you don’t need to stand in the garage in 110f weather programming the stupid thing system.
  2. Can set any interval, daily, every 2nd day, every 3rd day, every 4th day, every 5th day, every 6th day, every 7th day, weekly, monthly, semi-monthly, annually, or a list of calendar days.
    1. Can set start time and hard end (stop) time
      1. If hard stop time is set system will not allow water to flow after that time.
      2. If hard stop time is set, when programming a “???? set” if you ask for more water then the start time and end time would allow the system will warn you and suggest a new start time that will allow all water to be sent and stop watering by the hard end time.
  3. Real Time Clock so it knows what today is.
  4. Zones can be scheduled independently from each other. So I could set zone 1 – 9 to water every other week according to the local rules, but zone 10 (which is a soaker hose on my foundation) can be run every other day as needed to keep the clay moist near my foundation. 1
  5. Each zone can be set for total length of watering, independent of other zones.
  6. Duration of water applied to a zone. If the duration is shorter then the length of time set for the zone the zone will be watered for the duration and the system will keep coming back to the zone until all water has been delivered. This will keep run off from happing with our clay soil.
  7. Might be nice if durations can be set by zone but this would be an enhancement.
  8. Use any standard off the shelf parts for a sprinkler system available at your local hardware store. No requirement for expensive special water control valves or other specialty hardware. Everything low voltage (most sprinkler systems today use 24VAC as their control voltage on zone valves), no 120/220 in the sprinkler control box.
  9. The ability to easily skip a zone on a once time basis in case you discover a sprinkler head is broken but you want to water the rest of the zones.
  10. Connected to my house network so I don’t have to go digging into my garage to know what is going on. Additionally would be nice to be able to do testing of the system remotely when I’m watering in the yard looking at a zone to make sure it’s working correctly. While not hard it’s a pain to have to go back into the garage to trigger each zone and then walk back to the zone to see what works and is broken several times as I fix issues.2
    1. Expand this to remote control from anywhere in the world via the Internet. Clearly need SSH/SSL/VPN security setup so that bad things can’t happen easily.
  11. Expandable, I have nine (9) zones and I can see adding a tenth (10th) zone soon (soaker hose).
  12. Rain Sensor, including volume of rain fall, so if it rains hard enough 24-48 hours before watering time, cancel the scheduled watering.
  13. Ground moisture sensors, multiple zones so you can if desired analyze by zone the need for water.. Would allow skipping areas if they already are moist enough and don’t need to be watered.
  14. Integration to Internet weather sources so you can see if it rained yesterday or is about to rain tomorrow.
  15. Display on the front panel of what the system is doing now or about to do. Time and date displayed when doing nothing else.
  16. Permanent memory so watering instructions are not lost on power fail.
    1. Not require battery backup, I really dislike 9VDC battery backup systems, the battery always dies at the wrong time.
  17. System resume after power loss, including resuming watering if system was running when power failed.
  18. Record what was done over time in a log. What zones were watered, how long, or what zones were skipped and why (raining, rain predicted, soil already moist, etc.)
  19. Run the entire system on a single wall plug. Use a 24VAC wall wart transformer and make any other voltages needed internally to the system. You should not need more then a single source of power.
  20. External temperature sensor, so if its near or below freezing we don’t water.
  21. An emergency off button, so if you see an issue, like for example a broken sprinkler head that is pouring water into the street you can stop it NOW.
  22. This would include the ability to restart to continue watering if the problem is resolved or you tell the system to skip a zone one time and do the rest.



1Without watering on a regular basis the foundation can crack and that is a big $$$$$ repair. Because of this local law allows watering your foundation as needed vs every two weeks. Crazy isn’t it? Water your house?????

2Yes in ground sprinklers need regular service, lawn mowers shave off heads, heads stick with dirt, tops just break off from age. Lots goes wrong, and run off = $$$ in fines.

Next Steps

Turns out I had a bigger list then I understood when I started. Too big to get done in a single pass. So I’m going to break it up into chunks. This was how I wanted to proceed but as usual your plans go out the window when they intersect reality.

  1. Get the hardware.
    1. Assemble all hardware including the parts we are not going to use right now like:
    2. Raspberry Pi Computer (RPi)
    3. 2 banks of 5VDC relays
    4. 2×18 LCD display
    5. AtoD converter to input moisture sensors and rain sensor.
    6. 40V DC DctoDC converter
    7. Full Wave Bridge Rectifier
    8. 1000uf 50VDC Electrolytic Cap
  2. Installed on the garage wall where the existing controller is.
  3. Modify the init scripts to read the RTC and set the date even if the unit can’t see the Internet for any reason.
  4. Basic cron job that will water the lawn on the specific days allowed:
    1. cron tab of:

00 06 05 06 * sudo /bin/bash /home/pi/bin/
00 06 05 21 * sudo /bin/bash /home/pi/bin/

You see I ordered a bunch of the hardware and it won’t come in until the day after I need to water the grass for the next cycle 😦 So I’m going to have to take just the Raspberry Pi and Relay board and put them in temporally so the grass can get watered. So the actual order will look more like this:

  1. Get some hardware
    1. Raspberry Pi Computer (RPi)
    2. 1 banks of 5VDC relays
    3. Some jumper wires
    4. 40V DC DctoDC converter
    5. Full Wave Bridge Rectifier
    6. 1000uf 50VDC Electrolytic Cap
  2. Disassemble the old control system and leave parts of it in the box on the wall and keep the 24VAC transformer.
  3. Solder the full wave bridge rectifier and cap directly to the DCtoDC converter
  4. Use a chunk of cardboard to zip tie the RPi, relay board, and the new little 5VDC power supply to it.
  5. Using jumper wires connect up everything. Power the RPi via the GPIO pins and not the micro USB connector

Examine the existing connections and wires

Old Sprinkler Controller Connection Board

The old system was made by Irritrol an RD-900 unit, which consists of a control unit and a separate connection board. I don’t care about the control unit as its dead and I”m building a new one BUT I do care about the old connection board and the wires that control the sprinklers that come out of the ground. So time to document them. It’s pretty clear from a closer inspection of the board that the RD-900 is a pretty simple system there are lots of areas not populated on the board. But it’s pretty clear I can use the ribbon cable that came out of the old control unit and attach to this connection board and save some time and cost.

Connection on Old Wall Board Barrier Terminal
1 24 VAC after going through a 2A SLO-BLO Fuse
3 #9 Zone
4 #12 Zone
5 #5 & #7 Bridged to AC Common
6 #11 Zone
7 #5 & #7 Bridged to AC Common
8 #10 Zone
9 #3 Zone
10 #1 Zone
11 #4 Zone
12 #2 Zone
13 #6 Zone
14 #5 Zone
15 #8 Zone
16 #7 Zone

All connections on the Barrier Strip have an MOV for protection but it was never hooked up by the original contractor. Another example of the shoddy work that gets done on these development homes.

Old Sprinkler Controller Connection Board

Old Sprinkler Controller Connection Board

The Barrier Terminal Strip has all of the zone wires connected to it and the 24VAC power. It also has a slo-blo fuse which is quite handy since I’m bypassing the fuse on the RPi by supplying power on the GPIO pins directly.

Barrier Terminal
Strip Label
Wire Color
1 Black (Solid Wire)
2 Blue (Solid Wire)
3 Red (Solid Wire)
4 Green (Solid Wire)
5 Yellow (Solid Wire)
6 Orange (Solid Wire)
7 Brown (Solid Wire)
8 Grey (Solid Wire)
VC White (Solid Wire)
24 Black (Stranded Wire from 24VAC
VAC Black (Stranded Wire from 24VAC

OK ignoring the shoddy workmanship issues I can make use of this board. I’ll be using the following pins listed in the table below, I’m going to skip the 9th zone as I don’t need to water it right now.

Pins Description Connection Point
1 24 VAC after going through a 2A SLO-BLO Fuse DC2DC Converter Full Wave Bridge input
5 #5 & #7 Bridged to AC Common DC2DC Converter Full Wave Bridge input
7 #5 & #7 Bridged to AC Common Bridge to all relays NO Connection
9 #3 Zone Relay 3 Center contact
10 #1 Zone Relay 1 Center contact
11 #4 Zone Relay 1 Center contact
12 #2 Zone Relay 2 Center contact
13 #6 Zone Relay 6 Center contact
14 #5 Zone Relay 5 Center contact
15 #8 Zone Relay 8 Center contact
16 #7 Zone Relay 7 Center contact

Easy to wire up, and test. All good.

First Install and Test

Interesting morning, put the old sprinkler connection board back in the box, hooked up all the wires in the correct spots. Then mounted the RPi/Relay temporary cardboard mount into the lid of the old system, then used jumper cables to connect the 5VDC power supply and the relay board to the connection board.

RPi, Relay, Full wave bridge rectifier, filter cap and DC to DC power Supply

RPi, Relay, Full wave bridge rectifier, filter cap and DC to DC power Supply

Old Connection board jumped to RPi and Relay's

Old Connection board jumped to RPi and Relay’s

Jumped onto my network and checked yep, the RPi is on right where it should be. Sure enough the system set it’s time from the Internet, and SSH is working. Sweet. Ran a test program of 30 seconds per zone to see what happens, YEA success, or sort of, anyway, zones 1,2,4-8 all work as expected. Zone 3 dead, no joy, ugh, what did I do wrong?

So got out a jumper wire and shorted out zone 1 to AC common, on it comes, did the same with all the zones (this bypasses my RPi/Relay setup completely), again all zones except zone 3 work, zone 3 still dead. Looks like the zone valve in the ground is dead. Not really a surprise, this will be the second valve in the last year that has died1, and at least it failed in a better way then the first valve, which failed on, this one failed off, who knows how long it’s been dead, could be just short of a year when I last fixed zone valves. Of course we would have not noticed it, its not like I stand outside and watch my sprinklers go on and off. The only reason I did today was to test my new contraption. Since I now have full SSH access to the RPi I don’t have to go into the garage to manage the grass watering. SCORE 🙂

So I call this a total success, my controller is working, I have a crontab that will water the lawn in June without any attention, so I can now get the rest of the parts in and work on software. And better yet my wife is happy that I completed stage one of the build. Of course I still have to complete the rest of the stages but at this point the grass is getting watered on schedule so its a win.

Now I have to design the web pages to program the system, right now it’s hard coded and that won’t do, I want my wife to be able to change this from anywhere in the world without having to resort to C or Python programming. More about that another day.

1No real surprise, the zone valves are more then 12 years old and have been covered over in clay and dirt and water over that entire time. More shoddy workmanship, no dirt blocking fabric, no gravel under the zone valves just stick them in the ground, put a too small box over them and let it rip. No one is going to notice until years later.