To control servo with Arduino hardware, you need a PWM-capable digital pin, the standard Servo.h library, and a dedicated external power supply for any motor drawing more than 500mA. The Arduino generates a 50Hz pulse-width modulation (PWM) signal, where a 1000µs pulse commands 0 degrees, a 1500µs pulse commands 90 degrees (center), and a 2000µs pulse commands 180 degrees. While the logic is simple, the mechanical and electrical realities of driving inductive loads require careful component selection and power management.

Motor Selection: Why a Servo and Not a Stepper or DC Motor?

Before wiring anything, you must confirm a servo is actually the right tool for your load profile. Hobbyists frequently treat steppers and servos as interchangeable because both can move to specific angles, but their torque curves and control architectures are fundamentally different. A standard brushed DC motor offers high RPM but zero native positional control without adding an external encoder and PID loop. A stepper motor excels at holding torque and open-loop precision at low speeds, but it vibrates, runs hot, and requires a dedicated microstepping driver (like an A4988 or TMC2209).

A servo, by contrast, is a closed-loop system. It packages a DC motor, a gear train, and a potentiometer (or magnetic encoder) into one housing. The internal feedback loop constantly corrects positional errors, making it ideal for robotic arms, camera gimbals, and RC steering where dynamic load changes occur. If your application requires holding a heavy static load at a specific angle without continuous power draw, a servo is superior to a stepper, which must constantly energize its coils to maintain holding torque.

Motor Type Comparison for Embedded Projects
Motor Type Torque Curve Profile Control Needs Typical Cost (Hobby Grade)
Standard DC High torque at stall, drops linearly with RPM H-Bridge (L298N), requires encoder for position $2 - $8
Stepper (NEMA 17) Maximum holding torque at 0 RPM, drops sharply at speed Stepper driver (A4988), step/dir pulses $12 - $25
RC Servo (e.g., MG996R) High stall torque, limited to ~180° rotation Direct 50Hz PWM from microcontroller GPIO $5 - $15

Sizing Your Servo: Torque Rules and a Worked Load Example

The most common mistake when learning to control servo with Arduino boards is undersizing the motor. Servo torque is rated in kilogram-centimeters (kg-cm) or ounce-inches (oz-in) at stall. However, stall torque is the absolute mechanical limit before the motor stops moving; you should never design a system that operates at this threshold.

Sizing Rule of Thumb: Calculate your static load torque, then multiply by a dynamic safety margin of 2.0 to 2.5. This accounts for acceleration forces, friction, and voltage sag under load.

Worked Load Example:
Imagine you are building a robotic arm segment. The arm is 12 cm long from the servo spline to the center of mass of the payload. The payload weighs 250 grams (0.25 kg), and the arm itself weighs 100 grams (0.1 kg) with its center of mass at 6 cm.

  • Payload Torque: 0.25 kg × 12 cm = 3.0 kg-cm
  • Arm Torque: 0.10 kg × 6 cm = 0.6 kg-cm
  • Total Static Torque: 3.6 kg-cm
  • Dynamic Margin (×2.5): 3.6 kg-cm × 2.5 = 9.0 kg-cm

You need a servo rated for at least 9.0 kg-cm. A micro servo like the SG90 (rated at 1.8 kg-cm) will instantly stall and strip its plastic gears. You must step up to a standard metal-gear servo like the Tower Pro MG996R, which offers roughly 13 kg-cm of stall torque, giving you a safe operating envelope.

Wiring, Terminals, and Power Delivery

Standard hobby servos use a 3-pin JR or Futaba connector. Identifying the terminals correctly is critical, as reversing VCC and GND will instantly destroy the internal control IC.

Servo Terminal Identification and Wiring
Function Wire Color (Standard) Arduino / Power Connection
Ground (GND) Brown or Black Arduino GND AND External PSU Negative
Power (VCC) Red External PSU Positive (5.0V - 6.0V)
Signal (PWM) Orange, Yellow, or White Arduino Digital Pin (e.g., Pin 9)
Callout Tip: The Common Ground Rule
When using an external power supply (like a 5V 3A buck converter or a battery eliminator circuit) to drive the servo, you must connect the external power supply's ground to the Arduino's GND pin. Without a shared ground reference, the PWM signal from the Arduino will float, resulting in erratic servo twitching or total failure to respond.

If you need to control more than two high-torque servos, the Arduino's onboard 5V regulator will overheat and fail. For multi-servo rigs, use an I2C PWM driver like the Adafruit PCA9685 16-Channel Shield. This offloads the pulse timing to a dedicated chip and provides screw terminals for high-current servo power rails.

Recognizing Failure Signatures: Hum, Overheat, and Stall

Servos communicate their distress through physical symptoms. Diagnosing these early prevents melted wires and stripped gears.

  • The 'Hum' or Jitter: If the servo vibrates or hums while holding position, you have either a noisy power supply, a missing common ground, or a worn internal potentiometer. Measure the VCC rail with an oscilloscope; if you see voltage ripple greater than 100mV, add a 470µF electrolytic capacitor across the servo's power terminals.
  • Overheat: A servo casing that is too hot to touch (>60°C) is being commanded to hold a position against a mechanical bind. The internal H-bridge is dumping stall current (often 2A+) into the motor windings. Check your mechanical linkages for binding and ensure your code isn't commanding an angle outside the servo's physical travel limits.
  • Stall and Click: If the motor stops moving and emits a rhythmic clicking sound, the load exceeds the stall torque, and the internal gears are skipping or stripping. Immediately cut power. You must either reduce the load, increase the lever arm distance, or upgrade to a higher-torque metal-gear model.

Frequently Asked Questions

Can I control servo with Arduino without an external power supply?

Yes, but only for micro servos like the SG90 (which draw ~200mA at stall) and only if you are powering the Arduino via USB. The Arduino's onboard linear regulator can typically supply 500mA to 800mA total. If you attempt to drive a standard MG996R (2.5A stall current) directly from the Arduino's 5V pin, you will trigger the Arduino's polyfuse, cause a brownout reset, or permanently damage the voltage regulator.

Why does the board reset when I control servo with Arduino pins?

This is a classic brownout condition. When a servo starts moving, it draws a massive inrush current. If the servo is powered from the same 5V rail as the Arduino, this current spike causes the voltage to dip below the ATmega328P's minimum operating threshold (typically ~2.7V), triggering the brownout detection (BOD) circuit and resetting the microcontroller. Always isolate the servo power rail and use a dedicated supply with adequate current headroom.

How do I control servo with Arduino using I2C for multiple motors?

The standard Arduino Servo library uses hardware timers (usually Timer1), which limits you to about 12 servos on an Uno and conflicts with other libraries like ServoTimer2 or certain motor shields. To control 16 or more servos, use a PCA9685 I2C PWM driver board. You communicate with it via the Wire library, sending angle commands over I2C, while the PCA9685 handles the precise 50Hz pulse generation independently of the Arduino's timers.

What is the difference when I control servo with Arduino using analog vs digital signals?

Standard 'analog' servos use a continuous 50Hz PWM signal to update their position; if the signal drops out, they lose holding torque. 'Digital' servos use an internal microcontroller to process the PWM signal and drive the motor at a much higher internal frequency (up to 300Hz+). This gives digital servos tighter deadbands, faster acceleration, and better holding torque under load. However, digital servos draw significantly more current at idle and can overload weak power supplies if not sized correctly.