while trying to connect Arduino Mega to ABB ACS 380 vfd using Modbus RTU protocol the device is showing communication error. i am trying with MAX 485 module for communication, arduino connections are in serial port 0 , all VFD parameters set to Modbus RTU and tried some basic code but vfd is showing communication error. please recommend any example code to check weather vfd is communicating with arduino or not.
Bad idea because that collides with debugging output. As you're hiding your code from us we cannot check if that applies to you.
A link to that device's Modbus manual would help! Did you check the baudrate, parity, stop bits, Modbus ID, etc.? Is the bus biased?
#include <ModbusMaster.h>
// ModbusMaster object
ModbusMaster node;
// Define the slave address of the ACS380 drive
const uint8_t ACS380_SLAVE_ID = 1; // Replace with your ACS380 slave ID
// Define the register address for controlling motor state
const uint16_t MOTOR_CONTROL_REGISTER = 0x2000; // Replace with the appropriate register address
void setup() {
Serial.begin(9600); // Arduino Serial Monitor
node.begin(ACS380_SLAVE_ID, Serial); // Modbus communication
pinMode(13, OUTPUT); // Pin connected to the motor control relay
}
void loop() {
// Turn the motor on (Example: Set a specific value to turn on)
uint16_t motorOnValue = 1; // Replace with the value that turns the motor on
// Write the motor on value to the ACS380 drive's control register
uint8_t result = node.writeSingleRegister(MOTOR_CONTROL_REGISTER, motorOnValue);
if (result == node.ku8MBSuccess) {
digitalWrite(13, HIGH); // Turn on the motor control relay
} else {
digitalWrite(13, LOW); // Turn off the motor control relay
Serial.println("Error writing motor control value");
}
delay(5000); // Motor on for 5 seconds
// Turn the motor off (Example: Set a different value to turn off)
uint16_t motorOffValue = 0; // Replace with the value that turns the motor off
// Write the motor off value to the ACS380 drive's control register
result = node.writeSingleRegister(MOTOR_CONTROL_REGISTER, motorOffValue);
if (result == node.ku8MBSuccess) {
digitalWrite(13, LOW); // Turn off the motor control relay
} else {
digitalWrite(13, HIGH); // Turn on the motor control relay
Serial.println("Error writing motor control value");
}
delay(5000); // Motor off for 5 seconds
}
please find the code that i am using for testing, VFD is not showing any error but it is showing Emergency stop warning. please share any other sample code for testing if available.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.