DEV Community

Cover image for Arduino 5V 4-Channel Relay Module: Pinout, Wiring and How It Works
Play with Circuit
Play with Circuit

Posted on

Arduino 5V 4-Channel Relay Module: Pinout, Wiring and How It Works

An Arduino can easily control LEDs, sensors, displays, and other low-voltage components. But what happens when you need to switch a motor, lamp, fan, or another higher-power load?

A relay module provides a simple interface between the Arduino and the load.

In this tutorial, we'll look at a commonly available 5V 4-channel relay module (HL-52S type), understand its working, and connect it to an Arduino Uno.

The example uses the relay outputs to control a DC motor and the three channels of a multicolor LED.

Safety: Relay contacts can be used with mains voltage. Do not work with 120/230V AC unless you understand mains safety practices. For this example, we'll use DC loads.

5V 4-Channel Relay Module Pinout


Each relay channel has three output terminals:

  • COM — Common
  • NO — Normally Open
  • NC — Normally Closed

The module also has the following control connections:

Pin Function
VCC Relay module supply
GND Ground
IN1 Relay 1 control
IN2 Relay 2 control
IN3 Relay 3 control
IN4 Relay 4 control

How the HL-52S Relay Module Works

The relay board contains four 5V relay coils and driver circuitry.

On this particular type of module, the control inputs are active LOW.

That means:

  • HIGH → relay de-energized
  • LOW → relay energized

The input signal controls a transistor in the driver circuit. When the input is pulled LOW, the transistor switches the relay coil and the corresponding relay changes state.

A flyback diode is connected across each relay coil. Its purpose is to suppress the voltage spike produced when the magnetic field of the coil collapses after the relay is switched off.

The board also provides LEDs to show the power and individual relay states.

Relay Module Specifications

Typical specifications for this 5V 4-channel relay board are:

Parameter Specification
Supply voltage 3.75V–6V
Input trigger current Approximately 5mA
Relay coil current Approximately 70mA per relay
All four relay coils Approximately 300mA
Maximum switching current 10A
Maximum contact voltage 250VAC / 30VDC

The exact specifications can vary slightly between manufacturers and board revisions, so check the markings or datasheet for your particular module.

Testing the Relay Module with Push Buttons

Before connecting an Arduino, you can also test the relay board using push buttons.

Connect the relay module's IN1–IN4 inputs to four push buttons. The buttons can pull the corresponding inputs to ground.

Because the module uses active-LOW triggering, pressing a button pulls the input LOW and activates that relay.

The relay's indicator LED will also turn on.

When the button is released, the input returns HIGH and the relay returns to its inactive state.

This is a useful way to understand the relay module without writing any code.

Connecting the Relay Module to Arduino Uno

Components

For a basic setup, you'll need:

  • Arduino Uno R3
  • 5V 4-channel relay module
  • 9V DC motor
  • Common-cathode multicolor LED
  • External DC supply/battery for the loads
  • Breadboard
  • Jumper wires
  • USB cable for the Arduino

For the Arduino example, we'll use the following connections:

Relay Module Arduino Uno
VCC 5V
GND GND
IN1 — Motor Pin 2
IN2 — RED Pin 3
IN3 — BLUE Pin 4
IN4 — GREEN Pin 5

The four relay channels are assigned as follows:

  • Relay 1: DC motor
  • Relay 2: Red LED channel
  • Relay 3: Blue LED channel
  • Relay 4: Green LED channel

The relay contacts are then used to switch the external DC supply to the respective loads.

The Arduino can control each relay independently.

Because the relay contacts are electrically separate from the Arduino control logic, the load receives power from its own supply rather than directly from an Arduino GPIO pin.

Conclusion

A 5V 4-channel relay module is a convenient way to let an Arduino control loads that cannot be driven directly from its GPIO pins.

For the original circuit diagrams and a more detailed hardware walkthrough, see the full 5V 4-channel relay module with Arduino tutorial on Play with Circuit.

Top comments (0)