Free wiring guides
Wire the 2-channel relay module to the ESP32-S3
Relay module, 2 channels, 5 V, with optocoupler. Two switches the board can flip, for low-voltage loads.
When buying: Most of these switch on when the input is LOW. The sketch has one line to flip if yours is the other kind.
Which pin goes where
| On the part | On the ESP32-S3 |
|---|---|
| GND | GND |
| IN1 | GPIO 5 |
| IN2 | GPIO 6 |
| VCC | 5V |
Wire it with the USB cable unplugged. Follow the names printed on your own part: makers sometimes reorder the pins.
In 3D
Example sketch
// Relay module, 2 channels, 5 V, with optocoupler
// on the ESP32-S3-DevKitC-1 (N8R2 or N16R8)
// https://stem.manusignal.com/en/parts/2-channel-relay-esp32-s3
const int PIN_IN1 = 5;
const int PIN_IN2 = 6;
// Most relay modules switch ON when the input is LOW.
const int RELAY_ON = LOW;
const int RELAY_OFF = HIGH;
void setup() {
pinMode(PIN_IN1, OUTPUT);
pinMode(PIN_IN2, OUTPUT);
digitalWrite(PIN_IN1, RELAY_OFF);
digitalWrite(PIN_IN2, RELAY_OFF);
}
void loop() {
digitalWrite(PIN_IN1, RELAY_ON);
delay(1000);
digitalWrite(PIN_IN1, RELAY_OFF);
digitalWrite(PIN_IN2, RELAY_ON);
delay(1000);
digitalWrite(PIN_IN2, RELAY_OFF);
}
- Tools > Board > ESP32S3 Dev Module, then Tools > Port and choose the board's port.
This sketch is compiled for the board before the page is published. It has not been run on real hardware by us.
What you should see
The two relays click on in turn, a second each, with their lights.
If it does not work
- The relay is on when the page says off.
- Flip RELAY_ON in the sketch between LOW and HIGH.
Build something with it
These Build Packs use this part on this board, with the same pins.
More parts on the ESP32-S3
- ST7789 1.54 in TFT screenESP32-S3 · 7 wires
- ST7789 2.0 in TFT screenESP32-S3 · 7 wires
- GC9A01 round screenESP32-S3 · 7 wires
- SSD1306 OLED 0.96 in screenESP32-S3 · 4 wires
- SSD1306 OLED 0.91 in screenESP32-S3 · 4 wires
- 4.2 in e-paper screenESP32-S3 · 8 wires
- TTP223 touch sensorESP32-S3 · 3 wires
- Push buttonESP32-S3 · 2 wires
- Foot switchESP32-S3 · 2 wires
- Slide switchESP32-S3 · 2 wires
- SW-520D tilt switchESP32-S3 · 2 wires
- MC-38 door switchESP32-S3 · 2 wires
- AM312 PIR motion sensorESP32-S3 · 3 wires
- HC-SR04 ultrasonic sensorESP32-S3 · 4 wires
- Capacitive soil moisture sensorESP32-S3 · 3 wires
- BME280 sensorESP32-S3 · 4 wires
- MLX90614 infrared thermometerESP32-S3 · 4 wires
- SGP30 air quality sensorESP32-S3 · 4 wires
- HX711 load cellESP32-S3 · 4 wires
- KY-040 rotary encoderESP32-S3 · 5 wires
- 3×4 keypadESP32-S3 · 7 wires
- Passive buzzerESP32-S3 · 2 wires
- WS2812 LED ringESP32-S3 · 3 wires
- WS2812 LED stickESP32-S3 · 3 wires
- WS2812B LED stripESP32-S3 · 3 wires
- KY-016 RGB LEDESP32-S3 · 4 wires
- 28BYJ-48 stepper motor (ULN2003)ESP32-S3 · 6 wires
- MAX98357A I2S amplifierESP32-S3 · 5 wires
- SX1262 LoRa module (Ra-01SH)ESP32-S3 · 9 wires