The Arduino board is used to communicate with the external device through RS-485 Modbus-RTU. The device responses are resolved by the Arduino with cyclic redundancy check (CRC) and outputted to the human-machine interface (HMI).
Suggested board:
- Arduino MEGA 2560 Rev3
Purpose:
- Send Modbus-RTU command to the device through RS-485 via the assigned "RS485_Serial."
- Get responses from the device through RS-485.
- Send the device responses to the human-machine interface (HMI) via the assigned "HMI_Serial."
- Arduino can monitor the device responses from the serial monitor.
Suggested hardware setup:
- A "RS-485 to TTL module" is used to convert the RS-485 signal because Arduino MEGA 2560 Rev3 does not support RS-485 directly.
- A HMI with the UART interface is used to show the device responses through the assigned HMI_Serial channel of the Arduino.
The codes are in the code directory.
# | Sketch name and key differences | Date |
---|---|---|
5 | Name: RS-485_Modbus-RTU_Call_Response_and_HMI_display_with_CRC.ino Difference: CRC function added. #define HMI_Serial Serial1 // Assign serial port #define RS485_Serial Serial3 // Assign serial port |
2021-07-08 |
4 | Name: RS-485_Modbus-RTU_Call_Response_and_HMI_display_without_CRC_v04.ino Difference: #define HMI_Serial Serial1 // Assign serial port #define RS485_Serial Serial3 // Assign serial port |
2021-07-07 |
3 | Name: RS-485_Modbus-RTU_Call_Response_and_HMI_display_without_CRC_v03.ino Difference: Serial1.begin( 9600); // Serial3 for RS-485 to TTL Serial2.begin(115200); // Serial1 for HMI with UART interface |
2021-07-06 |
2 | Name: RS-485_Modbus-RTU_Call_Response_and_HMI_display_without_CRC_v02.ino Difference: Serial1.begin( 9600); // Serial3 for RS-485 to TTL Serial2.begin(115200); // Serial2 for HMI with UART interface |
2021-07-06 |
1 | Name: RS-485_Modbus-RTU_Call_Response_and_HMI_display_without_CRC_v01.ino Difference: Serial1.begin( 9600); // Serial1 for RS-485 to TTL Serial2.begin(115200); // Serial2 for HMI with UART interface |
2021-07-06 |
Distributed under the MIT License.
Author: Dr. Hsien-Ching Chung
ORCID: https://orcid.org/0000-0001-9364-8858
Project Link: https://github.com/HsienChing/RS-485_Modbus-RTU_Call_Response_and_HMI_Display_with_CRC_for_Arduino
H.C. Chung thanks all the contributors to this project for their valuable discussions and recommendations, especially Jung-Feng Lin, Hsiao-Wen Yang, Yen-Kai Lo, An-De Andrew Chung.
This work was supported in part by Super Double Power Technology Co., Ltd., Taiwan under grant SDP-RD-PROJ-001-2020.