小编
Published2025-10-15
What is the SG90 Micro Servo and Why Should You Care?
The SG90 micro servo is one of the most commonly used components in the world of electronics and robotics. It is a small, inexpensive, and lightweight servo motor that can be controlled by a microcontroller such as an Arduino, Raspberry Pi, or any similar platform. The servo's main appeal lies in its ability to precisely control angular movement, making it ideal for various applications including robotics, RC models, cameras, and even toys.
At the heart of any servo motor is its ability to rotate its shaft to a specific position based on an input signal. The SG90 offers a rotation range of around 180 degrees, which is typically sufficient for many projects. This servo motor is popular among beginners due to its affordability, ease of use, and broad compatibility.
Understanding the SG90 micro servo pinout is critical for effectively incorporating this component into your projects. Whether you're assembling a robotic arm, designing a remote-controlled car, or just playing around with electronics, you'll need to know how to wire the servo correctly and control it through software.
Pinout of the SG90 Micro Servo
The SG90 servo typically comes with three pins that are used to connect it to your microcontroller or other control systems. These pins are:
VCC (Power) – This is the power supply pin for the servo. It typically requires a voltage of 4.8V to 6V to function properly. In most cases, this is connected to the 5V output pin on a microcontroller like Arduino.
GND (Ground) – This is the ground pin, which should be connected to the ground (GND) pin of your microcontroller to complete the circuit.
Signal (PWM) – The signal pin is where the magic happens. This pin receives a Pulse Width Modulation (PWM) signal that controls the servo’s position. By adjusting the length of the pulse sent to this pin, you can control the angle at which the servo rotates. For the SG90, a pulse width of around 1ms corresponds to one extreme (usually 0 degrees), and 2ms corresponds to the other extreme (usually 180 degrees).
How Does the Pinout Work in Practice?
When you set up the SG90 servo in your project, the key to controlling the motor lies in the signal pin. Here's a closer look at how it works:
The microcontroller sends PWM signals to the signal pin, which consists of a series of square waves.
The width of each pulse (how long it lasts) determines the angle to which the servo rotates.
A pulse width of 1ms moves the servo to one end of its range (typically 0 degrees).
A pulse width of 2ms moves the servo to the other end (typically 180 degrees).
A pulse width of 1.5ms will place the servo in the middle (around 90 degrees).
The servo's internal controller interprets this pulse and adjusts the motor’s position accordingly.
Key Features of the SG90 Micro Servo
Before we move on to the actual wiring and usage, let’s quickly highlight some important features of the SG90 servo that make it a top choice for many projects:
Compact Size: The SG90 is small and lightweight, which makes it perfect for space-constrained projects like drones or mini robots.
Cost-Effective: As mentioned earlier, the SG90 is very affordable, which is great for beginners who are just getting started with electronics and robotics.
180-Degree Rotation: The servo typically provides 180 degrees of rotation, making it versatile enough for many applications, though it may vary slightly depending on the model.
Ease of Control: The use of PWM for controlling the servo's position is simple and can be done with just about any microcontroller, making it highly compatible.
Wiring the SG90 Micro Servo: Step-by-Step Guide
Now that we have a basic understanding of the SG90 servo and its pinout, let’s dive into the practical side of things. Wiring your SG90 servo to a microcontroller is a relatively simple task, but it does require some basic understanding of how to manage power, ground, and signal connections.
Step 1: Gather Your Materials
Before you start wiring, make sure you have the following materials at hand:
Microcontroller (e.g., Arduino, Raspberry Pi, etc.)
External power supply (if necessary)
Breadboard (optional, but helpful)
Step 2: Connect the Servo to the Microcontroller
Here’s the step-by-step guide to wiring the SG90 micro servo to an Arduino:
Connect the VCC Pin (Power):
The VCC pin on the servo provides power to the motor. You should connect this pin to the 5V pin on the Arduino board. Some users prefer to use an external power supply for more power-hungry servos, but for the SG90, the 5V from the Arduino is usually sufficient.
Connect the GND Pin (Ground):
The GND pin from the servo needs to be connected to the ground (GND) pin of your Arduino. This ensures that the circuit is complete, allowing current to flow properly.
Connect the Signal Pin (PWM):
The signal pin controls the rotation of the servo. In Arduino projects, this is typically connected to a PWM-capable pin on the board (such as pin 9). It’s through this pin that the Arduino will send the PWM signals to control the servo's position.
Step 3: Testing the Servo with Code
Once you’ve wired the servo, you’ll need to write some basic code to test whether the servo is working correctly. Below is a simple Arduino sketch that demonstrates how to control the SG90 servo:
#include // Include the Servo library
Servo myServo; // Create a Servo object
myServo.attach(9); // Attach the servo to pin 9 on the Arduino
myServo.write(0); // Rotate the servo to 0 degrees
delay(1000); // Wait for 1 second
myServo.write(90); // Rotate the servo to 90 degrees
delay(1000); // Wait for 1 second
myServo.write(180); // Rotate the servo to 180 degrees
delay(1000); // Wait for 1 second
In this code, the Servo.h library makes it easy to control the servo motor. By calling myServo.write(angle), you send a PWM signal corresponding to the specified angle (in degrees). This simple sketch rotates the servo between 0, 90, and 180 degrees in a loop, demonstrating basic servo control.
Step 4: Troubleshooting Common Issues
While the SG90 is a simple and reliable servo, it’s always good to be prepared for potential issues:
Servo Doesn’t Move: Double-check your wiring, especially the VCC and GND connections. Ensure that your power source is sufficient, and the PWM signal is being sent correctly.
Noisy or Erratic Movement: This is typically a result of inconsistent or incorrect PWM signals. Make sure your code is sending a stable and appropriate signal to the servo.
Servo Moves But Not to the Right Position: If the servo doesn’t rotate to the expected position, check the timing of the PWM signal in your code. The standard range is 1ms to 2ms for a full 0 to 180-degree rotation, but some servos may require slight adjustments.
The SG90 micro servo is an incredibly useful and versatile tool for anyone interested in robotics, electronics, and DIY projects. Understanding its pinout and how to wire it properly is crucial for successful integration into your projects. By following the simple steps outlined in this article, you can easily begin experimenting with servo motors in your own creations. Whether you're building a robot arm, designing a remote-controlled vehicle, or just exploring the possibilities of this powerful little motor, the SG90 is an excellent starting point for all types of electronic enthusiasts.
Kpower has delivered professional drive system solutions to over 500 enterprise clients globally with products covering various fields such as Smart Home Systems, Automatic Electronics, Robotics, Precision Agriculture, Drones, and Industrial Automation.
Update:2025-10-15
Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.