Servo Motor Interfacing with ARM mbed
Servo motor is an electromechanical device which consists of motor, gear assembly and feedback circuitry. It is used in Robotics applications, airplanes, rudders, quad copters, etc. here we learn how to drive (0-180 degree) servo motor using ARM MBED LPC1768.
5.4k views1 min readUpdated Jan 13, 2023
Overview of Servo Motor

- A servo motor is an electric device used for precise control of angular rotation. It is used in applications that demand precise control over motion, like in case of control of robotic arm.
- The rotation angle of the servo motor is controlled by applying a PWM signal to it.
- By varying the width of the PWM signal, we can change the rotation angle and direction of the motor.
For more information about Servo Motor and how to use it, refer the topic Servo Motor in the sensors and modules section.
Connection Diagram of Servo Motor with ARM MBED (LPC1768)

Rotate Servo Motor using LPC1768 ARM MBED
Here, we will be using Simon Ford‘s “Servo” Library from MBED.
Download or Import code from here.
Here is the program to drive the servo motor for 0-180 degree and 180-0.
Servo Motor Code for LPC1768 ARM MBED
#include "mbed.h"
#include "Servo.h"
Servo myservo(p21);
int main()
{
while(1) {
for(int i=0; i<100; i++) {
myservo = i/100.0;
wait(0.01);
}
for(int i=100; i>0; i--) {
myservo = i/100.0;
wait(0.01);
}
}
}Components Used
Powered by
Downloads
Comments0
Join the discussion — share a question or tip.
Be the first to share your thoughts on this guide.

