Skip to content

Motor · Arduino Uno guide

Controlling Brushless Motor (BLDC) with ESC with Arduino Uno

How a 30A ESC drives an A2212 brushless motor: wiring, the 1000–2000 µs throttle signal, arming, calibration and sizing.

Updated November 16, 2026 Arduino C++ServoAlso forESP32

What is the BLDC ESC?

A brushless DC (BLDC) motor has no brushes, so it can't run from a plain DC supply. It needs an ESC (electronic speed controller): a small board that switches the battery current through the motor's three wires in the right order, thousands of times a second. Your Arduino or ESP32 never powers the motor. It only sends the ESC a small throttle signal saying how fast to go.

This page uses the kit most makers start with: an A2212 1000KV motor, a 30A ESC and a 3S LiPo, as used on F450 quadcopters, RC planes and test rigs. You'll learn what each wire does, how the throttle signal works, why ESCs need arming and calibration, and how to size an ESC and battery. To drive one from a board, follow the Arduino Uno guide or the ESP32 guide.

Example kit specifications

Example kit
A2212 1000KV outrunner + 30A ESC + 3S 2200 mAh LiPo
ESC continuous / burst current
30 A / 40 A for 10 s (Hobbywing Skywalker 30A)
ESC input
2–3S LiPo (7.4–11.1 V nominal, 12.6 V full)
BEC output
5 V, 2 A linear (Skywalker 30A); many generic 30A ESCs list 5 V 3 A
Control signal
Servo-style PWM: 1000–2000 µs pulse at 50 Hz (after calibration)
Hobbywing default range
1100–1940 µs until you calibrate
Motor KV
1000 rpm per volt (no load): about 11,100 rpm on 11.1 V
Motor current
12 A for 60 s; best efficiency at 4–10 A
Motor no-load current
0.5 A at 10 V
Thrust (3S, 1045 prop)
About 700–800 g
Motor wires
3 phase wires, 3.5 mm bullet connectors

ESC figures from the Hobbywing Skywalker V2 manual; motor figures are the common A2212 1000KV listing. Check your own ESC's label: current, cell count and BEC rating vary by model.

ESC wires and where they go

  • Thick red (BAT+)

    Goes to
    LiPo + via XT60 or Deans
    Notes
    Check polarity before plugging in: reversed polarity can destroy the ESC
  • Thick black (BAT−)

    Goes to
    LiPo −
  • 3 motor wires

    Goes to
    The 3 motor wires (bullet connectors)
    Notes
    Any order works. Swap any two to reverse direction, with the LiPo unplugged
  • Signal (white, yellow or orange)

    Goes to
    Board PWM pin
    Notes
    Servo-style throttle pulse
  • Ground (black or brown, thin)

    Goes to
    Board GND
    Notes
    Required: the signal is measured against this ground
  • Red, thin (BEC +5 V)

    Goes to
    Leave unconnected if the board has USB or its own supply
    Notes
    Can power a receiver or a board on its own; never in parallel with USB

Wiring & code

Setting up BLDC ESC with Arduino Uno

Library

Servo by Arduino

Included with the Arduino IDE

In this guide you'll control a brushless motor from an Arduino Uno: a potentiometer becomes the throttle, the sketch arms the ESC safely, ramps the speed smoothly and caps it for bench testing. You'll also run a one-time calibration sketch so the ESC uses the full 1000–2000 µs range.

It takes about 30 minutes. The motor never starts on its own: the sketch waits until the knob is at zero.

Danger

Propeller OFF for every test on this page. An A2212 on 3S spins at roughly 11,000 rpm with no load and can pull about 800 g of thrust with a 10-inch prop: enough to cut fingers. Clamp the motor down, keep hands clear, and unplug the LiPo before touching any wire.

What you need

  • Arduino Uno R3

    Qty
    1
    Notes
    Powered from USB
  • A2212 1000KV brushless motor

    Qty
    1
    Notes
    Or any 2–3S outrunner
  • 30A brushless ESC

    Qty
    1
    Notes
    SimonK, BLHeli or Hobbywing Skywalker
  • 3S LiPo, 2200 mAh, XT60

    Qty
    1
    Notes
    Charged with a proper balance charger
  • 10 kΩ potentiometer

    Qty
    1
    Notes
    The throttle knob
  • Jumper wires

    Qty
    5
    Notes
    Male-female for the ESC's servo plug
  • Clamp or motor mount

    Qty
    1
    Notes
    The motor must not move

How it fits together

There are two separate circuits, joined only by the signal and its ground:

  • Power circuit: LiPo → ESC → motor. Tens of amps, thick wires. The Arduino Uno never touches it.
  • Control circuit: USB → Arduino Uno → signal pin → ESC. A few milliamps.

The ESC's servo plug has three wires. Signal goes to D9, the thin ground goes to GND, and the thin red wire (the ESC's 5 V BEC output) stays unconnected, because the Arduino Uno already has power from USB.

Wiring: ESC and potentiometer to Arduino Uno

  • ESC signal (white/yellow/orange)Arduino Uno D9

    Why
    Throttle pulse
  • ESC ground (thin black/brown)Arduino Uno GND

    Why
    Shared reference for the signal
  • ESC thin red (BEC 5 V)Not connected: tape it

    Why
    The Arduino Uno is on USB
  • Potentiometer ends5V and GND

    Why
    Throttle knob supply
  • Potentiometer middle pinArduino Uno A0

    Why
    Knob position
  • ESC 3 motor wiresMotor's 3 wires

    Why
    Any order; swap two to reverse
  • ESC thick red/blackLiPo XT60

    Why
    Connected last, in step 6

Wire it up, step by step

  1. 1Remove the propeller and clamp the motor down.
  2. 2Plug the ESC's three motor wires into the motor's bullet connectors.
  3. 3Connect the ESC signal wire to D9 and the thin ground wire to GND. Tape the thin red wire's pin.
  4. 4Wire the potentiometer: outer pins to 5V and GND, middle pin to A0.
  5. 5Connect the Arduino Uno to your computer by USB. Leave the LiPo unplugged.
  6. 6Run the calibration sketch below (once per ESC), then upload the throttle sketch. Connect the LiPo only when the sketch tells you to.

Upload and calibrate (once per ESC)

The Servo library comes with the Arduino IDE; nothing to install. Choose Tools → Board → Arduino Uno, select the port, and upload this sketch with the LiPo unplugged:

sketch.ino
// ESC throttle calibration (run ONCE per ESC). PROPELLER OFF.
// 1. Upload with the LiPo DISCONNECTED. 2. Open Serial Monitor (9600).
// 3. Follow the prompts. Sets the ESC range to 1000-2000 us.
#include <Servo.h>
Servo esc;

void waitForEnter() {
  while (Serial.available()) Serial.read();
  while (!Serial.available()) {}
  delay(50);
  while (Serial.available()) Serial.read();
}

void setup() {
  Serial.begin(9600);
  esc.attach(9, 1000, 2000);
  esc.writeMicroseconds(2000);                      // MAXIMUM first
  Serial.println(F("Sending 2000 us (max). Connect the LiPo to the ESC now."));
  Serial.println(F("When the ESC beeps to say max is stored, press Enter."));
  waitForEnter();
  esc.writeMicroseconds(1000);                      // then MINIMUM
  Serial.println(F("Sending 1000 us (min). Wait for the confirmation beeps."));
  delay(4000);
  Serial.println(F("Done. Unplug the LiPo. Upload the throttle sketch."));
}

void loop() {}

Open the Serial Monitor at 9600 baud and follow the prompts: plug in the LiPo while the sketch sends 2000 µs, press Enter after the "max stored" beeps, then wait for the "min stored" beeps. Unplug the LiPo. The exact tones depend on your ESC; the main page explains arming and calibration.

Arming at minimum throttle every power-up, and the one-time calibration from 2000 µs to 1000 µs.

The throttle sketch

sketch.ino
// BLDC motor + 30A ESC + Arduino Uno: potentiometer throttle with safe start
// PROPELLER OFF while testing. ESC signal -> D9, ESC signal ground -> GND,
// ESC red BEC wire NOT connected (the Uno runs from USB). Pot: 5V / A0 / GND.
#include <Servo.h>

const byte ESC_PIN = 9;
const byte POT_PIN = A0;
const int  MIN_US  = 1000;   // after calibration: 0 % throttle
const int  MAX_US  = 2000;   // after calibration: 100 % throttle
const int  LIMIT_US = 1500;  // bench-test cap: change only when you are ready
const int  STEP_US  = 10;    // max change per 20 ms: smooth ramp, no sudden jumps

Servo esc;
int outUs = MIN_US;

void setup() {
  Serial.begin(9600);
  esc.attach(ESC_PIN, MIN_US, MAX_US);
  esc.writeMicroseconds(MIN_US);           // minimum throttle from the very start

  Serial.println(F("Turn the pot fully DOWN, then connect the LiPo to the ESC."));
  while (analogRead(POT_PIN) > 20) {        // refuse to start with the knob up
    delay(100);
  }
  Serial.println(F("Pot at zero. Waiting 5 s for the ESC to arm..."));
  delay(5000);
  Serial.println(F("Armed. Turn the pot slowly."));
}

void loop() {
  int target = map(analogRead(POT_PIN), 0, 1023, MIN_US, LIMIT_US);
  if (target < MIN_US + 20) target = MIN_US;          // small dead zone = clean stop

  if (target > outUs)      outUs = min(outUs + STEP_US, target);  // ramp up gently
  else if (target < outUs) outUs = target;                        // stop at once

  esc.writeMicroseconds(outUs);

  static unsigned long lastPrint = 0;
  if (millis() - lastPrint > 250) {
    lastPrint = millis();
    Serial.print(F("Pulse: "));
    Serial.print(outUs);
    Serial.print(F(" us  Throttle: "));
    Serial.print((outUs - MIN_US) / 10);
    Serial.println(F(" %"));
  }
  delay(20);
}

How the code works

  • Minimum first. esc.writeMicroseconds(1000) runs before anything else, so the ESC sees minimum throttle the moment the LiPo is connected and arms instead of entering calibration.
  • Knob must be at zero. The while loop refuses to continue until the potentiometer is turned fully down. A knob left halfway can't start the motor by surprise.
  • Ramp up, stop at once. The output rises by at most 10 µs every 20 ms (0 to 50 % takes about a second) but drops to minimum instantly when you turn the knob down.
  • LIMIT_US = 1500 caps the bench test at half throttle. Raise it towards 2000 only when the motor is mounted properly and you need full power.
  • Dead zone. Readings within 20 µs of minimum become exactly 1000 µs, so the motor stops cleanly instead of twitching.

What you should see

With the LiPo unplugged, open the Serial Monitor (9600 baud), turn the knob fully down, then connect the LiPo:

Output
Turn the pot fully DOWN, then connect the LiPo to the ESC.
Pot at zero. Waiting 5 s for the ESC to arm...
Armed. Turn the pot slowly.
Pulse: 1000 us  Throttle: 0 %
Pulse: 1180 us  Throttle: 18 %
Pulse: 1340 us  Throttle: 34 %
Pulse: 1000 us  Throttle: 0 %

Troubleshooting

Common problems and fixes

  • ESC keeps beeping, never arms

    Likely cause
    Signal not at minimum, or no common ground
    Fix
    Make sure the ESC ground goes to Arduino Uno GND; the sketch sends 1000 µs before the LiPo goes in
  • Sketch stuck at 'Turn the pot fully DOWN'

    Likely cause
    Knob not at zero, or pot wired backwards
    Fix
    Turn it the other way, or swap the pot's outer wires
  • Motor reaches full speed at a quarter of the knob

    Likely cause
    ESC not calibrated
    Fix
    Run the calibration sketch
  • Motor only twitches

    Likely cause
    Loose bullet connector or throttle too low
    Fix
    Push the bullets home; turn the knob a little further
  • Spins the wrong way

    Likely cause
    Phase order
    Fix
    Unplug the LiPo, swap any two motor wires
  • Arduino Uno resets when the motor starts

    Likely cause
    BEC red wire connected while on USB
    Fix
    Disconnect and tape the thin red wire

Frequently asked questions

Why not use analogWrite()? It makes 490 Hz PWM with a duty cycle, not the 50 Hz, 1000–2000 µs pulse the ESC expects. Use the Servo library.

Can I power the Arduino Uno from the ESC's BEC instead of USB? Yes: connect the thin red wire to the Uno's 5V pin and remove USB. Never both at once.

How do I control more than one ESC? Attach another Servo object to another pin. Each ESC needs its own signal wire; the grounds all join.

Can I use a different signal pin? Yes, any digital pin works with the Servo library. Note that it disables PWM on pins 9 and 10 while in use.

What to build next

  • Thrust stand: mount the motor on an HX711 load cell and measure grams of thrust against throttle.
  • Battery monitor: read the LiPo voltage through a divider and stop the motor below 3.5 V per cell.
  • Two-motor drive: a second ESC on another pin for a hovercraft or boat.
  • Wireless throttle: the ESP32 guide adds a phone slider with a failsafe.

Keep learning

Related guides & projects