ESP32 Relay Board x8

Last modified 3 months

Thinking about using the ESP32 Relay Board x8 for your home automation, automation or irrigation projects? In this guide I explain in a clear and practical way everything you need to know to get started: what this board is, how it works and how you can program it from scratch.

Although this content accompanies a step-by-step video, here you will find all the detailed information in written form, with diagrams, explanations and example code. You don't need to watch the video to understand it - but if you like to learn visually, you can complement it with it.

Introducing the ESP32 Relay Board x8

The ESP32 Relay Board x8 is a development board based on the popular microcontroller ESP32 WROOMspecifically designed to control up to 8 relays from a single board. It is perfect for home automation projects, industrial automation or any system that needs to manage multiple electrical devices independently.

Possible applications

There are many possible applications for this board, but I would like to highlight the following, which I think may be the most common:

  • Irrigation valve control
  • Automation of lights or blinds
  • Activation of pumps or fans
  • Remote management via Wi-Fi

Features and Capabilities

This board offers not only relay control, but also great versatility. Some of its most outstanding features:

  • ESP32-WROOM-32 Microcontroller with Wi-Fi and Bluetooth
  • 8 relay outputs with optocouplers for electrical isolation
  • 5V or 7 to 30V power supply
  • Reset button
  • Programming button
  • Status LEDs for each relay for immediate display
  • Firmware controllable LEDs (GPIO23)

Power supply and electrical characteristics

Each relay on the board has output terminals labeled COM (common), NO (normally open), and NC (normally closed). Although the product description doesn’t specify the maximum load, the silkscreen printed on each relay module indicates a rating of up to 10 A.

The board can be powered in two different ways:

  • You can power the board directly through the 5 VDC input by applying 5 V between the GND (negative) and 5 V (positive) terminals.
  • You can also power the board via the 7–30 VDC input, which routes the voltage through its internal regulator. Apply a DC voltage between the GND (negative) and 7–30 VDC (positive) terminals, within the supported range of 7 to 30 volts.

💡 Important: Keep in mind that this board must be powered with direct current (DC). If you’re using it to control irrigation solenoid valves, note that many of them operate at 24 V alternating current (AC), which is not compatible with the board’s power input. In such cases, you’ll need a separate DC power source to supply the ESP32 Relay Board x8.

In terms of electricity consumption:

  • With all relays switched off, the consumption is about 100mA
  • With all eight relays activated simultaneously, the power consumption can exceed 500mA

Therefore, make sure that your power supply can deliver enough current if you plan to activate several relays at the same time.

ESP32 Relay Board x8 connectors, buttons and GPIOs

The board is designed to be easy to use.

There are two buttons on the board:

BotónMain functionDescription
ENMicrocontroller resetPerforms a full hardware reset of the ESP32. It doesn’t erase the program, just reboots it.
001Programming modeUsed to flash firmware by holding it down when starting the upload from the IDE.

También hay una serie de pines y conectores:

ConnectorMain function
DC input terminal5V external power supply or 7 to 30V external power supply
Relay terminals (3 per channel)Normally Open (NO), Common (C), Normally Closed (NC)
GPIO exposedAdditional pins for sensors or inputs

The eight relays are controlled via dedicated ESP32 GPIO pins, from GPIO25 to GPIO33. Each GPIO is mapped directly to one relay channel.

Complete ESP32 Relay Board x8 Pin Table

GPIO pinAssigned functionDescription
GPIO32Relay 1Controls relay channel 1
GPIO33Relay 2Controls relay channel 2
GPIO25Relay 3Controls relay channel 3
GPIO26Relay 4Controls relay channel 4
GPIO27Relay 5Controls relay channel 5
GPIO14Relay 6Controls relay channel 6
GPIO12Relay 7Controls relay channel 7
GPIO13Relay 8Controls relay channel 8
GPIO23Status LEDGeneral LED on the board, useful as indicator
GPIO0Programming buttonConectado al botón 001 para flasheo
TX / RXSerial communicationPins for USB-TTL adapter (3.3V level)
5V / GNDPower inputPower input for the board (5V DC)

💡Todos los relés están conectados a través de un optoacoplador a pines GPIO del ESP32-WROOM-E. El control se realiza mediante lógica activa HIGH, es decir, el relé se activa cuando el pin se pone en estado alto

Programming with USB-TTL Converter

The ESP32 Relay Board x8 does not include a USB port or an integrated USB-to-serial converter, so to load the firmware you need to use a external USB-TTL adaptersuch as those based on CH340, CP2102 o FTDI.

I have many similar adapters but not all of them have worked well for me. I am currently using one that I bought on Amazon. It has given me no problems and allows you to select logic levels of 3.3 or 5V (for this board make sure you have it at 3.3V, whatever your adapter is).

Connecting the USB-TTL adapter

Here's how to connect it:

USB-TTL adapter pinPin on ESP32 Relay Board x8
TX (3.3V)RX
RX (3.3V)TX
GNDGND
5V5V

As you can see there are two GND terminals. You can use either of them, they are linked internally).

GPIO0 is used to put the board into bootloader mode for firmware flashing (make sure the voltage level is 3.3 V!). Instead of connecting GPIO0 manually, you can press the 001 button on the board to activate programming mode.

💡 Make sure that the voltage levels on the RX and TX lines of the adapter are 3.3 V. Also remember that the ESP32 requires you to press the 001 button at the moment of uploading the firmware.

Loading the firmware

Once the adapter is connected, you can load the firmware (e.g. from the Arduino IDE) as follows:

  1. Connect the USB-TTL adapter to the board and to the PC.
  2. Press the button 001 on the board and hold it down.
  3. Reinicia el ESP32 pulsando brevemente el botón EN.
  4. Start the firmware upload from the Arduino IDE or your environment (Visual Studio Code, for example).
  5. Release the button 001 when the process begins.

How to program it (with Arduino IDE)

Programming this board is child's play. Here is a basic configuration that simulates the factory-loaded program: activate the eight relays sequentially, with a short pause between each one, until they are all on. Then it switches them off one by one, keeping the rhythm. It is a perfect visual example to check that the board is working correctly, that the relays respond and that the programming from the Arduino IDE has been successful. Ideal for a first contact before going into more advanced configurations.

/*********
  eMariete
  Complete project details at https://emariete.com  
*********/

// Orden físico de relés: del 1 al 8
const int relays[] = {32, 33, 25, 26, 27, 14, 12, 13};

void setup() {
  for (int i = 0; i < 8; i++) {
    pinMode(relays[i], OUTPUT);
    digitalWrite(relays[i], LOW); // Apaga todos al iniciar
  }
}

void loop() {
  // Encendido secuencial
  for (int i = 0; i < 8; i++) {
    digitalWrite(relays[i], HIGH);
    delay(500);
  }

  delay(1000); // Mantén todos encendidos durante 1 segundo.

  // Apagado secuencial
  for (int i = 0; i < 8; i++) {
    digitalWrite(relays[i], LOW);
    delay(500);
  }

  delay(1000); // Haz una pausa antes de repetir.
}

You just need to open the Arduino IDE, connect the board with the USB-TTL adapter, upload the firmware and you're done!

Complementary video: Discover the ESP32 Relay Board x8 in action

If you prefer to see how this board works in real time, I invite you to watch the video that accompanies this article. In it I show how it is connected, how it is programmed and how the relays behave sequentially.

💡 Although this article includes all the necessary details, the video gives you a practical and visual overview that can help you understand it even better.

Así no te perderás el momento en que un nuevo proyecto cobre vida delante de tus ojos 😉

Suscríbete

The shopping basket


He comprado la ESP32 Relay Board x8 en AliExpress y el adaptador USB-TTL en Amazon, pero aquí te dejo los enlaces de compra de ambos sitios para que elijas el que prefieras.

ESP32 Relay Board x8

Yo la compré en AliExpress, en el enlace que te dejo, y me tardó unos 8 días. Sin embargo, puedes comprarla en Amazon si lo prefieres o si estás en España y quieres recibirla más rápido.

ESP32 WROOM relay card - 8CH

ESP32 WROOM WiFi/Bluetooth relay card - 8 channels

Automation controller with 8 relays. WiFi and Bluetooth 5.0 connectivity, ideal for projects with Home Assistant, Node-RED and customised home automation systems.

Buy on AliExpress
ESP32 WROOM BLE WiFi 8-relay ESP32 WROOM BLE Module

ESP32-WROOM-32E WiFi 8 Relay BLE Module - Development Board

Relay controller with WiFi and Bluetooth 5.0 connectivity. Ideal for home automation, Home Assistant, Node-RED and ESP32 projects. Compatible with 5-30 V DC.

Buy on Amazon

USB-TTL Adapter

En mi caso, lo adquirí en Amazon (el paquete de tres unidades), pero también puedes conseguirlo en AliExpress, que es exactamente el mismo y más económico, aunque tendrás que esperar un poco más.

USB to TTL Adapter CH340G - AliExpress

USB to TTL Adapter CH340G - UART Converter

USB to UART converter with CH340G chip. Compatible with Arduino, ESP32, and more. Ideal for serial communication between microcontrollers and PCs.

Buy on AliExpress
USB UART TTL Adapter CH340G - AZDelivery

USB to UART TTL adapter with CH340G - AZDelivery

Converts UART signals to USB with support for 3.3V and 5V. Includes jumper cable and is compatible with Arduino, ESP32, and other microcontrollers. With quick setup eBook.

Buy on Amazon

What next?

Esta es solo la primera parada. Próximamente te enseñaré a configurar la placa con ESPHome, integrarla en Home Assistant y llevarla al terreno con un sistema de riego inteligente. ¡Te sorprenderá todo lo que puedes hacer con ella!

Leave a comment