Skip to content
E

Servo

Controlling MG996R Servo with ESP32

What is the MG996R?

A metal-gear servo offering significantly more torque than the SG90, favored in robotic arms and RC vehicle steering.

Specifications

Operating voltage4.8V - 7.2V DC (6V typical)
Torque~9.4 kg·cm at 4.8V, ~11 kg·cm at 6V
Rotation~120° on most units (some rebadged versions claim 180° — verify with your specific unit)
Speed~0.17 sec/60° at 4.8V, ~0.14 sec/60° at 6V
Control signalPWM, 50Hz, ~1ms-2ms pulse width
Stall currentUp to ~2.5A — needs its own 5-6V supply, not the MCU board's 5V rail
Weight~55g

MG996R Pinout

PinNameDescription
1GNDGround — usually the brown wire
2VCCPower, 4.8V-7.2V DC — usually the red wire
3SignalPWM control input — usually the orange wire

A single MG996R under load can brown out an Arduino running from USB. Power it from a separate 5-6V supply and tie grounds together.

Setting Up MG996R with ESP32

Library

Servo by Arduino

Bundled with the Arduino IDE core

Library guide

Wiring

Component pinESP32 pinNote
VCCExternal 5-6V supply, not the ESP32's onboard 5V pinMG996R can draw 500mA-1A+ under load -- the ESP32's regulator can't supply this reliably
GNDGNDCommon ground between the ESP32 and the servo supply is required
SignalGPIO18Any PWM-capable GPIO works

Example code

C++

MG996R needs its own 5-6V supply capable of at least 1A -- powering it from the ESP32's 5V/VIN pin can brown out the board under load. Share ground between both supplies.

Related Guides & Projects