小编
Published2025-10-15
The SG90 servo motor is a popular choice in robotics, electronics, and hobby projects due to its compact size, low cost, and high efficiency. This article dives deep into the SG90 servo motor’s pin diagram, explaining its structure, function, and how to use it effectively in various applications. Whether you’re a beginner or an experienced maker, this guide will help you understand how to use the SG90 servo motor for your projects.
.webp)
Introduction to the SG90 Servo Motor and Its Pin Diagram
The SG90 servo motor is a small, high-torque, and precise rotary actuator commonly used in various electronics projects. Its compact form and low power consumption make it ideal for hobbyists, especially in robotics, RC models, and other automated systems. But understanding how to connect and use this motor effectively is key to making the most out of its capabilities. This is where the SG90 servo motor pin diagram comes in, offering clarity on how to wire and operate it.
The SG90 is a type of hobby servo motor that uses pulse-width modulation (PWM) to control its position. It has three essential pins that allow communication with a microcontroller, such as an Arduino or Raspberry Pi. These pins are typically power (VCC), ground (GND), and signal (PWM). Understanding each pin’s role in the system is crucial to controlling the servo motor’s movement accurately.
Let’s break down the three main pins on the SG90 servo motor and how each one functions:
The VCC pin is used to supply power to the servo motor. Typically, it requires a 5V power source, though some servo motors, including the SG90, can work at a lower voltage (3.3V to 6V). It’s important to provide a stable and sufficient voltage to ensure the servo operates efficiently. This pin should be connected to the positive voltage output of your power supply, typically the 5V pin on an Arduino.
The GND pin is used to complete the electrical circuit by providing a return path for the current. This pin should be connected to the ground of your microcontroller or power supply. It’s essential to ensure that the ground of the servo motor is connected to the ground of the controller or the power source to avoid any potential damage from voltage differences.
The signal pin controls the movement of the servo motor. This pin receives pulse-width modulation (PWM) signals from the microcontroller, which determines the motor’s position. The signal is typically sent in the form of a periodic square wave, where the duration of the high pulse defines the angle of rotation. The signal pin should be connected to a PWM-capable pin on your microcontroller.
The operation of the SG90 servo motor relies on the PWM signal sent to the signal pin. The signal usually has a frequency of 50 Hz, meaning the signal repeats every 20 milliseconds. The key to controlling the motor’s movement lies in the width of the pulse sent to the signal pin. A longer pulse will move the servo to one extreme (e.g., 180 degrees), while a shorter pulse will move it to the other extreme (e.g., 0 degrees).
By changing the pulse width, the servo motor can be positioned at various angles, typically between 0° and 180°. For example, a 1.5ms pulse will make the motor stop at its neutral position (90°), while a 1ms pulse will make it rotate to the 0° position, and a 2ms pulse will move it to the 180° position.
It’s important to note that the SG90 is not continuously rotating like a DC motor. Instead, it moves within a limited range (usually 0 to 180 degrees), making it ideal for applications requiring precise positioning.
The SG90 servo motor is widely used in robotics and hobbyist projects for several reasons:
The SG90 is small, lightweight, and affordable, making it perfect for applications where space and budget are limited.
Despite its small size, the SG90 offers precise control, which is essential for tasks like robotic arms, pan-tilt camera systems, and steering in RC vehicles.
The SG90 can be easily controlled using PWM signals, which are simple to generate with microcontrollers like Arduino, Raspberry Pi, or ESP32.
Applications of the SG90 Servo Motor
Due to its compact size, low cost, and precision, the SG90 servo motor has found a wide range of applications:
The SG90 is often used in robotics for joint actuators and robotic arms. It is ideal for precise movement control in small robots.
Many remote-controlled cars, planes, and drones use SG90 motors for steering, throttle control, and other movement systems.
The SG90 can be used in automated doors, camera rigs, and other small systems requiring precise, limited motion.
Its affordability and ease of use make the SG90 a popular choice for DIY electronics enthusiasts and hobbyists.
Connecting and Using the SG90 Servo Motor in Projects
Now that we’ve covered the basics of the SG90 servo motor and its pin diagram, let’s delve into how to connect and use it in practical applications. We’ll explore wiring the servo to a microcontroller, sending PWM signals to control the servo’s movement, and troubleshooting common issues.
Wiring the SG90 Servo Motor to a Microcontroller
One of the simplest and most common ways to control the SG90 servo motor is by using an Arduino. The wiring process is straightforward and typically involves the following steps:
Connect the VCC pin of the SG90 servo motor to the 5V pin on the Arduino board. This will supply power to the servo motor.
Connect the GND pin of the SG90 servo motor to the ground (GND) pin on the Arduino. This establishes the return path for the electrical circuit.
Connect the signal pin of the SG90 to one of the PWM-capable pins on the Arduino, such as pin 9 or pin 10. This will allow you to send PWM signals to control the servo motor’s position.
Once the servo is connected, the next step is to program the Arduino to control the servo.
Programming the Arduino to Control the SG90 Servo Motor
To control the SG90 servo motor, you need to send PWM signals using the Arduino programming language. Here’s a simple example that demonstrates how to control the SG90 motor using the Arduino IDE:
Servo myServo; // Create a servo object
myServo.attach(9); // Attach the servo motor to pin 9
myServo.write(0); // Move the servo to 0 degrees
delay(1000); // Wait for 1 second
myServo.write(90); // Move the servo to 90 degrees
delay(1000); // Wait for 1 second
myServo.write(180); // Move the servo to 180 degrees
delay(1000); // Wait for 1 second
In this simple program, the servo is moved to three different positions: 0°, 90°, and 180°. The Servo library in Arduino makes controlling the motor easy, with the write() function used to specify the angle.
Troubleshooting Common SG90 Servo Issues
While the SG90 is a reliable and easy-to-use motor, there are some common issues that may arise:
If the servo doesn’t respond, check the wiring. Ensure that the VCC, GND, and signal pins are correctly connected. Also, verify that your power supply is providing the correct voltage (5V).
Unstable movement can occur if the servo motor is not receiving a stable PWM signal. Check your code to ensure the PWM signal is being generated correctly. Also, ensure that the servo motor’s power supply is sufficient to handle the current demand.
Servo Not Reaching Full Range:
The SG90 has a limited range of 0° to 180°. If your servo is not reaching its full range, check the PWM signal’s pulse width and ensure it is within the appropriate range for your motor.
By understanding the SG90 servo motor pin diagram, wiring the motor correctly, and programming your microcontroller to control it, you can unlock a wide range of creative possibilities in robotics, automation, and hobby electronics projects. Whether you're just starting or looking to improve your skills, the SG90 is an excellent choice for hands-on experimentation and learning.
Established in 2005, Kpower has been dedicated to a professional compact motion unit manufacturer, headquartered in Dongguan, Guangdong Province, China.
Update:2025-10-15
Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.