OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Using a Raspberry Pi with OpenSprinkler
Tagged: RuneScape gold RSgoldfast
- This topic has 21 replies, 11 voices, and was last updated 4 years, 8 months ago by Ray.
-
AuthorPosts
-
November 29, 2012 at 10:02 pm #22319
Dan in CAParticipantI 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.
One of the first things I noticed about the OpenSprinkler software was that it fetched the JavaScript files for the web interface from the rayshobby server. Those JavaScript files in turn fetched icons for the buttons from there also. That is obviously due to the fact that the firmware has pretty well maxed out the memory on the OpenSprinkler. The Raspberry Pi uses an SD card to hold the operating system, programs, and data files. It can provide gigabytes of storage depending on the size of the card.
As soon as I got the OpenSprinkler kit assembled and working I started setting up an SD card for the Pi to work with it. I flashed an 8GB SD card with the latest release of the Raspian (Debian) operating system and installed lighttpd which is a light weight and fast web server. then I put the Icons and JavaScript files for OpenSprinkler on the Pi after modifying the JS files to point to the PI which I set to a static IP address of 192.168.1.50.
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.
Dan
December 1, 2012 at 10:20 pm #23201
RayKeymasterThanks 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
shawnParticipantGreat 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 CAParticipantThe 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.
Dan
January 13, 2013 at 5:47 pm #23204
HomerlhMemberThis 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
RayKeymaster@Homerih: in case you haven’t checked it already, all information about OpenSprinkler can be found at http://www.opensprinkler.com. It runs an ATmega328 microcontroller itself so you don’t need to attach it to any arduino. The microtronoller runs a full-featured program which serves the webpage, and carries out the water schedules. The webpage requires some Javascripts that are currently hosted on rayshobby.net server. Dan’s Raspi scripts are designed to offload these Javascripts to a Pi server, as well as to log the sprinkler status (which the controller doesn’t do itself). Also, using a Pi to interface with OpenSprinkler makes it easy to introduce weather-based features and anything that requires computation beyond what a simple microcontroller can do.
January 24, 2013 at 3:34 am #23206
dmanParticipantDan – 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
AndrewParticipantActually you can change the location that you get the javascript from without reprogramming the the OpenSprinkler.
What I do is have a php script that runs on a server that you access. It takes any references to the rayshobby.net address and rewrites them to it’s own address and adds the address of the OpenSprinkler in where it should before handing this back to the browser. There is a bit of work to be done after this in the javascript to make sure that the server is kept in the loop but after that it works a treat.
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
dmanParticipantNot 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
pericoMemberjust 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
RayKeymasterThis 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
AndrewParticipantThe 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
AndrewParticipantdman, 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
[server modifies response with links to local copies of javascript, etc]
you <== server
[you fetch javascript from local copy]
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
dmanParticipantJust 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
mrburns42MemberPerico, 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.
Thanks.
SteveMarch 23, 2013 at 3:46 pm #23215
RayKeymasterSteve, are you referring to the changes in formware 1.8.3 (vs the previous version 1.8.2)? The changes are all documented in the GitHub commit messages, and README.txt. For example, the commit message of 1.8.3 says:
main changes are 1) added back support for concurrent running mode; 2) new ‘device_id’ option which allows modifying the last byte of the controller’s mac address.March 25, 2013 at 2:18 am #23216
mrburns42MemberRay,
I was referring to Dan’s post about his blog using Raspberry Pi with OpenSprinkler. In his zip file there is a OpenSprinkler hex file which is described as:
“A modified version of the OpenSprinkler firmware”. I did not find the source code to the mods or what exactly was changed.
Thanks.—- Steve
January 24, 2019 at 11:23 am #53845
AnonymousInactiveHello Dan,
I am following your blog to have opnensprinkler in my rasperry pi and get stuck in point 7.3
-Follow the instructions on the OpenSprinkler web site to flash the OpenSprinkler with the precompiled modified firmware. This is only necessary if you will be hosting the files for OpenSprinkler’s web interface on the Pi.My cuestion is how to flash the OpenSprinkler with the precompiled modified firmware?
Thanks.
March 28, 2019 at 3:27 pm #59494
WildBillpdxParticipantDidn’t see anything in the posts specifically about Pi Zero. I just bought my OSPi kit and a Pi Zero W H. The Pi has built-in WiFi and has the GPIO header installed. Ordered from AdaFruit for $14 plus $4.71 shipping. Hooked it up the OSPi board and it seems to work great. Haven’t connected to sprinklers yet but all functions appear usable. Saves a lot of trouble having both wifi and the GPIO header.
May 15, 2019 at 2:44 pm #60377
RayKeymaster@nbelles: there is NO ‘precompiled’ firmware for OSPi: you install it and compile it directly. Follow the instructions here:
https://openthings.freshdesk.com/a/solutions/articles/5000631599-installing-and-updating-the-unified-firmware
I assume you are referring to the unified firmware. If you want to install any third-party firmware, you have to follow their instructions.
@WildBillpdx: yes, I would definitely vote for RPi Zero W H — the lowest cost RPi with built-in WiFi.December 31, 2019 at 5:55 am #63843
venki.dasParticipantHi Ray,
yes i am able to change other settings like create a program with days and time etc. All settings are saved. But when change the name of the station it doesnt save and reverts back to reset
I have created a screen capture video for the same and uploaded to you-tube. please kindly check and if you have any questions please let me know
This happens from the mobile app as well as from the desktophttps://www.youtube.com/watch?v=uiR3HJObtag&feature=youtu.be
January 1, 2020 at 11:58 pm #63863
RayKeymaster@venki.das: what version of OpenSprinkler do you have?
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Using a Raspberry Pi with OpenSprinkler