A WiFi-Enabled Lawn Sprinkler Controller using the chipKIT WF32

I don’t know about you, but I’m never happy with my lawn sprinkler schedule. In Austin, it can rain till my garage floods one week, then return to the typical four-year drought conditions with 100°F+ temperatures for the rest of the summer. As we progress through the drought stages, we go from being allowed to water whenever we want to twice a week to once a week. I also find that the consumer-grade zone controllers have really crappy user interfaces, they are often limit you to either an “every X days” pattern or watering on specific days of the week (but not both), and they tend to limited in how many events are associated with a given zone…not to mention you have to go out to your yard – or maybe your garage if you’re lucky – every time you want to change the schedule.

I decided to build my own sprinkler controller and Digilent’s chipKIT line provided an excellent platform.

My first iteration was an Arduino UNO  tethered to my PC via USB cobbled together with a custom C# GUI for maintaining the schedule for my six zones and sending on/off signals to the Arduino via a simple serial protocol. That served me for a year or two, but the tethered solution was less than ideal – power outages or PC restarts were problematic, and having to run a USB cord out the window was just lame. I finally decided to build a fully standalone solution that could be accessed and programmed over WiFi. The controller would essentially be a stand-alone web server with integrated timer functionality. The chipKIT WF32 (and, alternatively, the uC32 plus a WiFi shield) are an ideal platform for this.

A significant portion of the project is code which implements a very basic web server. Implementing an HTTP server from the ground up in C probably would have been beyond my capability – I will readily admit I am a terrible C code. Fortunately, Digilent’s Gene Apperson has written a basic implementation which I was able to use as a starting point. As of this writing, that basic server code can be found hereSince starting this project, I’ve been in touch with some Digilent folks who have developed a more robust version of the HTTP server which would really be better to use…I just haven’t had time to go back an re-implement on that foundation. Maybe someone out there would be willing to take that effort on? The new version is more modular, should perform better, and have better connection handling.

The hardware incorporates a realtime clock/calendar; I went with a really cheap module from China, but Digilent’s PmodRTCC would no doubt work and would be better supported by the MPIDE libraries. The chipKIT boards also have a non-obvious, poorly publicized feature – you can solder a 32.768Khz crystal onto the board which enables an embedded real-time clock! (see http://hacking.majenko.co.uk/node/33) – but you’d have to provide backup power for the whole board in the event of power outages. To drive the 24V sprinkler water valve solenoids, I connected six of the IO pins to a triac board I found online, which in turn connects to the six solenoids.

I’ve open-sourced all my code for this project and, as of this writing, the source repository is hosted here: https://code.google.com/p/wifi-sprinkler

Greater detail regarding the whole project can be found on my blog here: http://austinlightguy.wordpress.com/2013/10/18/arduino-based-wifi-lawn-sprinkler-controller/

VN:F [1.9.22_1171]
Rating: 8.7/10 (6 votes cast)
A WiFi-Enabled Lawn Sprinkler Controller using the chipKIT WF32, 8.7 out of 10 based on 6 ratings