Introduction: Sweeping Servo

Servo motors are small, lightweight, and energy efficient rotary actuators which allows for a precise and accurate rotary control to a certain angular limit, normally 180 degrees. They utilize a closed-loop control system to provide the user feedback and control of the the angle of a servo control horn attached to the top-most gear.

Servos are commonly used in robotics for the precise contort of a bipedal robot and in radio-controlled airplanes to position control surfaces like elevators, rudders. The

This project focuses on the basic use of a servo motor control, specifically the ability to control the angle in which the servo horn moves with precision.

Step 1: Tools and Materials

  • Arduino Uno
  • Servo Motor
  • 3 pieces of Jumper Cables

Step 2: Attaching the Servo to Arduino

  1. Connect the black female pin of the servo motor to the GND pin in the Arduino.
  2. Connect the red female pin of the servo motor to the 5V pin in the Arduino.
  3. Connect the white female pin of the servo motor to the digital pin 9 in the Arduino.

Step 3: Securing the Servo

4. Using tape, adhere the body of the servo motor to any flat surface to counter the torque produced by the servo motor as it turns it gears.

Step 4: Coding

//include the servo library

#include <SoftwareServo.h>
//create a servo object  
Servo myServo;  
// declare the pins to which the servo is connected.  
const int servoPin = 9;
void setup() {   
	//connect 'myServo' to pin 9 on the Arduino    
	myServo.attach(9);  

	//initialize the position to 0 degrees
	myServo.write (0);
}
void loop() {
	// move the servo angle to 90 degrees     
	myServo.write(90);

	delay (500);

	// move the servo to its maximum angle 180 degrees     
	myServo.write (180);

	delay (500);
    // move the servo angle back to 0  degrees     
	myServo.write (0);
	
	delay (500);
}

Step 5: Servo Control Demo

The servo motors, first moves to 90 degrees, then 180 degrees, then back to 0 degrees. This demonstration videos shows the accuracy and precision of the servo motor.