Tagged: Pi Zero
November 29, 2012 at 10:02 pm #22319
Dan in CAParticipant
I got a Raspberry Pi a couple of months ago. It is often described as a credit card sized computer and costs just $35.00. I’ve been trying out some of its amazing capabilities and thought it might be useful as part of a home automation system. It only uses about a half Watt of power.
One of my greatest interests is gardening with drip irrigation. Climate change and a growing population make water conservation vitally important. I figured the Raspberry Pi could be programmed to automatically adjust an irrigation schedule based on weather/climate data that it could access from the internet. The problem was how to interface it with sprinkler valves. Out of curiosity I Googled “irrigation controllers with Ethernet” since the Pi has an Ethernet interface. That’s when I discovered OpenSprinkler. I felt like I had just won the lottery! OpenSprinkler has everything I needed and more and at a reasonable price. I ordered the DIY kit and while I was waiting for it to arrive I downloaded the software/firmware zip file from github so I could start getting familiar with it.
Then It was only a matter of changing one line of the firmware to point to the PI. That was easy but compiling and uploading the modified firmware to OpenSprinkler turned out to be a project in it self but that’s a story for another day.
Once the updated firmware was installed on OpenSprinkler, I connected the Pi and OpenSprinkler to my home network and fired them up. Then I tried to access OpenSprinkler’s web interface and it worked the first time!!!
My next step will be to get David Gustavson’s logging scripts working on the PI. As soon as I do that, I would be willing to share the image file for the SD card so anyone who wants to add a Raspberry pi to their OpenSprinkler system could do it with minimum hassle.
I’m also working on some Python programs to automatically adjust OpenSprinkler’s schedule based on weather conditions.
I’ll report back as things move along.
DanDecember 1, 2012 at 10:20 pm #23201
Thanks for sharing, Dan. It’s great to know that you modified OpenSprinkler firmware to work with Raspi. I’ve got my first Pi recently and am very happy with it. I think a lot of home automation projects will move towards embedded linux in the future. It will lower the programming barrier for users who are less familiar with microcontroller programs but more familiar with script languages. Keep us updated on your progress. Thanks.December 28, 2012 at 8:26 pm #23202
Great idea. I stumbled upon OpenSprinkler in the same manner you did and for the same purpose. I haven’t purchased one of these yet, but plan to shortly. I would be interested in your efforts to integrate it with the Raspberry Pi, since I recently purchased one of those to tackle this very problem.
Great stuff Ray!January 9, 2013 at 5:43 pm #23203
Dan in CAParticipant
The combination of Raspberry Pi and OpenSprinkler seems to be working quite well.
I posted the steps I used to get the pi and OpenSprinkler working together on my blog. At this point the Pi serves the JaveScript files and icons for the UI and handles logging of irrigation events.
I am in the process of writing a python module for interacting with OpenSprinkler. It will allow to write python programs which can be run on the Pi or other computer on the network that will be able to check and set irrigation schedules on OpenSprinkler. So far I have python functions that can change the Water Level %, set Rain Delay, read and change Run-Once Program settings and do things like set manual mode, reboot, and dis/enable OpenSprinkler. Once the module is ready I will be able to start working on some programs that tweak irrigation schedules based on evapotranspiration (ET) estimates from a local weather station. I will post here when the python module is available.
DanJanuary 13, 2013 at 5:47 pm #23204
This is a totally awesome thread. I have had a Raspberry Pi for a long time. One of the things I wanted to do was develop some sort of web based sprinkler control system for my house.
I am glad to see that it is already done and it is open source, except for the board.
So, I buy the board from Rays Hobby for controlling sprinklers that is designed to attach to an arduino and it will work with a Raspberry pi?
And I get the programs and stuff from here.
Thank you.January 14, 2013 at 1:19 am #23205
Dan – looking forward to getting this up and running. I have fixed IP for both my existing R-Pi and OpenSprinkler – but I can edit the python, PHP and java files easily to make the changes. However I also customise my Opensprinkler firmware to change MAC address as I have both a v.1.0 and v.1.4 running on my network and it didn’t like duplicate MAC’s.
You supply the HEX file for the firmware – can you also post the actual source code, or tell me what has changed in the Arduino code? I was hoping that the logging could be all external so I don’t have to reprogram my OpenSprinkler (which is a bit of a challenge under Windows) – just change the exteranl button image and intercept the weather call to the new logging page???
EDIT: Just realised my question is dumb – obvioulsy need to change where the Opensprinkler looks for java from Rays page to the local server – any other changes?January 29, 2013 at 3:48 am #23207
A few benefits:
The server logs all changes made along with the username of the person doing it (from the http authentication).
The scripts are all local and MUCH faster than accessing from the US (we are in Australia).
The timers each have the password set but the script inserts this into any request thus removing the need for staff to know it.
I have a very simple index.php that takes the list of OpenSprinklers from a vars.php used by the other script and this displays a selection of timers along with direct commands appropriate for them.
I will be working on refining it over the next few weeks and will look at publishing it all then. In the meantime I can pass on what I’ve done if you would like to look at it once I can be sure I’m not exposing any of our network data, etc by mistake.January 30, 2013 at 5:40 am #23208
Not sure I fully understand the tech details on rerouting Rays site aradke – but sounds interesting! I’ll certainly be keen to try out your system (in Oz also – Geelong, Vic- but don’t have any real issues with speed on the interface – but quicker is always better!).
I’m currently running the logger as well as using the RPi as a network print server for an attached USB printer, but if you’re after some beta testers let me know.January 30, 2013 at 4:36 pm #23210
just asking because I don´t have much idea about it:
It is possible to wire-connect opensprinkler to the raspberrypi?. I know how to share the connection with windows, but no idea about how to do it with linux.
The configuration would be: A raspberry pi with wifi adapter and then opensprinkler wired to the pi via ethernet cable.January 30, 2013 at 6:28 pm #23209
This should be possible. For exemplar, the OpenSprinkler can be connected to Pi with a cross-over cable, and then Pi is connected to the main router through USB WiFi.
Just to give everyone a heads up: I am working on an OpenSprinkler Pi edition: basically it’s a shield that’s wired to Pi through the GPIO pins, so the Pi can directly control the shift register and hence the solenoids. The board is essentially a subset of the current OpenSprinkler hardware, with 24VAC->5V power conversion, shift register and triacs, and DS1307 RTC. The 24VAC->5V is capable of outputting 1A current, so it can power a PI board together with a WiFi USB dongle. The hardware has been tested and is working fine. It’s pretty straightforward and the nice thing is that I designed some copper pillars to support the Pi board on top of the shield, so that everything can fit inside the existing OpenSprinkler enclosure. The software is not finished yet: I’ve written a piece of Python code that runs a very simple http server, presenting a list of buttons and allows you to control solenoids manually (very much like the first manual control program for OpenSprinkler which I wrote a long time ago). I am hoping to post about it some time this week and next week. This should probably attract some interests from people who have a Pi at hand.
Some pictures for the curious:January 30, 2013 at 10:42 pm #23211
The Pi edition looks fantastic Ray!
And the options it would open up are huge. Of course the benefit of the existing OpenSprinkler is simplicity and that you know exactly what code is running on the microcontroller without a full OS and all it’s bugs.January 30, 2013 at 11:02 pm #23212
dman, I’m sorry I didn’t explain clearly.
Basically, instead of accessing the OpenSprinkler directly you access the server’s web server. Each request you make is then sent to the OpenSprinkler by it instead and the returned page is modified as appropriate before handing it back to your web browser. Hopefully that makes more sense… ❓
you ==> server
server ==> OpenSprinkler
server < == OpenSprinkler
you < == server
So you don’t talk directly to the OpenSprinkler. The server does it on your behalf. There are other things it does as well but they are more for a business environment (like logging who did what, etc) and these are what makes the effort extra worthwhile.
It is very lightweight stuff though so a Raspberry Pi with a PHP supporting web server would be more than enough, though we have it running on the server that does all the monitoring of the nursery’s watering, tank levels, etc.
I have a little bit more work to do before I can spend time making it ready for others but if you are interested email me directly: [email protected]February 1, 2013 at 10:58 am #23213
Just had another look at the Sprinklers.php posted by Dan. Although he has the OpenSprinkler at 192.168.1.55 in his instructions, and in the first part of the php file, there are a couple of references to 192.168.1.18 later in the code. If you edit these to be the same as your OpenSprinkler IP you also get the next weeks schedule printed after the logs. Even better, if you enable a rain delay, you see the schedules that won’t be run in red!
Didn’t even realise that was there – an added bonus – great work Dan!March 21, 2013 at 5:39 pm #23214
Perico, I think what you want to do is an Ethernet bridge. This is doable from Linux. We have small embedded processors at work that do this. What exactly you have to enable is kind of beyond me. However, you may want to dig around the DD-WRT forums. This port of linux deals with routers and I believe the folks there should know all the setup and config files to change.
Is the source code for the modification to the OpenSprinkler firmware available? I saw the compiled hex file in the zip file and the instructions mentioned that the firmware was changed. However, what exactly that was modified was not detailed.
You must be logged in to reply to this topic.