YMFC-AL quadcopter , bumped start. Damaged one propeller

Started by Suvnkr, August 11, 2019, 09:40:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Suvnkr

Hello guys,
     Hope y'all doing well. I am building a quadcopter. Since I am new to the programming and circuitry I am following YMFC-AL and his programs. It is quite easy to understand. But anyway I came across this serious problem with the bumped start.

According to Brokking's procedure, my all tests, calibrations go well.
like the receiver, signals check out, gyro checks out. Furthermore while ESC's calibration, they calibrate successfully. Also after calibration, with "ESC calibration" program inside Arduino all motors run at equal speed when I gradually increase throttle. Until this everything works just fine.

But after uploading flight controller program, it gets worse right at the beginning.
1) I connect the battery upon which everything calibrates, and it waits for receiver signal to start.
2) When I start it (Throttle low and yaw left then throttle center and yaw center) all motors start at the same speed except one motor at pin 6 (PORTD |= B11110000) keeps on increasing to double the speed of other motors even if the throttle is at low and results into bumping of the copter. I lost one propeller due to that.
Here is the copter startup piece of code for reference:

//For starting the motors: throttle low and yaw left (step 1).
if(receiver_input_channel_3 < 1050 && receiver_input_channel_4 < 1050)start = 1;
//When yaw stick is back in the center position start the motors (step 2).
if(start == 1 && receiver_input_channel_3 < 1050 && receiver_input_channel_4 > 1450){
   start = 2;
'
'
'
throttle = receiver_input_channel_3;                                      //We need the throttle signal as a base signal.

if (start == 2){                                                          //The motors are started.
   if (throttle > 1400) throttle = 1400;                                   //We need some room to keep full control at full throttle.
   esc_1 = throttle - pid_output_pitch + pid_output_roll - pid_output_yaw; //Calculate the pulse for esc 1 (front-right - CCW)
   esc_2 = throttle + pid_output_pitch + pid_output_roll + pid_output_yaw; //Calculate the pulse for esc 2 (rear-right - CW)
   esc_3 = throttle + pid_output_pitch - pid_output_roll - pid_output_yaw; //Calculate the pulse for esc 3 (rear-left - CCW)
   esc_4 = throttle - pid_output_pitch - pid_output_roll + pid_output_yaw; //Calculate the pulse for esc 4 (front-left - CW)

   if (battery_voltage < 1240 && battery_voltage > 800){                   //Is the battery connected?
     esc_1 += esc_1 * ((1240 - battery_voltage)/(float)3500);              //Compensate the esc-1 pulse for voltage drop.
     esc_2 += esc_2 * ((1240 - battery_voltage)/(float)3500);              //Compensate the esc-2 pulse for voltage drop.
     esc_3 += esc_3 * ((1240 - battery_voltage)/(float)3500);              //Compensate the esc-3 pulse for voltage drop.
     esc_4 += esc_4 * ((1240 - battery_voltage)/(float)3500);              //Compensate the esc-4 pulse for voltage drop.
   }

   if (esc_1 < 1100) esc_1 = 1100;                                         //Keep the motors running.
   if (esc_2 < 1100) esc_2 = 1100;                                         //Keep the motors running.
   if (esc_3 < 1100) esc_3 = 1100;                                         //Keep the motors running.
   if (esc_4 < 1100) esc_4 = 1100;                                         //Keep the motors running.

   if(esc_1 > 2000)esc_1 = 2000;                                           //Limit the esc-1 pulse to 2000us.
   if(esc_2 > 2000)esc_2 = 2000;                                           //Limit the esc-2 pulse to 2000us.
   if(esc_3 > 2000)esc_3 = 2000;                                           //Limit the esc-3 pulse to 2000us.
   if(esc_4 > 2000)esc_4 = 2000;                                           //Limit the esc-4 pulse to 2000us. 
}

else{
   esc_1 = 1000;                                                           //If start is not 2 keep a 1000us pulse for ess-1.
   esc_2 = 1000;                                                           //If start is not 2 keep a 1000us pulse for ess-2.
   esc_3 = 1000;                                                           //If start is not 2 keep a 1000us pulse for ess-3.
   esc_4 = 1000;                                                           //If start is not 2 keep a 1000us pulse for ess-4.
}

About my setup, I am using SimonK ESCs.

I know this is a very long-ass passage, and I apologize for that but I am trying to put here my scenario. I even got many cuts on hands and face due to propellers (10x45).

Please suggest to me what's going on here. Is it the program or escs or something else.

I am attaching every bit of code I used in this project...please look through it suggests what can I do.

Thanks in advance.