OpenSprinkler Recent News and Updates (Feb 2015)

Hey, it’s March already, that means spring will be here soon! Amid an unusually cold winter and freezing weather this winter in New England, we’re finally starting to see some warm winter days. No more snow please, we’ve had enough 🙂

Ars Technica
This post is to give you some recent updates on OpenSprinkler and upcoming plans. First of all, OpenSprinkler Pi got blogged by Ars Technica, which is super cool. It’s really a fun article to read. That caused a huge spike of orders, but we managed. I only wish that Cyrus Farivar, the author, had talked about the microcontorller-based OpenSprinkler as well, because appearance-wise it looks more elegant.

Unified Firmware 2.1.3

Next, we just released the first version of the Unified OpenSprinkler Firmware, numbered 2.1.3. The biggest benefit of this firmware is that it’s cross-platform — it can compile and run on all OpenSprinkler hardware platforms, including the standard OpenSprinkler (OS), OpenSprinkler Pi (OSPi), and OpenSprinkler Beagle (OSBo). The cross-platform idea was inspired by Rich Zimmerman’s sprinklers_pi program. The purpose is to make a fully consistent firmware for OS, OSPi and OSBo, so that the same firmware and same features are available on all of them.

Technically, the unified firmware is written in C++. It’s done this way to share the code between OS, OSPi and OSBo as much as possible. The major differences are that on OS, all non-volatile memory data (such as options, program settings) are stored in EEPROM, while for OSPi/OSBO, these are stored in a local file, which simulates EEPROM. Also, OSPi/OSBo uses the standard socket to handle Ethernet communication, while OS uses an Arduino EtherCard library. Other than these, the code is largely shared between them, making it easy to extend in the future. Folks may find C++ based programs less friendly to modify than Dan’s Python-based interval_program. However, as I said, the point is to make the three platforms maximally compatible, so that any new features introduced in OS will be simultaneously available to OSPi and OSBo.

The main added new feature of this firmware is the support of using sunrise/sunset times in program settings. Specifically, the program’s first start time (and any of the additional start times) can be defined using sunrise/sunset time +/- an offset (in steps of minutes) up to 4 hours. The program preview will also take into account the sunrise/sunset time of a specific day. Another change is the support for MD5 hashed password, which attempts to address the previous plain-text password to some extent. For the security-minded, I admit that this is far from sufficient, but better than before.

For OSPi/OSBo, all features currently implemented on the OS, such as individual station water time, Zimmerman’s weather-based water adjustment, and support for radio frequency stations, are also immediately available for OSPi/OSBo.

Details on this firmware and how to upgrade OS/OSPi/OSBo to use this firmware can be found in this forum post.

Upcoming Plans
There are quite a few things on our todo list. The top items include:

  • Getting OpenSprinkler certified by the EPA WaterSense program (which requires ET-based water time calculation).
  • Support for soil moisture sensor and flow sense (at least flow estimation).
  • Improve the scheduling algorithm to better handle overlapping schedules using a queue.
  • Adding firmware support for using sensors (either digital or analog) to trigger sprinkler events.
  • Adding cloud-support (long term goal).

Some of these are purely software, but some will entail hardware changes. For example, for cloud-support, we’ve come to the conclusion that it will require an upgraded microcontroller due to the resource limitations of the current hardware. So the cloud support will likely not happen until OpenSprinkler 3.0 comes into place. It seems that adopting ATmega1284 is the most straightforward solution — it’s totally pin compatible with the current ATmega644, but doubles the flash memory space and quadruples RAM size. If you have suggestions about desired hardware changes, please feel free to let me know. This is the time that your opinions will be factored into the future of OpenSprinkler 🙂

Besides the additional new features, we are also planning to remove some features which are rarely used. One immediate plan is to remove the built-in relay, which seems not very useful, only to add manufacturing cost. The original idea of including a built-in relay is to use it for general-purpose switching, such as garage doors, landscape lighting etc. However, there is no cutout dedicated to the relay wires, so it requires some modification to the enclosure. Also, now that we have support for Radio Frequency (RF) stations, the need for build-in relay is even lower. Alternatively, you can use an external 24V AC relay, which I blogged about previously. At any rate, it seems wise to retire the built-in relay.

Retiring OpenSprinkler DIY and OSPi Standard Version
To prioritize our business, we have decided to permanently discontinue OpenSprinkler DIY kit and OSPi Standard version. We will no longer stock these kits. I know that OpenSprinkler DIY kit has been a fun product for many makers and Arduino lovers. But the maintenance cost is also pretty high — even though we do not officially provide technical support for DIY kits, in practice we still help users a lot in fixing their soldering mistakes and diagnosing issues. This has taken too much overhead, and because of this reason, we will retire the DIY kit.

As for the OSPi Standard version — it will also be retired soon in favor of the Plus version. Most of Raspberry Pi’s new products, including A+/B+/2 use the same form factor, which is not compatible with the original A/B. The standard version is still compatible if you own a RPi 1 model A/B. But we are looking into the future, and expect the orders of the standard version to drop significantly in the upcoming season.

DC Powered OpenSprinkler
I’ve received several requests to make an OpenSprinkler variant for DC solenoids. Within the US, most sprinkler solenoids are still AC powered. But for International users, it can be painful and confusing to find a AC power source, especially since AC adapters are not regulated (i.e. you can’t plug in a 110VAC adapter to 220VAC socket). In contrast, DC adapters and solenoids are sometimes more common and cheaper to source, and DC adapters are usually regulated and universal.

In a previous blog post, entitled Understand 24V AC Sprinkler Solenoids, I analyzed the electric specs of a typical sprinkler solenoid. One interesting discovery there is that it’s totally possible to drive a 24V AC sprinkler solenoid using DC voltage. The trick is that it needs a high momentary voltage to activate, but once activated, it can remain open with a relatively low voltage (some where around 6~8 VDC). This means a DC powered OpenSprinkler not only works for DC solenoids, but can work for a typical 24V AC solenoid as well. In fact, combining this with the H-bridges that OpenSprinkler Bee uses, it’s even possible to use the same hardware to drive DC Latching solenoids as well! Perhaps I can call this the Unified OpenSprinkler Hardware design 🙂

Inspired by this idea, I am actually working on a DC version of OpenSprinkler. Besides the benefits to International users, another benefit of a DC design is that this makes it easy to add a current sensing circuit to monitor each station, and detect potential solenoid shorting / damage etc.

Announcing the OpenSprinkler Mobile App — Native Version (all platforms)

I am very excited to announce that the OpenSprinkler native mobile app is now available on all platforms (iOS, Android, Windows Mobile). A big shout-out to Samer Albahra for his diligent and absolutely fantastic work in developing this app!

Different from the previous OpenSprinkler web app, the native app can be installed as a standard app on your mobile device. This not only enables some new features (such as automatic scanning device, multi-language support) right away, but opens doors for more exciting features in the future, such as push notification and local storage (e.g. representing each station with a photo icon). The app is free, so go ahead and give it a try right now!

os_nativeapp_ui

Requirements:

Let me briely go through the requirements for using the app:

  • Hardware: to use the app you need to have either an OpenSprinkler (v2.0 and above), or OpenSprinkler Pi (OSPi, any version), or OpenSprinkler Beagle (OSBo, any version). Even if you don’t have the hardware, you can set up a software simulation (Dan’s interval_program) on RPi or BeagleBone to try out the firmware and app. OpenSprinkler hardware v1.x is currently not supported. Sorry!
  • Firmware: the app requires OpenSprinkler firmware 2.0.4. If you don’t have this version, please follow the firmware update instructions to upgrade your firmware.
  • App Installation: search for ‘opensprinkler’ in iOS App Store, Android Play Store, or Windows Phone Store, and you should be able to find and install the app.
    • If you like the app, please give a +1 to show your appreciation of Samer’s work!
  • Port Forwarding (optional): unlike the previous web app, you don’t need to set up port forwarding any more if you are accessing the controller within your home network. However, if you want to access the controller outside of your home network (say, when you are traveling), you still need to set up port forwarding on your router. This requires knowing your OpenSprinkler’s IP address and port number (default is 80). Please refer to your router’s user instructions. You can also use dynamic DNS service (such as dyn.com, freeDNS etc.) to set up an easy-to-remember DNS name for your router. Most routers support dynamic DNS service as well.

NOTE to keep in mind: the app provides an alternative front end to the OpenSprinkler controller. The default front end, which is the controller’s webpage (accessed by typing in the controller’s IP in a browser), is still available and functioning. Any operation you apply through the app will also be reflected in the default front end.

Features:

The app has a number of notable new features:

  • Scan For Device: on first-use of the app, you need to input information about your OpenSprinkler device, normally the IP address and device password. Samer found a very clever way to quickly scan the local network and automatically find your OpenSprinkler device. This saves your work of having to find the IP address yourself.
  • Multi-Device Support: the app supports multiple device configurations. This is very useful if you have multiple OpenSprinklers and want to access each individual within the same app.
  • Multi-Language Support: this is another exciting new feature — the app provides language localization. There are currently six supported languages: English, Spanish, Hungarian, German, Italian, and Chinese. Big thank-you to Balazs for starting this feature and Samer for continued development. The translations are mostly provided by the users — for those who have contributed: thank you!

os_nativeapp_scanos_nativeapp_multios_nativeapp_language

These are just some of the highlights I would like to bring to your attention. There are plenty of other features that really make the app stand out, such as automatic count-down timer, easy editing of station names and programs, intuitive program preview, instant launch of any existing program (not just the run-once program), import/export configurations. You’ve got to try it out yourself to find out.

To find out additional details, please go to Samer’s website. Discussions of ongoing development are available at the Rayshobby Forum. Samer is continuously supporting the app development. Please kindly leave your comments and suggestions, either in the comments section below, or on the forum. Thanks!

OpenSprinkler Mobile Web App Instructions (with Video)


Update: OpenSprinkler new mobile app (native version) is now available on all platforms. Search ‘opensprinkler’ in iOS App Store, Android Play Store, or Windows Phone Store, then download and install the app. Additional details can be found in this blog post.


In this blog post, I will walk you through the basic steps to set up and use the OpenSprinkler mobile web app developed by Samer Albahra. I’d like to thank Samer for making this app available, and credits should be attributed to him. Initially I was planning to write a long post with textual instructions. But then I felt this app is such a significant contribution that it deserves its own video tutorial. So please take a look at the video below first. As the video is already quite long, I will keep the textual information short, with only a summary of the necessary steps, download links, and pointers to resources. Since the app is a work in progress, feel free to leave your comments and suggestions at the Rayshobby Forum.


Prerequisites

In order to use this app, you will need a working OpenSprinkler setup, such as

  • OpenSprinkler 1.x running firmware version 1.8.2 or above (note: firmware 1.8.3 preferred);
  • or OpenSprinkler 2.0 running firmware version 2.0.0 or above;
  • or OpenSprinkler Pi any version running Dan’s interval_program (equivalent to firmware 1.8.2).

If you have OpenSprinkler 1.x with firmware earlier than 1.8.2, please follow the Firmware Update Instructions to re-flash the microcontroller with the latest firmware.

Also, if you are not familiar with the concept of a mobile web app, please take a look at my previous post about the app. Simply speaking, it’s an app that runs in a browser. It’s somewhat slower than a native app, but the biggest advantage is that it’s cross-platform (i.e. same app runs on both iOS, Android, etc., even desktop browsers). By adding the web link to home screen, the app will appear like a true native app.

NOTE to keep in mind: the app provides an alternative front end to the OpenSprinkler controller. The default front end, which is the controller’s webpage (accessed by typing in the controller’s ip in a browser), is still available and functioning. Any operation you apply through the app will also be reflected in the default front end.


Version 1: Hosted App on Rayshobby.net

Samer made the app available in two versions. The first is a hosted app available at the following url:

http://rayshobby.net/apps/sprinklers/

Type this in the browser on your smartphone, tablets, or even desktop computer, and you can start using it immediately. However, before you proceed, make sure you have port forwarding set up on your router. See below.

Port Forwarding: because the hosted app needs to communicate with your OpenSprinkler through HTTP commands, your controller must be accessible by the rayshobby server. To do so, you need to set up port forwarding on your router, so that an external HTTP request to your router will be mapped to your OpenSprinkler controller. This requires knowing your OpenSprinkler’s IP address and port number (default is 80). Please refer to your router’s user manual for instructions. In addition, you can use dynamic DNS service (such as dyn.com, freeDNS etc.) to set up a DNS name for your router (i.e. an easy-to-remember name such as rayshobby.dyndns-web.com instead of the router’s IP). Most routers support dynamic DNS service as well.

Logging in: going back to the app, on the log-in page, type in your router’s IP (or dynamic DNS), optionally followed by the port number (if it’s not the default 80), and your OpenSprinkler’s access password (the default password is ‘opendoor’). Then click on the button.

Add Link to Homescreen: most mobile browsers support adding (or bookmarking) a link to homescreen. This creates a homescreen icon, which you can simply click to start the app each time.

Features: the app has implemented all features available on the latest OpenSprinkler firmware. It provides a more stylish and intuitive interface than the default front end. For example, you can use slidebars to set values, there is a status bar that shows the currently running station with count-down timer, the app’s program preview provides an easy way to switch to a different day, everything is optimized for mobile viewing experience, and finally since the app is a front end itself it does not require external Javascript as required by the default front end. Please follow the video tutorial above and try out the app yourself. Most of the features are self-explanatory.

Donation: Samer wrote the app and shared it for free. I can’t thank him enough for making this app available and so polished. If you like the app, please consider donating some money to support his work. The donation link is available on the app’s ‘About’ page (accessible by clicking the control panel button at the upper-left corner of the app).

Summary: to summarize, in order to use the hosted web app, all you need is to set up port forwarding on your router, and use the hosted web app’s url above. That’s it!


Version 2: Self-Installed App on A Local Web Server

The second version is a self-installed app that requires using a local web serer. Most of the features in the second version are shared with the hosted web app above, however, by using a local web server you gain two additional features that may be very useful: logging, and weather-based rain delay.

Installation: for installation, simply follow the instructions on my previous post about the web app, particularly the How to Set it Up (using Raspberry Pi as example) section.

Logging Feature: the self-installed app records stations runs and keeps the history of station runs in a log file. On the app’s homepage you will see a button. Clicking on it brings out the log view, which categorizes log data by station names.

Weather-based Rain Delay: having a local web server also allows weather-based rain delay. This feature is developed by Andrew Shilliday (thank you, Andrew!). Basically, it’s a script that periodically pulls data from Yahoo Weather API (using your location information), and enforces rain delay if certain weather conditions are met. Technically, the data from Yahoo Weather contains a condition code that tells the local weather condition (e.g. showers, thunderstorm etc.). The script is associated with a data file that defines the amount of rain delay hours when a certain condition code is detected. For installation and setup instructions, please refer to Andrew’s GitHub page:

https://github.com/andrewshilliday/OpenSprinkler-WebRainDelay

This is a work in progress, and we are planning to integrate this feature into the OpenSprinkler firmware so that in the future it will not need installation any more.


Resources and Links

I am really glad to see these wonderful user contributions. They tremendously help make OpenSprinkler a better product, and I learned a lot through the forum discussions, which in turn inspired new ideas. Below I list the currently active forum threads that are related to the mobile web app development and the weather feature:

We are actively working on making the weather-based control a firmware feature. If you have ideas and suggestions, please feel free to leave them at the forum. Thanks!


A Mobile Web App for OpenSprinkler and OpenSprinkler Pi


Update: OpenSprinkler new mobile app (native version) is now available on all platforms. Search ‘opensprinkler’ in iOS App Store, Android Play Store, or Windows Phone Store, then download and install the app. Additional details can be found in this blog post.


I am very excited to announce that a mobile web app for OpenSprinkler and OpenSprinkler Pi is now available, thanks to the generous contributions by Samer Albahra. After playing with the app for a while, I am quite pleased with the polished user interface. The only thing I want to say is it’s absolutely amazing! I would highly recommend those who are interested in a mobile app to give it a try. This blog post is a brief introduction to the app. For details, please refer to Samer’s write-up:

Before I begin, let me summarize some of the highlights of this development:

  • Cross-platform: the same web app runs on iOS, Android, as well as Desktop browsers. Also, the app is self-contained and does not rely on external Javascripts (so you can use it to access OpenSprinkler without Internet connection).
  • Supports the complete set of features in OpenSprinkler firmware 1.8.3 (and equivalently 2.0.0 for v2.0 hardware). Supports both OpenSprinkler and OpenSprinkler Pi (running the interval_program ported by Dan).
  • Supports additional features including logging and days selection in program preview.

The main requirement to enable this web app is an HTTP server with PHP support. You can either use a desktop server, or a Raspberry Pi (instructions given below), or an external server. For OpenSprinkler Pi users: the same RPi that drives your OSPi can be used as the HTTP server, so no additional RPi needed!

What’s a Mobile Web App?

Since the beginning of OpenSprinkler, requests for an iPhone or Android app have never stopped. To be frank, I have never written a mobile app myself. When writing the firmware for OpenSprinkler, I did consider a few tricks to make the webpage look a little nicer on a mobile browser, but the interface is still evidently written by an engineer, namely me 🙂 So far there have been a couple of efforts, mostly by OpenSprinkler users, to write iPhone apps (which I will blog about later). I am not aware of any effort to write Android apps.

So what’s a mobile web app? Simply speaking, it’s a webpage which appears like an app. Mobile webpages are not a new thing: when you use your phone or any mobile device to browse webpages, such as a bank’s homepage, the server will automatically detect what kind of device you are using, and return a page that’s optimized for mobile browsing experience. For example, the pages may have fewer elements than the desktop version, and buttons may appear larger, etc.

With the emergence of HTML5, mobile webpages are becoming fancier and more dynamic. Almost any feature you can find in a standard iPhone or Android app can be implemented in a web app. Speaking of that, the main difference of a standard app with a mobile web app is that the former is a native application that runs on an iOS or Android device, while the latter is a webpage that runs in a browser. This brings the biggest benefit of a web app, namely it’s cross-platform — you write one app and it instantly runs on almost any device, thanks to the universal support of HTML5 on modern browsers. No more learning how to write an iPhone app, no more messing with the Apple store. Everything is unified 🙂

Of course there are certain things you can’t do with a web app vs. a native app, such as accessing hardware (e.g. cameras, bluetooth etc.) Actually even these I am not entirely sure if they are absolutely impossible. For example, I’ve heard about accessing phone cameras in HTML5. I need to do some more research on these. The other downside is that a web app is slower than a native app, but there are lots of applications where the speed is not critical. In any case, one can argue that in the future web apps can replace most native apps, and this will be a big win for developers as they don’t have to maintain multiple implementations of the same app.

The OpenSprinkler Mobile Web App

Now let me go back to talk about the OpenSprinkler mobile web app that Samer wrote. Here are a few screenshots from his blog:

os_webapp1os_webapp3os_webapp2os_webapp4

os_webapp5os_webapp8os_webapp9os_webapp10

Very sleek and clean. Gotta love it! The app currently supports the complete set of features in OpenSprinkler firmware 1.8.3 (and equivalently 2.0.0 for OpenSprinkler v2.0s users). You do probably need to refer to the OpenSprinkler Online User Manual for detailed explanations of specific settings, but the app itself is quite intuitive to use and self-explanatory.

Not only does it support the complete set of firmware features, it offers additional ones, notably:

  • A logging feature (i.e. records of watering events).
  • The ability to select an arbitrary day in program preview.
  • The app is self-contained (implemented using PHP) and does not rely on external Javascripts, so you can use it to access OpenSprinkler locally without Internet connection.

These really help improve the user interface significantly. Also, as mentioned before, the app is cross-platform: the same app runs on iOS, Android, as well as Desktop browsers.

os_webapp12os_webapp13IMG_1239

How to Set it Up (using Raspberry Pi as example)

To set up the web app, you need to have an HTTP server with PHP support. There are many options, for example, a desktop server running Ubuntu Linux, a Raspberry Pi, or an external server. In the following I will use Raspberry Pi (RPi) as an example since it can be used as a low-cost web server. The steps should be the same for desktop servers. For details, please refer to Samer’s GitHub repository (link given above). In addition, you will need an OpenSprinkler running firmware 1.8.3 or above, or OpenSprinkler Pi running the interval_program ported by Dan.

Step 1. Install the necessary packages

  • sudo apt-get update
  • sudo apt-get install apache2 php5 libapache2-mod-php5 git

Step 2. Create direcotry

  • sudo mkdir -m 777 /var/www/sprinklers

Step 3. Clone Samer’s GitHub repository

  • sudo git clone https://github.com/salbahra/OpenSprinkler-Controller.git /var/www/sprinklers/

This will download and copy necessary files to the /var/www/sprinklers/ directory. Once these steps are completed, you can open a web browser (either desktop browser or mobile browser), and type in the IP address of your RPi, followed by /sprinklers. For example, my RPi’s IP address is 192.168.1.147, so I type in:

  • http://192.168.1.147/sprinklers/

You should then see a setup page that requires you to type in some necessary information. In particular,

  • An account including user name and password.
  • Your OpenSprinkler’s IP address (including port number if it’s not the default 80).
  • Your OpenSprinkler’s access password (‘opendoor’ by default).
  • Un-check the ‘Force SSL’ checkbox, unless if you are sure you server has the proper SSL setup.

Once your settings are saved, you will be automatically directed to a login page (or if not, you can directly type in the web url again: http://192.168.1.147/sprinklers/). Type in the account you created above, and then you should be directed to the app’s homepage. I recommend you to bookmark this page to your home screen (most mobile browsers support this), so that next time you can simply click on the home screen icon to access the web app. From this point on, you can feel free to play with the app, and check all the features it supports. I will probably make a video demo at some point to give you a visual walk-through of the app.

In case your settings are changed, you can open /var/www/sprinklers/config.php to change the information there accordingly. Since this is a un-encrypted text file, you probably want to restrict its access right for security reasons (e.g. sudo chmod o-r /var/www/sprinklers/config.php)

For OpenSprinkler Pi Users

If you are an OpenSprinkler Pi user, you don’t need to install any additional RPi or HTTP server: the same RPi that drives your OSPi can be used to serve the web app! Just follow the instructions above to install apache2, php5 and the other goodies. Your Python-based interval_program can run in conjunction with the HTTP server in the background.

At some point it will make sense to combine the Python-based program and PHP-based web app into a single program that serves both the front-end (UI) and back-end (scheduling algorithms). This would be awesome for the OpenSprinkler Pi in the future.

Acknowledgement

Finally, a big thank-you again to Samer Albahra, who wrote this app and made it available to the public. This is yet another evidence of the spirit of open-source development.

Keep in mind that the web app is continuously being improved and supported, and we can use your feedback and suggestions for making it better and fixing bugs. Please leave your comments and suggestions at the Rayshobby Forum. Thanks!