SIP Relay Version
The OSPI software has been renamed SIP and is independent of the Open Sprinkler hardware. Now with a relay board plug in the SIP software will drive relays from a Raspberry Pi.
Installation
The easiest way to install the relay_board plugin is to use the plugin manager in OSPi (version 2.2.28 or newer). Connect to OSPi with your web browser then select the Plugin menu and select Manage Plugins, then select the Browse More Plugins button. Find relay_board in the list and check the box on the right and select the Install button. Go back to Manage Plugins, find relay_board in the list and check the box to the right to enable it then select the Update Enabled button.
To install the plugin manually, download it from the OSPi Plugin Repository and copy the relay_board.py file into the OSPi/plugins directory, then copy the relay_board.html file to the OSPi/templates directory.
Plugin Settings
Use your web browser to connect to OSPi running on your Raspberry Pi. After logging in, select the Plugins menu then select Relay Board.
Relay channels: From the drop-down list select the total number of relay channels you have connected. Often this is just one relay board but you can use as many boards as you want up to 12 total channels.
Active: Select Low if your relays are activated (switched on) by taking the input low (0 Volts). Select High if the Raspberry Pi should change it's output (input of the relay board) from low to high (3.3 Volts).
IMPORTANT: If Active is changed, Relay channels will be set to 1 to prevent all the relays being switched on, and possibly damaging the power supply (see the wiring section below for more information). After verifying that the first relay is off, return to the Settings page and set Relay channels to the correct number.
Keyes Funduino Relay Board
This is the board I have in the sprinkler system.
It is active high, meaning a relay is switched on when the Raspberry Pi output changes from 0 Volts to 3.3 Volts. The indicator LEDs are powered by external power (Vcc) and not the Raspberry Pi.
Relay | P1 |
1 | 11 |
2 | 12 |
3 | 13 |
4 | 15 |
5 | 16 |
6 | 18 |
7 | 22 |
8 | 7 |
9 | 3 |
10 | 5 |
11 | 24 |
12 | 26 |
Power
The maximum permitted current draw from the Raspberry Pi 5 Volt pins is the USB input current minus any current draw from the rest of the board and connected USB devices. For example, a typical USB power supply is 1 Amp - 0.7 Amps for the Raspberry Pi = 0.3 Amps for the 5 Volt output. If the maximum permitted current is exceeded it will cause the Raspberry Pi to shutdown. Any USB devices plugged into the Raspberry Pi will take away from the maximum permitted current (for example, a USB WiFi device uses around 0.15 Amps, leaving 0.15 Amps for the relay board). For most relay boards, each relay draws 0.07 Amps when switched on.
The plugin provides some protection by reducing the number of relay channels when Active is changed (see Plugin Settings above). Before connecting any relay boards, set the plugin to 1 Relay channel to be sure at most only 1 relay will turn on while you get things setup. Be sure the plugin is enabled, if it is not enabled the OSPi program will default to OpenSprinkler board mode which will cause 3 relays to be activated if a relay board is connected.
OSPi defaults to sequential mode which means only one station (relay) is on at a time. If sequential mode is disabled (in OSPi: Options, Station Handling), you must be very careful not to exceed the maximum permitted current. If you need to have more than one relay on at a time, you could use a USB power supply capable of higher current output, or use a separate 5 Volt power supply that only powers the relay board(s).