MPU6050 + Arduino for CPR
I need vertical up–down depth (5 cm target), no rotation.
How to do gravity removal + ZUPT and ignore tilt? Any code/tips? 🙏
4 Replies
you can remove gravity by subtracting 9.8 from the positive z axis, and mpu6050 has a built in gyroscope, so you can use that to find out the angle and then use trigonometry to calculate the depth
i try and is not working
this my code
Maybe there are something I didnt notice
help please
Hi,
you can never be sure, if the sensor is always perpendicular to gravity. I would do sth like this:
1) filter all three acc values (e.g. new_val = 0.8old_val + 0.2measured_val)
2) build the norm (sqrt(acc_x²+acc_y²+acc_z²)
3) subtract the 9.81 or the correct offset, that the imu measures when in rest) from that