Difference between revisions of "RS485 Modbus Relay"
From Diustou Wiki
Yousimaier17 (talk | contribs) |
Yousimaier17 (talk | contribs) |
||
Line 17: | Line 17: | ||
* RS485 Modbus Relay | * RS485 Modbus Relay | ||
|interfaces= | |interfaces= | ||
− | {{Category| | + | {{Category|RS485}} |
+ | |related= | ||
+ | * [[RS232 Modbus Relay]] | ||
+ | * [[RS485 Modbus Relay PRO]] | ||
}} | }} | ||
Revision as of 11:43, 10 January 2025
| ||||||||||||||||||||||
| ||||||||||||||||||||||
| ||||||||||||||||||||||
|
Contents
Product Overview
- A relay is an electrical control device that causes a controlled quantity within an electrical output circuit to undergo a predetermined step change when the variation of the input quantity (excitation quantity) meets specified requirements. It establishes an interactive relationship between the control system (also known as the input circuit) and the controlled system (also known as the output circuit). Typically used in automated control circuits, it essentially functions as an "automatic switch" where a small current controls the operation of a larger current. Therefore, in circuits, it plays roles such as automatic regulation, safety protection, and circuit conversion.
- The RS485 Modbus Relay Module is equipped with a mature and stable 8-bit MCU and RS485 level communication chip. It adopts the standard MODBUS RTU format RS485 communication protocol, capable of achieving 2/3/4-channel input signal detection and 2/3/4-channel relay output. This makes it suitable for applications requiring digital signal detection or power control.
Product Features
- Equipped with a mature and stable 8-bit MCU and SP3485 level conversion chip.
- Power Supply Voltage: 5V - 32V.
- Communication Protocol: Supports the standard Modbus RTU protocol.
- Communication Interface: Supports the RS485 interface.
- Communication Baud Rate: 4800/9600/19200 bps, default 9600 bps, supports power-loss retention.
- Output Signal: Relay switch signal.
- Device Address: Range from 1 to 255, default 255, supports power-loss retention.
- Baud rate, input signals, relay status, and device address can be read using software/instructions.
- Equipped with 2/3/4 channels of 5V, 10A/250VAC, 10A/30VDC relays, capable of continuous operation up to 100,000 cycles, featuring diode flyback protection, optocoupler protection circuitry, and fast response time.
- Equipped with relay switch indicator lights and power indicator lights.
Product Description
- 1. VCC, GND: DC5-32V 5.08mm power input terminal
- 2. A+, B-, GND: RS485 communication interface, A+ and B- are connected to the A+ and B- of the external control terminal respectively, GND can be left unconnected
- 3. Relay 2 switch signal output:
- NC2: Normally closed terminal, short-circuited to COM before the relay is energized, and open after the relay is energized;
- COM2: Common terminal;
- NO2: Normally open terminal, open before the relay is energized, and short-circuited to COM after the relay is energized.
- 4. Relay 1 switch signal output:
- NC1: Normally closed terminal, short-circuited to COM before the relay is energized, and open after the relay is energized;
- COM1: Common terminal;
- NO1: Normally open terminal, open before the relay is energized, and short-circuited to COM after the relay is energized.
- 5. Relay indicator light: Lights up when the relay is energized
- 6. Optocoupler protection circuit
User Instructions
Host Computer Testing
- Connecting the Serial Port
- Connect the relay module to the USB-to-485 module with the connection: A - A, B - B. GND can be left unconnected.
- Open the host computer software.
- Setting the Communication ID
- If there is only one module on the 485 bus, you can click the "Read ID" button to automatically read the module's ID and display it in the ID text box (in hexadecimal format). You can also set the module's ID to the value in the ID text box (in hexadecimal format) by clicking the "Set ID" button. The set module ID will be saved in the module and retained even after power-off.
- If there is more than one module on the 485 bus, you cannot use the above method to read or set the ID. You must manually enter the ID of the module you wish to communicate with into the ID text box (in hexadecimal format) to operate the corresponding module. If the ID is set to 0, it is in broadcast mode, and all modules on the bus will receive the same command and perform the same action, but there may be conflicts in the response commands, leading to unexpected results.
- Operating the Relay
- Debugging Function
- The debugging area displays the command data (in hexadecimal format) currently being sent and received by the serial port. Click the "Send Directly" button to send the data in the "Send Data" text box via the serial port. Click the "Calculate CRC" button to automatically calculate the CRC for all data in the "Send Data" text box and append the result to the end, facilitating Modbus command debugging. Note: Since the sent command already includes the CRC, if you manually modify the command to be sent, you need to delete the last two bytes before clicking the "Calculate CRC" button.
Introduction to Modbus RTU Commands
- Modbus devices execute relevant operations by receiving Modbus RTU commands from external control terminals (such as host computers/MCUs). A frame of commands generally consists of the device address, function code, register address, register data, and checksum. The frame length is related to the function code. Typically, the first byte of each frame of data is the device address, with a settable range of 1-255 and a default of 255 (i.e., 0xFF). The last two bytes are the CRC checksum.
- Assuming the device address is 255, the commonly used Modbus RTU commands are as follows. For details, please refer to Module User Manual.
- Turn On Relay 1
Send: FF 05 00 00 FF 00 99 E4 Return: FF 05 00 00 FF 00 99 E4
Note 1: The 3rd and 4th bytes of the sent frame represent the relay address. The addresses for relays 1 to 8 are 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, and 0x0007, respectively.
Note 2: The 5th and 6th bytes of the sent frame represent the data. 0xFF00 represents turning on the relay, and 0x0000 represents turning off the relay.
- Turn Off Relay 1
Send: FF 05 00 00 00 00 D8 14 Return: FF 05 00 00 00 00 D8 14
- Turn On All Relays
Send: FF 0F 00 00 00 08 01 FF 30 1D Return: FF 0F 00 00 00 08 41 D3
- Turn Off All Relays
Send: FF 0F 00 00 00 08 01 00 70 5D Return: FF 0F 00 00 00 08 41 D3
- Set Device Address to 255
Send: 00 10 00 00 00 01 02 00 FF EB 80 Return: 00 10 00 00 00 01 02 00 FF EB 80
Note: The 8th and 9th bytes of the sent frame, 0x00FF, represent the device address to be written.
- Read Device Address 255
Send: 00 03 00 00 00 01 85 DB Return: 00 03 02 00 FF C5 C4
Note: The 4th and 5th bytes of the response frame, 0x00FF, represent the read device address.
- Set Baud Rate to 9600
Send: FF 10 03 E9 00 01 02 00 03 8B CC Return: FF 10 03 E9 00 01 C5 A7
- Read Relay Status
Send: FF 01 00 00 00 08 28 12 Return: FF 01 01 01 A1 A0
References
Precautions
- Please use the power supply and load within the specified parameters and avoid exceeding them.
- The rated load and lifespan are reference values and may vary significantly depending on different environmental factors, load properties, and types. Therefore, it is best to confirm them in actual or simulated actual use.
- The module's load capacity is significantly affected by ambient temperature and its own temperature rise. It needs to be installed in an environment with good air convection for heat dissipation.
- Electrical endurance at high temperatures: When the module is used at high temperatures, its electrical endurance will be lower than at normal temperatures. Therefore, please confirm this in actual use.