Component guide · Beginner · 4 min read
5V, 12V and 24V Relay Modules (1 to 16 Channel)

Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
A relay module lets an Arduino or ESP32 switch a lamp, pump, solenoid or fan through an isolated contact rated about 10 A at 250 V AC or 30 V DC. The coil voltage (5 V, 12 V or 24 V) must match the module's supply. Most boards are active-low (input LOW turns the relay on), have an optocoupler on each input, and a JD-VCC jumper to power the coils separately.
Key specs at a glance
- Coil voltage
- 5 V, 12 V or 24 V (module supply); wide-input 6 to 30 V model
- Contacts
- SPDT (COM, NO, NC), typically 10 A 250 V AC / 10 A 30 V DC
- Channels
- 1, 2, 4, 8 or 16
- Input
- Active-low on most boards (some have a high/low jumper), 3.3 or 5 V logic
- Isolation
- Optocoupler per channel, JD-VCC jumper for separate coil supply
- Coil current
- About 70 to 90 mA per 5 V relay
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 15V Relay Module with Optocoupler₹74
Option 25V Relay Module (Optocoupled)₹35
Option 3Relay Module Board 5V, Optocoupled (2 / 4 / 8 / 16 Channel)₹82
Option 412V Relay Module₹160
Option 512V Relay Module with Optocoupler (1 to 8 Channel)₹142
Option 6Relay Module Board 12V, Optocoupled (2 / 4 / 8 / 16 Channel)₹164
What the 5V relay module is
The relay coil pulls in a contact that connects COM to NO (normally open) and breaks COM from NC (normally closed). Use NO so the load is off when the controller is off or resetting.
With the JD-VCC jumper removed, the coils run from a separate 5 V supply and the controller only lights the optocoupler LEDs, which keeps relay noise off the logic side.
5V relay module pinout
The pins on the 5V relay module and what each one does.
| Pin | Function |
|---|---|
| VCC | Logic side supply (optocoupler LEDs) |
| GND | Logic ground |
| IN1...INn | Inputs, usually LOW = relay on |
| JD-VCC / VCC jumper | Fit to share one supply; remove to power coils from JD-VCC |
| COM | Common contact |
| NO | Normally open contact |
| NC | Normally closed contact |
- VCC
- Logic side supply (optocoupler LEDs)
- GND
- Logic ground
- IN1...INn
- Inputs, usually LOW = relay on
- JD-VCC / VCC jumper
- Fit to share one supply; remove to power coils from JD-VCC
- COM
- Common contact
- NO
- Normally open contact
- NC
- Normally closed contact
Wiring the 5V relay module
Many 5 V modules do not switch reliably from a 3.3 V ESP32 pin with the jumper fitted: remove the jumper, power VCC from 3.3 V and JD-VCC from 5 V. For mains loads, switch the live wire only, use a fuse, an enclosure and cable rated for the load, and ask a qualified electrician for permanent wiring.
| 5V relay module pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V | 5V (VIN) for 5 V relays, or 3V3 with jumper removed |
| GND | GND | GND |
| IN1 | D7 | GPIO 26 |
| JD-VCC (jumper off) | Separate 5 V supply + | Separate 5 V supply + |
| COM / NO | In series with the load's live wire | In series with the load's live wire |
- VCC
- Arduino Uno:
- 5V
- ESP32:
- 5V (VIN) for 5 V relays, or 3V3 with jumper removed
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- IN1
- Arduino Uno:
- D7
- ESP32:
- GPIO 26
- JD-VCC (jumper off)
- Arduino Uno:
- Separate 5 V supply +
- ESP32:
- Separate 5 V supply +
- COM / NO
- Arduino Uno:
- In series with the load's live wire
- ESP32:
- In series with the load's live wire
Example code
Setting the pin HIGH before pinMode() stops the relay clicking on at boot. If your board has a high/low trigger jumper and it is set to high, swap ON and OFF.
const int RELAY = 7;
const bool ON = LOW, OFF = HIGH; // most modules are active-low
void setup() {
digitalWrite(RELAY, OFF); // set the level before enabling the output
pinMode(RELAY, OUTPUT);
}
void loop() {
digitalWrite(RELAY, ON);
delay(5000);
digitalWrite(RELAY, OFF);
delay(55000);
}Setup and tuning
an 8-channel 5 V board with all relays on draws about 0.7 A; do not run it from the Uno 5V pin.
put a diode across DC solenoids and pumps; for motors and AC loads, add an RC snubber.
motors and lamps have high inrush; derate the 10 A contact to about 3 to 5 A for them.
avoid ESP32 strapping pins (0, 2, 12, 15) for relays.
What you need
Shop this list12 of 15 found in our store · ₹1,878
5V Relay Module with Optocoupler: the part this guide covers5V Relay Module with Optocoupler₹74
5V Relay Module (Optocoupled): another version this guide covers5V Relay Module (Optocoupled)₹35
Relay Module Board 5V, Optocoupled (2 / 4 / 8 / 16 Channel): another version this guide coversRelay Module Board 5V, Optocoupled (2 / 4 / 8 / 16 Channel)₹82
12V Relay Module: another version this guide covers12V Relay Module₹160
12V Relay Module with Optocoupler (1 to 8 Channel): another version this guide covers12V Relay Module with Optocoupler (1 to 8 Channel)₹142
Relay Module Board 12V, Optocoupled (2 / 4 / 8 / 16 Channel): another version this guide coversRelay Module Board 12V, Optocoupled (2 / 4 / 8 / 16 Channel)₹164
24V Relay Module 1 Channel: another version this guide covers24V Relay Module 1 Channel₹59
ACEBOTT 5V Relay Module, Easy-Plug, for ESP32 and Arduino: another version this guide coversACEBOTT 5V Relay Module, Easy-Plug, for ESP32 and Arduino₹227
Wide-Input One-Way Relay Module 6–30V: another version this guide coversWide-Input One-Way Relay Module 6–30V₹112- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
SMPS power supply (5 V, 12 V or 24 V): to power the relay coilsEnclosed SMPS Power Supply₹257Closest match, check the specs- Fuse holder: to fuse the switched loadFind this part
- 1N4007 diode: flyback diode across a bare relay coilFind this part
Digital multimeter: to check supply and signal voltagesDigital Multimeter₹177
Alternatives and when to choose them
- Relay modules: types and choosing a relay board.
- SSR or relay: when a solid-state relay is better.
- Solid state relay: silent, fast switching for AC loads.
- Optocouplers: how input isolation works.
Common mistakes to avoid
- Switching neutral instead of live on mains loads.
- Powering many relays from the Arduino 5V pin.
- Expecting a 5 V relay to pull in from 3.3 V with the jumper fitted.
- Using the 10 A rating for a motor's inrush current.
Frequently asked questions
Why does the relay turn on when I write LOW?
Most modules are active-low. Write HIGH to turn it off.
Can an ESP32 drive a 5 V relay module?
Yes, with the JD-VCC jumper removed, VCC on 3.3 V and JD-VCC on 5 V, or with a module rated for 3.3 V input.
NO or NC?
Use NO for loads that should be off when the controller is off.
Can it switch a 1.5 ton AC or geyser?
Not directly. Use it to drive a contactor rated for the load.
Why does my Arduino reset when the relay switches?
Coil and load noise. Separate the coil supply with JD-VCC and add snubbers.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




