This demo estimates roll and pitch angles in software without using a DMP.
Estimate roll and pitch using the very famous Kalman Filter.
Since the MPU6050 does not have a magnetic sensor, yaw cannot be estimated.
I used this Kalman Filter by TKJ Electronics.
I used this as a reference.
MPU6000/6050/6500/6555 6DoF MotionTracking device.
They have an internal processing function called DMP (Digital Motion Processor).
But this sample doesn't use DMP, just 6DoF data.
cd esp-idf-mpu6050-dmp/MPU6050_KALMAN
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
idf.py menuconfig
idf.py flash
ESP32 acts as a web server.
I used this component.
This component can communicate directly with the browser.
Enter the following in the address bar of your web browser.
http:://{IP of ESP32}/
or
http://esp32.local/
You can view Euler angles using this tool.
It works as a UDP display server.
This is a great application.
------------- ------------- -------------
| IMU | i2c | ESP32 | UDP | pyteapot.py |
| |---->| |---->| |
| | | | | |
------------- ------------- -------------
$ sudo apt install python3-pip python3-setuptools
$ python3 -m pip install -U pip
$ python3 -m pip install pygame
$ python3 -m pip install PyOpenGL PyOpenGL_accelerate
$ git clone https://github.com/thecountoftuscany/PyTeapot-Quaternion-Euler-cube-rotation
$ cd PyTeapot-Quaternion-Euler-cube-rotation
$ python3 pyteapot.py
The posture of your sensor is displayed.
Value after 10 minutes at rest.
- When using DMP
I (600093) IMU: roll:-0.035195 pitch:0.062826 yaw:-0.405707
I (600193) IMU: roll:-0.035195 pitch:0.062826 yaw:-0.405707
- When using Kalman Filter
I (600117) IMU: roll:-0.028039 pitch=-0.056162
I (600237) IMU: roll:-0.028626 pitch=-0.027323