4-CH Relay Raspberry Pi Relay Expansion Board 4-CH Relay HAT

4-CH Relay HAT

Overview

This product is a 4-channel relay expansion board for Raspberry Pi, based on the Raspberry Pi 40-pin GPIO interface header. It is compatible with Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+/4B. The board is equipped with four relays that can be controlled individually to turn on and off.

Product Features

  • Operating Voltage: 3.3V&5V
  • Maximum Load per Relay: 250V/5A
  • Each relay has a working indicator light for easy monitoring of relay status
  • Opto-isolated circuit for strong anti-interference capability and stable operation
  • Designed based on Raspberry Pi 40-pin GPIO interface header, suitable for Raspberry Pi series boards
  • Provides open-source example programs for Raspberry Pi development boards

Product Specifications

Dimensions65mm (Length) x 56mm (Width)
Opto-isolatorLTV-357T-B-IN
Operating Voltage3.3V&5V

Product Usage

Resource overview

4-CH Relay HAT
  • ① Relay Output Terminal
  • ② Relay
  • ③ Specified Pin Selection jumper header: short status indicates the relay is connected to the specified control pin; open status indicates users can connect to other pins through jumpers.
  • ④ Raspberry Pi 40-pin GPIO Interface header
  • ⑤ Relay Working Indicator LED: When lit, it signifies the relay's normally open (NO) contact is closed and the normally closed (NC) contact is open. When off, it indicates that the normally open (NO) contact is open and the normally closed (NC) contact is closed.

Relay wiring diagram

4-CH Relay HAT

Raspberry Pi Example Usage

Installation of WiringPi Library

sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb  # Upgrade Raspberry Pi
sudo dpkg -i wiringpi-latest.deb
gpio -v     # If version 2.52 is displayed, it indicates a successful installation.

For Bullseye branch systems, use the following commands

git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v

Running "gpio -v" should display version 2.70. If it doesn't appear, it indicates an installation error.

If you got the "ImportError: No module named 'wiringpi'" error while running the Python version of the example program, execute the following commands:

For Python 2.x version:

pip install wiringpi

For Python 3.x version:

pip3 install wiringpi

Note: If installation fails, you can try the following compilation installation:

git clone --recursive https://github.com/WiringPi/WiringPi-Python.git

Note: The --recursive option automatically fetches submodules; otherwise, you would need to download them manually.

Navigate to the recently downloaded WiringPi-Python folder and execute the following commands to compile and install:

For Python 2.x version:

sudo python setup.py install

For Python 3.x version:

sudo python3 setup.py install

If the following error occurs:

4-CH Relay HAT

At this point, run the command "sudo apt install swig" to install SWIG. After completion, run "sudo python3 setup.py" install again for compilation and installation. If you see similar information as shown below, it indicates a successful installation.

4-CH Relay HAT

Execute the sample program

Python:

Go to the Python directory:

cd /home/pi/4-ch_relay/python

performance:

sudo python3 4-ch-relay.py

C:

Go to the C directory:

cd /home/pi/4-ch_relay/c

performance:

sudo make clean
sudo make
sudo ./main

Resources

Schematic

Demo Codes

Product

Data Sheet

HF3FF005-1ZS

LTV-357T-B-IN

Technical Support

Technical Support and Product Notes