Skip to content

Data Magician

Sensor data is the foundation of drone control. In this project, you will learn how to read the drone’s sensor data and perform simple analysis.

  • Sensor data reading
  • I2C communication protocol
  • Data logging functionality
  • Data analysis methods
ItemQuantityNotes
Fully Assembled Drone1-
Computer1With VS Code + ESP-IDF environment
USB Cable1For programming
Smartphone1With Drone Control APP installed
SensorFunction
MPU60506-axis sensor, measures acceleration and angular velocity
BMP280Pressure sensor, measures pressure and altitude

Open the following files to understand data reading logic:

  • components/drivers/i2c_devices/mpu6050/mpu6050.c
  • components/core/crazyflie/modules/src/estimator_complementary.c

Open components/core/crazyflie/modules/src/log.c and add new log variables (e.g., acc_x, gyro_y, height).

Register these variables in the logInit() function.

  1. Compile and flash the code
  2. Power on, connect to smartphone APP
  3. Enter the “Log” page, select the data variables to view
  4. Click “Start Log”
  5. Move the drone and observe changes in sensor data
  1. Export log data to computer
  2. Use Excel or Python for analysis
  3. Plot curves of acceleration, angular velocity, and altitude over time
  4. Analyze the drone’s motion state
  • Check I2C connections
  • Confirm sensor address is correct
  • Check Wi-Fi connection
  • Confirm log variables are registered

Congratulations! You have mastered the methods of reading and analyzing sensor data, which is an important skill for drone development!

In the next project, you will learn how to use ultrasonic sensors for obstacle avoidance.