Relay HAT 2

This documentation includes hardware info, installation guidelines, and sample code for your hardware.

Overall Info

Relay HAT is a stackable, high-quality relay module for Raspberry Pi.



  • Relay Power: Relay power selector.

    • Host Power: Short 'PI 5V' and 'EXT 5V' pins via included jumper to use Raspberry Pi's power to supply relays. Relay HAT 2 has a power filter to minimize noise on the power line.

    • External Power: If you're stacking more than two Relay HATs, you may consider using external power for relays. Connect 'EXT 5V' and 'GND' to external 5V power supply. Each Relay HAT consumes 5V 400mA max.

  • I2C Port: Grove System compatible I2C port. Exposes 'SCL', 'SDA', '3.3V' and 'GND' pins. Directly connected to the host device's headers. Data bus is 3.3V Tolerant.

  • Relay Outputs: 'COM' and 'NO' (Normally Open) terminals of the relays.

  • Stackable Raspberry Pi Connector: Connects the board to the Raspberry Pi. The connector is stackable, so you can attach other boards on top or bottom.


  • 5Ch OMRON 10A Relays. (10A @ AC 110-240V, 5A @ DC 30V)

  • Stackable up to 8 boards, 40 relays.

  • Preserve state feature keeps relay states, even if you reboot the Raspberry Pi.

  • Only uses I2C pins.

  • Grove compatible I2C port.

  • Relay indicator LEDs can be enabled or disabled.

  • Optical isolation and isolation slot.

  • Internal or external power input option.

  • Power filter.

  • ID EEPROM for Raspberry Pi HAT specification compliance.


Relay HAT 2's specifications are as follows:


Turns AC or DC devices on or off. Relays are optically coupled to the logic side to prevent any possible surges.

  • DC Current: 5A at 30V.

  • AC Current: 10A at 120V or 250V. (5A max is recommended on Relay HAT 2.)

  • Operate Time: 10ms max.

  • Release Time: 5ms max.

  • Mechanical Durability: 10.000.000 operations min.

  • Electrical Durability: 100.000 operations min.

Electric Shock Risk

Do not touch the terminals, terminal pins and relay pins when electricity is applied to the board.

Microchip MCP23008 I/O Expander

Controls the relay logic with serial interface.

  • 100kHz low speed and 400kHz high speed I2C interface.

  • User configurable device address allows up to 8 devices to work in the same bus.

1206 Size SMD jumper soldering (or shorting in any form) is required for optional device address configuration. The jumper area is located on the back of the board for easy access.

The default I2C device address is 0x20. This address is user configurable from 0x20 to 0x27 for stacking.


This memory holds manufacturer information, GPIO setup and device tree. The OS loads required drivers and configures GPIO pins according to the data on this memory. ID EEPROM is required for Raspberry Pi HAT specification compliance.

Do not try to overwrite or erase the contents of the EEPROM as it may block the device's operation.

The EEPROM is connected to the I2C1 bus and requires root privileges for user access.


To get maximum performance from your hardware, please make sure you'll meet the following requirements.


We designed Relay HAT 2 to work with Raspberry Pi. Alternatively, you may wish to use any Raspberry Pi pin compatible device as an host.

Relay HAT 2 consumes 5V 400mA for powering the relays and 3.3V 100mA for optical isolation. When stacking more than two Relay HATs, we recommend using external power for relays.

Relay HAT 2 uses 5V 80mA and 3.3V 20mA per active relay.

Operating System

You can use Relay HAT 2 with any operating system that supports I2C communication. We officially support Raspbian operating system.

Development Environment

Relay HAT 2's Raspbian library supports Python. You can write Python code in any text editor. We recommend using Visual Studio Code as an editor.


Select your operating system for set-up and programming guidelines.

pageRaspberry Pi OS


If you're experiencing difficulties while working with your device, please try the following steps.

Problem: Host device reboots when relays are turning on. Cause: Your power adapter does not provide required energy for both host and the relays. Solution: If you are powering external hardware, like USB devices, remove the most energy-hungry ones. Alternatively, power the relays with external power supply.

Last updated