fbpx

Interface Servo Motor With ARM7

Description

Servo motor uses servo mechanism. It is a closed-loop mechanism that uses position feedback to control the precise angular position of the shaft.

  • Some special types of applications of the electrical motor where rotation of the motor is required for just at a certain angle not continuously for a long period of time.
  • The motor is required with some special arrangement which makes the motor to rotate at a certain angle for a given electrical input (signal).
  • Servo motors have three wires.
  • Two of them are red and black which is used to give power to the motor.
  • The third wire is used to provide a control signal for an angular position.
  • It uses Pulse Width Modulated(PWM) waves as control signals.
  • The angle of rotation is determined by the width of the pulse at the control pin.

Hardware Required

  • Servo Motor.
  • LPC21XX MicroController.

Circuit

Code

 #include <LPC21xx.H>
 void Delay(unsigned int ms);
 void Delay_servo(unsigned int us);
 int main()
 {
 IODIR0=0XFFFFFFFF;
 while(1)
 {
 IO0PIN=0XFFFFFFF1;
 Delay_servo(50);
 IO0PIN=0XFFFFFFF0;
 Delay(1000);
 IO0PIN=0XFFFFFFF1;
 Delay_servo(82);
 IO0PIN=0XFFFFFFF0;
 Delay(1000);
 IO0PIN=0XFFFFFFF1;
 Delay_servo(110);
 IO0PIN=0XFFFFFFF0;
 Delay(1000);
 IO0PIN=0XFFFFFFF1;
 Delay_servo(138);
 IO0PIN=0XFFFFFFF0;
 Delay(1000);
 }
 }
 void Delay(unsigned int ms)
 {
 unsigned long int us = ms*1000;
 while(us--)
 {
 
 }
 }
 void Delay_servo(unsigned int us)
 {
 while(us--)
 {
 
 }
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *