• sales

    +86-0755-88291180

ESP32-S3-POE-ETH-8DI-8DO User Guide

Introduction

Introduction

ESP32-S3-ETH-8DI-8DO is an industrial-grade device based on the ESP32-S3 microcontroller, supporting WiFi, Bluetooth, RS485, CAN, and Ethernet interfaces, and featuring 8 digital input and 8 digital output channels over WiFi network. It has built-in protection circuits such as power supply isolation and optodecoupler isolation, which is safe, stable and reliable, and suitable for the AIoT field.

Features

  • Based on ESP32-S3 microcontroller with Xtensa 32-bit LX7 dual-core processor with frequency up to 240MHz
  • Integrated 2.4GHz WiFi and Bluetooth LE dual-mode wireless communication, with superior RF performance
  • The output utilizes Darlington transistors with optocoupler isolation, provides stronger driving capability with up to up to 500mA sink current, and built-in freewheeling diode protection
  • The digital input has bidirectional optocoupler isolation, supporting both passive and active switching input, and the digital output supports switch input linkage mode control
  • Onboard isolated RS485 interface, for connecting to various RS485 Modbus industrial modules or sensors
  • Onboard isolated CAN interface, for connecting to various CAN devices
  • Onboard pin header, allowing access to other devices
  • Onboard USB Type-C port for power supply, firmware downloading and debugging, making development more convenient
  • Onboard power supply screw terminal, supports 7~36V wide voltage input, suitable for industrial applications
  • Onboard RTC clock chip, supports timing tasks
  • Onboard W5500 Ethernet chip, extending 10/100Mbps network connectivity via SPI interface
  • Onboard PoE module for Power over Ethernet (IEEE 802.3af compliant)
  • Onboard optocoupler isolation to avoid external circuit interference with the control chip
  • Onboard digital isolation to avoid external signal interference with the control chip
  • Onboard integrated power isolation, providing stable isolation voltage, no extra power supply required for the isolated terminal
  • Onboard TF card slot, supporting external TF card storage for pictures or files
  • Onboard buzzer, RGB light, power supply, RS485 TX/RX indicator and CAN indicator for easy sensing of the operating status of the device
  • Rail-mounted ABS protective enclosure, easy to install, safe to use

Specifications

ItemParameter
Supply voltage7~36V (or 5V/1A Type-C port)
Digital output channels8 channels
Digital input channels8 channels
Wiring portType-C
Communication protocolUSB protocol
Dimensions90 (H) x 175 (V) (mm)

Interfaces


  • Digital Output
Control EXIOFunction
EXIO1Control pin for No. 1 digital output
EXIO2Control pin for No. 2 digital output
EXIO3Control pin for No. 3 digital output
EXIO4Control pin for No. 4 digital output
EXIO5Control pin for No. 5 digital output
EXIO6Control pin for No. 6 digital output
EXIO7Control pin for No. 7 digital output
EXIO8Control pin for No. 8 digital output
  • Digital Input
Control EXIOFunction
GPIO4Detection pin for No. 1 digital input
GPIO5Detection pin for No. 2 digital input
GPIO6Detection pin for No. 3 digital input
GPIO7Detection pin for No. 4 digital input
GPIO8Detection pin for No. 5 digital input
GPIO9Detection pin for No. 6 digital input
GPIO10Detection pin for No. 7 digital input
GPIO11Detection pin for No. 8 digital input
  • W5500 Ethernet chip
Control GPIOFunction
GPIO12ETH_INT
GPIO13ETH_MOSI
GPIO14ETH_MISO
GPIO15ETH_SCLK
GPIO16ETH_CS
GPIO39ETH_RST
  • TF Card
Control GPIOFunction
GPIO45SD_D0
GPIO47SD_CMD
GPIO48SD_SCK
NCSD_D3
NCSD_D1
NCSD_D2
  • RS485
Control GPIOFunction
GPIO17UART TX pin, corresponding to RS485
GPIO18UART RX pin, corresponding to RS485
GPIO21UART RTS pin, corresponding to RS485
  • CAN
Control GPIOFunction
GPIO2CAN TX pin, corresponding to TWAI
GPIO3CAN RX pin, corresponding to TWAI
  • RTC
Control GPIOFunction
GPIO40RTC_INT, interrupt pin of RTC chip
GPIO41RTC_SCL, I2C clock line
GPIO42RTC_SDA, I2C data line
  • RGB light beads
Control GPIOFunction
GPIO38RGB control pin
  • Buzzer
Control GPIOFunction
GPIO46Buzzer control pin
  • BOOT button
Control GPIOFunction
GPIO0BOOT button control pin

Dimensions



Electrical Safety Precautions

  • This product should be operated and used by professional electricians or technical personnel. During use, please ensure electrical safety and take protective measures such as anti-leakage and insulation.
  • Before installation, maintenance, or device adjustment, please make sure to turn off the power and unplug the device.

Implementation Logic


Usage Guide

ESP32-S3-POE-ETH-8DI-8DO currently provides the Arduino IDE development tool and framework.

Development Tool


Arduino IDE

Arduino IDE is an open source electronic prototyping platform, convenient and flexible, easy to get started. After a simple learning, you can start to develop quickly. At the same time, Arduino has a large global user community, providing an abundance of open source code, project examples and tutorials, as well as rich library resources, encapsulating complex functions, allowing developers to quickly implement various functions.


Each of these two development approaches has its own advantages, and developers can choose according to their needs and skill levels. Arduino and MicroPython are suitable for beginners and non-professionals because they are easy to learn and quick to get started.

Components Preparation

Before operating, it is recommended to browse the table of contents to quickly understand the document structure. For smooth operation, please read the FAQ carefully to understand possible problems in advance. All resources in the document are provided with hyperlinks for easy download.

Working with Arduino

This chapter introduces setting up the Arduino environment, including the Arduino IDE, management of ESP32 boards, installation of related libraries, program compilation and downloading, as well as testing demos. It aims to help users master the development board and facilitate secondary development.

Environment Setup

Download and Install Arduino IDE

  • Click to visit the Arduino official website, select the corresponding system and system bit to download

  • Run the installer and install all by default

Install ESP32 Development Board

  • Regarding ESP32-related motherboards used with the Arduino IDE, the esp32 by Espressif Systems library must be installed first.
  • According to Board installation requirement, it is generally recommended to use Install Online. If online installation fails, use Install Offline
  • For the installation tutorial, please refer to Arduino board manager tutorial
  • ESP32-S3-POE-ETH-8DI-8DO required development board installation description
Board nameBoard installation requirementVersion number requirement
esp32 by Espressif Systems"Install Offline" / "Install Online"3.0.0 and above

Install Library

  • When installing Arduino libraries, there are usually two ways to choose from: Install online and Install offline. If the library installation requires offline installation, you must use the provided library file
    For most libraries, users can easily search and install them through the online library manager of the Arduino software. However, some open-source libraries or custom libraries are not synchronized to the Arduino Library Manager, so they cannot be acquired through online searches. In this case, users can only manually install these libraries offline.
  • For library installation tutorial, please refer to Arduino library manager tutorial
  • ESP32-S3-POE-ETH-8DI-8DO library file is stored in the demo, click here to jump: ESP32-S3-POE-ETH-8DI-8DO Demo
  • ESP32-S3-POE-ETH-8DI-8DO library file installation description
Library NameDescriptionVersionLibrary Installation Requirement
ArduinoJsonLightweight JSON libraryv6.21.4"Install Online" or "Install Offline"
PubSubClientMQTT message subscription publishing libraryv2.8.0"Install Online" or "Install Offline"
NTPClientNetwork time synchronization client libraryv3.2.1"Install Online" or "Install Offline"
For more learning and use of LVGL, please refer to LVGL official documentation

Run the First Arduino Demo


If you are just getting started with ESP32 and Arduino, and you don't know how to create, compile, flash, and run Arduino ESP32 programs, then please expand and take a look. Hope it can help you!

New Project

  • Run the Arduino IDE and select File -> New Sketch

  • Enter the code:
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Hello, World!");
  delay(2000);
}
  • Save the project and select File -> Save As.... In the pop-up menu, select the path to save the project, and enter a project name, such as Hello_World, click Save

Compile and Flash Demos

  • Select the corresponding development board, take the ESP32S3 motherboard as an example:

①. Click to select the dropdown menu option Select Other Board and Port;
②. Search for the required development board model esp32s3 dev module and select;
③. Select COM Port;
④. Save the selection.

  • If the ESP32S3 mainboard only has a USB port, you need to enable USB CDC, as shown in the following diagram:


  • Compile and upload the program:

①. Compile the program; ②. Compile and download the program; ③. Download successful.

  • Open the Serial Monitor window, and the demo will print "Hello World!" every 2 seconds, and the operation is as follows:


Demo


  • ESP32-S3-POE-ETH-8DI-8DO demos
DemoBasic demo descriptionDependency library
01_MAIN_WIFI_APRS485 interface control, Bluetooth control, Bluetooth send IP, Web page control (short distance)Can be flashed directly
Web pages are only available if they are connected to device WIFI
02_MAIN_WIFI_STARS485 interface control, Bluetooth control, Bluetooth send IP, Web page control (short distance)Need to modify the WIFI to be connected
Web pages can only be used within the intranet
03_MAIN_ALLRS485 interface control, Bluetooth control, Bluetooth send IP, Web page control (short distance), Waveshare cloud control (long distance)Need to modify the WIFI to be connected
The device must be created in the Waveshare cloud
Web pages can only be used within the intranet

Arduino Project Parameter Setting


01_MAIN_WIFI_AP

Demo description


  • This example implements the control of 8 relays on and off through WiFi, Bluetooth, network port and RS485. The AP mode of WiFi is enabled in this example

Precautions


  • Can be flashed directly
  • The web page can only be accessed by connecting to the device's WIFI, or if connected to a network cable, by accessing the network port IP within the internal network

Code analysis


  • Relay_Analysis(): This function is mainly used to analyze received data, perform corresponding relay control operations based on the data content, and output corresponding status prompt information.
    • Parameter analysis
      • uint8_t *buf: A pointer to an unsigned 8-bit integer array, which is supposed to store the received data, and the function determines the content of the command based on the value of the first element (buf[0]) of the array.
      • uint8_t Mode_Flag: The mode flag is used to represent the data source, and the corresponding data source prompt information (such as Bluetooth data, Wi-Fi data, or RS485 data) is output by judging this flag, and different relay operations are performed according to different commands.
    • Logical flow
      • First output the corresponding data source prompt message according to the value of Mode_Flag.
      • Then use the switch statement to perform different operations based on the value of buf[0]:
        • For the cases from CH1 to CH8, the digitalToggle function is used to switch the level states of the corresponding EXIO pins (such as GPIO_PIN_CH1, etc.), and the corresponding elements of the Relay_Flag array are updated to record the change in relay status. The Buzzer_PWM function is called to control the buzzer, and the corresponding on or off prompt information is output according to the final state of the relay.
        • For the ALL_ON command, set all GPIO pins (corresponding to 8 channel relays) to high level (on state), use the memset function to set all elements of the Relay_Flag array to 1, indicating that all relays are turned on, output all relay ON prompt information, and control the buzzer.
        • For the ALL_OFF command, set all relevant GPIO pins to low level (off state) similarly, update the Relay_Flag array elements to 0, output a message that all relays are turned off and control the buzzer, and perform two additional buzzer control operations (with a delay in between).
        • If the value of buf[0] does not belong to the above command cases, a prompt message for non-instruction data is output.
  • WIFI_Init (): Configure the device as a Wi-Fi access point (AP), set up a Web server, and set up request processing functions corresponding to different paths to implement related network functions and device control functions, and give corresponding status prompts.
    • AP creation
      • First set the Wi-Fi mode to WIFI_AP, and then attempt to create a soft AP through WiFi.softAP(ssid, password). If it fails, it will loop through prompt and retry until it succeeds
    • Parameter configuration and prompts
      • After successfully creating the AP, give a prompt with RGB light (green light on for 1 second)
    • IP address display
      • Obtain and format the IP address of the soft AP, store it in ipStr and output it for easy network address recognition
    • Web server setting
      • Set up corresponding request handling functions (such as handleRoothandleGetData, etc.) for multiple paths (such as "/", "/getData", etc.) through server.on, each function should be defined elsewhere for different functional operations like returning pages, getting data, controlling switches etc.
      • Finally call server.begin() to start the Web server and output a startup prompt message.

RS485 Control


Bluetooth Control


Web Page Control


02_MAIN_WIFI_STA

Demo description


  • This example implements the control of 8 relays on and off through WiFi, Bluetooth, and RS485. The STA mode of WiFi is enabled in this example

Precautions


  • Need to modify the WIFI to be connected
  • The Web page only supports controlling the device and this product to be used under the same network, if you use the mobile phone control, you need to turn off the mobile network

Code analysis


  • WIFI_Init (): Connect the device to a specified Wi-Fi network in station (STA) mode. If the connection is successful, it will perform subsequent network-related configurations (such as obtaining an IP address, starting a Web server, and registering callback functions, etc.). If the connection fails, it will give a corresponding prompt and set the connection status flag. The process also provides visual connection status indicators through an RGB light
    • Attempt to connect to Wi-Fi network:
      • First set Wi-Fi to WIFI_STA mode and enable sleep mode, then start connecting to the specified network. In the cyclic wait of unsuccessful connection, a point is output as a prompt every half second, and the RGB light briefly turns red on every even number of attempts (except the first attempt). If every 10 attempts fail, the connection is disconnected and reconnected. If the number of attempts exceeds 22, the connection is considered a failure and the loop is exited.
    • Operations after successful connection:
      • If the number of connection attempts is less than 23 (i.e. successful connection), set WIFI_Connection to 1, light up the green light for 1 second to indicate success, and then obtain and display the local IP address. Next, register callback functions corresponding to multiple paths for the web server (such as root path, data retrieval, control of different switches, etc.), and finally start the server and output startup prompt, so that the device can receive corresponding control through the web page.
    • Operations after connection failure:
      • If the number of attempts is greater than or equal to 23 (connection failure), set WIFI_Connection to 0, output a prompt to inform that the device can be controlled through Bluetooth debugging assistant, and light a red light to indicate a connection failure status

RS485 Control


Bluetooth Control


Web Page Control


03_MAIN_MQTT_ALL

Demo description


  • This example is a collection of RS485 interface control, Bluetooth control, Web page control (near distance), and Waveshare cloud control (long distance).

Precautions


  • Need to modify the WIFI to be connected
  • The Web page only supports controlling the device and this product to be used under the same network, if you use the mobile phone control, you need to turn off the mobile network
  • Must create the device in Waveshare Cloud

RS485 Control


Bluetooth Control


Web Page Control


Waveshare Cloud Control


External Expansions


RS485 Extended Relay Channels

  • Use Modbus RTU Relay to extend 8-ch relay
  • The 4 main example files are compatible with this operation, and the Extension_Enable in WS_imformification. h needs to be set to 1 (default is 1)
  • Externally extended relays can be controlled via Bluetooth
Operation CommandCommand Function
06 01Switch the CH1 relay status of Modbus RTU Relay
06 02Switch the CH2 relay status of Modbus RTU Relay
06 03Switch the CH3 relay status of Modbus RTU Relay
06 04Switch the CH4 relay status of Modbus RTU Relay
06 05Switch the CH5 relay status of Modbus RTU Relay
06 06Switch the CH6 relay status of Modbus RTU Relay
06 07Switch the CH7 relay status of Modbus RTU Relay
06 08Switch the CH8 relay status of Modbus RTU Relay
06 09Turn on all relays of Modbus RTU Relay
06 0ATurn off all relays of Modbus RTU Relay
  • The commands for Bluetooth control relay are characters 1-8, which are hexadecimal 0x06 0x01 ~ 0x38 0x0A
  • Click the SEND button and fill in the data to be sent (currently hexadecimal sending), enter 0x06 0x01 as below


  • Send 0x06 0x01 to control relay CH1 for status reversal


  • Send 0x06 0x0A to control to turn off all relays


Working with Homeassistant

The product can be controlled online through the Homeassistant built on the Raspberry Pi, and the relevant operations can be found in Reference link

Port Description


Resources

Demo

Datasheets

ESP32-S3

Software Tools

Arduino

VScode

Thonny

Debugging Tools

FAQ

Question: After the module downloads the demo and re-downloads it, why sometimes it can't connect to the serial port or the flashing fails?

 Answer:
  • Long press the BOOT button, press RESET at the same time, then release RESET, then release the BOOT button, at this time the module can enter the download mode, which can solve most of the problems that can not be downloaded.


Question: Why does the module keep resetting and flicker when viewed the recognition status from the device manager?

 Answer:
  • It may be due to Flash blank and the USB port is not stable, you can long-press the BOOT button, press RESET at the same time, and then release RESET, and then release the BOOT button, at this time the module can enter the download mode to flash the firmware (demo) to solve the situation.


Question: How to deal with the first compilation of the program being extremely slow?

 Answer:
  • It's normal for the first compilation to be slow, just be patient


Question: How to handle the display "waiting for download..." on the serial port after successfully ESP-IDF flashing?

 Answer:
  • If there is a reset button on the development board, press the reset button; if there is no reset button, please power it on again


Question: What should I do if I can't find the AppData folder?

 Answer:
  • Some AppData folders are hidden by default and can be set to show.
  • English system: Explorer->View->Check "Hidden items"
  • Chinese system: File Explorer -> View -> Display -> Check "Hidden Items"


Question: How do I check the COM port I use?

 Answer:
  • Windows system:

①View through Device Manager: Press the Windows + R keys to open the "Run" dialog box; input devmgmt.msc and press Enter to open the Device Manager; expand the "Ports (COM and LPT)" section, where all COM ports and their current statuses will be listed.
②Use the command prompt to view: Open the Command Prompt (CMD), enter the "mode" command, which will display status information for all COM ports.
③Check hardware connections: If you have already connected external devices to the COM port, the device usually occupies a port number, which can be determined by checking the connected hardware.

  • Linux system:

①Use the dmesg command to view: Open the terminal.
①Use the ls command to view: Enter ls /dev/ttyS* or ls /dev/ttyUSB* to list all serial port devices.
③Use the setserial command to view: Enter setserial -g /dev/ttyS* to view the configuration information of all serial port devices.


Question: Why does the program flashing fail when using a MAC device?

 Answer:


Question: Why is there no output after successfully flashing the code with no issues?

 Answer:
  • Check the schematic diagram for different development boards with Type-C interfaces, and handle the output accordingly:
    • For development boards with direct USB output, printf function is supported for printing output. If you want to support output via the Serial function, you will need to enable the USB CDC On Boot feature or declare HWCDC.
    • For development boards with UART to USB conversion, both printf and Serial functions are supported for printing output, and there is no need to enable USB CDC On Boot.


Question: What is the address of the I2C device for the extended IO (TCA9554PWR) ?

 Answer:
  • The device address is 0x20.


Question: Please note!

 Answer:
  • The factory demo is for learning only, if it is used for practical application, please optimize the demo logic by yourself.


Question: When controlling other devices using RS485, it is not sensitive or communication fails?

 Answer:
  • Please move the jumper cap to 120R and try again. Some RS485 devices require a 120R resistor to be connected in series

Support

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

Email: services01@spotpear.com


[Tutorial Navigation]