Hi there. Im currently designing Autonomous Quadrotor as my final project at school. Everything was good so far until trying to find PID parameters.
      I have a question and some concerns about suppyling power from Li Po's. As you know brushless motors can supply different thrusts on different voltage levels supplied from Li Po's.
For example while using fully charged 12.6V 3S Lipo on 9000rpm with XX brand brushless, it can supply 900gr thrust. On the other hand, everything same but Lipo charged only 11.0V, it may supply like 820gr thrust. Therefore, because of different voltage conditions PID parameters will never match. It will be ok only if I have a voltage feedback from LiPo's and then change PID parameters for each voltage level. Adding voltage feedback on the control algorithm will solve the problem i guess.
     The question is anybody use this approach, or power distribution board have something like that included in it or any other solution on that ?  And I was wondering can i connect 2 same Li Po's as parallel to a power ring and supply all ESC's from there.

Any help will be greatly appreciated, thanks. Sorry if similar subject has already been discussed. Have a nice one...

Config is Arduino USB, Ardu IMU V2, Emax BL 2215/20, 30A ESC's, 3S 11.1V 2200mA 20C LiPo's, hand made plexi glass frame.

Views: 245

Reply to This

Replies to This Discussion

i parallel two 3s 11.1v 2200 mah
got 15 min with fpv gear on it .. under powered as well ..

now im trying something new cuz its rough to get help sometimes ..
Thanks 420choky. And come on guys no idea at all ? Today i had some test on my brushless motors. With 12.5V battery and 172 pwm value i have measured a thrust value of 965gr. With 11.2V battery and same 172 pwm value thrust value was 870gr. Now Im definately sure that i need to include a feedback from battery in my PID algrorithm. Anybody do that or try ? Help please...
Faik, Let's take the throttle stick as reference. During flight you will notice that your hovering point will change as your battery voltage is lowering. You will need to up your throttle stick a bit more as you have less voltage to deliver. This is a fact.

But your PID should NOT be voltage dependent, due you need to stabilize from lower to hi throttle.
PID is based on a desired state, a feedback of your real state and the correction. So, changing the speed you should just reach the set-point fast or not so fast (if slow, you will crash).

So, what is the key? Well... you cannot work at limit of speed, your frame needs to be light sufficient to give you a great margin. You need to have a good thrust around mid point on throttle. By the same reason, your motors will work better if they have lower KV.

If your hardware don't give you that great margin, when your battery lost a little bit of charge... it will have NO extra power to do the corrections or even for sustain the frame weight.
Hmm thanks for your answer Sandro. I appreciate it. First of all my quad is autonomous so i dont have any transmitter or throttle to control it right now. Im working on hovering then it will be like take off go left or right then land. GPS will added for tracking etc. Thats not the point.

For height control i have ultrasonic sensor its working fine. Increasing / decreasing motors pwm's as a reference of height weather the batteries are fully charged or not. So no problem with that.

For the frame and motors, i have changed it all. Motor thrust werent enough before but now it takes off like 140 pwm value (motors start runnin at 106 and max torque is at 215) No problem with these too.

The thing im still not sure is PID parameters. I can find PID parameters for the case batteries fully charged. When batteries are a little low these values may not be enough and system might be unstable. If i use large PID values, at low voltage it will work, but somehow this time these values can make my quad oscillate or unstable at fully charged battery case.

Since the all systems are working on dynamic conditions, there sould be dynamic, kinda adaptive control variables to do that right. I guess i got to work on that a little more. Thanks...
You should have problems on your algorithm. It's really not a simple thing.
Based on your hardware, you probably will find all your answers here.
You can open the code and take a look.

Jose Julio is our master-plus-mega-power coder at ArduCopter team. He is such a god on this subject.

Just a side comment. Usually, to achieve auto navigation you need to fly it nicely by hand first.

Good look!
Yes, any fixed pulse width to the ESC will result in reduced thrust as battery voltage falls. The point of the control algorithm is to compare the set state (input) and the actual state. But you don't put a PID control on the pulse width. That is silly -- the generated pulse width had better be what you tell the micro to output or you've got far bigger problems.

The states you are comparing are x,y,z position (possibly velocity, possibly acceleration/roll rate) not pulse width to the ESC. If you tell the copter to go to 3m altitude, and the batteries weaken and thus the copter settles to 2.9 m, there will be an altitude error. The altitude error (-.1m) is multiplied by the PID gains and more power is added. The copter rises. Problem solved. Until battery voltage at 100% throttle does not provide thrust = weight.
I had a look at Jose Julios code, its way different than mine. Now I think i have something wrong with my approach or code. First of all I use Arduino Duemilanove and Ardu IMU V2 connected to it. Ardu IMU has a code version 1.7 running in it. I get IMU orientation from IMU with the code running in Duemilanove. Here it is

int imu_read() // function for imu reading

byte buffer[100];
unsigned int newData = 0;
byte IMU_cksum_a=0; // checksums defined
byte IMU_cksum_b=0;
int i = 0;
newData = 0;

if(Serial.available() > 0)
buffer[0] = Serial.read();
if(buffer[0] == 'D') // first preample check
wait_for_byte(3); //
buffer[1] = Serial.read(); //preample checks
buffer[2] = Serial.read();
buffer[3] = Serial.read();
newData = 0;

if(buffer[1] == 'I')
if(buffer[2] == 'Y')
if(buffer[3] =='d')
newData = 1;
wait_for_byte(10); // Get Data

buffer[4] = Serial.read(); //Message Length 0x06
buffer[5] = Serial.read(); //Message ID 0x02
buffer[6] = Serial.read(); //Roll low
buffer[7] = Serial.read(); //Roll high
buffer[8] = Serial.read(); //Pitch low
buffer[9] = Serial.read(); //Pitch high
buffer[10] = Serial.read(); //Yaw low
buffer[11] = Serial.read(); //Yaw high
buffer[12] = Serial.read(); //cksum_a
buffer[13] = Serial.read(); //cksum_b
if(newData == 1)
for (i=4;i<=11;i++)
IMU_cksum_a+=buffer[i]; //Calculates checksums


if (IMU_cksum_a == buffer[12] && IMU_cksum_b == buffer[13])
//Passed the Checksum
pitch=word(buffer[9],buffer[8]); // word(high,low);
pitch/=100; // return pitch 1 degree resolution
// Serial.println(pitch,DEC);

roll=word(buffer[7],buffer[6]); // word(high,low);
// Serial.println(roll,DEC);

yaw=word(buffer[11],buffer[10]); // word(high,low);
// Serial.println(yaw,DEC);
return pitch;
return roll;
return yaw;

void wait_for_byte(byte number) // function for new coming byte
while(Serial.available() < number);

Using this code i read IMU orientation outputs (pitch, roll, yaw), to use them in control part.
Later on i have PID's for each pitch, roll, yaw. One of them is like;

int myPID_1()
double integ, deriv;
long pr_time, error, pr_error, input_1;
double dt = 0.02; // PID sampling rate is fixed and 20ms because of Ultrasonic in system
// have delay(20) in main loop.
float Kp = 5, Ki = 0.5, Kd = 0; // Enter PID parameters
long setpoint = 0; // Enter setpoint
imu_read(); // Calling imu orientation values calculated by IMU and read by Duemilanove
input_1 = pitch; // Use pitch as input

error = setpoint - input_1;
integ = integ + (error * dt);
deriv = (error - pr_error) / dt;
output_1 = long( (Kp * error) + (Ki * integ) + (Kd * deriv) );
pr_error = error;

return output_1;

In main loop i call pitch, roll and ultrasonic PID's and create outputs for Motors.

Here it is
delay(20); // pid sample rate delay

HOVER = 150; // Another pid called to find hover mode pwm value using ultrasonic rangefinder
myPID_1(); // pitch pid
pwmc_front = (HOVER) + (0.1 * output_1);
pwmc_rear = (HOVER) - (0.1 * output_1);

myPID_2(); // roll pid
pwmc_2 = (HOVER) - (0.1 * output_2);
pwmc_4 = (HOVER) + (0.1 * output_2)

So in Joses code he runs all the algorith in Ardu IMU, but i read from it and run the main code in Duemilanove as it is above. I didnt even change IMU algorithm running in IMU a little bit, version 1.7 running in it. Just did user configurations.

So how do i need to change my approach or codes ? Any recommandations ? Thanks...

The mass and center of gravity of the system do not change and that is the largest factor in the PID settings. If you were burning off fuel and the fuel tank was not near the center of gravity you could change PID settings.

The PID error system doesn't care if you are changing throttle position or losing battery charge. It reacts to the change in error.

At 100% throttle the available power will drop along with the voltage. At less than 100% power the battery state cannot be detected. If you correcting for altitude there could be a higher power setting required at low battery charge but the error system only looks at the differential and corrects. At the point where you would notice a degradation in system performance you would need to land anyway.

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service