Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria
Using a variable frequency drive with an industrial Arduino based PLC
How to work with a PLC controller Arduino
Introduction
In this case, we are using a VFD (variable frequency drive or adjustable frequency drive, AFD). The software on your industrial PLC M-Duino 21+ is in charge to provide a simple user interface to the user and controls the VFD. So, through your serial monitor in your PLC Arduino IDE you will be able to control the three phase motor.
Using a 0-10 V analog output, you will be able to control the speed of a three-phase motor. Apart from that, you will also be able to control the direction of rotation using two digital pins.
Requirements
Three phase motor
Wiring
(*Remember to wire the VCom and Com (-) to provide power supply to the digital outputs)

Software
////////////////////////////////////////////////////////////////////////////////////////////////////
void setup(){
Serial.begin(9600L);
delay(1000);
printMenu();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void loop(){
if (Serial.available()){
int byteSerial = Serial.read();
if (byteSerial == '0'){
digitalWrite(Q0_0, LOW);
digitalWrite(Q0_1, LOW);
analogWrite(A0_7, 0);
Serial.println("Motor Stop");
printMenu();
}
else if (byteSerial == '1'){
digitalWrite(Q0_0, HIGH);
digitalWrite(Q0_1, LOW);
digitalWrite(A0_7, 50);
Serial.println("Forward rotation mode");
printMenu();
}
else if (byteSerial == '2'){
digitalWrite(Q0_0, LOW);
digitalWrite(Q0_1, HIGH);
analogWrite(A0_7, 50);
Serial.println("Reverse rotation mode");
printMenu();
}
else if (byteSerial == '3'){
analogWrite(A0_7, 50);
Serial.println("Speed nº1");
printMenu();
}
else if (byteSerial == '4'){
analogWrite(A0_7, 127);
Serial.println("Speed nº2");
printMenu();
}
else if (byteSerial == '5'){
analogWrite(A0_7, 255);
Serial.println("Speed nº3");
printMenu();
}
}
}
void printMenu(){
Serial.println("------------------------------------------");
Serial.println("Command guide:");
Serial.println("Press 0 for Stop");
Serial.println("Press 1 for reverse rotation");
Serial.println("Press 2 for forward rotation");
Serial.println("Press 3 for Speed nº1");
Serial.println("Press 4 for Speed nº2");
Serial.println("Press 5 for Speed nº3");
Serial.println("------------------------------------------");
}