1

I stream ax,ay,az from sensor mpu6050 to calculate the angle as this equation:

ax = data_mpu["ax"]
ay = data_mpu["ay"]
az = data_mpu["az"]

phi   = np.arctan2(ay,az) * 180/np.pi 
theta = np.arctan2(ax,az) * 180/np.pi 
psi   = np.arctan2(ay,ax) * 180/np.pi 

But it seem like if any axis get the orientation parallel with the gravity, i can not calculate angle of sensor rotate around that axis correctly. Is that true, Anybody get the same problem? Can anyone help me :(

Loc
  • 13
  • 2
  • 1
    Without gravity you, you'd get zero on all axes of a stationary accelerometer. Gravity is exactly what you are measuring. When one axis is parallel with G, then the entire vector G is represented in that vector and the other two perpendicular to G will be zero. If you rotate about the G axis, that motion will not be detected. For that you'd need to combine the accelerometers with the gyroscopes which the MPU6050 also has. – Clifford May 26 '21 at 15:25
  • However this is not as it stands a question about your code - including code in the question does not make it so. As such it is off topic, and probably an X-Y question. Perhaps you should specify what you want the sensor to tell you and ask how to code that? Note that the MPU6050 has an on board DSP that can do do all the complex sensor fusion for you. The documentation is hard to come by though and the part is obsolete. – Clifford May 26 '21 at 15:42
  • The eMD code that supports the DMP can be found at https://invensense.tdk.com/developers/software-downloads/ – Clifford May 26 '21 at 15:55
  • Thank you for your answer, i get the problem, i just wanna make sure i am not the only person get this :). i stream value reading from sensor via esp8266 and using python to handle the next part. i think in some specific application we can expand the ability of mpu60250 by mechanics. Glad and thank you. – Loc May 27 '21 at 03:48
  • 1
    The only person subject to physics? I doubt it. The issue is that it is a 6 axis sensor and you are only using three axes. – Clifford May 27 '21 at 06:11

0 Answers0