> Source: https://www.tinkered.ai/components/servo-sg90 (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/servo-sg90. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# SG90 Micro Servo

A 9-gram positional micro servo that swings about 180 degrees in response to a 50 Hz servo pulse, rated at 4.8V.

Source page: https://www.tinkered.ai/components/servo-sg90
Datasheet: http://www.ee.ic.ac.uk/pcot/TowerPro/SG90_datasheet.pdf

## In short

The SG90 is TowerPro's 9 g micro servo, rated 1.8 kg·cm of stall torque and 0.1 s per 60 degrees at 4.8 V, with about 180 degrees of travel (TowerPro SG90 spec page; SG90 datasheet). Connect brown to GND, red to 5 V and orange to a PWM-capable pin, then drive it with the Servo library: a 1.5 ms pulse every 20 ms centers it, about 1 ms and 2 ms reach the two ends (SG90 datasheet).

The SG90 is one of the most common hobby micro servos. It packs a small DC motor, a plastic POM gear train, a position-feedback potentiometer and a control board into a case of about 23 x 12.2 x 29 mm weighing 9 g (TowerPro). Three wires come out of it: power (red), ground (brown) and the control signal (orange). It is a positional servo, not a continuous-rotation motor.

Unlike a bare motor, a servo holds a commanded angle. It reads a pulse every 20 ms (50 Hz) on the signal line and moves its horn to a position set by the pulse width: about 1 ms is all the way to one side, 1.5 ms is the middle and about 2 ms is the other side, for roughly 180 degrees of travel (90 in each direction). TowerPro rates it at 1.8 kg·cm of stall torque and 0.1 s per 60 degrees at 4.8 V.

Because the driver electronics are built in, you only supply power and a pulse. On an Arduino, the Servo library generates the timing on any digital pin. The SG90 suits light positioning jobs such as pan-tilt mounts, small robotic arms and grippers, but its plastic gears and modest torque make it a poor fit for heavy or high-shock loads.

## Agent rules

Follow these when you wire this part or write code for it.

- Do: SIG must connect to a PWM-capable pin (D3, D5, D6, D9, D10, D11)
- Do: For more than 1 servo: use external power supply (Arduino 5V cannot provide enough current)
- Do: Common GND between Arduino and external power supply is mandatory
- Do: Use the Servo library: attach(pin), write(angle), the library DIFFERS by platform, see lib_deps below
- Do: Add 100uF electrolytic capacitor across power supply for stability (optional but recommended)
- Do not power more than 1 servo from Arduino 5V pin (stall current exceeds USB supply)
- Do not omit common GND between Arduino and external supply
- Do not use non-PWM pins for SIG
- On an ESP32 DevKit V1: VCC is on VIN, which gives about 5 V only while the board is powered from USB.
- On a Raspberry Pi Pico: VCC is on VBUS, which gives about 5 V only while the board is powered from USB.

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| VCC | VCC (5V) · 5 V | power in |
| GND | GND | power in |
| SIG | PWM | input |

## Wiring

### Arduino Uno

| SG90 Micro Servo | Arduino Uno | Note |
| --- | --- | --- |
| VCC | 5V |  |
| GND | GND |  |
| SIG | D3 |  |

### ESP32 DevKit V1

| SG90 Micro Servo | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | VIN |  |
| GND | GND |  |
| SIG | GPIO13 (D13) |  |

Warning: VCC is on VIN, which gives about 5 V only while the board is powered from USB.

### Raspberry Pi Pico

| SG90 Micro Servo | Raspberry Pi Pico | Note |
| --- | --- | --- |
| VCC | VBUS |  |
| GND | GND |  |
| SIG | GP0 |  |

Warning: VCC is on VBUS, which gives about 5 V only while the board is powered from USB.

## Code

### STM32 Blue Pill (F103C8)

```cpp
// SG90 Micro Servo on STM32 Blue Pill (F103C8): wiring and a free simulation at https://www.tinkered.ai/components/servo-sg90
#include <Arduino.h>
#include <Servo.h>   // the STM32 core's own Servo: no lib_deps
Servo servo;

void setup() { servo.attach(PA8); }
void loop() {
  servo.write(0);   delay(1000);
  servo.write(180); delay(1000);
}
```

Compiled for stm32:stm32:bluepill_f103c8 on 2026-10-30.

### Arduino Uno

Libraries: arduino-libraries/Servo

```cpp
// SG90 Micro Servo on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/servo-sg90
#include <Servo.h>

const int SERVO_PIN = 3;
Servo servo;

void setup() {
  servo.attach(SERVO_PIN);
}

void loop() {
  for (int angle = 0; angle <= 180; angle += 2) {
    servo.write(angle);
    delay(15);
  }
  for (int angle = 180; angle >= 0; angle -= 2) {
    servo.write(angle);
    delay(15);
  }
}
```

Compiled for arduino:avr:uno on 2026-10-30.

### ESP32 DevKit V1

Libraries: madhephaestus/ESP32Servo

```cpp
// SG90 Micro Servo on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/servo-sg90
#include <ESP32Servo.h>

const int SERVO_PIN = 13;
Servo servo;

void setup() {
  servo.attach(SERVO_PIN, 500, 2400);
}

void loop() {
  for (int angle = 0; angle <= 180; angle += 2) {
    servo.write(angle);
    delay(15);
  }
  for (int angle = 180; angle >= 0; angle -= 2) {
    servo.write(angle);
    delay(15);
  }
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

### Raspberry Pi Pico

```cpp
// SG90 Micro Servo on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/servo-sg90
#include <Servo.h>

const int SERVO_PIN = 0;
Servo servo;

void setup() {
  servo.attach(SERVO_PIN);
}

void loop() {
  for (int angle = 0; angle <= 180; angle += 2) {
    servo.write(angle);
    delay(15);
  }
  for (int angle = 180; angle >= 0; angle -= 2) {
    servo.write(angle);
    delay(15);
  }
}
```

Compiled for rp2040:rp2040:rpipico on 2026-10-30.

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Supply voltage | 5 V | Tinkered component registry |
| Interface | GPIO pulse timing | Tinkered component registry |
| Weight | 9 g | Tinkered component registry |

## Circuit notes

- TowerPro rates the SG90 at 4.8 V; it is normally run from a 5 V rail.
- One SG90 with a light load can run from a board's 5V pin. For more than one servo, or a servo working under load, give the servos their own 5 V supply: the current spike as a servo starts or stalls can sag the board's regulator and reset it.
- Always tie an external supply's ground to the Arduino ground. The pulse is referenced to ground, so without a shared ground the servo jitters or ignores the signal.
- No external motor driver or flyback diode is required: the SG90's own control board drives the motor. The signal pin only receives the 50 Hz pulse.
- A 100 µF electrolytic capacitor across the servo supply smooths the current spikes and reduces brownout resets, especially with several servos.

## Common mistakes

- **Powering several servos from the Arduino's 5V pin.** Each SG90 pulls a current spike when it starts or stalls. Two or more on the board's 5V pin sag the regulator and the board browns out or resets. Use a separate 5 V source for the servos and share a common ground with the Arduino.
- **Treating it like a continuous-rotation motor.** The standard SG90 is a positional servo with about 180 degrees of travel. Commanding it to spin like a wheel only drives it against its end stop, where it buzzes and stalls.
- **Forgetting the common ground.** When the servo runs from an external supply, its ground must connect back to the Arduino ground. Skipping this leaves the signal without a reference, so the servo twitches or does not respond.
- **Commanding angles beyond the travel range.** Pulses past what a unit can reach push the servo against its mechanical stops. It grinds and pulls stall current, which heats the motor and wears the plastic gears.
- **Reversing the power wires.** On the SG90, brown is ground, red is power and orange is the signal. Swapping red and brown puts reverse voltage on the control board and can damage the servo.

## Questions

### What voltage does an SG90 servo need?

TowerPro rates the SG90 at 4.8 V, and its torque (1.8 kg·cm) and speed (0.1 s per 60 degrees) are given at that voltage (TowerPro SG90 spec page). In practice it runs from a 5 V rail.

### Can I power an SG90 from the Arduino 5V pin?

One lightly loaded SG90, yes. For two or more, or a servo under load, use a separate 5 V supply with its ground tied to the Arduino's ground, because the start-up spikes reset the board. A 100 µF capacitor across the servo supply helps.

### Can an ESP32 or Raspberry Pi Pico control an SG90?

Yes. The 3.3 V pulse from an ESP32 or Pico drives the orange signal wire, while red takes 5 V from VIN, VBUS or an external supply with a shared ground. On the ESP32 family use the ESP32Servo library; the Pico core ships its own Servo.h.

### Why does my SG90 jitter or not move?

Check the three usual causes: no common ground between the servo supply and the board, a supply that sags when the servo starts, or the signal on a pin your sketch did not attach. A servo that buzzes at one end is being driven past its travel; reduce the pulse range.

### How many degrees does an SG90 rotate?

About 180 degrees, 90 in each direction: a 1.5 ms pulse is the middle, about 1 ms is fully one way and about 2 ms fully the other (SG90 datasheet). Units vary slightly, so check the end points of yours before fixing a mechanism to it.

### SG90 vs MG996R: which servo should I use?

The SG90 weighs 9 g and gives 1.8 kg·cm at 4.8 V on plastic gears (TowerPro SG90 spec page); the MG996R weighs 55 g and gives 11 kg·cm at 6 V on metal gears with a 1,400 mA stall current (TowerPro MG996R spec page). Use the SG90 for light pointers and flaps, the MG996R for arms and loads.

## Related parts

- [PCA9685 16-Channel Servo Driver](https://www.tinkered.ai/components/pca9685-servo-driver.md): drives it
- [MG996R Servo · Straight Horn](https://www.tinkered.ai/components/servo-mg996r-straight.md): same job: a positional servo
- [MG996R Servo · Cross Horn](https://www.tinkered.ai/components/servo-mg996r-cross.md): same job: a positional servo
- [MG996R Servo · Star Horn](https://www.tinkered.ai/components/servo-mg996r-star.md): same job: a positional servo
- [MG996R Servo · Round Horn](https://www.tinkered.ai/components/servo-mg996r-round.md): same job: a positional servo
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the SG90 Micro Servo in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
