Driver for MPU6050 IMU Sensor, and Pose Estimation with Kalman Filter
MPU6050 is a low-cost IMU sensor, which provides 3-axis acceleration and 3-axis angular velocity measurements (6 DOF in total). This sensor is really handy when it comes to implementing things like wearable devices and drones. I got an evaluation module of this sensor, and decided to build a very simple interface for it using a 8-bit MCU. Source code is available at https://github.com/YifanJiangPolyU/MPU6050
A video showing how it works:
MPU6050 has build-in ADC and is capable of outputting readings digitally via a I2C interface. In this interface, a Arduino Nano, which has a 8MHz 8-bit MCU, is used as the I2C master. The Arduino reads measurements from MPU6050 cyclically, and estimates the pose of the sensor, represented as Euler angles, using a Kalman filter.
The estimated Euler angles are then transmitted to the PC via serial port (i.e. UART). On the PC side, a python script reads the pose data and visualizes it in real time.
The current implementation has a number of problems, but improvements are also easy to implement.
- The 8-bit MCU is not powerful enough to execute pose estimation.
- Delay is sever, because of inadequate processing power of the MCU.
- Communication protocol between Arduino and PC is too primitive. Better protocol can be used to enable data integrity checking and miss data detection.
- The data acquisition and the Kalman filter run in an infinite loop in
main()
. A better way would be to make this interrupt-triggered, for a more deterministic sample time.
Leave a Comment