SG90 Servo Motor: Controlling Precise Angular Movements

Need to move a robotic arm or aim a camera? The SG90 servo motor is the perfect companion. Compact and simple to drive, it offers angular control from 0 to 180 degrees.

Quick Answer

The SG90 servo motor is a small actuator capable of reaching a precise angular position between 0° and 180°. It integrates a DC motor, a gearbox, and a control circuit, driven via a PWM signal where the pulse width defines the target angle.

Safety: Always disconnect the power supply before modifying the wiring.

Essentials in 60 seconds

No time to read it all?

“Need to move a robotic arm or aim a camera?”

Watch our visual summary to master the key concepts instantly.

db-tronic Raspberry Pi 5 8 GB Starter Kit (128 GB Edition)

db-tronic Raspberry Pi 5 8 GB Starter Kit (128 GB Edition)

🛠️ The essential tool for this project.

Check price on Amazon

The Assembly

SG90 wiring diagram

Wiring Table

Component Pin Arduino Pin Color
GND (Brown) GND Black
VCC (Red) 5V Red
Signal (Orange) Pin 9 Orange

Arduino Code

#include 

Servo myservo;

void setup() {
  myservo.attach(9);
}

void loop() {
  myservo.write(0);
  delay(1000);
  myservo.write(90);
  delay(1000);
  myservo.write(180);
  delay(1000);
}

Live Demonstration

SG90 simulation
Interactive simulation via Velxio.

Why the SG90 is the Maker’s Best Friend?

If you take a look inside any electronics enthusiast’s workshop, you will inevitably find one or more translucent blue SG90 servo motors. Why such success? Unlike a classic DC motor that rotates indefinitely, a servo motor integrates a small “brain” (a potentiometer coupled with a control circuit) that allows it to know its exact position at any time.

When you ask it to move to 90 degrees, it goes there and stays locked with force. It is this ability to hold a position (the holding torque) that makes the SG90 indispensable for animating robot joints, control surfaces of model aircraft, or locking mechanisms.

Beware of the Power Supply Trap!

This is the number one mistake for any beginner: connecting the servo motor directly to the Arduino’s 5V pin. Although it works without a load, a servo motor that forces to lift a weight (even a light one) will draw a peak current. This peak can cause the Arduino’s voltage to drop, leading to random reboots and totally erratic behaviors.

My enthusiast recommendation: For your serious projects, always use an external power supply (like a 4xAA battery pack or a step-down module) to power your servo motors. Just remember to connect the grounds (GND) of the Arduino and the external power supply together. This is the secret to a stable system!

SG90 vs MG996R: Which One to Choose?

The SG90 has plastic gears (Nylon). It is perfect for light movements (up to ~1.5 kg/cm of torque). If you are building a robust robotic arm or an imposing hexapod, its gears will eventually give way. In this case, switch to the big brother: the MG996R. It works with the same Arduino code, but its metal gears give it colossal strength.

In summary, the SG90 is your Swiss Army knife for rapid prototyping. So, what are you going to animate today? A cat food dispenser? An articulated arm? Imagination is your only limit.

To further explore power management, don’t forget to consult our article on Ohm’s Law.

Share

Leave a Reply

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

Post comment