Introduction
Although OpenSprinkler is primarily a sprinkler controller, it's fundamentally a web-based controller with a sophisticated timer and an intuitive user interface. So you can use it to control / switch other devices using the same web interface. The microcontorller is general-purpose and can interface with additional sensors / actuators. To extend the hardware capabilities, you need to have basic knowledge about electronics. Learning electronics and programming is fun and rewarding, and can bring you life-long benefits.
Microcontroller Pins
OpenSprinkler has a number of spare pins (both analog and digital) which you can use to interface with simple analog or digital sensors, relays and other actuators. It also has pinouts for I2C, SPI, Serial, which you can use to interface with more advanced sensors, transceivers, and other microcontrollers.
Sensors
Sensors can be used to trigger sprinkler events or adjust watering schedules. For example, temperature sensor can be used to stop watering when the temperature drops below a certain threshold; motion sensor can be used to spray water to drive away wild animals; soil moisture sensor can be used to measure the water content in soil and help optimize water time. To connect a sensor, first you should figure out what type of communication interface the sensor uses:
- Analog: many sensors, such as temperature, light sensors, output analog signals. You can use an analog pin to read the sensor values.
- Digital: some sensors may have built-in transistor or op-amp to convert analog signal to digital, for example, water-level sensor and rain sensor. You can use a digital pin to read the sensor values. (Note: most analog pins can function as digital pins as well).
- I2C, SPI: more sophisticated sensors may use I2C or SPI to provide high-speed data transfer. For these you need to use the I2C or SPI interface.
- Special: there are sensors with special protocols, such as the DHT11 and DHT22 temperature / humidity sensor. For these you can generally find available Arduino libraries to interface with them.
Control Other Devices
To use OpenSprinkler to switch / control other devices, the first step is to check the required voltage and current, and figure out the control interface. OpenSprinkler by default uses 24V AC sprinkler transformer, and outputs 24V AC to each station terminal. Any device that can use the same voltage and draw less than 800mA current can be directly wired to OpenSprinkler. For example:
- 24V AC landscape light bulbs
- 12V LED lights (LEDs are intrinsically diodes, which block half of the AC waves, effectively converting 24V AC to 12V DC).
- 24V AC relays.
Low-Voltage DC Devices: generally you cannot directly wire DC devices (e.g. DC light bulbs, motors) to OpenSprinkler, because OpenSprinkler internally uses triacs that can only switch AC but not DC voltage. However, you can replace triacs with transistors or MOSFETs. That way OpenSprinkler can switch DC devices. You can use a single power supply as long as the voltage is below 40V DC (OpenSprinkler has built-in switching regulator that can work with any DC voltage between 7V DC to 40V DC, or AC voltage between 5V AC to 28V AC). If you want to use OpenSprinkler to control both 24V AC sprinkler valves and low-voltage DC devices, you need to use a split power supply design: use 24V AC transformer to power OpenSprinkler and sprinkler valves, and a separate DC supply to drive DC devices.
Garage Doors and Low-Voltage Landscape Lights: OpenSprinkler has a built-in mini relay, which can be used to interface with a garage door opener, or a single line of low-voltage landscape lights. The advantage of this is that it involves minimal hardware modifications, and the disadvantage is that there is only one relay on board so you can't control more than one device with the relay.
Powerline Devices: powerline devices, such as heaters, pumps, standard light bulbs (110V or 220V) generally require a power relay, or a power socket to control. For these, the recommended solution is to use remote power sockets. OpenSprinkler has built-in support to connect a standard 433MHz radio frequency (RF) transmitter, which can simulate remote signals and switch on/off power sockets. These power sockets are inexpensive, easy and safe to work with, and you can control as many sockets as you need with no extra wires running from OpenSprinkler.
The way this works is that OpenSprinkler can be programmed to send remote control signals (the same way as the remote control does) therefore directly talk to the power sockets. Firmware support for this will be added soon. For now please refer to this blog post for proof-of-concept demos.