Search Here

INTERFACING OF ARDUINO WITH SERVO MOTOR

INTERFACING OF ARDUINO WITH SERVO MOTOR

In this session ARDUINO interfacing with Servo Motor is discussed and the controlling of the servo motors using the program developed to the ARDUINO board. Servo Motor is a type of motor that rotate to the certain angle depending up on the instructions designed according to the program.

Servo Motor contains of different parts.

1. DC Motor

2. Potentiometer

3. Circuit Board with gear assemble unit

Potentiometer connected to the DC Motor helps to detect the position of the shaft of the motor and to instruct accordingly to rotate by certain angle.

Servo Motor consists of three pins – VCC, GROUND and OUTPUT PWM pin

The Servo Motor works only when it is connected to the PWM pin. PWM pins obtain the analog value of the digital signal, this is the special case of the PWM pins which is different from both analog and digital pins.

There are different types of Servo Motors that they have different torque specifications. The common torque specification of servo SG90 is 2.5 Kg/Cm.

Basically Servo Motor is designed to work on Feedback Mechanism

CONNECTING THE SERVO WITH ARDUINO

The Servo Motor consists of three pins VCC, GROUND and OUTPUT pins. The connection is discussed in the following points:

Initially the VCC pin of the Servo which is in the Red color is connected to the 5V pin on the ARDUINO board by using the male to female jumper wire.

Then the GROUND pin of Servo Motor which is in Brown Color is connected to the GROUND pin on the ARDUINO board by using the male to female jumper wire.

Finally the PWM OUTPUT pin of the Servo Motor which is in brown color is connected to the PWM pin on the ARDUINO board to retrieve the analog value of the digital signal by using the male to female jumper wire.

Here finally completes the electronic connection of the Servo Motor with the ARDUINO board is successfully done and the Servo motor receives the power source from the ARDUINO board.


ARDUINO PROGRAM OF SERVO MOTOR

#include <Servo.h>

 

Servo servo;

int angle = 10;

 

void setup() {

  servo.attach(3);

  servo.write(angle);

}

void loop()

{

 // scan from 0 to 180 degrees

  for(angle = 10; angle < 180; angle++) 

  {                                 

    servo.write(angle);              

    delay(15);                  

  }

  // now scan back from 180 to 0 degrees

  for(angle = 180; angle > 10; angle--)   

  {                               

    servo.write(angle);          

    delay(15);      

  }

}


After the successful writing of the program in the ARDUINO IDE and execution, the program can be dumped in to the ARDUINO Dev board and run the program accordingly.

 

FUNCTIONING OF SERVO MOTOR

After the successful program dumping and connections with ARDUINO the Servo Motor is set to start functioning. The output values and the position of the output shaft of the servo motor can be seen by the values on the serial monitor.

This enables the successful working of the Servo Motor.

Servo Motors can be used for different purposes. They can be used for feedback mechanism applications. The servo motors have certain torque instead of the RPM. The gear alignment turn out the RPM factor into the torque mechanism and offer a good amount of torque to fulfill its use in the robotics projects.



EXPLAINATION OF THE PROGRAM

Initially the shaft position is kept at the position of 10 degrees. Then the PWM pin of the servo is connected to the pin 3 of the ARDUINO board and finally the serial communication with the ARDUINO is established.

Now the Servo shaft is rotated from 10 degrees to 180 degrees with a time delay of 1.5 second. Then after reaching the 180 degrees, the program is applied in the opposite manner that is to rotate 10 degrees backwards until to reach 10 degrees with a time delay of 1.5 second.

In this way the above written program is used to control the rotation of the shaft accordingly to the above explanation. One important thing to note down is that the servo connected can only turn up to 180 degrees not of 360 degrees.

 

CONCLUSION

The above discusses information is all about the functioning of the servo motor with the help of ARDUINO programming and this application can make you to improve your experience with the working of the servo motors and this article made you to understand the concept of the PWM Pins and ensures you to improve your knowledge over the robotics projects with overall development in mechanics, programming and electronics fields.

More Posts

Compact Fluorescent Lamp Circuit (CFL)

Arduino UNO

SMD Register coding

Thermoelectric Generators AKA Peltier Modules

Capacitors

PN Junction Diode

Introduction To Raspberry Pi

Gas sensor

What Are Resistors?

INTERFACING OF ARDUINO WITH ULTRASONIC SENSOR

Archived