MPU6050s are configurable accelerometers and gyroscopes. So you are capable to measure acceleration, rotation speed, and temperature. The gravity is added to the acceleration. From these data, the current angle of MPU6050 is calculated in degrees. You can set sensor ranges too. Bigger ranges imply less quality in measurements while smaller ranges make the quality better. You can store a high variety of measured data to instantly react or later analyze them.
After studying the characteristics of both gyro and accelerometer, we know that they have their own strengths and weaknesses. The calculated tilt angle from the accelerometer data has slow response time, while the integrated tilt angle from the gyro data is subject to drift over a period of time. In other words, we can say that the accelerometer data is useful for the long term while the gyro data is useful for short
The idea behind the complementary filter is to take slow-moving signals from the accelerometer and fast-moving signals from a gyroscope and combine them.
The complementary filter is designed in such a way that the strength of one sensor will be used to overcome the weakness of the other sensor which is complementary to each other.
Accelerometer gives a good indicator of orientation in static conditions. Gyroscope gives a good indicator of tilt in dynamic conditions. So the idea is to pass the accelerometer signals through a low-pass filter and the gyroscope signals through a high-pass filter and combine them to give the final rate.
The key point here is that the frequency response of the low-pass and high-pass filters add up to 1 at all frequencies. This means that at any given time the complete signal is subject to either low pass or high pass.