You are on page 1of 3

Anjuman-I-Islam’s

M.H. SABOO SIDDIK COLLEGE OF ENGINEERING


8, Saboo Siddik Poly. Road, Byculla, Mumbai-4000 08.

DEPARTMENT OF AUTOMOBILE ENGINEERING

Date: / /2023
Aim: To interface Arduino Uno with servo motor.
Apparatus:
Hardware: An Arduino board connected to a computer via USB, a servo motor, Jumper wires
Software: Arduino IDE
Theory:
Servo Motor Description:
Micro Servo Motor SG90 is a tiny and lightweight servo motor with high output power. Servo can
rotate approximately 180 degrees (90 in each direction), and works just like the standard kinds but
smaller. You can use any servo code, hardware, or library to control these servos. Good for beginners
who want to make stuff move without building a motor controller with feedback & gear box,
especially since it will fit in small places. It comes with 3 horns(arms) and hardware.
Specifications:

 Product: SG90 Servo


 Torque: 2.0kg/cm(4.8V), 2.2kg/cm(6V)
 Speed: 0.09s/60°(4.8V), 0.08s/60°(6V)
 Rotate angle: 180°
 Operating voltage: 4.8 ~ 6V
 Gear: plastic
 Weight: 10.5g
 Dimension: 22.8mm × 12.2mm × 28.5mm

Figure 1. Servo motor


Connection Diagram:

Procedure:
Step 1. Following are the steps to connect a servo motor to the Arduino:

 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.

 Connect the power cable that in all standards should be red to 5V on the Arduino.

 Connect the remaining line on the servo connector to a digital pin on the Arduino.

Step 2. Power the Arduino board via computer USB connection.


Step 3. Write the code which will turn a servo motor to 0 degrees, wait 1 second, then turn it to 180,
wait one more second and then go back. (Note: If the servo motor is connected on another digital pin,
simply change the value of servoPin to the value of the digital pin that has been used.)

Step 4. Verify the code, and remove the errors if any.


Step 5. After successful compilation of the code, upload the code into Arduino.
Step 7. Observe the output in the servo motor.

Conclusion:
In this practical working of servo motor and interfacing of it with Arduino Uno was studied
successfully.
NOTE: CODE SHOULD BE HANDWRITTEN
Code:
#include <Servo.h>
Servo s1;
void setup()
{
s1.attach (3);
}
void loop()
{
s1.write(0);
delay(1000);
s1.write(180);
delay (1000);
s1.write(0);
}

You might also like