Hi! I am currently working on a project that requires me to calculate the angle that the object is currently in. I am using a MPU-6050 which has a 3 axis accelerometer and 3 axis gyroscope built in. At first I thought that I could use the accelerometer to measure angles, but after a bit of research I found out that accelerometer readings can become inaccurate when exposed to g-forces and vibrations. Unfortunately for me, this chip will be implanted on a quadcopter which will have both. My goal is to get an accurate angle of my quadcopter while it is flying.

I have done a lot of reasearch and found out two main ways of accomplishing my goal is by using a Kalman filter or a Complementary filter. I decided to go with the Complementary filter since I had trouble understanding how the Kalman filter works. I am using the following formula for the Complementary filter.

**Filtered Angle = ? × (Gyroscope Angle) + (1 ? ?) × (Accelerometer Angle) where ? = ?/(? + ?t) and (Gyroscope Angle) = (Last Measured Filtered Angle) + ?×?t (got this from http://www.geekmomprojects.com/gyroscopes-and-accelerometers-on-a-chip/)**

I was confused what they wanted me to put in for the variable "a" so I decided to put .96, the same number that the writer of the article used. I ran my code and found that the results were even more inaccurate than using the accelerometer alone. I tried researching why this is happening but I was unable to find anything usefull. I was hoping that someone might be able to help me with this problem. I don't know if this helps but I only need to get the pitch and roll. I do not not need to find the yaw.