DC Motor Rotation Control With Start-Stop-Start and a Latch
by PanosA6 in Circuits > Arduino
3155 Views, 2 Favorites, 0 Comments
DC Motor Rotation Control With Start-Stop-Start and a Latch
This project is based on a classic electric automation circuit, the 3phase Motor Rotation Control with Start - Stop - Start and a Latch. The subject is you have a 3 phase motor and want to control its rotation. As you might think you need three push buttons. One for right turn, left turn and a stop button. In order to keep safety, we use a latch, that means if you push the right turn button, the left turn button is out of use, only the stop button works and reverse, If you push the left turn button, the right turn button is out of use. This protects the 3phase motor to have a short circuit if both left and right turn buttons are pressed simultaneously by a user. In this classic circuit you can use any kind of motor to do the work, like a typical monophase AC motor, or like our example here a small DC motor.
There are two things to have in mind and important to motor control circuits
-self-restraint that is to press just once the button and to start the circuit aka the electric motor
- latch explained before not to let two actions happen on the same time, like pressing the two buttons at once.
the parts here for this project are easy to obtain, you will need:
1. An opto isolated 2 relay module. This can be directly connected to the Arduino with out to make any damage it. And this because it has the optocoupler to isolate the relay from the Arduino. Reading from its data, this activates the relay with LOW input so we need to take this account when programming. And it means it needs separate Outputs to be connected, as the indicator LEDs activate with HIGH.
2. The motor used is a 5dc Volt little motor, that is connected to 3.5dc Volts of the Arduino output to function.
3. The pushbuttons are set to PULLUP to eliminate the use of resistors.
4. And 3 Leds, and resistors (two Green and a Red) or (Green and yellow and a red) and 330 Ω resistors.
The Classic Circuit
From these two electric circuits shown derives the circuit and the complete idea and function of our Arduino one.
On the left is the Control circuit, that controls the right Power circuit. The left has the self-restraint circuit that is to press one of the two start buttons momentary and start the AC Motor for right or left turn this through the parallel C1, C2 NO contacts. It also has the latch circuit that prevents any user to press simultaneously the Start 1 and Start 2 momentary buttons on this through the NC C1 and C1 closed contacts. On the right we have the Power circuit that is controlled by the left side circuit. This changes the Power Contacts from the two relays C1, C2 and thus inverses the rotation of the 3 Phase AC Motor.
NO is Normally Open Contacts of the relay
and
NC is Normally Closed Contacts of the relay.
Downloads
The Internal Relay Circuit
This is what is inside the 2 relay circuit. This diagram shows the connection of one of them. Doubling it you have the one we are using. This link will give you a little more insight to the 2 relay module connection we use. Also the complete connection is shown on the first step. The Opto Isolated dual relay module
The DC Motor Connection With the Relay Module
Here is a diagram to give a little insight to the motor connection to the two relay, and the four possible connection it could have.
The Code
/*******************************************
TITLE: DC Motor Rotation Control With Start-Stop-Start and a Latch
Created by: P.Agiakatsikas
DATE: 15/03/2020
*********************************************/
int yellow = 2; //Yellow (or green led) as indicator (right motor turn)
int red = 4; // Red indicator led for Stop
int green = 6; // Green led as indicator (left motor turn)
int btn1 = 8; //Start button A (right motor turn)
int btn3 = 10; //Start reverse button B (left motor turn)
int btn2 = 12; //Stop button C
int motorRight = 9;// HIGH output to optocouple relay No1 so it will not turn On
int motorLeft = 11; //HIGH output to optocouple relay No2 so it will not turn On
int buttonStatus1 = 0; // Initial button A status
int buttonStatus2 = 0; // Initial button B status
int buttonStatus3 = 0; // Initial button C status
int A;
int B;
int C;
void setup() {
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);
pinMode(motorRight, OUTPUT);
pinMode(motorLeft, OUTPUT);
pinMode(btn1, INPUT_PULLUP);// use of pullup so we avoid the use of resistors
pinMode(btn2, INPUT_PULLUP);
pinMode(btn3, INPUT_PULLUP);
digitalWrite(red, HIGH);
digitalWrite(motorRight, HIGH);// Initial HIGH output for optocouple relay No1 turns relay Off
digitalWrite(motorLeft, HIGH); // Initial HIGH output for optocouple relay No2 turns relay Off
}
void loop(){
buttonStatus1 = !digitalRead(btn1);
buttonStatus2 = !digitalRead(btn2);
buttonStatus3 = !digitalRead(btn3);
A = buttonStatus1;
B = buttonStatus2;
C = buttonStatus3;
if (A==HIGH && digitalRead(green)==LOW) {
digitalWrite(yellow,HIGH);
digitalWrite(green, LOW);
digitalWrite(red, LOW);
digitalWrite(motorRight, LOW);
digitalWrite(motorLeft, HIGH);
}
if (B==HIGH && digitalRead(yellow)==HIGH){
digitalWrite(yellow,HIGH);
digitalWrite(green, LOW);
digitalWrite(red, LOW);
digitalWrite(motorRight, LOW);
digitalWrite(motorLeft, HIGH);
}
if (B==HIGH && digitalRead(yellow)==LOW) {
digitalWrite(yellow,LOW);
digitalWrite(green, HIGH);
digitalWrite(red, LOW);
digitalWrite(motorRight, HIGH);
digitalWrite(motorLeft, LOW);}
if (C==HIGH) {
digitalWrite(yellow, LOW);
digitalWrite(green, LOW);
digitalWrite(red, HIGH);
digitalWrite(motorRight, HIGH);
digitalWrite(motorLeft, HIGH);}
}