The MG996R is the go-to "big" hobby servo: a standard-size positional servo with metal gears and around 10 kg·cm of torque, several times the strength of the little SG90. You send it a pulse, it turns its output shaft to the matching angle and holds it there against a load. That makes it the default choice for robot arm joints, RC steering, pan-and-tilt camera mounts, door latches and walking robots.
That strength has a price: it can draw over 2 A when it stalls, which is more than any Arduino or ESP32 board can supply. Almost every MG996R problem (jitter, resets, a board that will not boot) is a power problem. This page explains how a servo turns a pulse into an angle, the specs that matter, how to power one or several safely, how to tell a genuine unit from a weak clone, and how it compares with other servos. For code, see the Arduino Uno guide and the ESP32 guide.
MG996R at a glance
MG996R in one paragraph. Three wires: brown = GND, red = power (4.8 to 7.2 V), orange = signal. Send a 50 Hz pulse: about 0.5 ms ≈ 0°, 1.5 ms ≈ 90°, 2.5 ms ≈ 180° (find your unit's limits). Power it from a separate 5 to 6 V supply rated for at least 2.5 A per servo, join its ground to the microcontroller's, and add a 470 to 1000 µF capacitor at the servo. On an Uno use the built-in Servo library; on an ESP32 use ESP32Servo (the standard Servo library does not compile there).
Specifications
- Type
- Positional (standard) servo, about 180° travel; continuous-rotation versions are sold separately
- Operating voltage
- 4.8 to 7.2 V (6 V is the sweet spot)
- Stall torque
- About 9.4 kg·cm at 4.8 V, 11 kg·cm at 6 V
- Speed
- About 0.17 s per 60° at 4.8 V, 0.14 s per 60° at 6 V (no load)
- Current
- About 10 mA idle, 0.5 to 0.9 A moving, up to about 2.5 A stalled at 6 V
- Control signal
- PWM at 50 Hz (20 ms frame); pulse width sets the angle
- Pulse range
- Roughly 0.5 to 2.5 ms end to end; varies by unit
- Dead band
- About 5 µs
- Gears
- Metal, with dual ball bearings on the output shaft
- Signal level
- 3.3 V or 5 V logic both work in practice
- Size / weight
- About 40.7 × 19.7 × 42.9 mm, 55 g
From the TowerPro MG996R datasheet. Many MG996Rs on the market are clones with lower torque and wider tolerances: treat these as best-case figures and test your own unit.
Wires
| Wire | Name | Connect to |
|---|---|---|
| Brown | GND | Servo supply ground, joined to the microcontroller's GND |
| Red | V+ | Servo supply positive, 4.8 to 7.2 V. Not the board's 5V pin |
| Orange | Signal | A PWM-capable GPIO (Uno D9, ESP32 GPIO18 in the guides) |
Colours follow the TowerPro convention; some clones use black / red / white or yellow. The middle wire is almost always power.
How a servo turns a pulse into an angle
Inside the case are a DC motor, a gear train, a potentiometer on the output shaft and a small control board. Every 20 ms your microcontroller sends one pulse. The control board measures how long it stays HIGH, compares that with the potentiometer's position, and drives the motor until the two match. Then it holds the shaft there, pushing back against any load, for as long as pulses keep arriving.
So the pulse width is the angle: on a typical MG996R about 0.5 ms points one way, 1.5 ms is the centre and 2.5 ms points the other way. The exact numbers differ between units and clones, and pushing a servo past its mechanical end stop makes it stall, buzz and heat up. That is why the Uno guide includes a sketch for finding your servo's safe limits before you attach anything to it.
Power: the part that decides whether it works
A servo is a motor, and the MG996R is a hungry one. When it starts moving, reverses or holds against a load it pulls hundreds of milliamps; stalled against an end stop or a jammed linkage, about 2.5 A. A USB port gives 0.5 A; an Uno's or ESP32's 5 V pin is limited by USB or a small regulator. Powering an MG996R from either makes the board brown out and reset the moment the servo works hard.
- Use a separate supply of 5 to 6 V: a 5 V adapter of 3 A or more, a 2S Li-ion pack through a buck converter set to 6 V, or a hobby BEC. 4 × AA alkaline cells sag badly under servo loads; NiMH cells cope better.
- Join the grounds. The servo supply's negative must connect to the microcontroller's GND, or the signal has no reference and the servo twitches randomly.
- Add a capacitor. 470 to 1000 µF (10 V or higher) across the servo's power wires, close to the servo, absorbs the current spikes that otherwise reset the board.
- Budget for every servo. For a robot arm where several joints can stall at once, plan about 2.5 A per MG996R; if only one moves at a time, 1 to 1.5 A each plus margin.
- More than two or three servos? Use a PCA9685 16-channel PWM driver board on I2C: it generates all the pulses, and its terminal block feeds the servos from your supply.
Servo supply sizing
| Servos | Typical moving current | Worst case (all stalled) | Suggested supply |
|---|---|---|---|
| 1 × MG996R | 0.5 to 0.9 A | 2.5 A | 5 to 6 V, 3 A |
| 2 × MG996R | 1 to 2 A | 5 A | 5 to 6 V, 5 A |
| 4 × MG996R (arm) | 2 to 4 A | 10 A | 5 to 6 V, 10 A, fused |
| 6 × MG996R (hexapod leg set) | 3 to 6 A | 15 A | Dedicated BEC or 6 V 15 A supply |
Order-of-magnitude figures from the datasheet currents; clones vary. A supply that sags under load causes the same symptoms as no supply at all.
Torque in practice
kg·cm means the servo can hold 1 kg at 1 cm from the shaft, or half as much at 2 cm. An MG996R's roughly 10 kg·cm at 6 V holds about 1 kg on a 10 cm arm, at stall, which is the point where it stops moving and draws maximum current. For smooth, reliable motion, design for a third to a half of the stall torque: about 3 to 5 kg·cm. For a robot arm, remember that the shoulder joint carries the weight of everything after it.
Genuine or clone?
Most MG996Rs sold online are clones. Many work well; some have plastic-cored gears, weak motors or poor centering. Signs of a weak unit: it jitters at rest even on a good supply, it does not return to exactly the same position, it needs far more than 1.5 ms to reach centre, or the case gets hot while holding no load. Buy one or two first, test them with the limit-finder sketch, and then order the rest from the same seller.
MG996R vs other servos
| Servo | Torque | Gears | Stall current | Pick it when |
|---|---|---|---|---|
| SG90 | About 1.8 kg·cm | Plastic | About 0.7 A | Light loads, pointers, small mechanisms; can run from a board's 5 V for testing |
| MG90S | About 2.2 kg·cm | Metal | About 0.7 A | SG90 size with tougher gears |
| MG996R | About 10 kg·cm at 6 V | Metal | About 2.5 A | Robot arms, steering, pan/tilt with real load |
| DS3218 | About 20 kg·cm | Metal | About 3 A | Heavier arm joints; often more consistent than MG996R clones |
| Continuous-rotation servo | Varies | Varies | Varies | Wheels and spinning parts: pulse sets speed and direction, not angle |
Ready to build?
- MG996R with Arduino Uno: safe wiring with an external supply, a sweep test, a limit finder that tells you your servo's real pulse range, and smooth potentiometer control
- MG996R with ESP32: the ESP32Servo library, a phone slider over Wi-Fi with eased motion, and library-free LEDC code
Troubleshooting
Board resets or Wi-Fi drops when the servo moves
- Likely cause
- Servo powered from the board, or a weak supply
- Fix
- Separate 5 to 6 V supply, grounds joined, 470 to 1000 µF at the servo
Servo twitches randomly
- Likely cause
- No common ground, or a long signal wire next to motor wires
- Fix
- Join the grounds; keep the signal wire short and away from power leads
Buzzes and gets hot at one end of travel
- Likely cause
- Driven past its mechanical stop
- Fix
- Find the safe limits and constrain the pulse range in code
Jitters while holding still
- Likely cause
- Supply ripple, a clone with a wide dead band, or a noisy pulse
- Fix
- Better supply and capacitor; try a hardware PWM pin; test another unit
Does not move at all
- Likely cause
- No power, or the signal on the wrong wire
- Fix
- Check 5 to 6 V on red and brown; signal on orange
Moves only about 90° instead of 180°
- Likely cause
- Library pulse limits too narrow
- Fix
- Attach with a wider range, for example attach(pin, 500, 2500)
Weak, cannot lift the load
- Likely cause
- Too low a supply voltage, or the load is beyond its torque
- Fix
- Run at 6 V; shorten the lever arm; use a stronger servo
What to build with it
- Robot arm with 4 to 6 MG996R joints driven by a PCA9685 board.
- Pan-and-tilt mount for a camera or an ultrasonic sensor.
- RC car steering or a self-driving model car.
- Smart door latch or bolt opened by an RFID card (see the RC522 reader).
- Automatic pet feeder or a valve that turns on a timer.
- Hexapod or quadruped walking robot (plan a serious power supply).
Frequently asked questions
Can I power an MG996R from the Arduino's 5V pin? Not reliably. It may twitch on an unloaded bench test, but any real load pulls more current than the Uno's USB supply or regulator can give, and the board resets. Use a separate supply and join the grounds.
What voltage is best? 6 V gives more torque and speed than 5 V while staying well within the 4.8 to 7.2 V range. Do not exceed 7.2 V: a 2S Li-ion pack at 8.4 V needs a regulator or BEC.
Does the 3.3 V signal from an ESP32 work? In practice, yes. The servo's input treats 3.3 V as HIGH. The servo's power still needs its own 5 to 6 V supply.
How do I make it move slower? Move it in small steps with a short delay, or ease towards the target as in the Uno and ESP32 guides. The servo itself always moves at full speed to whatever angle you command.
Can the MG996R rotate continuously? The standard MG996R cannot; it stops at its end positions. A continuous-rotation version exists, where the pulse sets speed and direction instead of angle.
How many servos can one Arduino control? The Servo library drives up to 12 on an Uno, and they take one pin each. For more, or for steadier pulses, use a PCA9685 driver board over I2C (16 servos per board).
Wiring & code
Board integration
Library
Servo by Arduino (built in)
Built into the Arduino IDE, no install needed
This guide connects an MG996R servo to an Arduino Uno the safe way, with its own power supply, and builds up in three steps: a sweep test, a limit finder that tells you exactly how far your particular servo can travel, and smooth potentiometer control that eases into position instead of snapping. The specs, power sizing and servo comparison are on the MG996R overview.
What you need
1Arduino Uno R3 (or Nano)
- Notes
- Any 5 V Arduino; the Servo library is built in
1MG996R servo
- Notes
- Test it unloaded first
15 to 6 V supply, 3 A or more
- Notes
- A 5 V 3 A adapter, or a 6 V NiMH pack
1470 to 1000 µF capacitor, 10 V or higher
- Notes
- Across the servo's power wires
110 kΩ potentiometer
- Notes
- Only for Sketch 3
Wiring: MG996R to Arduino Uno
Brown (GND)Servo supply − and Uno GND
- Notes
- The grounds must be joined
Red (V+)Servo supply + (5 to 6 V)
- Notes
- Not the Uno's 5V pin
Orange (signal)Uno D9
- Notes
- Any digital pin works; D9 is the convention
CapacitorAcross red and brown, near the servo
- Notes
- Watch the polarity: stripe to brown (GND)
Warning
Do not power an MG996R from the Uno's 5V pin, even for a quick test. A stalled MG996R draws about 2.5 A; USB gives 0.5 A. The usual result is a reset loop, and you can damage the USB port or the Uno's 5 V regulator.
Sketch 1 - Sweep test
Moves the servo slowly from 0° to 180° and back, one degree at a time. Leave the horn off or unloaded: you are checking that it moves smoothly over its whole range without buzzing at the ends.
#include <Servo.h>
Servo servo;
void setup() {
servo.attach(9, 500, 2500); // pin, min and max pulse in microseconds
}
void loop() {
for (int angle = 0; angle <= 180; angle++) {
servo.write(angle);
delay(15); // about 2.7 s per sweep: easy on the gears
}
delay(500);
for (int angle = 180; angle >= 0; angle--) {
servo.write(angle);
delay(15);
}
delay(500);
}Why attach(9, 500, 2500)? By default the library maps 0 to 180° onto 544 to 2400 µs, which leaves many MG996Rs well short of their full travel. Giving it 500 to 2500 µs lets write(0) and write(180) reach further, which is also why the next sketch matters: at these extremes some units hit their internal stop. If the servo buzzes at 0° or 180°, it is pushing against that stop; Sketch 2 finds where to stop instead.
Sketch 2 - Find your servo's safe limits
Every MG996R, and every clone, has a slightly different pulse range. This sketch lets you type a pulse width in microseconds into the Serial Monitor and moves the servo there, so you can find the lowest and highest values it reaches without buzzing. Write them down: they are the limits for every later sketch, and they protect the servo and your linkage.
#include <Servo.h>
Servo servo;
void setup() {
Serial.begin(9600);
servo.attach(9, 400, 2600); // wide limits so writeMicroseconds() is not clamped
servo.writeMicroseconds(1500); // start at the centre
Serial.println(F("Type a pulse width (400-2600 us) and press Enter. Start near 1500."));
}
void loop() {
if (!Serial.available()) return;
int us = Serial.parseInt(); // reads the number you typed
while (Serial.available()) Serial.read(); // discard the line ending
if (us < 400 || us > 2600) return;
servo.writeMicroseconds(us);
Serial.print(F("Pulse: "));
Serial.print(us);
Serial.println(F(" us"));
}- 1Upload, open the Serial Monitor at 9600 baud and choose 'Newline'.
- 2Type 1500: the servo goes to its centre. Fit the horn so it points where you want 'centre' to be.
- 3Type 1300, 1100, 900... in steps of 100, then 50, listening at each step. The first value where it buzzes or stops moving is past the limit: your minimum is the last quiet value.
- 4Repeat upwards from 1500 (1700, 1900, 2100...) to find the maximum.
- 5Note both numbers, for example 600 and 2400. Keep the servo away from them in normal use by 20 to 50 µs.
Sketch 3 - Smooth control with a potentiometer
A servo jumps to each new position at full speed, which looks jerky and stresses gears and linkages. This sketch reads a potentiometer and eases towards it: each update moves 8 % of the remaining distance, so the arm accelerates and settles smoothly. It also keeps the servo inside the limits you found in Sketch 2.
Extra wiring for Sketch 3
| Potentiometer pin | Uno pin | Notes |
|---|---|---|
| Outer leg | 5V | |
| Wiper (middle) | A0 | |
| Outer leg | GND |
#include <Servo.h>
const int MIN_US = 600; // your limits from Sketch 2
const int MAX_US = 2400;
Servo servo;
float position = 1500; // current pulse width, eased towards the target
void setup() {
servo.attach(9, MIN_US, MAX_US);
servo.writeMicroseconds((int)position);
}
void loop() {
int target = map(analogRead(A0), 0, 1023, MIN_US, MAX_US);
position += (target - position) * 0.08; // move 8 % of the way each frame
servo.writeMicroseconds((int)position);
delay(20); // one update per 20 ms servo frame
}Tuning the feel. The 0.08 factor sets how quickly it follows: 0.03 is slow and silky, 0.2 is snappy. Because the motion slows near the target, the servo also stops hunting back and forth around a noisy potentiometer reading. The same easing line works for any target: a sensor, a serial command or a value received over Bluetooth.
Troubleshooting on the Uno
Uno resets as soon as the servo moves
- Likely cause
- Servo powered from the Uno
- Fix
- Separate supply; join only the grounds
Servo twitches, never settles
- Likely cause
- Grounds not joined
- Fix
- Connect the supply's negative to the Uno's GND
Only about 90° of travel
- Likely cause
- Default 544 to 2400 µs limits
- Fix
- attach(9, 500, 2500), then fine-tune with Sketch 2
Buzzes at the end of a sweep
- Likely cause
- Commanded past the mechanical stop
- Fix
- Use your measured limits
Servo slow and weak
- Likely cause
- 4 × AA alkaline pack sagging
- Fix
- 5 V 3 A adapter or NiMH / regulated 6 V
Other servo libraries stop working with Servo.h
- Likely cause
- Timer 1 conflict (Servo uses it on the Uno)
- Fix
- Avoid analogWrite on D9 and D10 while servos are attached
Arduino Uno FAQ
Can I control several MG996Rs from one Uno?
Yes, one pin each (up to 12 with the Servo library), all powered from one adequately sized supply. Note that while any servo is attached, analogWrite() no longer works on pins 9 and 10.
How do I make the servo hold its position when the Uno resets? It cannot: without pulses it goes limp, and at power-up it may jump to wherever the first pulse says. Start every sketch by writing the position the mechanism is already in, and power the servo up after the Uno where you can.
Can I use the Uno R4? Yes. The Servo library supports the R4, and the wiring is the same.
Where next? Control the servo from your phone with the MG996R ESP32 guide, or lock and unlock it with an RFID card using the RC522 Uno guide.
