小编
Published2025-10-15
Imagine a tiny robot arm gracefully mimicking human motion, a camera lens smoothly panning across a panoramic view, or an automated opening door responding to your presence—all these marvels are powered by a small but mighty component: the SG90 servo motor. Coupled with the versatility of Arduino, this seemingly simple motor transforms your creative ideas into tangible, functioning devices.
The SG90 servo motor has gained popularity among hobbyists, students, and makers for its affordability, compact size, and reliable performance. It’s an excellent entry point for anyone stepping into the world of robotics and embedded systems. In this guide, we’ll explore the ins and outs of the SG90—what it is, how it works, and most importantly, how to program it with Arduino to perform a myriad of tasks.
What is the SG90 Servo Motor?
The SG90 is a micro servo motor, designed primarily for lightweight applications where space and cost are constraints. It is a core component in many DIY projects, from simple hobbyist tasks to more complex automation and robotics systems. Its compact form factor is approximately 23mm by 12mm by 29mm, making it perfect for small-scale projects.
Despite its small size, the SG90 boasts a torque of approximately 1.8 kg.cm at 4.8V, which is sufficient for controlling small mechanical arms, pan-and-tilt mechanisms, or even miniature cameras. Its speed capabilities reach up to 0.12 seconds per 60 degrees at 4.8V, enabling swift and accurate movements.
Technical Specs at a Glance:
Voltage: 4.8V to 6V Stall Torque: About 1.8 kg.cm Rotation Range: Typically 0 to 180 degrees Size: 23mm x 12mm x 29mm Weight: Around 9 grams Compatibility: Widely compatible with Arduino, Raspberry Pi, and other microcontrollers
At its core, the SG90 operates using PWM (Pulse Width Modulation) signals. These signals are digital pulses that control the position of the motor’s internal geared wheel. When the motor receives a PWM signal with a specific duty cycle, it interprets that as a position command—say, neutral, maximum left, or maximum right.
The PWM pulse typically has a period of 20 milliseconds (50Hz), with the pulse width varying between approximately 1 millisecond (ms) to 2 ms. For example:
A 1 ms pulse usually moves the servo to 0 degrees. A 1.5 ms pulse centers the servo at 90 degrees. A 2 ms pulse moves it to 180 degrees.
The servo motor's internal circuitry contains a potentiometer, which provides real-time feedback on the current position, allowing the motor to adjust its movement and settle precisely at the commanded angle.
Why Use Arduino to Control the SG90?
Arduino microcontrollers are renowned for their ease of use, affordability, and extensive community support. They are perfect for controlling servos like the SG90 because they include dedicated libraries and functions that simplify PWM control.
What makes Arduino stand out in this context is the Servo library, which abstracts the low-level PWM signals into straightforward commands, allowing beginners to experiment without delving deep into the complex timing mechanics.
Starting Your First Project: The Basics of Connecting the SG90
Before you write any code, it’s essential to physically connect your SG90 to the Arduino. Here’s a quick rundown:
VCC (Power): Connect the red wire of the servo to the 5V pin on Arduino. GND (Ground): Connect the brown or black wire of the servo to one of the Arduino GND pins. Signal (Control): Connect the orange or yellow wire to a PWM-capable digital pin on Arduino, such as pin 9.
Use a separate power supply for multiple servos to prevent voltage dips that could cause erratic behavior. Ensure that the ground of the power supply and the Arduino share a common reference.
Why the SG90 Is Ideal for Beginners
The simplicity and affordability of the SG90 make it an appealing choice for those just starting with robotics. Its straightforward control via PWM, coupled with the extensive resources available for Arduino, reduces the barrier to entry.
In the next part of this guide, we’ll walk through writing your first Arduino code to move the SG90 servo motor, exploring functions, calibration, and practical examples you can try at home or in the classroom. Whether you aim to make a robotic arm, a camera slider, or an automated project, mastering the SG90 with Arduino opens a world full of possibilities.
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.