I am on a project which nearly completed. But what remains is balancing. My project is making a quadcopter. All the programing and hardware stuff is completed. But when i fly it, it doesnt goes up, it goes to a side so i just take it down again. I tried different balancing tecniques, using mpu6050. The procedure for balancing i use is; Find the accelerometer values from mpu6050. If lets say ax is less than 0 then speed up one side motor and slow down other motor, and similarly other. But that doesnt work, Please show me how can i balancing it, because that methods are not working for me. And if i am off topic please point me where to ask this question.
closed as too broad by Chris Stratton, RoyC, Voltage Spike, PeterJ, Finbarr Apr 11 '18 at 12:33
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
I suggest you to look at Automatics and PID regulation. Your approach is not wrong, but you're missing a LOT. For instance, how do you know but what amount you should change the speed of your motors to compensate the tilt angle ? How do you make it go to a stable position in a smooth motion ? How do you optimize the time to get to a stable position ? All these questions can be answered by learning about automatics.
If you look at this scheme, consider the Setpoint as your reference-level and Output as your quad-level. Setpoint - Output = Error (ie. the angle between your quad-level and the ref-level).
Now the P gain is going to multiply your error in order to send a correction-command proportional to the error.
The I gain is going to integrate the error. Integral are sums, this terms kicks in when the error is so small that the P gain can't really do anything about it.
The D gain will multiply the derivative of your error, it will basically smooth your output command (DO NOT confuse with Output, the quad-level)
By the way, when you say 'ax' do you mean the raw value you read on the 'x-axis' of your mpu6050 ? Because that's not your reference.
You should find most of your answers by looking at the multiwii code.