Knowledge / Hands-on project

Vibration anomaly detection: ESP32 + MPU6050

Not started

Hands-on hardware project

Detect vibration anomalies on a motor/fan using an ESP32 and MPU6050 IMU with statistical thresholds.

Practice in the Flight Lab: Spot the anomaly

Subareas

I2CData loggingMAD/Z-scoreMounting/debuggingSerial outputFault injectionFalse-positive rate measurement

Steps & what each needs

  1. Wiring: MPU6050 VCC→3V3, GND→GND, SDA→GPIO21, SCL→GPIO22; mount the sensor rigidly to the motor/fan.
  2. I2C init: Wire.begin(21,22) at 400 kHz, wake the MPU6050 (PWR_MGMT_1=0), verify WHO_AM_I=0x68, set accel range and DLPF.
  3. Sampling rate: fixed-rate timer sampling (e.g. 500 Hz–1 kHz); record timestamps and check for dropped samples.
  4. Logging: stream CSV over serial (timestamp, ax, ay, az) and save to file on the host.
  5. Baseline: record several normal runs; compute windowed RMS/peak features and their median & MAD.
  6. Thresholds: robust z = 0.6745·(x−median)/MAD; flag when |z| exceeds a threshold (e.g. 3.5) for N consecutive windows.
  7. Fault injection: add an imbalance mass or loosen the mount; confirm detection within 5 s.
  8. FPR measurement: run detection on held-out normal runs and report the false-positive rate.
  9. Repo writeup: public GitHub repo with code, sample data, FPR results, and a fault-caught-within-5-s plot.

Resources

← All knowledge