• sales

    +86-0755-88291180

ESP32-C6-Relay-1CH-U User Guide

Features​

  • Based on the ESP32-C6 microcontroller with a RISC-V 32-bit single-core processor running at up to 160 MHz.
  • Integrates 2.4 GHz Wi-Fi 6, Bluetooth Low Energy, and IEEE 802.15.4 wireless communication, supporting Zigbee 3.0 and Thread.
  • On-board 1-channel relay, allowing 250 V AC or 30 V DC loads with a current not exceeding 10 A.
  • On-board isolated RS485 interface for connecting RS485 Modbus industrial expansion modules or sensors. The address and protocol of the external device must match during communication.
  • On-board RTC clock chip supporting scheduled tasks.
  • On-board USB Type-C connector for power supply, download, and debugging.
  • On-board power terminal block supporting DC 5–36 V supply only.
  • On-board optocoupler isolation, reducing interference from the external high-voltage relay circuit on the control chip.
  • On-board digital isolation, reducing interference from external signals on the control chip.
  • On-board integrated power isolation, supplying the isolated side without an additional power input.
  • On-board RS485 transmit and receive indicator LEDs for checking the data transmission and reception status.
  • Rail-mounted protective enclosure that can be mounted on a standard 35 mm DIN rail.

Specifications​

ParameterDescription
ModelESP32-C6-Relay-1CH-U
MicrocontrollerESP32-C6
Wireless communication2.4 GHz Wi-Fi 6, Bluetooth 5 (LE)
USB interface
Interface type: USB Type-C
Supply voltage: 5 V
Functions: device power, USB communication, and firmware download
Isolated RS485
Interface type: terminal block
Direction control: transmit and receive direction switched automatically via MCU UART hardware flow control
Interface protection: TVS, surge, and ESD protection
Matching resistor: 120 Ω matching resistor reserved, disconnected by default, can be connected with a jumper cap
Relay
Allowed load: 250 V AC or 30 V DC, current not exceeding 10 A
Number of relay channels: 1
Contact type: normally open (NO)
Isolation type: optocoupler isolation
Indicator LEDs
PWR: lights red when the supply voltage is detected
Relay: lights when the normally open contact is closed
RS485: lights green when sending data and blue when receiving data
Terminal power supplySupply range: DC 5–36 V
DC-DC power module
Output voltage: 3.3 V
Maximum output current of the module: 3 A
Load requirement: loads connected to SH1.0 must account for the power consumed by the on-board circuits
Antenna connectorExternal SMA antenna
EnclosureRail-mount protective enclosure
Dimensions91.6 × 23.3 × 58.7 mm

Interfaces​


Upper Connectors​

  • Power terminal
    • VCC is the positive supply, with an input range of DC 5–36 V.
    • GND is the negative supply.
  • USB Type-C is used for 5 V power, firmware download, and USB communication.
  • SH1.0 expansion connector
    • GND is ground.
    • 3V3 is the 3.3 V power output.
    • GPIO7 and GPIO6 are expansion IOs.
  • SMA connector for connecting an external antenna.

Lower Connectors​

  • RS485 terminal
    • A+ and B- connect to A+ and B- of the peer device respectively.
  • Relay terminal
    • COM is the common terminal.
    • NO is the normally open terminal, which conducts with COM when the relay is energized.

On-board Resources​


  1. ESP32-C6 MCU runs at up to 160 MHz and supports 2.4 GHz Wi-Fi 6 and Bluetooth Low Energy.
  2. USB Type-C connector for 5 V power, firmware download, and USB communication.
  3. Power terminal block supports DC 5–36 V supply.
  4. Status indicator LEDs PWR lights red when the supply voltage is detected. Relay lights when the normally open contact is closed. RS485 lights green when sending data and blue when receiving data.
  5. RTC battery connector uses an SH1.0 connector for connecting a rechargeable RTC battery.
  6. BOOT button works with the RESET button to enter download mode.
  7. RESET button resets the device.
  8. Optocoupler isolation reduces interference from the external high-voltage relay circuit on the MCU.
  9. RS485 termination resistor jumper the on-board 120 Ω matching resistor is disconnected by default and can be connected with a jumper cap.
  10. RS485 terminal block brings out the A+ and B- signals.
  11. Power isolation supplies the isolated side without an additional power input.
  12. Relay 1 normally open contact. Allows 250 V AC or 30 V DC loads with a current not exceeding 10 A.
  13. Relay terminal block brings out the common terminal COM and the normally open terminal NO.
  14. DC-DC power module output voltage 3.3 V, maximum output current 3 A.
  15. PCF85063 real-time clock (RTC) can run scheduled tasks with the program.
  16. RS485 transceiver for RS485 data transmission and reception.
  17. TVS (transient voltage suppressor) suppresses surges and transient voltage spikes.
  18. Digital isolation reduces interference from external signals on the MCU.
  19. Open-window tinned traces in the load circuit improve current-carrying capability and suppress temperature rise.

GPIO Definition Diagram​


Device Wiring Diagram​

Read Electrical Safety Precautions for Power and Relays before wiring. Connect the device power to the upper power terminal, and connect the load circuit to the COM and NO terminals at the bottom.


Dimensions​


Instructions for Use

Electrical Safety Precautions for Power and Relays​

  • This product must be installed and used by a professional electrician or technician. Take proper precautions for electrical safety, leakage protection, and insulation during use.
  • Before installing, servicing, or replacing the relay device, always switch off the power and unplug it.
  • Do not attempt to disassemble the relay device; doing so may damage the device or cause electric shock.
  • Install and place the relay device properly. Do not use it in damp, overheated, flammable, or explosive environments, to avoid safety accidents caused by careless installation or use.

1. Load Matching​

  • Confirm that the rated voltage and current of the relay match the load, and never use it overloaded. Excessive current may weld the contacts or even cause a fire.
  • For inductive loads (such as motors and coils) or other loads with a high inrush current, the start-up current may be far higher than the rated current; choose a relay whose rated current has sufficient margin.

2. Short-Circuit and Overcurrent Protection​

  • Add a fuse or a circuit breaker to the relay circuit to prevent a load short circuit or accidental overcurrent from burning out the relay.
  • When wiring, make sure the load circuit has no short circuit, and select protective components with a suitable rated current if necessary.

3. Arcing and Switching Protection​

  • An arc is generated at the moment the relay switches, which easily causes contact wear or welding.
  • For inductive loads, use arc suppression such as an RC snubber or a varistor.

4. Installation Environment​

  • Avoid using the product in damp, high-temperature, flammable, explosive, or dusty environments.
  • Install the relay securely, and avoid vibration or shock that may cause false operation or damage.

5. Power-Off Operation​

  • Before servicing, wiring, or replacing the relay, always cut off the power to ensure personal and equipment safety.
  • Avoid severe vibration or strong magnetic interference, and confirm the relay operating state after installation.

6. State Confirmation​

  • After power-up, confirm or reset the relay state as needed, to avoid an abnormal operating state caused by transportation, installation, or external interference.
  • Avoid cutting the power while the relay is switching, to prevent an indeterminate state or contact damage.

7. Periodic Inspection​

  • After long-term use, periodically check the relay contacts, terminal blocks, and insulation to ensure normal operation.
  • If abnormal heating, a burning smell, or burn marks appear, cut off the power immediately and replace the relay.

Development Tools​

The ESP32-C6-Relay-1CH-U supports Arduino IDE and ESP-IDF development.

Arduino IDE can be used to open, compile, and flash the Arduino examples; for the procedure, see Working with Arduino.

ESP-IDF is Espressif's development framework. For the project configuration, build, and flash method of the relay control example, see Working with ESP-IDF.

Required Hardware​

  • ESP32-C6-Relay-1CH-U × 1, with the included SMA antenna installed.
  • USB Type-C cable that supports data transfer × 1, for connecting the device to the computer.
  • Modbus RTU Relay expansion module × 1, required only for the expansion example.
  • USB-TO-RS485-B converter × 1, required only for debugging RS485 from a computer.
BEFORE YOU START

Read the FAQ before operating. For the example programs and flashing tools, see Resources.

Power Supply and Interfaces​

VOLTAGE RANGES OF THE TWO POWER INPUTS

The USB Type-C supply voltage is 5 V. DC 5–36 V applies only to the power terminal block. When using the terminal block, confirm that VCC and GND connect to the positive and negative supply respectively.

Install the included SMA antenna. Power the device through USB Type-C or the upper power terminal. For the terminal locations, see Interfaces.

  • Connect the relay load circuit to the COM and NO terminals at the bottom. For the wiring, see Device Wiring Diagram.
  • Connect the A+ and B- of the isolated RS485 to the corresponding terminals of the peer device. The on-board 120 Ω matching resistor is disconnected by default; connect it with a jumper cap when termination is needed.
  • The SH1.0 expansion connector at the top brings out GND, 3V3, GPIO7, and GPIO6. There is also an internal SH1.0 RTC battery connector for a rechargeable RTC battery.

RS485 Relay Channel Expansion​

  • Use the Modbus RTU Relay to expand the relay channels. With the power off, connect the A+ and B- of both ends respectively, and then power the expansion module as required.
  • The Arduino example sets Extension_Enable in WS_Information.h to 1 by default. The example sends to the expansion module at address 0x01, with serial parameters of 9600 baud and 8N1.
  • Connect the ESP32-C6-Relay-1CH-U as described in Bluetooth Control steps. Send the two-byte command to the writable characteristic in nRF Connect, and the C6 forwards it to the expansion module over RS485.
CommandFunction
06 01Toggle the CH1 relay of the expansion module
06 09Energize all relays of the expansion module
06 0ADe-energize all relays of the expansion module

Controlling CH2–CH8 individually requires adding the corresponding command handling to the example. The figures below use the S3 to demonstrate the nRF Connect write operations; when connecting, select the Bluetooth advertising name of the C6.

  • Open the write interface of the writable characteristic, select the hexadecimal byte mode, and enter 0601.


  • Click "SEND" to send 06 01, and check whether the CH1 relay state of the expansion module toggles.


  • After sending 06 0A, check whether all relays of the expansion module are de-energized.


Working with Arduino

This chapter contains the following sections. Read them as needed.

Arduino Getting Started Tutorial​

New to Arduino ESP32 development and looking for a quick start? We have prepared a comprehensive Getting Started Tutorial for you.

Note: This tutorial uses the ESP32-S3-Zero as a reference example, and all hardware code is based on its pinout. Before you start, we recommend checking the pinout of your development board to ensure the pin configuration is correct.

Development Environment Setup​

1. Install and Configure the Arduino IDE​

Refer to the Install and Configure the Arduino IDE tutorial to download and install the Arduino IDE and add ESP32 support.

Board installation requirements for the ESP32-C6-Relay-1CH-U

Board packageInstallation requirementVersion
esp32 by Espressif SystemsInstall from the Boards Manager4.0.0

2. Install Libraries​

  • Get the repository from Example Programs, and install the bundled libraries in examples/arduino/libraries into the libraries directory of your Arduino sketchbook.
  • For the installation steps, see the Install and Configure the Arduino IDE tutorial. BLE, Wi-Fi, and WebServer are provided by the ESP32 board package.

Library installation requirements for the ESP32-C6-Relay-1CH-U

LibraryDescriptionBundled versionInstallation requirement
ArduinoJsonParse and generate JSON messages7.2.1Use the version bundled with the repository
PubSubClientSubscribe to and publish MQTT messages2.8Use the version bundled with the repository

Example Programs​


Open the .ino file with the same name in the selected example directory under examples/arduino/examples, and modify WS_Information.h as required by the example.

ESP32-C6-Relay-1CH-U example programs

ExampleBasic example descriptionConfiguration before use
MAIN_WIFI_APRS485, Bluetooth, and AP web page controlUse the hotspot configured in the example
MAIN_WIFI_STARS485, Bluetooth, and STA web page controlSet the router Wi-Fi SSID and password
MAIN_WIFI_MQTTRS485, Bluetooth, and MQTT controlSet the Wi-Fi and MQTT parameters
MAIN_ALLRS485, Bluetooth, STA web page, and MQTT controlSet the Wi-Fi and MQTT parameters

Arduino Project Settings​

Disconnect the relay load power before flashing, and connect the device with a USB data cable.

Configure the settings as shown in the table below under the "Tools" menu in the Arduino IDE.

Arduino IDE optionExample repository configuration
Board"ESP32C6 Dev Module"
PortSelect the COM port assigned to the device by your computer
USB CDC On Boot"Disabled"
Flash Size"16MB (128Mb)"
Partition Scheme"16M Flash (3MB APP/9.9MB FATFS)"


MAIN_WIFI_AP​

Program Description

  • This example starts the Wi-Fi AP mode and allows the on-board relay to be controlled through a web page, Bluetooth, or RS485.

Notes

  • Open and upload MAIN_WIFI_AP.ino. To access the web page, the computer or phone must connect to the device hotspot.

RS485 Control​

Connect an RS485 device to the ESP32-C6-Relay-1CH-U, and send the hexadecimal commands in the table below to control the on-board relay.

CommandFunction
06 05 00 01 55 00 A2 EDToggle the CH1 relay
06 05 00 FF FF 00 BD BDEnergize the CH1 relay
06 05 00 FF 00 00 FC 4DDe-energize the CH1 relay
  • Hardware connection. With the power off, select a USB-to-RS485 converter. Connect the converter's A+ and B- to the device's A+ and B- respectively, and then power the device.

  • Software operation.

    • Open SSCOM, select the COM port of the converter, and set a 9600 baud rate, 8 data bits, no parity, and 1 stop bit (8N1).
    • Select hexadecimal sending and open the serial port. When switching between several commands, use the multi-send feature.


  • After sending the corresponding command, watch the Relay indicator LED on the panel.


Bluetooth Control​

Connect the device with a Bluetooth debugging tool on your phone (such as nRF Connect). Send one character in text mode, or one byte in hexadecimal mode.

ASCIIHexFunction
10x31Toggle the CH1 relay
90x39Energize the CH1 relay
00x30De-energize the CH1 relay

Software Operation

The following images show the general nRF Connect operations. When scanning, select the advertising name of this product, ESP32-C6-Relay-1CH-U. The current IP address of the device is subject to the actual reading.

  • Scan for and connect to the device, and open the service with UUID 4fafc201-1fb5-459e-8fcc-c5c9c331914b.


  • Read the characteristic with UUID beb5484a-36e1-4688-b7f5-ea07361b26a8 to obtain the device IP.


  • Open the write characteristic with UUID beb5483e-36e1-4688-b7f5-ea07361b26a8. Enter 31 in hexadecimal mode.


  • Click "SEND" and watch the Relay indicator LED. Use 39 to energize the relay and 30 to de-energize it.


For the two-byte commands of the external relay, see RS485 Relay Channel Expansion.

Web Page Control​

  • AP mode

    • Connect to the ESP32-C6-Relay-1CH-U hotspot; the default password is waveshare. If APSSID or APPSK has been changed, use the customized name and password.


    • Open http://192.168.4.1/ in a browser. On the "Relay Control" page, click "Flipped State" to toggle the relay, or use "Relay On" to energize it or "Relay Off" to de-energize it.


    • Check the on-board clock on the "RTC Event" page. After setting the date, time, CH1 action, and repeat mode, click "New Event" to add a scheduled task.


Working with ESP-IDF

This chapter contains the following sections. Read them as needed.

ESP-IDF Getting Started Tutorial​

New to ESP32 ESP-IDF development and looking to get started quickly? We have prepared a general Getting Started Tutorial for you.

Please Note: This tutorial uses the ESP32-S3-Zero as a teaching example, and all hardware code is based on its pinout. Before you start, it is recommended that you check the pinout of your development board to ensure the pin configuration is correct.

ESP-IDF Development Environment Setup​

NOTE

The following guide uses Windows as an example, demonstrating development using VS Code + the ESP-IDF extension. macOS and Linux users should refer to the official documentation.

VERSION SELECTION

The screenshots in this section use ESP-IDF V5.5.2 as an example. When installing, please select the ESP-IDF version that matches your board's example.

Install the ESP-IDF Development Environment​

  1. Download the installation manager from the ESP-IDF Installation Manager page. This is Espressif's latest cross-platform installer. The following steps demonstrate how to use its offline installation feature.

    Click the Offline Installer tab on the page, then select Windows as the operating system and the ESP-IDF version you need (the version shown in the screenshot is for reference only — choose the version that fits your actual needs).


    After confirming your selection, click the download button. The browser will automatically download two files: the ESP-IDF Offline Package (.zst) and the ESP-IDF Installer (.exe).


    Please wait for both files to finish downloading.

  2. Once the download is complete, double-click to run the ESP-IDF Installer (eim-gui-windows-x64.exe).

    The installer will automatically detect if the offline package exists in the same directory. Click Install from archive.


    Next, select the installation path. We recommend using the default path. If you need to customize it, ensure the path does not contain Chinese characters or spaces. Click Start installation to proceed.


  3. When you see the following screen, the ESP-IDF installation is successful.


  4. We recommend installing the drivers as well. Click Finish installation, then select Install driver.


Install Visual Studio Code and the ESP-IDF Extension​

  1. Download and install Visual Studio Code.

  2. During installation, it is recommended to check Add "Open with Code" action to Windows Explorer file context menu to facilitate opening project folders quickly.

  3. In VS Code, click the Extensions icon Extensions Icon in the Activity Bar on the side (or use the shortcut Ctrl + Shift + X) to open the Extensions view.

  4. Enter ESP-IDF in the search box, locate the ESP-IDF extension, and click Install.


  5. For ESP-IDF extension versions ≥ 2.0, the extension will automatically detect and recognize the ESP-IDF environment installed in the previous steps, requiring no manual configuration.

Example Programs​

EXAMPLE VERSION

This example is installed with ESP-IDF v6.1.0; select that version.

Get the repository from ESP32-C6-Relay-1CH-U Example Programs. The ESP-IDF project is located in examples/esp-idf/ESP32-C6-Relay-1CH-U, and the same project supports the following two modes.

ModeBasic example description
Wi-Fi AP + WebDefault mode. The device creates a Wi-Fi hotspot; a computer or phone joins the hotspot and then controls the relay.
Wi-Fi STA + WebThe device connects to a 2.4 GHz router, and a computer or phone on the same LAN controls the relay.

Build and Flash​

Hardware Connection

  • Disconnect the relay load power, and connect the device to the computer with a USB Type-C cable that supports data transfer.

Project Configuration

  1. Enter the project directory in the ESP-IDF terminal. Select the target chip during the initial configuration.

    idf.py set-target esp32c6
  2. When using the default AP mode, you can compile directly. To connect to a router or change the hotspot parameters, run idf.py menuconfig and select the network mode under "Component config" > "ESP32-CX-Relay-1CH-U demo configuration" > "Demo mode".

    • In AP mode, set the device hotspot name and password through "Wi-Fi access point SSID" and "Wi-Fi access point password".
    • In STA mode, fill in the router Wi-Fi SSID and password in "Wi-Fi station SSID" and "Wi-Fi station password".
  3. Build, flash, and open the serial log. Replace PORT with the actual port of the device.

    idf.py build
    idf.py -p PORT flash monitor

Connect to the Device and Control the Web Page​

AP Mode

  1. Select ESP32-C6-Relay-1CH-U in the Wi-Fi list of the computer or phone. The default hotspot password of the GitHub ESP-IDF example is 12345678.


  2. Open http://192.168.4.1/ in a browser and go to the "Overview" page of Relay Studio.

STA Mode

  • After building and flashing with the STA configuration, check STA IP= in the serial log. Connect the computer or phone to the same LAN, and open the IP address shown in the log in a browser.

Relay Control

  • In the "Relay Control" area, click "Turn On" or "Turn Off". Watch the CH1 output status on the web page and the Relay indicator LED on the device.
  • "Onboard RTC" shows the on-board RTC time. If the time is inaccurate (for example, the date shows 1970), first confirm that the computer or phone time is correct, and then click "Sync Clock".


Scheduled Tasks​

  1. Check the RTC time of the device. Click "Schedules" on the left, and then click "Add Schedule".


  2. Select the execution date and time, the relay action, and the repeat rule. For the first verification, choose an execution time later than the current RTC time and set the task to run only once.

  3. After saving, confirm in the list that the task has been added. When the set time arrives, check whether the CH1 output status and the Relay indicator LED match the configured action.

Tasks run according to the device RTC time, and up to 10 tasks can be added. The tasks are cleared after the device restarts.

RS485 Control​

With the power off, connect the A+ and B- of the USB-to-RS485 converter to the corresponding terminals of the device. After connecting, power the device, set the serial tool to a 9600 baud rate, 8 data bits, no parity, and 1 stop bit (8N1), and send the commands in hexadecimal.

OperationHexadecimal frame
Toggle the relay06 05 00 01 55 00 A2 ED
Energize the relay06 05 00 FF FF 00 BD BD
De-energize the relay06 05 00 FF 00 00 FC 4D

Watch the Relay indicator LED on the panel after sending. The example echoes the received data back over RS485 unchanged.


ESP32-C6-Relay-1CH-U Firmware Flashing and Erasing

You can flash the test firmware to verify the on-board device functions.

Before flashing or erasing, disconnect the relay load power. Connect the device through USB Type-C and select ESP32-C6 in the flashing tool. Erasing the Flash clears the existing firmware and configuration.

The following steps apply to the firmware provided on this page.

  • Download and extract Espressif's official Flash Download Tool (Download)

  • Run Flash Download Tool and select the options that match the development board's MCU and download interface. The screenshot below uses ESP32-S3 and USB as an example; use the options required by the product's hardware design.


  • Parameter settings

    • Select the COM port for the development board
    • Set BAUD to the maximum value, 1152000
    • Click the "..." button in the row, select the bin file provided by Waveshare, manually enter the flash address given at the top of this page in the field to its right, and select the leftmost checkbox in the row
    • Click START to begin flashing


  • Wait for flashing to complete (this may take some time; please be patient)

  • Press the reset button and verify the result


Resources and Documents

1. Example Programs​

2. Hardware Resources​

3. Technical Manuals​

4. Software Tools​


Support

Monday-Friday (9:30-6:30) Saturday (9:30-5:30)

Email: services01@spotpear.com


TAG: Dual-MCU-Board GC2083 Raspberry Pi 64MP Camera MPS2280 POE Raspberry Pi 5 PCIe to M.2 NVMe SSD Adapter Board HAT Pi5 2280/2242/2230 Pi5 Pure- OLED-LCD-HAT-A ESP32 UART USB Bus Servo ST RSBL Driver board For Raspberry PI Robot Jetson Orin 4G/3G/2G expansion board GNSS GPS SIM7600G-H-M.2 SpotPear raw display 1.46inch LCD TouchScreen Display 412×412 SPD2010 For Arduino /Raspberry Pi /ESP32 /Pico /STM32 E-Paper ESP32 Drone Development board DIY Flight Controller Open-Source Mini Quadcopter ESP32-S3 Industrial-Grade WiFi Relay IOT RS485 Communicator Bluetooth Raspberry Pi 5 ABS Case JETSON NANO B01 X1002 Raspberry Pi 5 PCIe to M.2 NVMe SSD Adapter Board HAT Pi5 2280 DeepSeek ESP32-S3 Voice Chat Robot espHome XiaoZhi Ball Cortex-A7 ESP32 S3 2.1 inch Round LCD Development Board 480x480 TouchScreen Display LVGL HMI With QMI8658C 6-Axis Sensor