Calibrating four ESCs from a microcontroller
What ESC firmware expects during throttle calibration, the ways it fails silently, and why the idle floor matters more than the calibration.
Throttle calibration looks like a two-line job: send full throttle, then send minimum. I read up on it for a multirotor project that drives four ESCs from an ESP32. The details depend on firmware that you often cannot identify, and the failures are quiet. The details below come from vendor manuals, firmware source code and flight-controller documentation.
What SimonK expects
I start with the open SimonK firmware. Its calibration is compiled in. It starts when the ESC is disarmed and sees a stable pulse of at least 1460 microseconds. That is the midpoint between its default stop and full values.
The sequence has three steps.
- Valid pulses of at least that width must already arrive when the battery is connected.
- After the power-up tones, the ESC needs 31 consecutive pulses within 10 microseconds of the first, at 50 Hz. That takes about 0.65 seconds. The ESC confirms with one beep.
- When the input drops, the ESC averages 34 stable pulses, which takes about 0.7 seconds. It confirms with two beeps, writes both values to EEPROM and arms with a long beep. No power cycle is needed.
The ESC learns whatever stable pulse arrives. If you calibrate at half throttle, half throttle becomes full. The firmware also stores slightly offset values: about 17/16 of the measured minimum and 31/32 of the measured maximum. A 1000 microsecond minimum therefore still arms reliably.
Other firmware behaves differently
Timing that suits one family can break another.
- Hobbywing-style ESCs confirm the maximum a couple of seconds after power-up. They enter a programming menu if you hold full throttle for too long, in the region of seven seconds.
- BLHeli_S wants about three seconds above mid-stick and then three seconds below.
- The automatic routine of ArduPilot holds the maximum for five seconds and then holds the minimum until the board restarts.
If you do not know the firmware, use one sequence that is safe for all three. Hold maximum for three seconds, hold minimum for six or more seconds, then power cycle. The beeps tell you what you have. One beep, then two beeps and a long beep points to SimonK. Beeps that count the battery cells point to Hobbywing-style firmware. Upstream SimonK plays no tune while you hold full throttle. A repeating tune means the board runs something else.
Six quiet failures
Brown-out lockout
SimonK disables calibration after a brown-out reset. A weak pack could otherwise recalibrate an ESC by accident. You hear a different start-up tone, and the ESC simply arms. When four ESCs share one connector, a bouncy plug-in can leave some units calibrated and others not.
Jitter
A deviation above 10 microseconds restarts the capture. The ESC can sit at full throttle and never beep. Resolution is not the cause. A 16-bit LEDC timer at 50 Hz has a step of 0.31 microseconds. Ground bounce and weak logic levels are possible causes.
Missing or low pulses at power-up
Below 1460 microseconds, the ESC skips calibration.
A signal line held high as plain DC
Upstream SimonK jumps to its bootloader after about two seconds of continuous high input. A 10 kilohm pull-down on each signal line keeps the pins low while the microcontroller boots.
A thin logic margin
The ATmega8 needs 0.6 times its supply to read a high, which is 3.0 volts at 5 volts. The ESP32 guarantees 0.8 times its supply on an output, which is 2.64 volts. Most boards work, but the margin is not guaranteed, and any ground offset reduces it. A 5-volt push-pull buffer solves it properly.
Library defaults
ESP32Servo outputs 1500 microseconds as soon as you attach a pin. That is above the SimonK threshold. With raw LEDC, writing microseconds straight into ledcWrite() gives wrong pulses. You must convert them to duty counts first.
Calibration aligns the scale and not the motors
Driving all four ESCs with the same values at the same moment is valid. ArduPilot does exactly that in its all-at-once mode. Each ESC measures the pulse with its own oscillator. Boards without a crystal can differ by 5 to 10 percent, and this is the reason calibration exists.
Calibration does not make the motors start at the same throttle. Bearing friction, rotor position and propeller drag decide which motor starts first near the threshold. ArduPilot calls a spread of one to two percent between identical ESCs common.
Flight controllers measure and set a floor instead of recalibrating. The idle floor is the highest measured start percentage plus about two percent. The in-flight minimum sits a few percent above that. Betaflight does the same with an idle setting, and with RPM telemetry it can use a dynamic floor.
The routine therefore has three levels. Disarmed is 1000 microseconds. Armed idle is the highest measured start plus a margin. The in-flight minimum sits above idle. Jump straight from stop to idle. Never creep through the dead band.
A routine for all three families
// Arduino-ESP32 core 2.0.x (ledcSetup / ledcAttachPin)
const uint32_t PWM_HZ = 50, RES_BITS = 16, PERIOD_US = 20000;
const uint32_t US_MIN = 1000, US_MAX = 2000;
uint32_t usToDuty(uint32_t us) { return (us * 65536UL) / PERIOD_US; }
void calibrate() { // props OFF, battery disconnected on entry
writeAll(US_MAX); // valid max pulses before the ESCs have power
waitForEnter(); // plug the battery in with one clean push
delay(3000); // SimonK: one beep
writeAll(US_MIN);
delay(6000); // two beeps and a long beep, then armed
// keep sending US_MIN and never stop the pulses
}
Take the propellers off. Power the microcontroller from USB first. Never start this routine with the battery already connected, because an armed ESC treats 2000 microseconds as full power. After calibration, measure the start point of each motor in 5-microsecond steps, first without propellers and then with them.
The number that matters is the idle floor, and you find it by measuring.