Hello friends, hope you all are fine and having fun with life. Today, I am going to share DC Motor Direction Control with Arduino. I have designed a complete simulation in Proteus, which will help you in understanding the controlling of DC motor. I would recommend you to first read How to Control relay in Proteus ISIS which will help you in understanding the functionality of relays because in today's tutorial, I have used relays to do the DC Motor Direction Control. I have already posted a tutorial on DC Motor Drive Circuit in Proteus ISIS.
So, for DC Motor Direction Control, I have used Arduino UNO baord, so you should also download this Arduino Library for Proteus so that you can use Arduino boards in Proteus software. I have also provide the simulation and the code for DC Motor Direction Control but I would recommend you to design it on your own so that you learn from it. If you have any problem then ask in comments and I will try to resolve them. In this project, I have used Serial Terminal. So, whenever someone, sends character "C" on serial terminal then the motor will move in Clockwise Direction and when someone sends character "A" then it will move in Anti-clockwise Direction and will stop on character "S". Anyways, lets get started with DC Motor Direction Control with Arduino in Proteus ISIS.
DC Motor Direction Control with Arduino in Proteus ISIS
- You can download the Proteus simulation for DC Motor Direction Control by clicking the below button:
- So, now let's move on with designing it, first of all get the below components from Proteus and place them in your workspace:
- Now, design a circuit in Proteus software, as shown in below figure:
- You can see in the above figure that I have used two relays which I have used for DC Motor Direction Control.
- Moreover, there's a Virtual Terminal through which I am sending the commands.
- I have used Arduino UNO board for DC Motor Direction Control through Virtual Terminal. You should download the Arduino Library for Proteus so that you can use it in Proteus.
- Now upload the below code in your Arduino software and get the hex file. You should read how to get the Hex file from Arduino.
int Motor1 = 2; int Motor2 = 3; void setup() { pinMode(Motor1, OUTPUT); pinMode(Motor2, OUTPUT); Serial.begin(9600); } void loop() { if(Serial.available()) { char data = Serial.read(); Serial.println(data); if(data == 'C'){MotorClockwise();} if(data == 'A'){MotorAntiClockwise();} if(data == 'S'){MotorStop();} } } void MotorAntiClockwise() { digitalWrite(Motor1, HIGH); digitalWrite(Motor2, LOW); } void MotorClockwise() { digitalWrite(Motor1, LOW); digitalWrite(Motor2, HIGH); } void MotorStop() { digitalWrite(Motor1, HIGH); digitalWrite(Motor2, HIGH); }
- In the above code, I have designed three functions which I am calling on Serial receive.
- The code is quite self explanatory but if you got problem then ask in comments and I will resolve them.
- Once everything's done then run your simulation and if you have done fine then it will start working as shown in below figure:
- Obviously, you can't see a moving DC motor in an image but you can get the idea from Relays position in above figure. :)
- The below video will give you the better idea of How it works.
So, that's all for today. Hopefully now you have got the idea of How to do DC Motor Direction Control with Arduino in Proteus ISIS. In the next tutorial, I am gonna add speed control of DC Motor. So, till then take care and have fun. :)