All wiring guides

Free wiring guides

Wire the 2-channel relay module to the ESP32-C3

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 partOn the ESP32-C3
GNDGND
IN1GPIO 0
IN2GPIO 1
VCC5V

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-C3 Super Mini
// https://stem.manusignal.com/en/parts/2-channel-relay-esp32-c3

const int PIN_IN1 = 0;
const int PIN_IN2 = 1;

// 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 > ESP32C3 Dev Module (USB CDC On Boot: Enabled), 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.

The same part on the ESP32-S3

More parts on the ESP32-C3