Firmware 2.1.6 has become large enough that it exceeds the non-bootloader section of OpenSprinkler (OS) 2.1. In order to update OS 2.1 to firmware 2.1.6 (and beyond), you will need to use an external programmer such as USBasp, USBtiny, or other AVR ISP programmer. This guide provides step-by-step instructions on how to do so. Before proceeding, please read the following FAQ.


Q: Why is this required for OpenSprinkler 2.1? How is this different from the other OS?

In order to flash a firmware through the built-in USB, the microcontroller requires a piece of code called bootloader, which resides at the top of the flash memory space. There are different types of bootloaders. OS 2.1 in particular uses one called USBasp bootloader. There is a drawback of this bootloader that was not known at the time OS 2.1 was designed. The drawback is that this bootloader prevents writing into the first 8KB of the flash memory space, leaving only 56KB available. Months after OS 2.1, we were the first to discover this drawback. Firmware 2.1.6 unfortunately is larger than 56KB, therefore the only way to upload this firmware to OS 2.1 is using an external programmer, bypassing the bootloader. The other OS hardware versions (OS 2.0, 2.2, 2.3) use different bootloaders that do not have this limitation.


Q: What do I need to update OpenSprinkler 2.1 to this firmware?

  • You will need an external programmer, such as USBasp, USBtiny, or other AVR ISP programmers. If you don't have one already, get USBasp (search "USBasp with 6pin adapter"), as it's only a few bucks from eBay or Amazon (see picture below).
  • Install avrdude program (see below).
  • In addition, you will need to solder a 2x3 male pin header to the OS 2.1 circuit board (see instructions below).


Q: What are the implications of doing the update? Will I brick the controller?

The main implications is that once you follow the instructions below to update, every time you update the firmware on OS 2.1, you have to use the same instructions -- because the steps below will erase the bootloader, you can't use OpenSprinkler's built-in USB port to update firmware any more.


As long as you follow the instructions below, it's very unlikely you will brick the controller. If you did, don't panic, it can still be fixed, just submit a support ticket and we will help you.


Q: What if I don't want to perform the update myself?

First of all, the main features in 2.1.6 are support for flow sensor and remote stations. These are rather advanced features that not everyone needs. If you don't need these features, you can stay with your current firmware.


Second, we understand the firmware update for OS 2.1 has been frustrating, and therefore we provide discounted price for OS 2.1 owner to update to OS 2.3. If you don't have the technical skills to update, we highly recommend upgrading to OS 2.3. For details, please submit a support ticket, or email us at support@opensprinkler.com


Alternatively, if you want to stay with OS 2.1, and don't have the technical skills to update yourself, you can send it back to us and we will perform the upgrade for you. Please submit a support ticket, or email us at support@opensprinkler.com



Instructions

Step 1. Prepare an external programmer

If you don't already have an AVR ISP programmer, the easiest solution is to get a USBasp programmer. Just search USBasp on eBay or Amazon. You should also make sure to get the 2x5 pin to 2x3 pin adapter (see image below). Other ISP programmers, such as USBtiny, should also work fine.



Step 2. Solder 2x3 male pin header to OpenSprinkler 2.1 circuit board

Remove the LCD, and locate the 2x3 ISP pins on the OS 2.1 circuit board (it has a white stripe on one end). Solder a 2x3 male pin header. If you don't have double-row male header, you can use two 1x3 headers. BE CAREFUL when soldering -- the pins are very close to each other, avoid and bridges or shorting.


Step 3. Plug in USBasp programmer and flash firmware

Now plug in the USBasp programmer, as shown in the picture below. The orientation is as follows: the cable has a side that's marked, that side should match the side on the circuit board with a white stripe. If you plugged it with the wrong orientation, the steps below will show error. Note that if your USBasp has 2x5 pins, it's necessary to use the adapter to convert it to 2x3 pins. If you have other types of ISP programmer, their cables also typically have a side that's marked. So the orientation follows the same rule.


Assume you have avrdude installed (if not, follow the instructions on this page: https://learn.adafruit.com/usbtinyisp/avrdude to install avrdude for your specific operating system).


Plug the USB end of your programmer to your computer's USB port. Open a command line window, and run:

avrdude -c usbasp -p m644p

the name after -c is the programmer's name. If you are using USBtiny programmer, just substitute usbasp with usbtiny. If your programmer can successfully communicate with the microcontroller, you will see an output such as:


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e960a

avrdude: safemode: Fuses OK (H:FD, E:DC, L:FF)

avrdude done.  Thank you.


There may be some warning messages about sck period and signature mismatch, but just ignore those for now. Next, run:
avrdude -c usbasp -p m644p -U lfuse:w:0xff:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
It's important to follow the command exactly, as mistyping might end up bricking your controller! This will disable the bootloader, which is a necessary step to make the bootloader space available for firmware.

Before proceeding to the following step, keep in mind that once you upgrade the firmware, a factory reset will be automatically performed, and the password will recover to the default 'opendoor'. 


Finally, download firmware 2.1.6 for OS 2.1 (right click and 'Save As' a file), 'cd' to the folder where the downloaded .hex file exists, and run:

avrdude -c usbasp -p m644p -F -U flash:w:firmware2.1.6.hex

wait for the flashing to complete (this can take up to a couple minutes). Leave the controller on for about 30 seconds, because every time you update the firmware, it will perform a factory reset, and that can take up to 30 seconds. Since you don't have the LCD on, you can't see when the resetting has completed. So waiting for 30 seconds will give it ample time to finish resetting.


Now re-install the LCD. Make sure the 16 pins on the LCD aligns with the 16 pins on the circuit board -- misaligning the LCD may cause damage to the LCD!