> Source: https://www.tinkered.ai/components/servo-sg90/raspberry-pi-pico (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/servo-sg90/raspberry-pi-pico. 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 with a Raspberry Pi Pico

The SG90 takes its signal from the Raspberry Pi Pico's GP0 and its power from VBUS, the USB 5 V, with arduino-pico's built-in Servo library driving it. A 3.3 V pulse is enough for the servo; 5 V on its red wire is only there while USB powers the Pico.

## Wiring

| 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.

## What to know on the Raspberry Pi Pico

- VBUS is the micro-USB input, nominally 5 V and 0 V when USB is absent. On a battery through VSYS the servo gets no power from VBUS. (Raspberry Pi Pico datasheet, release 21, p. 8)
- Servo current on VBUS comes from the USB port directly, not through the Pico's 3.3 V regulator, so it does not eat into the 300 mA recommended for the 3V3 pin. VBUS also feeds VSYS through a Schottky diode, so servo dips show on VSYS. (Raspberry Pi Pico datasheet, release 21, pp. 8, 20)
- arduino-pico ships its own Servo.h, so no library is installed for this board; any GPIO can carry the signal, since the RP2040 has 16 PWM channels. (arduino-pico core documentation (Earle Philhower); Raspberry Pi Pico datasheet, release 21, p. 4)
- For more than one servo, give them their own 5 V supply with a common ground rather than VBUS. (Raspberry Pi Pico datasheet, release 21, p. 8)

## Code

```cpp
// SG90 Micro Servo on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/servo-sg90/raspberry-pi-pico
#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.

## Questions

### Can the Raspberry Pi Pico power an SG90 servo?

One small SG90, from VBUS while on USB (Pico datasheet, p. 8). Never from 3V3. For several servos use a separate 5 V supply with a common ground.

### Which Servo library works on the Pico?

The arduino-pico core includes Servo.h, so the page's code needs nothing extra; on an ESP32 you would need ESP32Servo instead.

### Why does my SG90 not move when the Pico runs on battery?

VBUS is 0 V without USB (Pico datasheet, p. 8). Power the servo from the battery side or a 5 V regulator, with the grounds joined.

## More

- [SG90 Micro Servo reference](https://www.tinkered.ai/components/servo-sg90.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the SG90 Micro Servo on the Raspberry Pi Pico in the browser, with this wiring and code, free: https://www.tinkered.ai/components/servo-sg90/raspberry-pi-pico
