Relay module 5 V
switch for big loads
An electromagnetic switch: with a 3.3 V signal from the ESP32 you switch a lamp, pump or heater on and off — electrically isolated from the microcontroller.
Open the course →How it works
When IN gets a signal, a transistor on the module lets current through the relay coil. The coil is an electromagnet that pulls a metal plate and moves it from the NC (normally closed) to the NO (normally open) contact. The load is wired between COM and NO — so it is off when the ESP32 is off. Most modules are active low (LOW = on). The optocoupler (if present) fully isolates the two sides.
Pins and wiring
| Pin | What it is | Where it connects / why |
|---|---|---|
| VCC | Coil power | → VIN (5 V). The coil needs ~70 mA. |
| GND | Ground | → GND. |
| IN | Control signal | → GPIO (e.g. 26). On active-low modules LOW = on. |
| COM | Common contact (screw) | One end of the load / live wire. |
| NO | Normally open | Joined to COM only when the relay is active. Use it for loads that should be OFF by default. |
| NC | Normally closed | Joined to COM when the relay is INACTIVE. |
Specifications
Control voltage5 V (works with a 3.3 V signal on IN on most)
Contacts10 A @ 250 VAC / 10 A @ 30 VDC
Coil current~70 mA
Switching time~10 ms
Isolationoptocoupler (on modules with a JD-VCC jumper)
Tips and typical mistakes
- ⚠ 230 V is lethal. Start with 5–12 V loads (LED strip, fan, pump). Mains voltage only with experienced supervision and an insulated enclosure.
- The relay "clicks" when it switches — that is normal and useful for debugging.
- For DC motors and solenoids put a diode (1N4007) across the load to protect against arcing.