Blackbox logging

Also known as: Blackbox

On this page 7

Blackbox logging is the recording of high-rate internal flight controller data, such as gyro readings, stick inputs, PID terms and motor outputs, to onboard flash memory or an SD card during flight. In drones, and particularly in the flight control of FPV and hobby multirotors running Betaflight or INAV, the blackbox is the primary diagnostic tool for tuning and troubleshooting, because it shows what the controller measured and commanded rather than what the pilot believed happened.

The name borrows from the flight data recorder of manned aviation, but the purpose is different. A drone blackbox is rarely used for accident investigation alone; its everyday role is evidence-based PID tuning and filter tuning, the detection of vibration and the explanation of oscillations, desyncs and failsafe events.

How blackbox logging records flight data

During flight, the flight controller runs its PID loop at several kilohertz and can write a selected subset of its internal variables to storage at a configurable rate. The firmware compresses each frame by storing intra frames with full values at intervals and inter frames with only predicted differences in between, which keeps the data stream small enough for onboard flash.

Logging normally starts when the aircraft is armed and stops when it is disarmed, although it can also be tied to a switch. The resulting file is decoded on a computer with a blackbox explorer application, which plots traces over time and computes spectra. The table below lists the most useful logged fields and what each reveals.

Logged fieldWhat it containsWhat it reveals
Gyro (raw and filtered)Angular rate per axisNoise level and filter delay
SetpointRequested rotation rate from sticksPilot intent and rate profile
P, I, D and feedforward termsIndividual controller outputsWhich term drives an oscillation
Motor outputsCommanded value per motorSaturation, imbalance and heat risk
Motor RPMeRPM from bidirectional DShotRPM filter accuracy and desyncs
Battery voltage and currentPower system readingsVoltage sag under load
Debug channelsMode-specific internal valuesDetailed filter and loop behavior
Key fields in a blackbox log

Storage options, sample rates and log size

The logging rate is set as a fraction of the PID loop frequency. Higher rates capture high-frequency noise accurately but fill storage faster, so the choice is a trade-off between spectral detail and recording time. For filter analysis, a rate of at least 1-2 kHz is generally recommended, while long cruise flights can be logged at lower rates.

Storage capacity differs greatly by hardware. Many compact flight controllers carry only 8-16 MB of onboard flash, which holds a few minutes of high-rate data, whereas boards with an SD card slot can record many flights.

StorageTypical capacityStrengths and limits
Onboard flash chip8-16 MB, some 128 MBReliable and light, but fills in minutes
MicroSD cardSeveral gigabytesLong recording, but card quality matters
External serial loggerDepends on the loggerLegacy option with extra wiring
No storageNoneLogging is unavailable on that board
Blackbox storage options compared

Onboard flash must be erased between sessions once it is full, otherwise new flights are not recorded. Pilots who tune actively usually download and clear the logs after every few packs.

Using blackbox logs for tuning and diagnosis

The central technique is comparing gyro against setpoint. On a well-tuned aircraft, the gyro trace follows the setpoint closely with little overshoot and little delay. Persistent overshoot points to excessive P or feedforward, slow tracking suggests too little gain, and slow drift away from the setpoint indicates insufficient I term.

The second technique is spectral analysis. The explorer converts gyro data into a frequency spectrum, in which motor noise peaks move with throttle, while frame resonances stay at a fixed frequency. This view shows whether the RPM filter is tracking motor harmonics correctly and how much lowpass filtering can be removed safely to reduce delay.

Symptom in the logLikely causeTypical fix
Gyro overshoots setpointP or feedforward too highReduce gain or feedforward
Low-frequency wobble after flipsPropwash oscillationRaise D or adjust dynamic idle
Broad noise above 200 HzDamaged propeller or bent shaftReplace the damaged part
Fixed-frequency peakFrame resonanceTighten frame or add a notch filter
One motor near maximumImbalance or failing motorCheck center of gravity and motor
Motor output drops to zeroESC desync or power lossCheck ESC settings and wiring
Common log symptoms and their usual causes

Blackbox logging compared with other flight records

Blackbox logging is often confused with other kinds of flight records. The key distinction is sampling rate and purpose: blackbox data captures controller dynamics in the millisecond range, while telemetry and flight logs in consumer apps track position, battery state and events at a few samples per second.

  • On-screen display and telemetry show live values to the pilot but are not designed for detailed post-flight analysis.
  • Consumer flight logs from camera drone apps record GNSS tracks, altitude and warnings, which suit incident reports rather than PID tuning.
  • ArduPilot dataflash logs serve a similar role to Betaflight blackbox files but cover a wider set of navigation and estimator data.
  • Remote identification broadcasts transmit position and identity for regulatory purposes and contain no control loop data.

Limitations and common mistakes

A blackbox log is only as good as its settings. The most frequent mistake is logging at too low a rate, which hides high-frequency noise through aliasing and leads to wrong filter decisions. Another is analyzing a log from a gentle hover flight, which does not exercise the controller enough to reveal tuning problems.

Logs also cannot record what the sensors do not see. Mechanical faults such as a loose stack or a cracked arm appear only indirectly as noise, and the cause still requires physical inspection. Finally, a crash often ends the log abruptly, so the final milliseconds may be lost if power is cut before the file is closed, which matters when the blackbox is used to explain a failure.

Understanding it simply

A blackbox log is a detailed diary of every flight. The small computer that flies the drone writes down what it feels and what it does. It notes how the drone rotates, what the pilot asked for and how hard each motor worked.

After landing, the pilot opens this diary on a computer. Charts show where the drone shook or reacted too slowly. It works like a doctor reading a heart monitor. The pilot can then change the settings based on facts, not guesses.

Applied in practice

A freestyle FPV pilot builds a new 5-inch quadcopter and notices a shaky image after quick flips. The flight controller has 16 MB of onboard flash, so the pilot sets the logging rate to 2 kHz and flies a short pack with flips, rolls and fast throttle changes.

In the blackbox explorer, the gyro spectrum shows a sharp peak near 160 Hz that does not move with throttle, which indicates frame resonance rather than motor noise. The step response also shows slight overshoot on the pitch axis. The pilot tightens the frame screws, replaces a loose arm, and lowers pitch P by about 10%. A second log confirms that the peak has disappeared, and the video becomes smooth after flips without adding extra filter delay.