Explain Like I'm 12
A relay is like a remote-controlled light switch. Your ESP32 sends a tiny signal and the relay clicks ON or OFF to control something big — like a water pump or a lamp.
Technical Specifications
Arduino library: Built-in digitalWrite
- Control voltage: 3.3 V or 5 V
- Switch rating: up to 10 A at 250 V AC
- Opto-isolated input
- Active LOW on most modules
Pinout
- VCC → 5 V
- GND → GND
- IN → GPIO26
Wiring
Connect each pin as shown in the pinout section above.
Wiring Diagram
Wiring diagram for 1-Channel Relay Module
Code Example
Copy into Arduino IDE. Install the library listed above first.
example.ino
#define RELAY 26
void setup() { pinMode(RELAY, OUTPUT); digitalWrite(RELAY, HIGH); }
void loop() {
digitalWrite(RELAY, LOW);
delay(2000);
digitalWrite(RELAY, HIGH);
delay(2000);
}
Expected Output
Relay clicks every 2 seconds, switching connected device on and off.
Related Projects
FAQ
Only with adult supervision. Start with low-voltage DC loads like 5 V fans.
Downloads
Official manufacturer PDF for teachers and advanced builders.
Datasheet coming soon.
