The OpenSprinkler unified firmware can compile under both the Arduino environment and any Linux-based system. The instructions on this page are for the Arduino-based OpenSprinkler (OS 2.3, 3.x) only. If your controller is Linux-based, such as OpenSprinkler Pi (OSPi) or Demo, please follow the OSPi firmware instructions to compile and run the firmware code.
NOTE: from firmware 2.2.0, we have adopted PlatformIO, which makes it easy to compile the OpenSprinkler firmware. To do so:
- Install VS Code
- Launch VS Code, search and install the platformio extension.
- Download and unzip (or git clone) the OpenSprinkler firmware repository, open the folder in VS Code, at the bottom of the screen, click PlatformIO:Build. The firmware repository contains platformio.ini which has all the information needed to build the firmware.
- The compiled firmware will be in a file called firmware.bin file located in the .pio/build/d1_mini subfolder (or .pio/build/sanguino if compiling for OS 2.3)
You can then upload the firmware file to your OpenSprinkler following the standard OpenSprinkler firmware update instructions. That's all.
The instructions below are for compiling firmwares prior to version 2.2.0, thus they are no longer relevant. We still include them here for archive purpose. The instructions are provided under Linux operating system only. If you use Windows or Mac, we strongly recommend you to install VirtualBox so you can run Linux. Compiling the firmware code requires technical skills. Instructions are provided as is, we will not be able to help you with compilation issues, nor can we help you with modifying the code.
Firmware Compilation Instructions for OpenSprinkler 3.x (ESP8266-based)
- Download or git clone OpenSprinkler Firmware Code.
- Install ESP8266 Core for Arduino. Specifically, in Linux, open terminal and run (the current firmware is compiled with ESP8266 core 2.7.4):
cd ~
git clone https://github.com/esp8266/Arduino.git esp8266_2.7.4
cd esp8266_2.7.4
git checkout tags/2.7.4
git submodule update --init
cd tools
python3 get.py - Install necessary libraries, including SSD1306 (4.2.1), RCSwitch (2.6.4), pubsubclient (2.8), and EthernetENC (master branch) (note that the latest firmware 2.1.9(9) no longer uses UIPEthernet, instead, it uses the newer EthernetENC library which has several major bug fixes). Download and unzip or git clone these into ~/Arduino/libraries folder. Depending on whether you downloaded or git cloned them, you may have to change the folder names to match the directory names in the makefile below. For example, the capitalization of folder names may be different, and in Linux folder names are case sensitive.
- The easiest way to compile is to use the makefile provided in the firmware code folder:
make -f make.lin32
this makefile assumes the ESP8266 core and the additional libraries are in the path as described above. In case you installed esp8266 core into a different folder, or in case the library folder names don't match what's in the makefile, open make.lin32 and modify ESP_ROOT variable and/or library folder names accordingly. Similarly, if you installed the additional libraries in a different path, modify the makefile accordingly. The makefile will compile the program into your system's temporary folder, as a bin file (e.g. /tmp/mainArduino/mainArduino.bin). - Now you can upload the firmware using the OTA firmware update instructions.
Firmware Compilation Instructions for OpenSprinkler 2.3 (ATmega1284p)
- Download Arduino Software (we have only tested version 1.8.15, but more recent versions should also work).
- Run Arduino, and install the following libraries and atmega1284 core:
- Sketch->Include Libraries->Manage Libraries, search and install pubsubclient (2.8), EthernetENC (master branch), and SdFat (1.0.7) libraries.
- Follow MightyCore instructions to install the atmega1284 core (basically, copy a link to the Additional Board Manager URLs, then install the board in Board Manager). We have only tested version 2.0.5 of mightycore.
- Download or git clone the OpenSprinkler Firmware Code.
- The easiest way to compile is to use the makefile provided in the firmware code folder:
make -f make.os23
if your mightcore version is not 2.0.5, modify the path in the make file accordingly. The program will be compiled into the build-1284 subfolder under the firmware code folder, as a .hex file. - Now you can upload the firmware using the OS 2.3 firmware update instructions.