Professional Documents
Culture Documents
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:
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.
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);
}