ESP32 C3 Super Mini - 2-Channel Relay Module

Learn how to control two high-voltage devices simultaneously using an ESP32 C3 Super Mini and a 2-channel relay module. This beginner-friendly tutorial covers everything you need to switch pumps, fans, lights, and other appliances with your ESP32 microcontroller.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - 2-Channel Relay Module

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×2-channel Relay Module
1×Breadboard
1×Jumper Wires
1×Optionally, 5V Power Adapter for ESP32 C3 Super Mini

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of 2-Channel Relay Module

A 2-channel relay module is a switching board that controls two separate high-voltage devices using low-voltage signals from your ESP32 C3 Super Mini.

Key features:

  • Controls two independent high-voltage devices (AC or DC)
  • Operates with 5V power supply
  • Accepts 3.3V or 5V control signals
  • Built-in optocouplers for safety and isolation
  • LED indicators show relay status
  • Supports both low-level and high-level trigger modes
  • Maximum load: typically 10A at 250VAC or 10A at 30VDC per channel
  • Perfect for beginners learning home automation

Why use a 2-channel relay module:

  • More compact than using two separate single-channel relays
  • Simpler wiring with shared power connections
  • Cost-effective solution for multi-device control
  • Ideal for ESP32 home automation projects

Pinout

2-channel Relay Module Pinout

The 2-channel relay module has three types of pins for power, control, and output connections.

Power pins:

  • DC+: Connect to 5V power supply
  • DC-: Connect to GND of power supply AND GND of ESP32 C3 Super Mini

Signal pins:

  • IN1: Control signal from ESP32 for relay 1
  • IN2: Control signal from ESP32 for relay 2

Output pins for relay 1:

  • COM1: Common terminal for device 1
  • NO1: Normally open terminal (connects when relay 1 activated)
  • NC1: Normally closed terminal (disconnects when relay 1 activated)

Output pins for relay 2:

  • COM2: Common terminal for device 2
  • NO2: Normally open terminal (connects when relay 2 activated)
  • NC2: Normally closed terminal (disconnects when relay 2 activated)

Additional features:

  • Two jumpers for selecting trigger mode (low-level or high-level) per relay
  • Two LED indicators showing each relay's status

For detailed information about relay basics, including normally closed vs normally open connections and low-level vs high-level triggering, check out our ESP32 C3 Super Mini - Relay tutorial.

Wiring Diagram

Connect your ESP32 C3 Super Mini to the 2-channel relay module following this wiring diagram:

The wiring diagram between ESP32 C3 Super Mini 2-channel relay module

This image is created using Fritzing. Click to enlarge image

Connection table:

2-Channel Relay Pin ESP32 C3 Super Mini Pin
DC+ 5V
DC- GND
IN1 GPIO2
IN2 GPIO3

※ NOTE THAT:

Power considerations: If both devices require the same voltage (e.g., both 12V), use one power adapter for both. If devices need different voltages, use separate power adapters for each device. Always connect the GND of all power supplies together with the ESP32 GND.

※ NOTE THAT:

Safety warning: When working with high-voltage devices, always disconnect power before wiring. Double-check all connections before applying power to prevent short circuits or damage.

How To Program For 2-Channel Relay Module

Programming the 2-channel relay module with ESP32 C3 Super Mini involves two simple steps.

What the code does:

  • Configures ESP32 pins as digital outputs for relay control
  • Sends HIGH or LOW signals to activate/deactivate each relay
  • Controls relays independently or simultaneously
  • Provides Serial Monitor feedback for debugging

Initialize relay pins:

pinMode(PIN_RELAY_1, OUTPUT); pinMode(PIN_RELAY_2, OUTPUT);

Control relay states:

digitalWrite(PIN_RELAY_1, HIGH); // Turn relay 1 ON digitalWrite(PIN_RELAY_2, HIGH); // Turn relay 2 ON

ESP32 C3 Super Mini Code

/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-2-channel-relay-module */ #define PIN_RELAY_1 2 // The ESP32 C3 SuperMini pin GPIO2 connected to the IN1 pin of relay module #define PIN_RELAY_2 3 // The ESP32 C3 SuperMini pin GPIO3 connected to the IN2 pin of relay module // The setup function runs once on reset or power-up void setup() { Serial.begin(115200); // initialize digital pin as an output. pinMode(PIN_RELAY_1, OUTPUT); pinMode(PIN_RELAY_2, OUTPUT); } // The loop function repeats indefinitely void loop() { Serial.println("Turned on both relays"); digitalWrite(PIN_RELAY_1, HIGH); digitalWrite(PIN_RELAY_2, HIGH); delay(2000); Serial.println("Turned off both relays"); digitalWrite(PIN_RELAY_1, LOW); digitalWrite(PIN_RELAY_2, LOW); delay(2000); }

Detailed Instructions

  • New to ESP32 C3 Mini? Complete our Getting Started with ESP32 C3 Mini tutorial first to set up your development environment.
  • Copy the code: Copy the code above to Arduino IDE
  • Select board: Choose ESP32 C3 Super Mini from Tools > Board menu
  • Select port: Choose the correct COM port from Tools > Port menu
  • Upload: Click the Upload button to program your ESP32 C3 Super Mini
  • Listen: You should hear clicking sounds as relays switch on and off
  • Open Serial Monitor: Click the Serial Monitor icon (top-right) and set baud rate to 115200
  • Observe output: Watch the relay status messages appear every 2 seconds
  • Pro Tip: Use different delay times for relay 1 and relay 2 to create custom timing patterns for your automation projects.

Serial Monitor Output

∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-04-15 14:32:01] Turned on both relays [2026-04-15 14:32:03] Turned off both relays [2026-04-15 14:32:05] Turned on both relays [2026-04-15 14:32:07] Turned off both relays [2026-04-15 14:32:09] Turned on both relays [2026-04-15 14:32:11] Turned off both relays [2026-04-15 14:32:13] Turned on both relays [2026-04-15 14:32:15] Turned off both relays
Ln 11, Col 1
ESP32C3 Dev Module on COM15
2

Applications and Project Ideas

Use your ESP32 C3 Super Mini with a 2-channel relay module to build these exciting projects:

  • Smart home lighting: Control two different room lights or lamp circuits independently
  • Garden automation: Manage a water pump and grow lights on separate schedules
  • Garage door opener: Control door motor and interior lights simultaneously
  • Aquarium controller: Operate filter pump and aquarium lighting system
  • HVAC automation: Switch heating and cooling systems based on temperature sensors
  • Security system: Control door locks and alarm sirens with smartphone or sensors
  • Tutorial automation: Manage power tools and ventilation fans remotely

Video Tutorial

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Take your ESP32 2-channel relay module skills to the next level with these challenges:

  • Easy: Modify the code to turn relays on and off at different time intervals (e.g., relay 1 every 1 second, relay 2 every 3 seconds)
  • Easy: Add LED indicators on breadboard that mirror the relay states for visual feedback
  • Medium: Create a web server that lets you control both relays from your phone's web browser
  • Medium: Connect a DHT22 temperature sensor and automatically control a fan (relay 1) and heater (relay 2) based on temperature
  • Advanced: Build a complete IoT home automation system using MQTT protocol to control relays from anywhere in the world
  • Advanced: Implement scheduling functionality that stores on/off times in EEPROM for automatic daily device control

Function References

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!