Brushless motor and ESC
An A2212 1000KV brushless outrunner on a 30 A ESC. A servo pulse is the throttle, and the ESC has to arm before it will spin.
Aliases: BLDC, brushless motor, ESC, electronic speed controller, A2212, 30A ESC, drone motor, SimonK, BLHeli. The motor and its speed controller are one part here: the ESC's three phase wires go straight to the motor.
Pins
| Pin | What it does |
|---|---|
SIG |
The throttle, a servo pulse: 1000 µs is stopped and 2000 µs is full. The white or yellow wire of the servo lead. |
5V |
The BEC's output, 5 V from the battery (rated 2 A). The red wire. Leave it unwired when the board has its own supply. |
GND |
The servo lead's ground, the brown or black wire. Join it to the board's GND. It is the same wire as BAT- inside. |
BAT+, BAT- |
The battery, 2S to 4S LiPo (5.5 V to 17 V). |
Arming
An ESC will not spin a motor the moment it gets power, because a propeller that starts by itself takes fingers off. This one does what the common SimonK and BLHeli firmware does:
- For the first second it plays its start-up tones and ignores the throttle.
- It then waits for the throttle at the bottom (no more than 1050 µs). After half a second of that it arms.
- If the throttle is up while it waits, it stays disarmed. A sketch that sends half throttle from power-up never starts the motor.
- Armed, the motor follows the throttle.
- If the signal lead comes loose (
SIGleft floating) for a quarter of a second, it disarms and the motor coasts to a stop. It arms again only after low throttle.
The 1 s, 0.5 s and 0.25 s are assumptions in the range those firmwares use. Many ESCs go into throttle calibration when they see full throttle at power-up; that is not simulated, and the range stays 1000 µs to 2000 µs.
#include <Servo.h>
Servo esc;
void setup() {
esc.attach(9, 1000, 2000);
esc.writeMicroseconds(1000); // throttle down
delay(3000); // let it arm
}
void loop() {
int us = map(analogRead(A0), 0, 1023, 1000, 2000);
esc.writeMicroseconds(us);
delay(20);
}
Mokxi's Servo library sends one pulse each writeMicroseconds() and the ESC
holds the last throttle until the next, which is what the real library's
continuous 50 Hz pulses come to.
The speed
A brushless motor's free speed is its KV (rpm per volt) times the volts across it,
so the speed is kv x battery volts x throttle: 11,100 rpm at full throttle on a
3S (11.1 V) pack. It gets there over about half a second (inertia, 150 ms, an
assumption for a bare 52 g outrunner). The probe and the label print the rpm.
There is no propeller here. With a 1045 prop on 3S a real A2212 holds about 7,000 to 8,000 rpm at full throttle and draws up to its 12 A.
Properties
| Property | What it sets |
|---|---|
kv |
The motor's rpm per volt, 1000 for the A2212/13T. |
min_us, max_us |
The throttle range, 1000 µs to 2000 µs. |
inertia |
The spin-up lag in milliseconds. |
What is not simulated
The commutation of the three phases (the part is the speed-controlled motor the ESC
makes), a propeller and its load, the battery current (so the pack never sags and
BAT+ draws nothing), the BEC's own draw on the battery, the beeps as sound,
throttle calibration, the low-voltage cut-off, braking, timing settings and heat. A
real ESC also times out on a lead that is still driven but carries no pulses; here
the last throttle is held.