Skip to content

Plugin relay 16

Martin Pihrt edited this page Oct 13, 2026 · 1 revision

Direct 16 Relay Outputs

Controls up to 16 direct Raspberry Pi GPIO relay outputs with configurable trigger polarity.

At a glance

Item Value
Version 1.0.0
Category Hardware, displays and outputs
Author Martin Pihrt
License GPL-3.0
OSPy 3.0.211 or newer
Python 3.8 or newer
Permissions gpio, system
Hardware platforms: raspberry_pi; interfaces: gpio
Dependencies None
Python/OS packages RPi.GPIO / python3-rpi.gpio (required)
Interfaces No provider or mobile API declared
Source Open the plug-in directory

What it is for

Controls up to 16 direct Raspberry Pi GPIO relay outputs with configurable trigger polarity.

How it works and how to configure it

Tested in Python 3+

The plug-in includes a plugin.json manifest and reports its worker, configured and active relays, GPIO readiness, trigger level, latest cycle and errors through the OSPy system health interface. Configured outputs are driven to their inactive level when the plug-in stops.

This is plugin is designed for use with Raspberry Pi models with a 40 pin GPIO header and example this board: https://www.tiaowiki.com/w/TIAO_Smart_Sprinkler_Pi_Hardware_Layout. This plugin allows OSPy to control relay boards with up to 16 relays.
The diagram below shows the GPIO pin header and indicates the pins to use with this plugin.
You can use a relay board with 1, 2, 4, 8 or 16 relays or a combination of those up to 16 relays.

Caution: when using more than 1 relay board, the boards must all be either low-level trigger or all high-level trigger. You can not mix the trigger types.
Warning: if you use all 16 outputs, you will not use the UPS Monitor and Air Temperature and Humidity Monitor

Connect the board(s) to the Raspberry Pi following the channel numbering indicated on the wiring diagram.

The hardware should be connected as follows: Possible GPIO [22,24,26,32,36,38,40,21,23,29,31,33,35,37,18,19] Station 1 as HW pin 22, Station 2 as HW pin 24 etc...

The 5V and ground pins on the Pi can be used to power 1 or 2 relay boards. If more boards are being used or if more than a couple of relays will be turned on at the same time It is a good idea to use a separate power supply to power the boards.
If you are using more than 8 channels and need to increase the number of stations OSPy displays, open the Options menu > Station Handling and incrase the number of Extension boards. Increasing the number by 1 will add 8 stations to OSPy.
If the number of relays you are using is not a multiple of 8 you can hide the unused stations. Open the Stations menu and uncheck the boxes under Enabled? next to the stations you are not using.

Plugin setup

  • Check Enable relays: If checked plugin is enabled.
  • Relay channels: Select outputs (1-16).
  • Trigger Level: LOW = Station is ON (Output set to 0V), Station OFF (Output set to 3.3V) HIGH = Station is ON (Output set to 3.3V), Station OFF (Output set to 0V)
  • Status: Status window from the plugin. Example: Relay 16 plug-in: 2018-06-06 10:35:08 3 Outputs set. Relay 16 plug-in: Possible GPIO [22,24,26,32,36,38,40,21,23,29,31,33,35,37,18,19]. Relay 16 plug-in: 2018-06-06 10:35:08 Setings Relay Output 22 to HIGH (Station 1 ON). Relay 16 plug-in: 2018-06-06 10:35:28 Setings Relay Output 22 to LOW (Station 1 OFF).

Visit Martin Pihrt's blog. for more information.

In-app help and settings notes

The following notes are generated from the help page shipped with this plug-in. Field names are also explained directly in the OSPy settings page.

This plugin allows OSPy to control relay boards with up to 16 relay outputs.

This is plugin is designed for use with Raspberry Pi models with a 40 pin GPIO header.

Visit example board TIAO Smart Sprinkler for more information

The diagram below shows the GPIO pin header and indicates the pins to use with this plugin.

You can use a relay board with 1, 2, 4, 8 or 16 relays or a combination of those up to 16 relays.

Caution

When using more than 1 relay board, the boards must all be either low-level trigger or all high-level trigger. You can not mix the trigger types.

Warning

If you use all 16 outputs, you will not use the UPS Monitor and Air Temperature and Humidity Monitor.

Connect the board(s) to the Raspberry Pi following the channel numbering indicated on the wiring diagram.

The hardware should be connected as follows

Possible GPIO [22,24,26,32,36,38,40,21,23,29,31,33,35,37,18,19] Station 1 as HW pin 22, Station 2 as HW pin 24 etc.

The 5V and ground pins on the Pi can be used to power 1 or 2 relay boards.

If more boards are being used or if more than a couple of relays will be turned on at the same time It is a good idea to use a separate power supply to power the boards.

If you are using more than 8 channels and need to increase the number of stations OSPy displays, open the Options menu - Station Handling and incrase the number of Extension boards.

Increasing the number by 1 will add 8 stations to OSPy.

If the number of relays you are using is not a multiple of 8 you can hide the unused stations.

Open the Stations menu and uncheck the boxes under Enabled? next to the stations you are not using.

Plugin setup

  • Check Enable relays

If checked plugin is enabled.

  • Relay channels

Select outputs (1-16).

  • Trigger Level

LOW = Station is ON (Output set to 0V), Station OFF (Output set to 3.3V).

HIGH = Station is ON (Output set to 3.3V), Station OFF (Output set to 0V).

  • Status

Status window from the plugin.

Example of an print from plugin

Relay 16 plug-in: 2018-06-06 10:35:08 3 Outputs set.

Relay 16 plug-in: Possible GPIO [22,24,26,32,36,38,40,21,23,29,31,33,35,37,18,19].

Relay 16 plug-in: 2018-06-06 10:35:08 Setings Relay Output 22 to HIGH (Station 1 ON).

Relay 16 plug-in: 2018-06-06 10:35:28 Setings Relay Output 22 to LOW (Station 1 OFF).

Related links and diagrams

schematics

Support

Check OSPy → Diagnostics first and remove passwords, tokens, private addresses and other secrets before sharing logs. Report reproducible plug-in problems in the OSPy-plugins issue tracker.

Back to the plug-in catalog

Clone this wiki locally