Drone Flight Control Issues

I have been working on an Arduino based drone for some time now. I am using small brushed motors, connected to a larger gear that connects to the propeller. I have a MOSFET connected to each motor, and control the motor speed with PWM. The gyro is a MPU-6050 that uses the I2Cdev example code to get back data on the orientation. Now that everything works mechanically, I have started to attempt to get a steady flight with the drone by using PID. But for the past few weeks I have not gotten the drone to fly for more than a few seconds before crashing to the ground erratically.

After much trouble, I decided to go back to the assembly of the drone and make sure it was getting the best possible data for the PID to react to.

To see if vibrations could be causing bad gyro values, I flipped the propellers upside down and run the motors at power while the drone was on the ground. In the Serial Plotter I saw that the gyro had variations of about +-2 degrees from the zero point. Is this to much? And should I consider adding vibrations dampeners to the PCB?

The center of gravity of the drone is almost center, but I will be adding a part that improves battery position to make sure the center of gravity is near perfect.

I also have the arduino loop running at about 15 Hz. Is that enough for the PID to be reacting correctly? Or should I get rid of all the unnecessary delays and have it running near 30 Hz?

Another question I had is what are some good starting PID values that should at least get the drone flying.

I was wondering if the community has any advice for PID tuning, PID starting values, and any other quad copter necessity I may be forgetting to give myself an easier time getting the drone off the ground. Thanks!!

mschindl:
I have been working on an Arduino based drone for some time now. I am using small brushed motors, connected to a larger gear that connects to the propeller. I have a MOSFET connected to each motor, and control the motor speed with PWM.

I'm assuming these motors are DC and not induction motors?

mschindl:
In the Serial Plotter I saw that the gyro had variations of about +-2 degrees from the zero point. Is this to much? And should I consider adding vibrations dampeners to the PCB?

I don't think you need to worry about that. Others may disagree.

mschindl:
I also have the arduino loop running at about 15 Hz. Is that enough for the PID to be reacting correctly? Or should I get rid of all the unnecessary delays and have it running near 30 Hz?

15Hz is pretty slow IMHO. Doable, but slow. You should always strive for speed and efficiency with embedded projects, especially for systems that fly.

mschindl:
I was wondering if the community has any advice for PID tuning, PID starting values, and any other quad copter necessity I may be forgetting to give myself an easier time getting the drone off the ground.

The general gist of PID tuning is to do the following:
1.) Set P=1, I=0, D=0
2.) Increase P until you get oscillations (but not unstable oscillations)
3.) Increase D until oscillations dampen out
4.) Increase I until offset disappears

PID tuning is generally guess and check.

Maybe if you posted your code we could be of more help.

Yes, there are DC motors. And thanks for the advice! I could be wrong, but what I have seen from others on the internet, it seems like PID can have a relatively wide range of values and still have flight, even if there are oscillations. My drone on the other and, it seems like I have tested a great many different values, but never get a flight longer than a few seconds.

Is there anything else that I a forgetting about drone assembly that can make the drone fly erratically?

When the drone comes crashing down, WHAT changed? Were you hovering, or starting to move? What inputs were altered before things go wrong?

Pics?

Hi
Now there's your problem.

I am using small brushed motors, connected to a larger gear that connects to the propeller.

The reason that copters use BLDCmotors is because the controller has COMPLETE control over Acceleration and DECELERATION of the motor.

With just DC brushed motor and simple PWM MOSFET control you only have control of Acceleration, to decelerate you are WAITING for the motor to slow due to its rotational intertia.
To complicate this, you are gearing the system up to get blade speed which increases the amount of spinning hardware.

BLDC controllers are also able to control the large amounts of instantaneous current need to get the BLDC motor to respond as quickly as an autonomous system requires.

You don't say how "small" your motors are but they need to be powerful enough to respond to speed changes signaled from the controller.

As previously requested can you post some pictures?

Tom.... :slight_smile:

Hi,
I presume it is a follow on from this;

https://forum.arduino.cc/index.php?topic=456725.0

My blood caffeine level must have been low then ...
DC brush motors and drone.... :o :o :o

Tom... :o

The code right now tells the drone to do nothing. The set point for PID is always zero, and the only thing I control is the power of the motors to raise it up and down. I have attached pictures below of the drone setup. The motors, gears, and propellers were taken off a Syma drone that flew pretty well. I just hooked them up to MOSFET's and controlled the speed with PWM.

Hi,
Can you post your code and a circuit diagram to bring us up to speed in this thread.

Thanks.. Tom.. :slight_smile:

I would think that you would want some type of digital filter on the gyro to avoid oscillations and noise from motor vibration.

Have you uploaded the multiwii program and tested the hardware ? Or is the point to write your own control software?

Those type of motors and props have so much air resistance compared to their mass that active braking would do very little. They lose speed very fast.

Do you have flyback diodes across the motor?

Hi,

I am worried about the thickness of the four supporting arms being a bit too thick, turbulence and lose of lift.

Tom... :slight_smile:

mschindl:
The code right now tells the drone to do nothing. The set point for PID is always zero, and the only thing I control is the power of the motors to raise it up and down.

HOLD. THE. BUS.
Am I interpreting this correctly? You have no active stabilization?
That being the case, I would expect the quad to flip over almost immediately upon takeoff. Is that what you experience?

I have attached pictures below of the drone setup. The motors, gears, and propellers were taken off a Syma drone that flew pretty well. I just hooked them up to MOSFET's and controlled the speed with PWM.

If you are taking off, then you are in the right ballpark.

Weigh the original Syma airframe and then weigh yours. Are you close?

The PID controller is the stabalizer. PID right now is set to keep the drone at 0 degrees roll and 0 degrees pitch. AKA completely flat. There is the base power of the motors (controlled by the remote control), and the PID controller (which is calculated by the code). These two values are added together to get the total power.

Im just trying to figure out why I'm having such a hard trouble finding working PID coefficients, when the trials online that I've seen make the process look relatively simply.

After looking at the code multiple times I'm thinking that maybe the problem lies with the MPU not giving accurate values while in flight. Causing the issues. The drone has no issue getting off the ground. Is starts to lift at only a PWM value of about 60.

Any way to get either serial data or sd data from it? Tie it down with a short leash so it can get off the ground and tilt, but not enough that rotors can hit the dirt.

Whew! I was afraid you were expecting dynamic stability. Sorry for the panic.
I am still interested in weight measurements but more for my own curiosity.

With my drones (all commercial) I test for expected performance after a crash by throttling up to hover speed(60 in your case) while holding the quad firmly in my hand.
Then I force pitch, then roll, then yaw deviations by twisting the quad in one direction or another.
You can hear and see the props change RPM in response, attempting to bring the frame back to flat.

Can you try that?

Hi,
Please read post #8.

How have you got your PIDs, configured in the x and y direction.

If you hold your drone with the motors running and level, if you tilt down the drone towards one one motor, that motor should speed up and the opposite slow down to try and bring the drone level.

To set it up you don't need to fly, in fact you can debug using the serial programming cable.

Tom... :slight_smile:

I have tried turning in my hand to see how it reacts, the problem with that is that I don't know how much force it should be trying to correct with?

This is the first "drone" I've really had. So I don't know if the correcting force is to much or to little. Or how much is D suppose to be dampibung the speed of rotation.

As a start, it's not HOW much it reacts when you tilt, but that it DOES react in the correct direction. No use trying to figure how much faster to spin a motor if it's the wrong one.