Skip to content

CrissCCL/DIY_UAV_Motor_System_Identification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ฉ๏ธ DIY UAV Motor System Identification (Rotational Model Component)

Brushless Motor Time Constant (ฯ„) Estimation via Acoustic Spectral Ridge Tracking

MATLAB Teensy UAV System%20ID Signal%20Processing Status License

๐Ÿ”— Part of the Main UAV Project

This repository is a dedicated propulsion dynamics identification module for the complete DIY UAV platform.

It is a submodule of the main UAV project:

๐Ÿ‘‰ DIY_UAV (main repository)
๐Ÿ”— https://github.com/CrissCCL/DIY_UAV

Within the full UAV architecture, this module provides:

  • Experimental motorโ€“ESC lag estimation (ฯ„)
  • Rotational plant modeling component
  • Basis for rate loop bandwidth design
  • Realistic simulation plant integration

๐Ÿ“Œ Role Within the UAV Rotational Model

This repository contributes to the rotational dynamic modeling of the UAV.

It experimentally identifies the motorโ€“ESC dynamic lag (ฯ„), which directly affects:

  • Roll, pitch and yaw rate response
  • Inner rate loop bandwidth
  • Phase margin and stability
  • Transient torque generation

The motor dynamics are modeled as:

$$ G_{motor}(s) = \frac{1}{\tau s + 1} $$

๐Ÿ“‚ Repository Structure

  • /Scripts โ†’ MATLAB acquisition and processing scripts
  • /exp_motor โ†’ Teensy PWM step generator firmware

๐Ÿ”ฌ Experimental Hardware Setup

setup

Test performed with 9450 propeller installed to capture real aerodynamic load dynamics. Identification includes aerodynamic loading effects due to installed propeller.

Brushless motor mounted on bench test configuration during acoustic identification. Microphone positioned at fixed distance to ensure repeatability.

๐ŸŽค Acoustic Sensor

  • Microphone: HyperX QuadCast (USB condenser microphone)
  • Fixed distance positioning
  • Ambient noise controlled environment

โš™๏ธ Propulsion System

  • Brushless Motor: 2212 โ€“ 920 kV
  • ESC: 30A
  • Hover reference PWM: 1400 ยตs (โ‰ˆ 40% RC throttle)
  • Step excitation: 1200 โ†’ 1400 ยตs

๐Ÿง  Step Generator

  • Controller: Teensy (PWM deterministic step generator)
  • No hardware logging (time reference defined in MATLAB)

๐Ÿ“ Identified Result

Motor time constant:

$$ \tau = 0.17 \text{ s} $$

This value is integrated into the rotational axis models:

$$ G_p(s), \quad G_q(s), \quad G_r(s) $$

Note This identification represents an initial experimental estimate of the propulsion dynamics. Additional tests with new ESC hardware will be performed to refine the motorโ€“ESC dynamic model.

๐Ÿ”ฌ System Identification

๐Ÿ›  Identification Pipeline

  1. Deterministic throttle step (Teensy)
  2. Audio acquisition in MATLAB (44.1 kHz)
  3. DC removal and zero-phase low-pass filtering
  4. STFT spectrogram computation
  5. Band-limited ridge tracking (60โ€“450 Hz)
  6. Median + moving average smoothing
  7. Time constant estimation (Tau63 + LS fit)

๐Ÿ”Ž Key Figures

RAW vs FILTERED Spectrogram

spectrogram raw
RAW Spectrogram
spectrogram filtered
Filtered spectrogram

Tau Estimation Window

tau_est

๐Ÿ“Š Power Spectral Density (Harmonic Analysis)

Welch PSD is computed for:

  • RAW signal
  • Filtered signal

This validates:

  • Fundamental frequency dominance
  • Harmonic structure visibility
  • Filtering effectiveness
  • Proper tracking band selection

PSD plot example:

psd

๐Ÿงฎ Identified Rotational Axis Models

Using:

$$ \tau = 0.17 \text{ s} $$

The identified continuous-time axis models are:

Roll (p-axis)

$$ G_p(s) = \frac{45.92}{0.17 s^2 + s} $$

Pitch (q-axis)

$$ G_q(s) = \frac{56.39}{0.17 s^2 + s} $$

Yaw (r-axis)

$$ G_r(s) = \frac{2.232}{0.17 s^2 + s} $$

Factored form:

$$ G(s) = \frac{K/J}{s(\tau s + 1)} $$

These models represent the complete rotational plant used for rate loop design in the main DIY_UAV project.

This explicitly shows:

  • Integrator from rigid-body rotational dynamics
  • First-order lag from propulsion system

๐Ÿ“ Physical Interpretation

Denominator:

$$ s(0.17 s + 1) $$

represents:

  • $$s$$ โ†’ rotational inertia
  • $$(0.17 s + 1)$$ โ†’ motorโ€“ESC lag

Numerator constants (45.92, 56.39, 2.232) correspond to the effective torque-to-inertia ratio $$(K/J)$$ for each rotational axis.

where:

  • $$K=$$ torque per PWM effectiveness
  • $$J=$$ axis inertia

๐Ÿ“Š Bandwidth Limitation Due to Motor Lag

This motor lag must also be considered when discretizing the plant model for embedded implementation (Ts = control loop sampling time).

Motor pole:

$$ \omega_m = \frac{1}{\tau} = 5.88 \text{ rad/s} $$

Equivalent frequency:

$$ f_m \approx 0.94 \text{ Hz} $$

Conservative Engineering Rule

$$ \omega_{BW} \lesssim \frac{1}{2\tau} $$

$$ \omega_{BW} \lesssim 2.9 \text{ rad/s} $$

This defines a safe inner rate-loop bandwidth region.

๐Ÿ“ˆ Frequency Domain Characteristics

The identified motor lag introduces an additional pole at:

ฯ‰ = 5.88 rad/s

This produces:

  • โˆ’20 dB/dec slope transition
  • Additional phase drop approaching โˆ’90ยฐ
  • Bandwidth constraint for inner rate loops

The combined plant (integrator + motor pole) yields:

โˆ’40 dB/dec slope after the motor pole frequency.

The identified motor lag introduces an additional pole at:

$$ \omega_m = \frac{1}{\tau} = 5.88 \text{ rad/s} $$

This limits achievable inner rate-loop bandwidth and reduces phase margin.

Roll (Gp)
bode_Gp_roll
Pitch (Gq)
bode_Gq_pitch
Yaw (Gr)
bode_Gr_yaw

๐Ÿ“‹ Numerical Summary (Identified Case)

Parameter Value
Motor model 2212 โ€“ 920 kV
ESC 30A
Hover PWM 1400 ยตs
Identified ฯ„ 0.17 s
Motor pole 5.88 rad/s
Equivalent frequency 0.94 Hz
Conservative BW limit < 2.9 rad/s

This summary defines the propulsion dynamic constraint used in the UAV rotational model.

This propulsion identification module directly supports the design of the inner rate control loops implemented in the main DIY_UAV project.

๐ŸŽฏ Engineering Impact

Including ฯ„ in the plant model ensures:

  • Realistic simulation
  • Correct phase margin prediction
  • Controlled bandwidth selection
  • Reduced oscillatory risk
  • Physically consistent tuning

Ignoring motor lag results in:

  • Overestimated bandwidth
  • Reduced stability margin
  • Instability in real flight despite stable simulation

โ–ถ๏ธ Quick Start

Record Audio

run("record_audio.m");

Process and Estimate ฯ„

run("process_audio_tau.m");

๐Ÿ”— Integration with Flight Controller

The identified motor lag model is directly integrated into:

  • Rate loop tuning
  • Simulation plant model
  • Embedded discrete-time controller design

๐Ÿค Support projects

Support me on Patreon https://www.patreon.com/c/CrissCCL

๐Ÿ“œ License

MIT License

About

Acoustic-based identification of brushless motor dynamics for UAV rotational plant modeling and rate loop design.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors