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
raptor
raptor2mo ago
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
Darawshe123
Darawshe123OP2mo ago
i try and is not working this my code
Darawshe123
Darawshe123OP2mo ago
Maybe there are something I didnt notice help please
enbw
enbw2w ago
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

Did you find this page helpful?