1. Introduction
This manual provides detailed instructions for the DIY NOW ESP32 RS485 Modbus Relay Module. This versatile module integrates an ESP32 microcontroller with RS485 communication, Modbus protocol support, WiFi, Bluetooth, and multiple relay outputs, making it suitable for various industrial automation and IoT applications. It is available in 4-channel and 8-channel configurations.
2. Safety Information
- Ensure power supply voltage (DC 9-24V) is within the specified range to prevent damage.
- Disconnect power before making any wiring changes to avoid electrical shock.
- Handle the module with care to prevent electrostatic discharge (ESD) damage.
- Do not expose the module to moisture, extreme temperatures, or corrosive environments.
- Relays switch AC/DC loads; ensure proper insulation and current ratings are observed for connected devices.
3. Package Contents
Please check the package for the following items:
- 1 x ESP32 RS485 Modbus Relay Module (4-channel or 8-channel, as ordered)
- (Optional) Enclosure/Outer Shell

4. Product Overview
The module integrates an ESP32-WROOM-32 module, RS485 transceiver, optocoupler isolated inputs, and multiple relays. It supports Modbus RTU protocol over RS485 and can be controlled via WiFi or Bluetooth.
4.1 Key Features
- Microcontroller: ESP32-WROOM-32 with integrated WiFi and Bluetooth.
- Relays: Available in 4-channel or 8-channel configurations.
- Communication: RS485 interface with Modbus RTU support, USART.
- Isolation: Optocoupler input/output isolation for enhanced stability and anti-interference.
- Programming: Built-in CH340 USB-to-serial chip for easy programming via Type-C port.
- Power Supply: DC 9-24V terminal block or Type-C USB.
4.2 Component Identification (4-Channel Module)

- Power Indicator: LED indicating power status.
- Type-C Interface: Used for power supply (5V) and programming.
- EN Reset Button: Press to reset the ESP32.
- BOOT Button: Press and hold, then press the reset button once to enter download mode for firmware flashing.
- 4 Optocoupler Inputs: Digital inputs that can be used to control relays or read external signals.
- RS485 Interface: Terminals B and A for RS485 communication.
- Relay Outputs: Each relay has NC (Normally Closed), COM (Common), and NO (Normally Open) terminals.
4.3 Component Identification (8-Channel Module)

- Type-C Interface: Used for power supply (5V) and programming.
- EN Reset Button: Press to reset the ESP32.
- BOOT Button: Press and hold, then press the reset button once to enter download mode for firmware flashing.
- 8-Channel Optocoupler Inputs: Digital inputs (IN1-IN8) that can be used to control relays or read external signals.
- RS485 Interface: Terminals B and A for RS485 communication.
- Relay Outputs: Each relay has NC (Normally Closed), COM (Common), and NO (Normally Open) terminals.
5. Setup
5.1 Power Supply Connection
The module can be powered via two methods:
- DC Terminal Block: Connect a DC 9-24V power supply to the designated screw terminals (GND and 9-24V). Ensure correct polarity.
- Type-C USB Port: A 5V USB power supply can be connected via the Type-C port. This port also serves for programming.
Caution: Do not connect both DC terminal block and Type-C power simultaneously unless specified by advanced documentation.
5.2 Programming the ESP32
The module features a built-in CH340 USB-to-serial converter for easy firmware uploading.
- Connect the module to your computer using a Type-C USB cable.
- Install the CH340 driver if your operating system does not recognize the device automatically.
- Open your preferred ESP32 development environment (e.g., Arduino IDE, PlatformIO).
- Select the correct ESP32 board (e.g., ESP32 Dev Module) and the serial port assigned to the CH340.
- To upload firmware, you may need to put the ESP32 into download mode:
- Press and hold the BOOT button.
- While holding BOOT, briefly press the EN Reset button.
- Release the BOOT button. The ESP32 is now in download mode.
- Proceed with uploading your code.
5.3 RS485 Connection
Connect the RS485 bus to the A and B terminals on the module. Ensure consistent wiring (A to A, B to B) across all devices on the bus.
5.4 Relay Connections
Each relay provides three terminals: Normally Open (NO), Common (COM), and Normally Closed (NC).
- NO (Normally Open): The circuit is open when the relay is de-energized and closes when energized.
- COM (Common): The common terminal for the switch.
- NC (Normally Closed): The circuit is closed when the relay is de-energized and opens when energized.
Connect your load according to the desired switching behavior. Ensure the load's voltage and current ratings do not exceed the relay's specifications (e.g., 10A 250VAC, 10A 30VDC).
5.5 Optocoupler Input Connections
The module provides optocoupler-isolated digital inputs (IN1, IN2, IN3, IN4 for 4-channel; IN1-IN8 for 8-channel) along with corresponding GND terminals. These inputs can be used to read external digital signals or trigger relay actions.

6. Operating Instructions
6.1 Modbus RTU Communication
The module supports Modbus RTU protocol over its RS485 interface. You will need to implement Modbus slave functionality in your ESP32 firmware. Common Modbus functions include:
- Function Code 0x01 (Read Coils): Read the status of relays.
- Function Code 0x05 (Write Single Coil): Control a single relay (ON/OFF).
- Function Code 0x0F (Write Multiple Coils): Control multiple relays simultaneously.
- Function Code 0x02 (Read Discrete Inputs): Read the status of optocoupler inputs.
Refer to Modbus specifications and ESP32 Modbus libraries for detailed implementation.

6.2 WiFi and Bluetooth Functionality
As the module is based on ESP32, it fully supports WiFi and Bluetooth connectivity. You can program the ESP32 to:
- Connect to a local WiFi network (STA mode) to receive commands or send data to cloud platforms.
- Create its own WiFi access point (AP mode) for direct control via a smartphone or computer.
- Utilize Bluetooth for short-range communication with other Bluetooth-enabled devices.

6.3 Controlling Relays
Relays can be controlled programmatically via the ESP32's GPIO pins. In your firmware, assign GPIO pins to control each relay. For example, setting a GPIO pin HIGH or LOW will energize or de-energize the corresponding relay.
The optocoupler inputs can also be programmed to directly control relays or trigger other actions based on external signals.
7. Maintenance
- Keep the module clean and free from dust and debris.
- Periodically check all wiring connections for tightness and corrosion.
- Ensure adequate ventilation if the module is enclosed, especially if switching high-current loads, to prevent overheating.
- Regularly update firmware to benefit from new features, bug fixes, and security patches.
8. Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| Module not powering on | Incorrect power supply voltage or polarity; faulty power supply; loose connection. | Verify DC 9-24V or 5V Type-C power supply. Check polarity. Ensure connections are secure. |
| Cannot upload firmware | Incorrect COM port selected; CH340 driver not installed; ESP32 not in download mode; faulty USB cable. | Install CH340 driver. Select correct COM port. Ensure ESP32 is in download mode (BOOT + EN Reset). Try a different USB cable. |
| Relays not switching | Incorrect GPIO assignment in code; insufficient power to module; faulty relay. | Verify GPIO pins in firmware. Ensure stable power supply. Test relay with a simple sketch. |
| RS485 communication failure | Incorrect A/B wiring; incorrect Modbus address/baud rate; bus termination issues. | Check A/B wiring. Verify Modbus parameters. Add termination resistors if needed (typically 120 Ohm at bus ends). |
| Optocoupler inputs not responding | Incorrect wiring to input; input signal voltage incompatible; software not reading input. | Verify input wiring (INx to signal, GND to common). Check input signal voltage levels. Ensure firmware correctly reads the input GPIOs. |
9. Specifications
| Parameter | Value |
|---|---|
| Microcontroller | ESP32-WROOM-32 |
| Relay Channels | 4-channel or 8-channel (optional) |
| Power Supply | DC 9-24V (terminal block) or 5V (Type-C USB) |
| Relay Contact Rating | 10A 250VAC / 10A 30VDC |
| Communication Interfaces | RS485 (Modbus RTU), USART, WiFi, Bluetooth |
| USB-to-Serial Chip | CH340 |
| Input Isolation | Optocoupler isolation |
| PCB Dimensions (4-channel) | 93mm x 87mm (Positioning hole: 4mm) |
| PCB Dimensions (8-channel) | 152mm x 87mm (Positioning hole: 3.5mm) |

10. User Tips
- Software Support: If you encounter issues or need specific firmware examples, check the seller's product page or contact their support for assistance. Many users have found the seller helpful with software-related queries.
- Community Resources: Leverage the vast ESP32 community online for example code, libraries, and project ideas related to Modbus, WiFi, and Bluetooth control.
- Testing: Before deploying in a critical application, thoroughly test all relay functions, communication protocols, and input responses in a controlled environment.
11. Warranty and Support
For warranty information, technical support, or further assistance, please refer to the product listing page or contact the seller directly. Additional documentation, including a PDF user manual, may be available for download from the product page: Download PDF User Manual.