Episode #2 · MG90S

How Robots Actually Move

A metal-gear micro servo gives you precise, repeatable position — perfect for joints, legs, and grippers. This build: a fully 3D-printable two-servo pan-tilt head.

Episode video — paste your YouTube ID to embed

What it is

A hobby servo is a little motor, a gearbox, and a control circuit in one sealed case. You don't tell it "spin" — you tell it an angle, and it goes there and holds it, even against a push. The one I build with is the MG90S — a 9-gram black servo with metal gears inside.

Buying tip: black = the metal-gear MG90S (buy this). The cheaper blue SG90 uses plastic gears that strip — saving a few pennies isn't worth it in the long run.

The bare minimum to use it

  • Three wires: brown/black = GND, red = +5 V, orange/yellow = signal.
  • Wants ~5 V and real current — give it its own supply, not the ESP32's 3.3 V pin. Share grounds.
  • Control with PWM — the ESP32Servo library does the math; you just write servo.write(90).
  • Center before mounting horns — command 90°, then attach the horn. Never force it by hand.

Wiring

5V supply (+) ──┬──▶ servo RED
                │
ESP32 GND ──────┴──▶ servo BROWN ──▶ supply (−)   (common ground!)
ESP32 GPIO 3 ───────▶ servo ORANGE  (pan signal)
ESP32 GPIO 4 ───────▶ servo ORANGE  (tilt signal)
ESP32-C3 SuperMini miniRobo pin map: servos on GPIO 3 and 4, motors on GPIO 5, 6, 7 and 10, onboard LED on GPIO 8

C3 SuperMini pin map — the servos use GPIO 3 (pan) and 4 (tilt).

The code

Drives a two-servo pan-tilt head with a smooth sweep. Full sketch in the sidebar.

// miniRobo EP2 — MG90S pan-tilt sweep (ESP32)
#include <ESP32Servo.h>

Servo pan, tilt;

void setup() {
  pan.attach(3);
  tilt.attach(4);
}

void loop() {
  for (int a = 30; a <= 150; a++) { pan.write(a); delay(15); }
  for (int a = 150; a >= 30; a--) { pan.write(a); delay(15); }
  tilt.write(60); delay(400);
  tilt.write(110); delay(400);
}

The 3D-printed parts

The pan-tilt head is three printed pieces driven by two MG90S servos. The OpenSCAD is fully parametric — set part to "base", "yoke", or "tilt" to export each one, and tweak fit_tol if the servo pockets are tight or loose.

base_plateHolds the pan servo upright; bolts to the chassis.
pan_yokeClips to the pan horn; cradles the tilt servo.
tilt_bracketClips to the tilt horn; holds a small camera/sensor.
Dimensions are nominal MG90S values — calipers on your actual servo beat any datasheet. Print PLA, 0.2 mm layers, 3 walls, 20–30% infill.

What I wish I knew

  • Never power servos from the ESP32 — they brown it out. Own supply, shared ground.
  • Black metal gears over blue plastic — the SG90's plastic gears strip under load.
  • They don't all hit a true 0–180° — test the real range and don't jam the stops.
  • Center, then mount the horn — forcing it by hand strips gears.
  • Jitter is power or a long signal wire, almost never the code.