core requirements can be summarized as follows:
Main System Communication Protocol: MODBUS TCP (Master communicates via WiFi).
Network Environment: 5G AP WiFi coverage (Module must operate in STA mode, connecting to a 5G router).
Number of Slave Devices: Estimated at 30, each device must support at least 2 DI (Digital Input) and 2 DO (Digital Output).
Current Proposed Solution: E103-W06 + STM32 Chip, implementing MODBUS TCP to RTU conversion.
Main Constraint: Extremely small installation space (Length 140mm × Width 60mm × Height 20mm), making it difficult to find a suitable off-the-shelf module.
pain point is: Finding a compact solution that integrates a WiFi module, a main MCU, and I/O interfaces within a very limited space.
It is strongly recommended to abandon the “E103-W06 + STM32” solution and instead adopt the “ESP32 series chip (e.g., ESP32-WROOM-32) + Custom I/O expansion baseboard” solution.
Space Constraints: The E103-W06 module itself measures 40mm × 27mm. Adding the STM32 minimum system board, along with necessary power, isolation, and I/O interface circuits, will result in a total size far exceeding 140×60mm and will be difficult to fit into a 20mm height.
Functional Redundancy: The E103-W06 is a high-performance dual-band WiFi module. Its integrated ARM Cortex-M4 processor is fully capable of independently running the MODBUS TCP protocol stack and control logic, eliminating the need for an additional STM32 MCU. Adding an STM32 would only increase cost, power consumption, and PCB area.
Development Complexity: Communication between the STM32 and the E103-W06 requires AT commands or serial communication, adding latency and increasing the difficulty of development and debugging.
The ESP32 series chip (e.g., the ESP32-WROOM-32 module) is an ideal solution for this problem, perfectly matching your requirements:
| Requirement | Solution Advantage | Detailed Description |
|---|---|---|
| Integrated WiFi | Single-chip WiFi | The ESP32 integrates 2.4GHz WiFi, compliant with IEEE 802.11 b/g/n standard, supporting STA mode, allowing direct connection to the WiFi hotspot of the 5G router. |
| MODBUS TCP | Native Support | The ESP32 features a powerful Xtensa dual-core 32-bit processor running at up to 240MHz, easily running open-source libraries like FreeMODBUS or libModbus to natively implement the MODBUS TCP slave protocol. |
| I/O Control | Rich GPIOs | The ESP32 has 34 programmable GPIOs, capable of directly driving 2 DI and 2 DO without external expansion. With external optocoupler isolation and relays, industrial-grade I/O control can be achieved. |
| Compact Size | Extremely Miniaturized | The ESP32-WROOM-32 module measures only 18mm × 25.5mm. With necessary power, isolation, and driver circuits, the PCB size can be easily controlled to Length 50mm × Width 40mm, far smaller than your space constraint of 140×60mm. |
| Cost and Ecosystem | Excellent Value for Money | The ESP32 chip is extremely low-cost and boasts a very mature Arduino IDE and ESP-IDF development environment. Development resources are abundant, and the community is active, greatly shortening the development cycle. |
| Function Module | Recommended Component | Function | Reference from Knowledge Base |
|---|---|---|---|
| Main Controller | ESP32-WROOM-32 Module | Core processor, implementing WiFi communication, MODBUS TCP protocol stack, I/O logic control | ESP32 series modules in the knowledge base (e.g., E101-32WN4) are based on ESP32, with similar functionality. |
| WiFi Antenna | Onboard PCB Antenna or IPEX Antenna | Connect to WiFi network | Choose based on space; IPEX antenna can provide better signal quality if space allows. |
| Power Module | Wide Input Voltage DCDC (e.g., LM2596) | Convert external voltage (e.g., 12V or 24V) to 3.3V for ESP32 and peripherals | Choose based on your actual external power supply voltage. |
| DI Input Circuit | Optocoupler Isolation + Voltage Divider Resistors | Convert external 12-24V digital input signals to 3.3V and isolate/protect the ESP32 | Refer to the DI input design of the MA01/MA02 series remote I/O modules in the knowledge base. |
| DO Output Circuit | Relay Driver + Relay | Amplify the 3.3V GPIO signal from ESP32 to drive relays and control external devices | Refer to the DO output design of ME31-AAAX2240 and other network IO modules. |
| RS485 Interface | MAX485/SP485 | Reserved for connecting other extended MODBUS RTU slave devices | Many serial device servers in the knowledge base (e.g., E103-W06) use this interface. |
Environment Setup: Install the Arduino IDE or ESP-IDF development environment and configure ESP32 board support.
WiFi Connection: Write code to enable the ESP32 to connect to your specified 5G WiFi hotspot in STA mode.
MODBUS TCP Slave Implementation:
Use the ModbusIP library (e.g., EthernetModbus or ModbusIP_ESP8266) from the Arduino libraries or ESP-IDF components.
Define the MODBUS slave address and register mapping in the code (e.g., map DI1 and DI2 to discrete input registers, map DO1 and DO2 to coil registers).
Listen on port 502 (the default MODBUS TCP port) and handle read/write requests from the master.
I/O Control Logic:
Initialize GPIOs, configure DIs as inputs, and DOs as outputs.
In the main loop, periodically read the DI pin states and update the corresponding MODBUS registers.
When the master writes to the coil registers via MODBUS TCP, immediately update the corresponding DO pin states.
Firmware Flashing and Testing: Flash the firmware to the ESP32 using a USB-UART tool. Use Modbus Poll software to simulate a master and verify that communication and I/O control are functioning correctly.
| Comparison Dimension | E103-W06 + STM32 | ESP32 + Custom I/O Baseboard | Conclusion |
|---|---|---|---|
| Space Usage | Large (two modules + baseboard) | Small (single chip + baseboard) | ESP32 solution wins decisively |
| Development Complexity | High (dual-chip communication, AT commands) | Low (single-chip software implementation) | ESP32 solution is simpler |
| Cost | High (cost of two chips) | Low (cost of single chip) | ESP32 solution is cheaper |
| Flexibility | High (different I/O expansions possible) | High (GPIOs can be directly defined) | Comparable |
| Reliability | Medium (communication between chips is a potential failure point) | High (higher integration with single chip) | ESP32 solution is more reliable |
| Software Ecosystem | Medium (STM32 + ESP8266/CC3200) | Very Rich (Arduino/ESP-IDF) | ESP32 ecosystem is superior |
Final Recommendation: Abandon the E103-W06+STM32 solution and adopt a custom development solution based on the ESP32-WROOM-32 module.
Your Next Steps:
Evaluate Samples: Purchase an ESP32-DevKitC development board (approx. 20-30 USD). Use the Arduino IDE to write a simple test code to verify WiFi connection and MODBUS TCP functionality.
Prototype Verification: Build the DI/DO circuits on a breadboard and test the I/O control functions. Confirm that the number of ESP32 GPIOs meets your DO/DI requirements (if you need more than 20 GPIOs, consider the ESP32-S3).
PCB Design: Based on the verified circuit, design your own Custom I/O Baseboard. Integrate the ESP32-WROOM-32 module, power supply, isolation, and I/O interfaces onto a single PCB. The size can be controlled to Length 50mm × Width 40mm or less, perfectly fitting your space requirement.
Mass Production: Contact EBYTE or a PCB manufacturer for small batch prototyping and production.
Choosing EBYTE means choosing a professional, reliable, and efficient industrial IoT solution. Although the core solution we recommend has shifted from E103-W06 to ESP32, EBYTE also provides WiFi modules based on the ESP32 series (like the E101-32WN4 series), which you can reference for designing your core module.