Component guide · Beginner · 4 min read
SG90 and MG90S Micro Servo

Pinout, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The SG90 is a 9 g micro servo that turns to an angle between 0 and 180 degrees when it receives a 50 Hz pulse of about 0.5 to 2.4 ms. Brown is ground, red is 5 V and orange is signal. It gives about 1.8 kg-cm of torque; the MG90S has the same size and pinout with metal gears and a little more torque.
Key specs at a glance
- Weight
- SG90 9 g, MG90S 13.4 g
- Torque
- SG90 about 1.8 kg-cm, MG90S about 2.2 kg-cm at 4.8 V
- Speed
- About 0.1 s per 60 degrees
- Voltage
- 4.8 to 6 V
- Signal
- 50 Hz PWM, roughly 500 to 2400 µs pulse for 0 to 180 degrees
- Gears
- SG90 plastic, MG90S metal
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1TowerPro SG90 9g Micro Servo (180°)₹442
Option 2TowerPro MG90S Metal Gear Micro Servo₹189
What the SG90 servo is
A hobby servo contains a small DC motor, a gearbox, a potentiometer on the output shaft and a control board. The control board compares the pulse width it receives with the potentiometer position and turns the motor until they match, so the shaft holds an angle.
The SG90 is the cheapest and most common servo for learning, pan-tilt camera mounts and small robot arms. Choose the MG90S when the gears must survive knocks, and an MG996R when you need much more torque.
SG90 servo pinout
The pins on the SG90 servo and what each one does.
| Pin | Function |
|---|---|
| Brown wire | GND |
| Red wire | +5 V (4.8 to 6 V) |
| Orange wire | Signal (PWM) |
- Brown wire
- GND
- Red wire
- +5 V (4.8 to 6 V)
- Orange wire
- Signal (PWM)
Wiring the SG90 servo
One SG90 can run from an Uno's 5 V pin for testing. For two or more, or any ESP32 build, use a separate 5 V supply of at least 1 A per servo and join its ground to the board's ground.
| SG90 servo pin | Arduino Uno | ESP32 |
|---|---|---|
| Brown (GND) | GND | GND |
| Red (+5 V) | 5V (one servo) or external 5 V | External 5 V |
| Orange (signal) | D9 | GPIO 18 |
- Brown (GND)
- Arduino Uno:
- GND
- ESP32:
- GND
- Red (+5 V)
- Arduino Uno:
- 5V (one servo) or external 5 V
- ESP32:
- External 5 V
- Orange (signal)
- Arduino Uno:
- D9
- ESP32:
- GPIO 18
Example code
Setting the min and max pulse lets the servo reach its full range; the library default of 544 to 2400 µs is close.
#include <Servo.h> // ESP32: use the ESP32Servo library instead
Servo s;
void setup() {
s.attach(9, 500, 2400); // pin, min and max pulse in µs
}
void loop() {
for (int a = 0; a <= 180; a++) { s.write(a); delay(10); }
for (int a = 180; a >= 0; a--) { s.write(a); delay(10); }
}Setup and tuning
cheap servos rarely give exactly 180 degrees. Start with 500 to 2400 µs and narrow it if the servo buzzes at the ends; that buzz means it is pushing against its end stop.
usually a weak supply. Add a 470 to 1000 µF capacitor across 5 V and GND near the servos.
before fitting the horn, write 90 degrees so the arm is mounted at the middle of its travel.
use a PCA9685 board to drive up to 16 from two I2C pins.
the servo pulse calculator converts pulse width to angle.
What you need
Shop this list4 of 5 found in our store · ₹1,242
TowerPro SG90 9 g micro servo (180°): plastic gears, lightest optionTowerPro SG90 9g Micro Servo (180°)₹442
TowerPro MG90S metal gear micro servo: metal gears, same sizeTowerPro MG90S Metal Gear Micro Servo₹189- Uno R3 development board: the controller used in the wiring tableFind this part
4-DOF robotic arm kit (for SG90 / MG90S): a first project for these servos4-DOF Robotic Arm Kit (for SG90 / MG90S)₹562
Dupont jumper wires: for the signal connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
Alternatives and when to choose them
- MG996R: 11 kg-cm class, for arms and steering.
- Continuous rotation servos: spin like a gear motor instead of holding an angle.
- Serial bus servos: position feedback and daisy-chain wiring for advanced robots.
Try it: Servo pulse angle calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Powering several servos from the Arduino 5 V pin, which resets the board.
- Forcing the shaft by hand, which strips the plastic gears.
- No common ground between the servo supply and the controller.
- Using the Uno Servo library on an ESP32 instead of ESP32Servo.
Frequently asked questions
What is the difference between SG90 and MG90S?
Same size and wiring. The MG90S has metal gears and slightly more torque, so it survives knocks better.
Can SG90 rotate 360 degrees?
The standard SG90 turns about 180 degrees. Continuous rotation versions exist, but they cannot hold an angle.
Why does my servo jitter?
Usually a weak or noisy supply. Use a separate 5 V supply and add a large capacitor; also check the ground connection.
Can I power an SG90 from 3.3 V?
It may move but with little torque. Power it from 5 V; the 3.3 V signal from an ESP32 is still fine.
How many servos can an Arduino control?
The Servo library supports up to 12 on an Uno, but power is the real limit. Use a PCA9685 for many servos.
How much weight can it lift?
About 1.8 kg at 1 cm from the shaft, so only about 180 g at 10 cm. Keep arms short.
Parts for this guide
Calculators
Projects that use it
Put this into practice: 52 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

