Getting the angle of a rocket using mpu6050

Hello, I am trying to build a thrust vector controlled model rocket, and I am struggling to figure out how to find the angle of the rocket. I am using the MPU6050, and normally to find the angle of the MPU6050 you would fuse the acceleration and the gyro rate to find the angle but as I understand it, that only works while the rocket is stationary. I need to find the angle of the moving rocket so that my code can use a PID controller to correct for the deviation from straight up. Would a magnetometer or other sensor be able to do this easier? Let me know if you have any ideas that can help. :slight_smile: Thanks

You seem to have answered your own question. Remember the angle of the rocket while it is stationary and then all new angles will be in relation to the first angle.

When stationary, use the sensor to measure tilt angles according to this tutorial: How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot

The method does not work when the rocket is accelerating, since the sensor measures all accelerations, including that due to gravity.

Seems the sensor is often used, but not for thrust vectoring the engine.

MPU6050 + Arduino + "rocket" - Search (bing.com)

A three-axis magnetometer would give you angles relative to the local magnetic field.

I dont need the angles of the rocket when it is stationary, I need the angle of the rocket when it is moving, that is the problem.

I dont see how that solves my problem, the angle of the rocket is always going to be relative to the first angle but how do I know what the angle of the rocket is while it is moving?

I'm not very familiar with magnetometers or magnetic fields, does this mean that I could get some sort of angle from the rocket?

Yes.

You cannot use an accelerometer to measure the angle with respect to vertical (as defined by gravity), if the rocket is accelerating.

It is possible to use the gyro to measure a change in angle of flight, but only if the gyro is very carefully calibrated, and only for a short while. The long obsolete MPU6050 may not work well enough to be useful, though.

How would I go about doing this?

I know other people have used the MPU6050 for this same purpose. How would you "carefully calibrate" it?

Most people average several hundred readings on each axis, while the sensor is still, then subtract those offsets before integrating the rates to get angles.

Just a little 3D Vector Math. Before the rocket takes off, calculate the direction of 'North' (from the magnetometers) relative to the direction of gravity (from the accelerometer). After the rocket takes off you can measure the orientation of the rocket relative to 'North' and subtract from that the difference between the orientation of gravity and the orientation of North to get the rocket's orientation relative to gravity.

Keep the magnetometer as far from the motors and high-current wires as you can.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.