To interface an Analog output (servo motor) and modify the angular displacement of the servo using PWM signal . COMPONENTS REQUIRED:
- Servo motor of choice (9v is preferred )
- 1 KΩ resistor
- Arduino Uno
- USB Interfacing cable
- Connecting wires
- Servo rated power supply (dc source )
Servo motors and are constructed out of basic DC motors, by adding: • gear reduction • a position sensor for the motor shaft • an electronic circuit that controls the motor's operation Typically, a potentiometer (variable resistor) measures the position of the output shaft at all times so the controller can accurately place and maintain its setting. Servo motors are used for angular positioning, such as in radio control airplanes. They typically have a movement range of 180 deg but can go up to 210 deg.The output shaft of a servo does not rotate freely, but rather is made to seek a particular angular position under electronic control.
Control An external controller (such as the Arduino) tells the servo where to go with a signal know as pulse proportional modulation (PPM) or pulse code modulation (which is often confused with pulse width modulation, PWM). PWM uses 1 to 2ms out of a 20ms time period to encode its information.
CIRCUIT DIAGRAM
- Connect the circuit as per the circuit diagram
- Connect the board to your computer via the USB cable.
- If needed, install the drivers.
- Launch the Arduino IDE.
- Select your board (If you the board is arduino uno, select accordingly).
- Select your serial port, accordingly ( E.g. COM5 )
- Open the file of the program and verify the error , clear if any errors that are existing
- Upload the program and check for the physical working.
- Ensure safety before powering up the device.
#include <Servo.h>
int pos = 0;
Servo servo_9;
void setup()
{
servo_9.attach(9, 500, 2500);
Serial.begin(9600);
}
void loop()
{
for (pos = 0 ; pos <= 180 ; pos += 1)
{
servo_9.write(pos);
delay(1);
//Serial.print("Angle of Server = ");
Serial.println(pos);
}
for (pos = 180 ; poas >= 0 ; pos -= 1){
servo_9.write(pos);
delay(1);
//Serial.print("Angle of Server = ");
Serial.println(pos);
}
}
Arduino uno interfacing with servo motor is learned and angular position is controlled using PWM signal.