Four Relays four HV Inputs 8-Layer Stackable HAT for Raspberry Pi
Four Relays 8A/240VAC; Four opto-isolated Inputs 3V-240V; RS485/MODBUS; Quadrature encoder, PPS counters, PWM inputs;
Overview
Relay control and high-voltage input hardware for Raspberry Pi for home and industrial automation. The Four Relays Four HV Inputs HAT combines four heavy-duty NO/NC relay outputs with four optically isolated inputs that read AC or DC signals from 3V to 240V, in a compact, stackable platform.
- Four NO/NC relay outputs switching up to 8A at 240VAC or 24VDC
- Four opto-isolated inputs reading AC or DC from 3V to 240V
- Separate low-voltage (3–30V) and high-voltage (30–240V) input connectors
- RS485/MODBUS interface — card controllable without Raspberry Pi
- Up to 8 cards stackable (32 relays + 32 inputs per Raspberry Pi)
- Works with any Raspberry Pi from Zero to 5
Works with Open Automation Software
Compatible with widely used tools for control, monitoring, and system integration.
INTERFACES AND I/O
| I/O's | Communication | Software Integration |
|---|---|---|
| • Four Relay Outputs NO/NC, 8A/240VAC or 24VDC with status LEDs | • I2C Port to Raspberry Pi | • Command Line |
| • Four Opto-Isolated Inputs 3V–30V (low voltage port) | • RS485/MODBUS Port | • Python Library |
| • Four Opto-Isolated Inputs 30V–240V AC/DC (high voltage port) | • Node-RED nodes | |
| • CODESYS Driver | ||
| • OpenPLC Module | ||
| • Home Assistant | ||
| • Arduino Library | ||
| Other Features | ||
| • Transition counters to 4kHz on all inputs (V4+) | ||
| • Input counters with cumulative or PPS (pulse per second) reading up to 4kHz (V4+) | ||
| • 2× Quadrature encoder inputs reading up to 4000 PPS (V4+) | ||
| • PWM inputs reading fill factor and frequency | • Pluggable Connectors 30–16 AWG wires | |
| • Raspberry Pi reset push button | • On Board Hardware Watchdog and fuse | |
| • Status LEDs on all relay and input channels | • Eight Level Stackable | |
DESCRIPTION
The Four Relays Four HV Inputs HAT provides relay switching and wide-range input reading for home and industrial automation projects with Raspberry Pi.
Four NO/NC relay contacts switch loads up to 8A at 240VAC or 24VDC. Status LEDs indicate the state of each relay. Pluggable connectors accept 30–16 AWG wire for easy field wiring.
Four optically isolated inputs read AC or DC signals from 3V to 240V. Separate connectors for low-voltage (3–30V) and high-voltage (30–240V) signals allow direct wiring of both low and line-level sources.
Version 4 and later adds transition counters to 4kHz, cumulative and PPS input counting, 2× quadrature encoder decoding up to 4000 PPS, and PWM input reading (fill factor and frequency) on all channels.
Standard RS485 transceiver allows the card to operate as a MODBUS RTU slave, controllable from any PLC, SCADA, or HMI — no Raspberry Pi required. The Raspberry Pi can also use it directly as a transparent RS485 bridge.
A momentary pushbutton at the board edge signals the Raspberry Pi via GPIO26 (pin 37) for a clean software shutdown — no monitor, keyboard, or mouse needed.
The hardware watchdog automatically power-cycles the Raspberry Pi if the software becomes unresponsive, ensuring reliable operation in unattended deployments.
TECHNICAL DETAILS
CARD LAYOUT

MECHANICAL SPECIFICATIONS

DIP SWITCH AND STACKING
The onboard six-position DIP switch configures both the stack address and the RS485 port behavior. Cards of different Sequent HAT types can be freely mixed in the same stack.
| Switch | Name | Function |
|---|---|---|
| TERM | RS485 termination | Enable on the last card in an RS485 chain to prevent signal reflections |
| TX | RS485 TX select | ON: Raspberry Pi drives RS485 directly |
| RX | RS485 RX select | ON: Raspberry Pi receives RS485 directly |
| ID2 | Stack ID bit 2 | Binary stack address bit 2 (MSB) |
| ID1 | Stack ID bit 1 | Binary stack address bit 1 |
| ID0 | Stack ID bit 0 | Binary stack address bit 0 (LSB) — sets card level 0–7 |
ELECTRICAL SPECIFICATIONS
| Power | |
|---|---|
| Power supply | 5V / 8A pluggable connector |
| Onboard resettable fuse | 3 A |
| Relay Outputs | |
|---|---|
| Contact rating | 8A / 240VAC or 24VDC |
| Contact types | NO and NC |
| Opto-Isolated Digital Inputs | |
|---|---|
| Input Forward Current | Typical 5 mA, maximum 50 mA |
| Low Voltage Input Series Resistor | 2.2 KΩ |
| High Voltage Input Series Resistor | 120 KΩ |
| Isolation Resistance | Minimum 1012 Ω |
| Low Voltage Range | 3V – 30V DC |
| High Voltage Range | 30V – 240V AC/DC |
POWER REQUIREMENTS
Power supply: The card needs 5V to operate and can be powered from the Raspberry Pi or from its own 2-pin pluggable connector. Relay coils are powered from 5V. The card draws 10mA with all relays off; each relay requires approximately 80mA when energized. If power is applied to the 2-pin connector, no separate Raspberry Pi power supply is needed.
INDUSTRIAL version: The INDUSTRIAL version of the Four Relays card accepts 5V or 10–24VDC. A step-down converter supplies 5V and up to 4A continuous, 5A peak to the Raspberry Pi — no other power supply needed.
COMMUNICATION INTERFACES
RELAY SELF TEST
The card can be tested before installation by running a simple command from the command line. The card will cycle each relay on and off at 0.5 seconds interval. The clacking noise of the relays and the lighting of the LEDs will assure that all relays are functioning.
EXTENDED INPUT FUNCTIONS
Version 4 of the card replaced the I/O expander with a local processor, enabling the following extended input capabilities on all channels:
- Transition counters to 4kHz on all inputs
- Input counters with cumulative or PPS (pulse per second) reading up to 4kHz
- 2× Quadrature encoder inputs reading up to 4000 PPS
- PWM inputs on each channel, reading both the fill factor and the frequency
- 1% resolution on PWM inputs up to 100Hz, 5% resolution up to 500Hz
HARDWARE WATCHDOG
The Four Relays Four HV Inputs HAT includes a hardware watchdog that ensures your system automatically recovers if the Raspberry Pi software becomes unresponsive. The watchdog is disabled at power-up and activates after it receives the first reset command from the Raspberry Pi.
| Watchdog Parameters | |
|---|---|
| Initial timeout period | Configurable — allows time for Raspberry Pi to boot and start the application |
| Running timeout period | Configurable — normal operating timeout |
| Off period | Configurable — duration the Raspberry Pi power is cut when timeout triggers |
| Reset counter | Stored in non-volatile flash; can be read or cleared at any time |
For a full list of watchdog commands, run: 4rel4in -h
COMPATIBILITY
| Interface | I2C |
| I2C address range | 0x0e – 0x15 |
| GPIO used | GPIO2 (SDA), GPIO3 (SCL) — 2 pins only; remaining GPIO pins stay free |
| Max stack | 8 cards of each type; different Sequent HATs can be freely mixed with virtually no upper limit on total I/O |
| Compatible with | All Raspberry Pi versions from Zero to 5 (40-pin GPIO header) |
FIRMWARE UPDATE
The onboard microcontroller firmware can be updated in the field. The update tool downloads the latest firmware from Sequent Microsystems' servers and flashes it to the board over I2C.
Running the Update
~$ cd ~/4rel4in-rpi/update/
~/4rel4in-rpi/update$ ./update <id>
Replace <id> with the board stack address (0-7). Full instructions including recovery procedures are available at:
https://github.com/SequentMicrosystems/4rel4in-rpi/tree/main/update/README.md
DOWNLOADS
| User's Guide (PDF) | Schematics (PDF) | CAD | Software & Integrations |
|---|---|---|---|
| User's Guide V1.0–V3.X | Schematic V3 | 2D CAD Drawing | Command Line V1–V4.X |
| User's Guide V4.X | Schematic V4 | 3D Printing Enclosure | Command Line V4.X |
| 3D STEP Model | Python Library V1–V4.X | ||
| Python Library V4.X | |||
| Node-RED Nodes | |||
| MODBUS Registers V4.X | |||
| Home Assistant | |||
| Arduino Library | |||
| CODESYS Library |
WHAT'S INCLUDED
When you purchase the card you will receive the following items:
| 1. Four Relays Four HV Inputs HAT for Raspberry Pi |
|---|
![]() |
| 2. Mounting Hardware | |
|---|---|
![]() |
|
| 3. Mating Connector Plugs | |
|---|---|
![]() |
|
QUICK START
- Plug your card on top of your Raspberry Pi and power up the system.
- Enable I2C communication on Raspberry Pi using
raspi-config. - Install the software from GitHub:
~$ git clone https://github.com/SequentMicrosystems/4rel4in-rpi.git~$ cd /home/pi/4rel4in-rpi~/4rel4in-rpi$ sudo make install~/4rel4in-rpi$ 4rel4in
The program will respond with a list of available commands. To read more about the cli, please refer to the README file. If you would rather use a different platform, you can access the same functionality through dedicated, ready-to-use integrations in the Downloads tab above.
Expand Your System
-
In stockEight Relays 4A/120V 8-Layer Stackable HAT for Raspberry Pi
Eight Relays 4A/120VAC, 24VDC N.O./N.C. contacts and LED indicators; RS485 Port. -
In stockRTD Data Acquisition 8-Layer Stackable HAT for Raspberry Pi
Eight Channel RTD Data Aquisition HAT; 0.01% accuracy through calibration; PT100/1000 Sensors; RS485/MODBUS, Watchdog. -
In stockSixteen LV Digital Inputs 8-Layer Stackable HAT for Raspberry Pi
Sixteen 3V-24V Opto-isolated Inputs with LED indicators; RS485/MODBUS, Hardware Watchdog. -
Only 1 leftSmart Fan HAT the Best Cooling Solution for Raspberry Pi
PWM controlled 40x40x10mm Fan keeps Raspberry Pi temperature constant; Stackable with any other HAT.










