Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
】Resource
Schematic
Document
Esp32-s3 Technical Reference Manual
Esp32-s3 Wroom-1 Wroom-1U Datasheet
Demo
Software
】Overview
Parameter
Items | Parameters |
Supply Voltage | 7~36V (or 5V/1A Type-C Interface) |
Relay channels | 6 CH |
Contact form | 1NO 1NC |
Interface | Type-C |
Communication Protocol | USB Protocol |
Dimensions | 88(H) x 122(V)mm |
Onboard Interface
GPIO Control | Function | Description |
GP0 | BOOT Key | BOOT Key Control Pin |
GP21 | BUZZER | Buzzer Control Pin |
GP38 | RGB | RGB LED Control Pin |
GP1 | CH1 | Relay No.1 Control Pin |
GP2 | CH2 | Relay No.2 Control Pin |
GP41 | CH3 | Relay No.3 Control Pin |
GP42 | CH4 | Relay No.4 Control Pin |
GP45 | CH5 | Relay No.5 Control Pin |
GP46 | CH6 | Relay No.6 Control Pin |
GP17 | TXD | UART TX, converted to RS485 |
GP18 | RXD | UART 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.
File | Function | Note |
MAIN_WIFI_AP | RS485 Interface Control | Support directly programmed Only support when the Web interface connects to WIFI |
Bluetooth Control, Bluetooth sends IP | ||
Web Interface Control (Close) | ||
MAIN_WIFI_STA | RS485 Interface Control | Only 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_MQTT | RS485 Interface Control | Only 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_ALL | RS485 Interface Control | Only 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.
Command | Function |
06 05 00 01 55 00 A2 ED | Switch CH1 relay ON/OFF |
06 05 00 02 55 00 52 ED | Switch CH2 relay ON/OFF |
06 05 00 03 55 00 03 2D | Switch CH3 relay ON/OFF |
06 05 00 04 55 00 B2 EC | Switch CH4 relay ON/OFF |
06 05 00 05 55 00 E3 2C | Switch CH5 relay ON/OFF |
06 05 00 06 55 00 13 2C | Switch CH6 relay ON/OFF |
06 05 00 FF FF 00 BD BD | All relays ON |
06 05 00 FF 00 00 FC 4D | All 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.
Command | Function | |
ASCII | Hex | |
1 | 0x31 | Switch CH1 Relay ON/OFF |
2 | 0x32 | Switch CH2 Relay ON/OFF |
3 | 0x33 | Switch CH3 Relay ON/OFF |
4 | 0x34 | Switch CH4 Relay ON/OFF |
5 | 0x35 | Switch CH5 Relay ON/OFF |
6 | 0x36 | Switch CH6 Relay ON/OFF |
7 | 0x37 | ALL Relays ON |
8 | 0x38 | ALL 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 Command | Function |
06 01 | Switch Modbus RTU Relay's CH1 relay ON/OFF |
06 02 | Switch Modbus RTU Relay's CH2 relay ON/OFF |
06 03 | Switch Modbus RTU Relay's CH3 relay ON/OFF |
06 04 | Switch Modbus RTU Relay's CH4 relay ON/OFF |
06 05 | Switch Modbus RTU Relay's CH5 relay ON/OFF |
06 06 | Switch Modbus RTU Relay's CH6 relay ON/OFF |
06 07 | Switch Modbus RTU Relay's CH7 relay ON/OFF |
06 08 | Switch Modbus RTU Relay's CH8 relay ON/OFF |
06 09 | ALL Modbus RTU Relay's relays ON |
06 0A | ALL 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.
Items | Parameters |
RTC_OPEN_Time_Hour | All relay timing switch ON --in hours |
RTC_OPEN_Time_Min | All relay timing switch ON --in minutes |
RTC_Closs_Time_Hour | All relay timing switch OFF --in hours |
RTC_Closs_Time_Min | All 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.