Skip to main content

Arduino board interfacing with servo motor

1.    Servo motor

    A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors.
                         


Table of specifications: -

S. no
Type
Specification
1
Size
38 x 11.5 x 24mm (Include tabs) 28 x 12.7 x 27mm (Not include tabs)
2
weight
17 to 18 g
3
Speed
0.14sec/60degrees (4.8V) 0.12sec/60degrees (6.0V
4
Torque
2.5kgf-cm (4.8V) 3.0kgf-cm (6.0V)
5
Voltage
4.8V-6.0V
6
Connector type
JR type (Yellow: Signal, Red: VCC, Brown:GND)


2.    Arduino interfacing with Servo motor

 Here we will see how to connect a servo motor and then how to turn it to different positions.
 The first motor I ever connected to an Arduino, seven years ago, was a Servo motor.  Nostalgic  moment over, back to work!
 We will need the following things:
 1.      An Arduino board connected to a computer via USB
 2.      A servo motor
 3.      Jumper wires


Following are the steps to connect a servo motor to the Arduino:
1.  The servo motor has a female connector with three pins. The darkest or even black one     is usually the ground. Connect this to the Arduino GND.
2.  Connect the power cable that in all standards should be red to 5V on the Arduino.
3.  Connect the remaining line on the servo connector to a digital pin on the Arduino.

Note: - Any digital pin of arduino board can be used to run servo motor but initial don’t forget to add servo library.

download servo library from here:Servo master library


Arduino code for Servo motor: -


#include <Servo.h>  //Include the Servo library


int servoPin = 3;   // Declare the Servo pin

Servo Servo1;      // Create a servo object

void setup()
{
   Serial.begin(9600);
   Servo1.attach(servoPin); / /We need to attach the servo to the used pin number
}

void loop()
{
   
   Servo1.write(0);      / / Make servo go to 0 degrees
   Serial.println("Rotate the servo with 0 degree");
   delay(1000);
   
   Servo1.write(90);       // Make servo go to 90 degrees
   Serial.println("Rotate the servo with 90 degree");
   delay(1000);
   
   Servo1.write(180);       // Make servo go to 180 degrees
   Serial.println("Rotate the servo with 180 degree");
   delay(1000);

}


Please share and follow my blog for more Arduino projects.

Comments

Popular posts from this blog

Smart Home Door lock system project.

RFID MFRC522  Door lock system Project summary: RFID system radio frequency identification in which Information is written in the card or tag is get read by RFID module when they get in contact. In this project we are making a home lock system which would open only when an authorized card will be available and access will be denied on wrong card. Component require: - In this project we are interfacing Arduino board with RFID MFRC522 and servo motor. RFID system would send data to Arduino board and according to that data action would be taken by Arduino board. Components are listed below:         ·          Arduino board.         ·          Arduino software.         ·          RFID MFRC522 board.         ·        ...

Arduino interfacing with capacitive touch sensor

  Arduino interfacing with capacitive touch sensor 1.     Digital touch sensor     A capacitive touch sensor is same as our android phone screen.  C apacitive touch sensing is a way of human touch sensing, that requires little or no force to activate. It may be used to sense human touch through more than a quarter of an inch of plastic, wood, ceramic or other insulating material (not any kind of metal though), enabling the sensor to be completely visually concealed.     Specifications of touch sensor:  - This touch sensor is a capacitive touch sensor which                 works on active capacitor which get create when any person touches it, just like our phone                   screen.                                           ...

Smart home project with MQ2 gas sensor

Project summary:   MQ2 gate sensor is analog type sensor which can detect LPG, Methane, CO2 and Smoke in Air. In this project we are going to calibrate LPG, CO and Smoke PPM in the air and display these values on the Nokia 5110 LCD screen. Figure 1 : MQ2 gas sensor with Nokia5110LCD In this project when you will exhale breathe on it or put a cigarette lighter near it then LCD screen reading would change. Component required: - This project is based on the Arduino uno board and we are interfacing MQ2 gas sensor with Nokia 5110LCD so we would required component which are described below. Components list:       ·           Arduino board.       ·           Arduino software.       ·           MQ2 gas sensor.       ·       ...