Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
A servo motor is a closed-loop system that uses position feedback to control its motion and final position. The SG90 Servo Motor is a popular, compact, and lightweight servo motor widely used in electronics, robotics, and DIY projects. It is known for its low cost and ease of use, especially with microcontrollers like Arduino, Raspberry Pi, and ESP boards.
Servo motor internal structure by Circuit Basics
DC Motor – Provides rotational motion.
Gearbox – Reduces the high-speed, low-torque output of the DC motor to a low-speed, high-torque rotation.
Potentiometer (Position Sensor) – Detects the shaft angle and provides feedback on the current position of the output shaft.
Control Circuit – Compares the desired position, received via PWM signal, with the actual position detected by the potentiometer, and drives the motor to correct any difference.
Servo motors typically have three pins: VCC, GND, and Signal. The Signal pin is used to transmit control signals from the microcontroller to the servo, enabling it to rotate to a specific angle.
The SG90 servo motor operates using Pulse Width Modulation (PWM) within a closed-loop control system. As an analog micro servo, it adjusts its angular position based on variable pulse widths and continuously corrects itself to maintain the target angle.
Servo Motors, how do they work? by The Engineering Mindset
A microcontroller or other control device sends a PWM signal to the servo’s signal pin. PWM determines the target angle.
The SG90 servo motor positions its shaft based on a PWM signal, with the pulse width determining the angle. For example,
The control circuit interprets the incoming PWM signal.
The control circuit drives a DC motor to rotate the output shaft to the corresponding angle.
The DC motor is geared down to provide higher torque for controlling the servo arm’s position.
As the motor rotates, the potentiometer provides real-time position feedback.
The servo continuously monitors the signal. If a discrepancy exists between the desired and actual positions, the control circuit activates the DC motor to adjust the output shaft accordingly. The motor stops once the shaft reaches the target angle.
Servo#include <Servo.h>
Servo myServo; // create servo object
void setup() {
myServo.attach(9); // attach to digital pin 9
}
void loop() {
myServo.write(0); // move to 0 degrees
delay(1000);
myServo.write(90); // move to 90 degrees
delay(1000);
myServo.write(180); // move to 180 degrees
delay(1000);
}
Rotate the servo to an angle we desire: pass the desired angle as an argument into the servo.write() function.