Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.
When I first started working with microcontrollers as a junior PCB engineer, the SG90 micro servo became my go-to component for learning motion control. This tiny blue motor has probably taught more people about robotics than any other servo on the market. If you’re just getting started with Arduino and want to add controlled movement to your projects, the SG90 micro servo Arduino combination is the perfect starting point.
This guide walks you through everything from understanding what makes the SG90 special to building your first working project. I’ve spent years debugging servo systems on production boards, so I’ll share the practical insights that datasheets don’t tell you.
Understanding the SG90 Micro Servo Motor
The SG90 is an analog micro servo motor manufactured primarily by TowerPro. At just 9 grams, it’s one of the lightest servos available, yet it packs enough precision for most beginner and intermediate projects. Unlike regular DC motors that spin continuously, the SG90 can rotate to specific angles and hold that position.
Inside the compact blue housing, you’ll find several key components working together. A small DC motor provides the rotational force, but it spins far too fast and with too little torque for most applications. A plastic gear reduction system solves this by slowing down the motor while multiplying the torque. A potentiometer mechanically coupled to the output shaft measures the current position, while control circuitry compares this feedback with your commanded position and adjusts the motor accordingly.
This closed-loop control system is what makes servos special. Send a signal for 90 degrees, and the servo will move there and actively resist external forces trying to push it away from that position. This happens automatically without any additional programming on your part.
SG90 Specifications and Technical Details
Understanding the specifications helps you determine if the SG90 fits your project requirements. Here’s what you need to know:
Specification
Value
Notes
Weight
9 grams
One of the lightest servos available
Dimensions
23 × 12.2 × 29 mm
Fits in very tight spaces
Operating Voltage
4.8V – 6V
Typically powered at 5V
Stall Torque @ 4.8V
1.8 kg-cm
Can lift 1.8kg at 1cm from shaft
Stall Torque @ 6V
2.2 kg-cm
Higher voltage = more torque
Operating Speed @ 4.8V
0.12 sec/60°
Takes 0.36 seconds for full 180° sweep
Rotation Range
180° (approximately)
90° in each direction from center
Gear Type
Plastic (POM)
Quieter but less durable than metal
Current Draw (Idle)
~10mA
Minimal when holding position
Stall Current
220-650mA
Maximum when blocked or under heavy load
What These Numbers Mean in Practice:
The torque rating of 1.8 kg-cm means the servo can support 1.8 kilograms suspended 1 centimeter from the output shaft. If you move that weight to 2 centimeters away, the servo can only handle 0.9 kilograms. This inverse relationship is crucial for mechanical design.
The plastic gears make the SG90 quieter than metal-gear alternatives, but they wear faster under continuous heavy loads. For learning projects and light-duty applications, the plastic gears are perfectly adequate and keep the cost down.
Why Choose SG90 Micro Servo Arduino Combination
The SG90 micro servo Arduino pairing has become the standard teaching platform for servo control, and for good reason. The Arduino ecosystem provides a built-in Servo library that handles all the complex PWM signal generation, letting you focus on your project logic instead of timer configuration.
Arduino boards can source enough current to power a single SG90 during testing, making initial experimentation simple without requiring external power supplies. The combination is forgiving enough for beginners while being capable enough for real applications.
From a cost perspective, both components are incredibly affordable. You can get started with SG90 micro servo Arduino projects for under $20 total, removing the financial barrier that often prevents experimentation.
How the SG90 Receives Position Commands
Servos use Pulse Width Modulation (PWM) for position control, but it works differently than the PWM you might use for LED dimming. The SG90 expects to receive a pulse every 20 milliseconds (50Hz frequency). The duration of each pulse determines the target position.
Here’s how the timing works:
Pulse Width
Servo Position
Angle
~1.0 ms
Fully left
0°
~1.5 ms
Center
90°
~2.0 ms
Fully right
180°
However, there’s a catch that catches many beginners. These values are approximate. Individual SG90 servos may require slight adjustments. Some units might need 0.5ms for 0°, while others want 0.55ms. Similarly, the maximum might be 2.4ms instead of 2.0ms.
This variation happens because servo manufacturers don’t calibrate each unit individually. They program the control chip with standard values and accept that each servo will have slight differences. The good news is that the Arduino Servo library lets you adjust these values if needed.
Essential Components for Your First Project
Before diving into wiring and code, gather these components:
Required Items:
Arduino Uno, Nano, or compatible board
SG90 micro servo motor
Breadboard (half-size works fine)
Jumper wires (male-to-male)
USB cable for Arduino programming
Recommended for Better Results:
External 5V power supply (500mA minimum)
470µF capacitor (for power supply filtering)
Servo extension cable (makes wiring cleaner)
The external power supply isn’t strictly necessary for initial testing with one servo, but it prevents the frustrating issues that arise when the Arduino’s voltage regulator gets overloaded.
Wiring the SG90 to Arduino Step-by-Step
The SG90 has three wires with color coding that’s usually consistent but occasionally varies between manufacturers. Here’s what you need to know:
Standard Wire Colors:
Wire Color
Function
Arduino Connection
Orange/Yellow/White
Signal (PWM)
Digital Pin 9
Red
Power (VCC)
5V pin*
Brown/Black
Ground (GND)
GND pin
*See power supply notes below before connecting.
Basic Wiring Steps:
First, position your breadboard and Arduino on your work surface. Take the SG90 servo and identify the three wires. If you’re uncertain about wire colors, the signal wire is always in the middle of the three-pin connector.
Connect the brown or black wire to any GND pin on the Arduino. This establishes the common reference for both devices. Next, connect the orange, yellow, or white signal wire to digital pin 9 on the Arduino. While you can use other digital pins, pin 9 is standard in most examples.
For the power connection, you have two options. For initial testing with a single servo, you can connect the red wire to the Arduino’s 5V pin. However, this approach has limitations. The Arduino Uno’s voltage regulator can supply about 500mA maximum when powered via USB, and that current must be shared with the Arduino itself and any other components.
Better Power Setup:
Connect the servo’s red wire to an external 5V power supply positive terminal instead of the Arduino 5V pin. Connect the external power supply’s ground to one of the Arduino’s GND pins. This creates a common ground between systems while keeping the power supplies separate. This approach prevents the Arduino from resetting unexpectedly when the servo moves and draws current.
Never connect the external power supply’s positive terminal directly to Arduino’s 5V pin. This could damage the voltage regulator or create ground loops.
Your First SG90 Arduino Code
Let’s start with a simple example that moves the servo to three positions with pauses between them. This code demonstrates the fundamental commands you’ll use in every servo project.
#include <Servo.h>
Servo myServo; // Create servo object
const int servoPin = 9;
void setup() {
myServo.attach(servoPin); // Connect servo to pin 9
delay(100); // Short delay for servo to initialize
}
void loop() {
myServo.write(0); // Move to 0 degrees
delay(1000); // Wait 1 second
myServo.write(90); // Move to center (90 degrees)
delay(1000); // Wait 1 second
myServo.write(180); // Move to 180 degrees
delay(1000); // Wait 1 second
}
Code Explanation:
The #include <Servo.h> statement loads the Servo library, which comes pre-installed with the Arduino IDE. The Servo myServo line creates a servo object that you’ll use to control the motor.
In the setup function, myServo.attach(9) tells the library which pin you’ve connected the servo signal wire to. This initializes the internal timers needed to generate the PWM signal.
The myServo.write(angle) command is where the magic happens. Pass it any value from 0 to 180, and the servo moves to that angle. The delays between commands give the servo time to complete each movement before receiving the next command.
Creating Smooth Servo Movement
The previous example shows discrete position changes, but many projects need smooth, gradual motion. Here’s how to create a sweeping motion:
#include <Servo.h>
Servo myServo;
const int servoPin = 9;
void setup() {
myServo.attach(servoPin);
}
void loop() {
// Sweep from 0 to 180 degrees
for(int angle = 0; angle <= 180; angle++) {
myServo.write(angle);
delay(15); // Control sweep speed
}
// Sweep back from 180 to 0 degrees
for(int angle = 180; angle >= 0; angle–) {
myServo.write(angle);
delay(15);
}
}
The for loop increments the angle by one degree at a time. The 15-millisecond delay between steps controls the sweep speed. Decrease this value for faster motion, increase it for slower movement. Most servos can’t physically move faster than about 10ms per degree, so going below that won’t increase speed.
Controlling SG90 with a Potentiometer
Adding a potentiometer creates a manual control system where rotating the knob directly controls the servo position. This is useful for testing servo range and creating adjustable mechanisms.
#include <Servo.h>
Servo myServo;
const int servoPin = 9;
const int potPin = A0;
void setup() {
myServo.attach(servoPin);
}
void loop() {
int potValue = analogRead(potPin); // Read pot (0-1023)
int angle = map(potValue, 0, 1023, 0, 180); // Convert to angle
myServo.write(angle); // Update servo position
delay(15); // Small delay for stability
}
The potentiometer connects with its center pin to A0, one outer pin to 5V, and the other outer pin to GND. The map() function converts the 10-bit ADC reading (0-1023) to a servo angle (0-180).
Common Problems and Solutions
After debugging hundreds of SG90 servo issues, here are the problems you’re most likely to encounter and how to fix them.
Servo Jitters or Vibrates:
This usually indicates insufficient power supply. The servo tries to move but doesn’t have enough current, causing it to oscillate around the target position. Solution: Use an external 5V power supply rated for at least 500mA. Add a 470µF capacitor across the servo’s power and ground wires, positioned as close to the servo as possible.
Servo Doesn’t Reach Full 180° Range:
Your specific SG90 unit might need adjusted pulse width values. Use the attach function with custom min/max values:
myServo.attach(servoPin, 500, 2400); // Custom pulse widths in microseconds
Experiment with these values to find what works for your servo. Start with 500 and 2400, then adjust based on actual movement.
Arduino Resets When Servo Moves:
The servo’s current draw causes the Arduino’s voltage to drop below the operating threshold. Always use an external power supply for the servo. If problems persist, add bulk capacitance (1000µF) across the Arduino’s power rails.
Servo Makes Buzzing Noise:
A slight buzz is normal for analog servos holding position. Excessive buzzing indicates the servo is fighting to maintain position, often due to mechanical binding. Check that nothing is restricting the servo’s movement and that your mechanical linkages move freely.
Practical Applications for Beginners
The SG90 micro servo Arduino combination works well for these beginner-friendly projects:
Camera Pan/Tilt Mount: Use two servos to create a remote-controlled camera platform. One servo handles horizontal rotation, the other controls vertical tilt.
Robotic Arm Gripper: The SG90’s size and torque make it ideal for small gripper mechanisms that can pick up lightweight objects.
Automated Door Opener: Create an automatic door for a dollhouse, pet feeder, or display case that opens when triggered by a sensor.
Gauge Display: Build an analog gauge that displays sensor data, weather information, or system status using the servo as a pointer mechanism.
RC Servo Tester: Create a tool to test and center servos before installation in projects.
When to Upgrade from SG90
The SG90 is excellent for learning and light-duty applications, but you’ll eventually encounter its limitations. Consider upgrading when:
You Need More Torque: The MG90S offers similar size but uses metal gears and provides 2.2 kg-cm torque. For even higher torque, the MG995 or MG996R servos provide 11 kg-cm but in a larger package.
Durability Becomes Critical: Projects with continuous operation or frequent direction changes will wear out plastic gears quickly. Metal gear servos last significantly longer under these conditions.
Precision Matters: Digital servos update position at 300Hz instead of the SG90’s 50Hz, providing better holding torque and more precise positioning.
Speed is Important: High-speed servos can complete 60° rotation in 0.06 seconds instead of 0.12 seconds, doubling the response time.
Essential Resources and Downloads
Official Documentation:
SG90 Datasheet PDF: Search for “TowerPro SG90 datasheet” from manufacturers
Arduino Official Getting Started: YouTube channel @Arduino
SG90-specific tutorials available on major maker channels
Frequently Asked Questions
Can I control multiple SG90 servos with one Arduino?
Yes, Arduino Uno can control up to 12 servos using the standard Servo library. However, consider power requirements carefully. Each SG90 can draw up to 650mA under stall conditions, so you’ll definitely need an external power supply for multiple servos. A 5V 3A power supply works well for projects using 3-4 servos simultaneously.
Why does my servo only move to 90 degrees instead of 180?
First, verify you’re using myServo.write(180) and not myServo.writeMicroseconds(180). The write() function takes angle as input, while writeMicroseconds() expects pulse width. If the code is correct, your servo might need custom min/max pulse width values. Try myServo.attach(pin, 500, 2400) to extend the range.
How much weight can the SG90 actually lift?
The 1.8 kg-cm torque rating means 1.8kg at 1cm from the rotation center. This decreases with distance: 0.9kg at 2cm, 0.6kg at 3cm, and so on. In practice, account for friction and mechanical inefficiency. Plan for 60-70% of the theoretical maximum. For the SG90, this means reliably lifting about 1kg at 1cm distance.
Can I power the SG90 with 3.3V logic from ESP32 or Raspberry Pi?
The SG90 accepts 3.3V logic signals without problems, as the signal input threshold is around 2V. However, the servo motor itself still needs 5V power. Connect your 3.3V microcontroller signal pin to the servo’s signal wire, power the servo from a 5V supply, and ensure common ground between all components.
How long does an SG90 servo typically last?
Lifespan depends entirely on usage. Under continuous operation with frequent direction changes and moderate loads, expect plastic gears to wear out after 50,000-100,000 cycles. For intermittent use in hobby projects, an SG90 can last years. The potentiometer and control electronics typically outlast the gears. Signs of wear include increased play in the output shaft, inconsistent positioning, and complete failure to hold position.
Taking Your Next Steps
The SG90 micro servo Arduino platform provides an excellent foundation for understanding motor control and mechatronics. Start with the basic examples provided here, experiment with different movement patterns, and gradually increase complexity.
Once you’re comfortable with single servo control, try coordinating multiple servos for more complex mechanisms. Combine servos with sensors to create reactive systems that respond to their environment. Build enclosures and mechanical linkages to turn your experiments into finished projects.
Remember that every professional robotics engineer started exactly where you are now, probably with an SG90 servo and an Arduino board. The skills you’re developing with this beginner setup transfer directly to more advanced systems.
The beauty of the SG90 micro servo Arduino combination lies in its simplicity and forgiveness. You can make mistakes, learn from them, and try again without significant cost or risk. Take advantage of this learning environment, and don’t be afraid to experiment beyond the examples you find online.
Keep track of what works and what doesn’t in your projects. Document your pulse width values for each servo, note the mechanical constraints you discover, and build your own reference library. These practical insights will prove invaluable as you progress to more ambitious projects.
Meta Description: Learn SG90 micro servo Arduino control in this complete beginner’s guide. Includes wiring diagrams, code examples, specifications, troubleshooting tips, and practical projects. Perfect for first-time Arduino users and makers.
Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Notes: For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.