• sales

    +86-0755-88291180

ESP32-S3-Relay-6CH Users Guide

】Resource

Schematic

Schematic Diagram

Document

Esp32-s3 Datasheet

Esp32-s3 Technical Reference Manual

Esp32-s3 Wroom-1 Wroom-1U Datasheet

Demo

Demo

Software

SSCOM

nRF Connect


】Overview

Parameter

ItemsParameters
Supply Voltage7~36V (or 5V/1A Type-C Interface)
Relay channels6 CH
Contact form1NO 1NC
InterfaceType-C
Communication ProtocolUSB Protocol
Dimensions88(H) x 122(V)mm

Onboard Interface

GPIO ControlFunctionDescription
GP0BOOT KeyBOOT Key Control Pin
GP21BUZZERBuzzer Control Pin
GP38RGBRGB LED Control Pin
GP1CH1Relay No.1 Control Pin
GP2CH2Relay No.2 Control Pin
GP41CH3Relay No.3 Control Pin
GP42CH4Relay No.4 Control Pin
GP45CH5Relay No.5 Control Pin
GP46CH6Relay No.6 Control Pin
GP17TXDUART TX, converted to RS485
GP18RXDUART RX pin, converted to RS485

】Multifunction Control

Example Analyze

[] Here we provide four examples for performing the following functions. Users can write their examples to realize other functions, these examples provided are only for simple operation of the device.

[] The factory default demo is MAIN_WIFI_AP.

FileFunctionNote
MAIN_WIFI_APRS485 Interface ControlSupport directly programmed
Only support when the Web interface connects to WIFI

Bluetooth Control, Bluetooth sends IP
Web Interface Control (Close)
MAIN_WIFI_STARS485 Interface ControlOnly support after modify
Require WIFI connection after Modify
Web page for intranet use only
Bluetooth control, Bluetooth sends IP
Web Interface Control (short-distance)
MAIN_WIFI_MQTTRS485 Interface ControlOnly support after modify
Require WIFI connection after Modify
Require Create device on Waveshare cloud platform

Bluetooth Control, Bluetooth sends IP
Waveshare Cloud Control (long-distance)
MAIN_ALLRS485 Interface ControlOnly support after modify
Require WIFI connection after Modify
Require Create device on Waveshare cloud platform
Web page for intranet use only

Bluetooth control, Bluetooth sends IP
Web Interface Control (short-distance)
Waveshare Cloud Control (long-distance)

Preparation

】Parameter Setting

Set Flash size and partition:

】Install Library Files

Install ArduinoJson library:

Install PubSubClient library:

Install NTPClient library:

】Demo Modify

There is a WS_Information.h file in each example, please change the content of the file to user information.

Take MAIN_ALL as an example:

Open WS_Information.h file:

Modify the WIFI "Waveshare-TL" and the password "waveshare".

For example, change the WIFI to be connected as "Waveshare-WIFI", and the password is "123456789", as shown below:

If you need to control relays on the Waveshare cloud platform, the device needs to be created first.

Modify the related data according to the devices on the Waveshare cloud platform.

As modified as below:

】Demo Flash

Demo modification is complete, after connecting the device, select the development board and COM port.


Click to flash.

RS485 Control

Connect the RS485 device to ESP32-S3-Relay-6CH, send commands to ESP32-S3-Relay-6CH for each relay ON/OFF, and the baud rate is 115200 by default.

CommandFunction
06 05 00 01 55 00 A2 EDSwitch CH1 relay ON/OFF
06 05 00 02 55 00 52 EDSwitch CH2 relay ON/OFF
06 05 00 03 55 00 03 2DSwitch CH3 relay ON/OFF
06 05 00 04 55 00 B2 ECSwitch CH4 relay ON/OFF
06 05 00 05 55 00 E3 2CSwitch CH5 relay ON/OFF
06 05 00 06 55 00 13 2CSwitch CH6 relay ON/OFF
06 05 00 FF FF 00 BD BDAll relays ON
06 05 00 FF 00 00 FC 4DAll relays OFF

】Hardware Connection

   Take USB TO 4CH Serial Converter for example:

ESP32-S3-Relay-6CH

USB TO 4CH Serial Converter - PORT B
RS485 - A+Port B - A+
RS485 - B-Port B - B-

】Software Operation

Sending data through SSCOM.

Open SSCOM, and select the COM port corresponding to Port B connected as above.

Open COM, and use the multiple send function to quickly send commands.

With the following commands, you can control the relays.

Web Interface control

Connect your mobile phone to ESP32-S3-Relay-6CH with Bluetooth Debugging Assitant, and then get the IP after the WIFI connection, you can enter the Web interface with this IP.

】AP Mode

Connect to ESP32-S3-Relay-6CH's WIFI, and the WIFI name is "ESP32-S3-Relay-6CH", and the password is "waveshare".

Get Current IP through Bluetooth Debugging Assistant.

Enter the Web interface, and you can control relays. (It takes a little while to configure the device after powering up, and the first time you enter the web page after each power-up may be slow.)

】STA Mode

After power on, it automatically connects to the configured WIFI ( Before programming, you need to Modify WIFI to be Connected)

Get Current IP through Bluetooth Debugging Assistant.

Enter the Web interface, and you can control relays. (It takes a little while to configure the device after powering up, and the first time you enter the web page after each power-up may be slow.)

】Bluetooth Control

Use your mobile phone to connect ESP32-S3-Relay-6CH through Bluetooth Debugging Assistant, and send commands to ESP32-S3-Relay-6CH for controlling all relays ON/OFF.

Please note that some Bluetooth debugging assistants send data in ASCII form by default, you need to enter the correct control commands according to the Bluetooth debugging assistant before controlling the device.

CommandFunction
ASCIIHex
10x31Switch CH1 Relay ON/OFF
20x32Switch CH2 Relay ON/OFF
30x33Switch CH3 Relay ON/OFF
40x34Switch CH4 Relay ON/OFF
50x35Switch CH5 Relay ON/OFF
60x36Switch CH6 Relay ON/OFF
70x37ALL Relays ON
80x38ALL Relays OFF

】Software Operation (Get IP)

Use nRF Connect on your phone to control relays (or you can use other Bluetooth Debugging Assistants).

Take nRF Connect as an example:

Bluetooth name: ESP32 S3 Relay 6CH.

After connection, select "Unknown Service", and click to read the data. If the WIFI fails to be connected for a long time, the RGB turns red and is always on. This step does not have any response.

After connecting to WIFI, it receives the device IP. As shown below, the Device IP is 192.168.6.133.

Bluetooth control relay commands are characters 1~8, i.e. hexadecimal 0x31 ~ 0x38.

Click to send, Fill in the data to be sent (currently sent in hexadecimal), and enter 0x31 as follows:

Send "0x31" to switch the CH1 relay status.

Send "0x38" to control all relays OFF.

Waveshare Cloud Platform

】Create Device

Login to Waveshare cloud.

Then, enter "Devices Manager" to "Add New" device, and fill in "Type Name":

Created successfully.

Create another device by "One-click Add" -> "Common Device Template".

ESP32-S3-Relay-6CH TO Cloud 2.png


Edit "Enter Device Name":

Click to edit and select its device type.

Save.


Then, you can see the device details. Modify WS_Information.h file and Flash it before using.

】Software Operation

Go to Waveshare website, and enter Waveshare Cloud.

Complete registration and create device.

Modify the corresponding MQTT and WIFI.

Demo Flash.

Enter "Dashboard" on the Waveshare Cloud Platform.

Select the corresponding device option and "Enter Development".

】External Expansion

RS485 Expand Relay Channel

Use Modbus RTU Relay to expand the 8-ch relay.

The 4 main example files are already compatible with this operation, you need to set Extension_Enable in WS_imformation.h to 1 (default is 1).

Externally expandable relays can be controlled via Bluetooth.

Operation CommandFunction
06 01Switch Modbus RTU Relay's CH1 relay ON/OFF
06 02Switch Modbus RTU Relay's CH2 relay ON/OFF
06 03Switch Modbus RTU Relay's CH3 relay ON/OFF
06 04Switch Modbus RTU Relay's CH4 relay ON/OFF
06 05Switch Modbus RTU Relay's CH5 relay ON/OFF
06 06Switch Modbus RTU Relay's CH6 relay ON/OFF
06 07Switch Modbus RTU Relay's CH7 relay ON/OFF
06 08Switch Modbus RTU Relay's CH8 relay ON/OFF
06 09ALL Modbus RTU Relay's relays ON
06 0AALL Modbus RTU Relay's relays OFF

Bluetooth control relay commands are characters 1~8, i.e. hexadecimal 0x06 0x01 ~ 0x38 0x0A.

Click to send, fill in the data to be sent (currently sent in hexadecimal), as follows: 0x06 0x01.

Send 0x06 0x01 to switch CH1 relay status.

Send 0x06 0x0A to switch all relays OFF.

】Working with Pico for Timer Switch Function

Use Pico-RTC-DS3231 to expand the timer switch function.

Connect Pico-RTC-DS3231 to ESP32-S3-Relay-6CH.

This function is compatible with the above four main sample files. What you need to do is to set "RTC_Enable" in "WS_imformation.h" to 1 (The default setting is 0, please make sure it is connected to Pico-RTC-DS3231).

Set RTC_OPEN_Time_Hour, RTC_OPEN_Time_Min, RTC_Close_Time_Hour, and RTC_Close_Time_Min in WS_imformation.h to the operation time.

ItemsParameters
RTC_OPEN_Time_HourAll relay timing switch ON --in hours
RTC_OPEN_Time_MinAll relay timing switch ON --in minutes
RTC_Closs_Time_HourAll relay timing switch OFF --in hours
RTC_Closs_Time_MinAll relay timing switch OFF --in minutes

The following settings are set to open at 08:06 and close at 16:30 every day.

Working with Pico for Expanding CAN Interface

Use Pico-CAN-B to expand the CAN communication interface.

】Preparation

Install mcp_can library:

】User Manual

Connect Pico-CAN-B to ESP32-S3-Relay-6CH.

Download Pico-CAN-B example demo.

Modify it according to your needs.

In the main program, use the files WS_MCP2515.c and WS_MCP2515.h.

After including, you can use the functions receiveCANData(uint32_t* canId, uint8_t* data) and sendCANData(uint32_t canId, uint8_t len, uint8_t* data) in the main program for CAN data receiving and CAN data sending, respectively.

Working with Pico For Expanding Environment Monitoring Function

Use Pico-Environment-Sensor to expand the environment monitoring function.

】Preparation

Install Adafruit BME280 library:

Select "Install All".

Install Adafruit TSL2591 library:

Select "Install All":

Install Adafruit LTR390 library:

Select "Install All":

Install Adafruit SGP40 library:

Select "Install All":

】How to Use

Connect the Pico-Environment-Sensor to ESP32-S3-Relay-6CH.

Download Pico-Environment-Sensor sample demo

Use Environment_Sensor.c and Environment_Sensor.h in the main demo.

Modify it according to your needs.

Working with Pico for Expanding RS232/RS485 Interface

Please note that when using the Pico-2CH-RS485 expansion with the RS485 interface, only Channel 1 is supported. Channel 0 is not available for use.

Use Pico-2CH-RS232 to expand RS232 interface.

】How to Use

Connect Pico-2CH-RS232 or Pico-2CH-RS485 to ESP32-S3-Relay-6CH.

Download Pico-2CH-RS232 example demo (This demo is compatible with the above two devices.)

In the main program, include the file WS_UART.h.

Modify it according to your needs.

Currently, real-time printing of received characters is enabled.

Call the initialization function Extension_Init() in setup.

After calling, you can send data in the main loop demo using the functions SetData2(uint8_t* data, size_t length) and SetData3(uint8_t* data, size_t length).

】Use in Micropython

Flash Firmware Demo

Download and unzip the MicroPython firmware: (Flash Tool and Firmware).

Connect the device to the PC.

Open the flash_download_tool_3.9.4.exe software, select ESP32-S3 and USB.

Select the corresponding COM port, as we have configured it well, just click on "Start" to download. (If the COM port is not identified, please press and hold the BOOT key, press the RESET key, and then release the RESET key first.)

If you encounter downloading delays or the download doesn't start, you can enter Download mode, press and hold the BOOT key while pressing the RESET key, and then release the RESET key first. Try to download it again, and wait for the flashing process to complete.

Preparation

】Thonny

Install Thonny (Thonny IDE)

Open Thonny, click on "Python x.x.x" at the bottom right, and select "Configure interpreter".

In the popup window, select "Interpreter" -> Interpreter select "MicroPython (ESP32)".

Save the setting.

Click to stop, Shell window appears "MicroPython v1.22.1 on 2024-01-05; using the generic ESP32S3 module for ESP32S3 Enter "help()" for more information." this means the connection is successful.

Demo Upload

Download MicroPython sample demo.

Open the file window on Thonny.

View the file path.

Enter Path to the example file on Thonny.

Press Ctrl and select all files on the directory, right-click and select "Upload to/".

Waiting for the uploading to finish.

After uploading successfully, you can see the uploaded file in the device file window, the current example can realize the Bluetooth control device, according to their own needs for secondary development.