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.

Using 24V AC Relays with OpenSprinkler

Back in early December last year, we introduced a new feature in OpenSprinkler Firmware 2.1.1 that allows OpenSprinkler to directly talk to remote power sockets. With this feature, you can use OpenSprinkler to not only switch sprinkler valves, but also switch powerline devices such as light, pump, heater, fan. While it’s a powerful feature, it is after all a wireless solution so it’s not the most reliable — sending wireless signals to remote power sockets is prone to interference and is limited by distance and barriers (e.g. walls, floors) in between.

If you still prefer using relays, whether because it’s more reliable, or because it’s the classic way, there are plenty of choices. I’ve often received questions about how to use OpenSprinkler with a relay. The easiest solution is to get a 24V AC relay. Then you can wire it up as if it’s a sprinkler valve — when OpenSprinkler turns on the corresponding station, the relay is activated, and that turns on the device connected to the relay. Because AC relays are not as common as DC relays, they tend to be more expensive. Here I list three choices I’ve found:

1. Omron G7L-2A-TUB-J-CB-AC24: this is available on Amazon. This is actually commonly used in sprinkler pump start relays — if you have a pump start relay, you can open it up and check if it has a 24V AC relay in side. This particular one has a contact rating of 25A @ 220VAC, which is sufficient for most applications. You can also find similar ones with different specifications: if you search for ‘Omron G7L-‘ you will find many choices, look for the ones ending with AC24, which are the 24V AC versions.

IMG_0659 IMG_0661

I am quite curious how such 24V AC relays work. It probably is constructed somewhat differently from a DC relay. So I ventured to open it up. As you can see in the picture on the right above, it has a big coil, a contact piece connected via a spring. When voltage is applied on the coil, the contact piece gets attracted and therefore connecting two contact pins together. That’s how a basic relay works.

Something strange I noticed is that when I try to measure the resistance on the coil, it gives me a very large value — several mega-ohms. The coil resistance can’t be that large. There is probably additional circuitry inside the relay. I then measured the forward voltage drop on the coil, at either polarity it gives about 1.25V drop, which strongly indicates there is a bridge (i.e. full-wave) rectifier inside. This makes sense, because a bridge rectifier is a standard way to convert AC to DC. So the additional ‘construction’ inside the AC relay (compared to DC) is probably the rectifier.

To verify it, I had to open it up even further, which involves cutting some pieces of the plastic. Eventually I was able to open it up completely. Check the bottom section of the relay:

 

IMG_0660-300x225

Yup, there is a bridge rectifier and a MOV. Previously I was measuring the resistance through the bridge rectifier, which explained why the value I got was incorrect. Now I can measure the real resistance of the coil, which turns out to be about 294 ohm. That’s about right — under 24V AC, it will draw an average of about 80 mA AC current, which matches the specification.

So in case you are looking for a 24V AC relay to work with OpenSprinkler in order to switch high-voltage devices, this is an inexpensive (

2. Schrack RT314524: This is a very small 24V AC relay that you can buy from Mouser or Digikey. It has a contact rating of 16A @ 250VAC, which is also plenty for common applications.

 

IMG_0662

3. Other choices: There are some other choices which were brought up on the forum, including a open-style panel mount 24V AC relay, and even solid-state relays (SSRs).

In any case, if you are looking for a relay to work with OpenSprinkler, the above are the ones worth considering.

OpenSprinkler Firmware 2.1.1 New Feature: Control Remote Power Sockets

In the past I’ve written several blog posts about how to use Arduino to interface with remote power sockets. For home automation involving powerline devices (e.g. lights, heaters, pumps, fans), this is my favorite solution, because it’s low-cost (remote power sockets are widely available at cheap price) and convenient (no messing around with relays and powerline wires). Also, one Arduino plus transmitter can simultaneously talk to many power sockets, making this a scalable solution too.

With the just released OpenSprinkler firmware 2.1.1, support for interfacing with remote power sockets has finally arrived. So you can now use OpenSprinkler not only to control sprinkler valves, but also powerline devices. Trying to find a programmable way to control your Christmas lights? Look no further! With OpenSprinkler’s easy-to-use web interface and flexible programming capability, you can enable automated control of lights, heaters, pumps, fans — anything that can be plugged into wall outlets.

Here is a quick video tour on how to get started:

Below are detailed instructions.

Required Parts:

How does this work?
Let me briefly explain how the whole thing works. First, common remote power sockets operate in the 433MHz radio frequency band. When you press a button on the remote, it sends out a signal to the power socket, which gets decoded and acted upon. If we can sniff the signal, we can use a microcontroller plus a 433MHz transmitter to replicate the signal, thus be able to directly control the power socket in software. The RFToy is a gadget that I’ve designed to easily decode signals from common remote power sockets. Once we have the code, we can use OpenSprinkler to simulate the code, thus be able to control remote devices.

Heads-up: the following steps require a small amount of soldering. The estimate time for modification is 15 to 20 minutes.

Step 1: Decode Remote Power Sockets
Take out the RFToy, plug in a 433MHz receiver (making sure the VCC and GND pins on the receiver match the +5V and GND pins on the RFToy). Follow the on-screen instructions to record the on/off signal of a power socket. Once decoded, the signal will be converted to a 16-character hexademical code.

To test if the code works, take out the 433MHz transmitter, and solder a 17cm (6.7inch) long wire antenna to the ANT pin. Then plug it into the RFToy (making sure the DATA and GND pins on the transmitter match the DATA and GND pins on the RFToy). Bend the pins as necessary. Now click button S3 or S1 on the RFToy, the power socket should be toggle on or off just like when you press the buttons on the remote. Keep in mind that although most remote power sockets work in the 433MHz band, there are some that work in the 315MHz band. In that case, just use a 315MHz transmitter-receiver pair.

Step 2: Install RF Transmitter to OpenSprinkler
Remove the OpenSprinkler enclosure, and locate the RF transmitter pinouts (marked A3 VIN GND). The pinouts are located either close to the top of the PCB, or next to the Ethernet jack. Plug in the transmitter to the pinouts, making sure the DATA-VCC-GND pins on the transmitter match the A3-VIN-GND pins on the circuit board. Then solder the three pins at the back of the circuit board, and clip as necessary. Carefully arrange the wire antenna around the LCD and re-install the enclosure.

It’s important to use a wire antenna of sufficient length, otherwise the transmission range will be severely limited.

Step 3: Final Testing
Make sure your OpenSprinkler is running firmware 2.1.1 or above. If not, please follow the firmware instructions to upgrade your firmware first. Then go to Edit Stations, select the station you’d like to use as an RF station, and change its name to the 16-character hexademical code recorded on the RFToy. Any station with a name of this form will be automatically recognized as an RF station. When the station is turned on, the controller will automatically send out the signal through the installed RF transmitter, thus turning on the corresponding power socket (and vice versa for turning off the station).

Three quick notes:

  • The normal station function still works (i.e. if there is a sprinkler valve connected to that station, it will be switched on/off accordingly).
  • Most likely you want to turn off the ‘sequential’ flag for RF stations. This is because unlike sprinkler stations, you probably don’t want RF stations to be serialized with other stations.
  • If you are short of stations, just increase the number of expansion boards. You don’t need to have the physical expansion boards (think of RF stations as virtual sprinkler valves). Firmware 2.1.1 supports up to 48 stations in total.

With this feature, you can now use OpenSprinkler to programmatically switch a large number of powerline devices, such as Christmas lights, landscape lights, water pumps, heaters, fans.

Keep in mind that because this is still an experimental feature, don’t use it on anything critical (i.e. those that can cause damages if accidentally left on). Depending on the distance and obstacles between OpenSprinkler and remote power sockets, it might not reliably switch on/off power sockets. So take time to do plenty of testing before you finalize the setup.

os_rf_install-300x224

That’s it. We encourage you to try out firmware 2.1.1 and let us know your comments / suggestions / feedback. Don’t forget to post pictures of your projects. We would greatly appreciate your efforts. Thanks!

Dead-Simple Driver Installation for USBasp and USBtiny on Windows

Today I came across a surprisingly simple approach to installing USBasp and USBtiny drivers for all versions of Windows — XP, 7, 8, 8.1, whether 32-bit or 64-bit, all inclusive! As you may know, installing open-source drivers such as USBasp and USBtiny have been a great pain on some of the recent Windows OS, due to the enforcement of signed drivers. The typical solution involves rebooting Windows into a mode that disables driver signature enforcement. Even after you’ve done it once, if you boot into the normal mode next time, it may fail to recognize the driver again (reporting it’s not digitally signed). A huge source of frustration.

Anyways, while searching for ‘fully signed USBasp driver’, I came across this tool called Zadig, which can be used to install libusb drivers on all versions of Windows, and it’s digitally signed. Since USBasp and USBtiny are both based on libusb, could it be the right solution? To my great surprise it worked really well — I was able to install both drivers on Windows XP, 7 (32-bit and 64-bit), 8, and 8.1 instantly, without messing with driver signature enforcement at all. I was mostly surprised such a great solution wasn’t documented more widely online.

Instructions
  • Go to http://zadig.akeo.ie/ and download the software (note that Windows XP has a separate link).
  • Plug in your USBasp or USBtiny device. In case your microcontroller uses a USBasp or USBtiny bootloader, enter bootloading mode, and let Windows detect the device (it will report driver not found). If a window pops up asking to search for driver, just close it or click on Cancel.
  • At this point, run Zadig, it should detect the USBasp or USBtiny, or any libusb device that you have. Then in the selection box (see below), choose libusb-win32 (v1.2.6.0), and click on Install Driver, and wait for the installation to complete.

zadig_srceenshot
That’s it! Because the drivers are digitally signed, there is no hassle installing it in Windows 7 64-bit and Windows 8.1.

I will be updating the driver installation instructions for OpenSprinkler 2.1 and SquareWear right away, as they both use USBasp bootloader. Users have often complained that it’s frustrating to install USBasp driver for Windows 7 64-bit and Windows 8.1. Those days are now past!