Quadcopter with Arduino

Hi everyone,

I am doing a project of quadcopter with Arduino as its controller. I have
a MPU6050,
1400Kv BLDC motors,
S500 Frame,
30A EMAX ESCs,
a 3300mah turnigy lipo battery,
with Arduino Mega 2560.

I have already written my code for it, referring the Arduino sketches available online in github. Also i am using the following libraries:
Servo (for my bldc motors),
MPU6050 ,
PID.
All these libraries were found in the Arduino playground.

I have a lot of questions to ask regarding my project.

  1. Why does my Arduino code stop after some time?
  2. My MPU6050 overflows very frequently(overflows for every 8-10 data got from the MPU).
  3. I am trying to tune my quadcopter for stability in single axis(pitch), but am not able to get the correct values for kp, ki, kd.
    If i increase p gain slowly, the copter gets a constant oscillation(p-gain at about 0.12). But if i continue doing it, i get increasing oscillations eventually. But keeping p-gain(with constant oscillations) and increasing d-gain, the error increases and never settles.

Any help will be greatly appreciated, as i have to finish my project within 2 weeks.

Thanks in advance.

esc_pid_quad_alpha1.ino (6.04 KB)

  1. Why does my Arduino code stop after some time?

What code?

  1. My MPU6050 overflows very frequently(overflows for every 8-10 data got from the MPU).

Poll it faster.

sorry, forgot to attach the arduino sketch, now please have a look

esc_pid_quad_alpha1.ino (6.04 KB)

Maybe your code is spending too long outputting verbose debug info.

True, i have a lot of debug info, but i need as much debug data as needed. But will try it out and lets see, how your advice helps me.

But does any hardware problems, makes the arduino code to stop? like loose contacts, etc.

Can someone help with PID values(kp, ki, kd)?