0% found this document useful (0 votes)
60 views4 pages

9G Servo Mod

The document describes how to control a servo motor using an Arduino. It provides an overview of servo motors and how they work using position feedback and electrical pulses to control rotation angle. It then gives the materials needed, including an Arduino Uno, servo motor, and DuPont wires. Finally, it provides a wiring diagram and sample Arduino code to rotate the servo from 0 to 180 degrees and back using the write function.

Uploaded by

thamer al-salek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views4 pages

9G Servo Mod

The document describes how to control a servo motor using an Arduino. It provides an overview of servo motors and how they work using position feedback and electrical pulses to control rotation angle. It then gives the materials needed, including an Arduino Uno, servo motor, and DuPont wires. Finally, it provides a wiring diagram and sample Arduino code to rotate the servo from 0 to 180 degrees and back using the write function.

Uploaded by

thamer al-salek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Servo control experiment

Overview

We will learn how to use the Arduino to control a servo motor and make it turn.

Materials
Arduino Uno x 1
Servo x 1
DuPont wires

Product Description

A servo motor is a motor that can turn to an accurate position based on signals sent to it. It consists of a
motor, gear a position detector and control circuitry. There is a feedback loop such that the motor is
controlled based on the position sensor and the control input. Generally servo motors have a range of 0 to
180 degrees. This servo motor is controlled by the length of electrical pulses sent to it.
The are suitable for control systems that require changing constantly changing angles that need to be
maintained. They are used in remote control toys, such as model aircraft, model boats and are commonly
used in robots. They are often just referred to as servos.
There are many different specifications for servos, but all the steering gear have three external wires colored
brown, red and orange. For this servo, brown is ground, red is positive and orange is the signal line.
The rotation angle of the servo is adjusted by the duty ratio of the PWM (Pulse Width Modulation) signal. The
duty cycle is how long the signal is positive for in once cycle of a pules. The cycle length of the standard
PWM signal is fixed at 20 ms (50 Hz). Theoretically, the pulse width distribution should be within 1 ms and
2ms, however,in fact the pulse width can be from 0.5ms to 2.5ms. The pulse width corresponds to steering
gear angle from 0°~ 180°. Please be aware that different servo Brands may have different steering angles
for the same signal.

Specification:

Weight:9g
Size:23x12.2x29mm
No-load operating speed:0.12s/60°(4.8V);0.10s/60°(6.0V)
Torque:1.6kg·cm(4.8V)
Operating temperature:-30~+60 degrees Celsius
Dead zone setting: 5 microseconds
Working voltage:3.5V~6V

Using Arduino to control Servo

The Aduino has its own Servo function for servo control. The advantage of using this is that it is already
written for you, though it is restricted to only two servos using its digital pins 9 and 10.
Wiring Diagram

Connect the servo to the digital 9 interface and write a program to move the servo to the position where the
user inputs the angle number.
Sample code

#include <Servo.h>

Servo myservo; // Define an object

int pos = 0; // Define the position of the rotation

void setup()
{
myservo.attach(9); // Setting the pin of the servo
}

void loop()
{
// 0° to 180°
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
// 180°to 0°
for(pos = 180; pos>=1; pos-=1)
{
myservo.write(pos);
delay(15);
}
}

Results

After uploading to the Arduino, it can be seen that the servo starts to run from 0° to 180° and then back from
180° to 0°

You might also like