Servo Motor Control using Arduino Simulation in Proteus

servo motor circuit diagram

Hey everyone. I hope you will be fine.today our post is Servo Motor Control using Arduino Simulation in Proteus

As you know that last time, we had started Arduino UNO course and given you a brief introduction how to simulate the LED blinking via Arduino UNO and its implementation in proteus ISIS.

Now, today we are going to implement Servo Motor Simulation via Arduino UNO in proteus ISIS.

Servo Motor Control using Arduino  Simulation in Proteus

What is Servo Motor?

With the help of servo motors you can position the motor shaft at a specific angle using control signal. The motor will hold its shaft at this position as long as the control signal is not changed. This is very useful for controlling robot arms, unmanned airplanes control surface or any object that you want it to move at certain angle and stay at its new position.

Servo motors may be classified according to size or torque into mini, standard and giant servos. Usually mini and standard size servo motors can be powered by Arduino directly with no need to external power supply or driver. Usually servo motors come with arms that are connected to the object required to move.

servo motor basic

Servo Motor Working:  

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to pin 9 on the Arduino board.

Controlling a servo motor directly with Arduino is quite easy. However, a servo motor may require significantly more current than the Arduino can provide.  In hardware implementation the following example uses a standard sized servo (without any load) powered directly from the Arduino via USB. When powering the servo directly from the Arduino board:

  • Connect the black wire from the servo to the GND pin on the Arduino
  • Connect the red wire from the servo to the +5V pin on the Arduino
  • Connect the yellow or white wire from the servo to a digital pin on the Arduino

In proteus you don’t need to connect servo motor pins 1 and 3 in proteus.

Schematic Diagram:

Servo Motor Control using Arduino  Simulation in Proteus

Here you can see the actual implementation of servo motor in proteus. In proteus you don’t need to connect the +5v and ground pins to servo motor. They are already built in the proteus ISIS and connected to +VCC and ground pins.

We will connect only pin 9 of the Arduino UNO to pin 2 of the servo motor through which control signal which is a pulse-width modulation (PWM) signal is given to servo motor. The control signal can be easily produced via Arduino board. Servo motor accepts the signal from your controller that tells it what angle to turn to.

The control signal is just a pulse of varying lengths. The length of the pulse corresponds to the angle the motor turns to. As you can see from the code that servo motor take an 1800 revolution in clockwise as well as in counter clockwise.  

schematic diagram

Circuit Diagram:

Here you can see the hardware circuit diagram which is designed to implement the desired operation. Alternatively, you can plug the servo’s wire into three adjacent pins, and set the pin connected to the red lead to “HIGH” and the pin connected to the black lead to “LOW”. If you want to connect it to a separate power supply, you would connect the battery / power supply’s red (5V) and black (GND) wires to the servo’s red and black wires, and connect the signal wire to the Arduino.

servo motor circuit diagram

Proteus Simulation:

Here you can see real implementation of servo motor in proteus. As you can see that I have connected just only pin 9 of the Arduino UNO to pin 2 of the servo motor and obtained the desired results.

Clockwise Direction:

proteus diagram clockwise rotation

Counter Clockwise Direction:

proteus diagram counter clockwise rotation

 

How to use Arduino Simulator in Proteus

GPS Library for Proteus8

Bluetooth Library for Proteus ISIS

 

Arduino Simulator

Arduino 3 Phase Motor Controller

 

Servo Motor Control using Arduino Simulation in Proteus
arduino simulation in proteus 7 and proteus 8 arduino uno interfacing with servo motor

 

Servo Motor Control using Arduino Simulation in Proteus
arduino simulation in proteus 7 and proteus 8 arduino uno interfacing with servo motor

 

 

Code:

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; pos += 2) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=2) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

 

****************************

I hope it will be helpful for you. Next time I will explain another example via Arduino UNO and explain you how it can be implemented in proteus to perform desired task.

Any query related to this will be welcomed. Take care for the next time………

One thought on “Servo Motor Control using Arduino Simulation in Proteus

Leave a Reply

Your email address will not be published. Required fields are marked *