It is not uncommon to see people asking about how to balance a quadricopter using MPU-6050. It's also common to see people answering that a PID controller is needed. However, people doesn't say how.

In my case, I've already managed to combine data of accelerometer and gyroscope with a complementary filter. Also, I've already studied about PID in college. What I don't get is:

The input is voltage signal to the motors, the output is quadricopter's tilt angle and the setpoint is 0 (no tilt angle), right? The error operated by the PID is the difference between setpoint and output. So, how will my system know how to operate in the motor in order to make tilt angle closer to zero? I guess I have to implement my own logic to speed up some motors and slow down others, according to the error. But, if I have to do so, I don't see why PID is necessary. If I haven't, I don't get how motor is balanced according to the error. Could someone clarify how PID could work or share another solutions?

• PID is a complex mix of software tuned to match the inertia/torque/rotation/position on all 3 axis of mechanical hardware. We can try to help you, but altogether this is a broad topic involving many skills and math. We will point to links to help you as we find them. Show us some diagrams and we will put more effort into helping you. NOTE: This maybe rejected as being to broad and complex a project for us to spend much time on it.
– user105652
Jul 10, 2016 at 2:59
• You've got things a bit mixed up. The input to your PID is the signal from your MPU-6050, the output from your PID is the control voltage to your motors. Jul 10, 2016 at 3:00
• Consider doing some reading on practical implementation of control systems, including PID-type ones. Jul 10, 2016 at 4:25
• But am I gonna have 1 PID for each motor? Jul 10, 2016 at 18:01
• I have done some research and this is too complex a project for a beginner. Heck, it would take a ATE expert a year to complete a basic version. VTC due to the amount of hardware expertise and software needed. It is much more than PID loops and motors. It is at least a uKernel with lots of sub-routines.
– user105652
Jul 10, 2016 at 22:51