The quadcopter part 1 : genesis of the project

When I was a student in my engineering school, we decided to build a drone. The project was abandonned after about one year, more or less because members of the robotic team didn't succeed to stabilize the drone. So with my bored engineer friend , we decided to give a second chance to this project. We took what the students made, which basically looks like this:

The very first version of the quadrotor.

After a few tries, it turned out that the power of the 4 motors wasn't enough for the drone to fly. So, we decided to make another frame, using light materials: carbon tubes and balsa (it's a very light wood used by modelists for their aircrafts). The verdict was straightforward : old frame's weight : 350g, new one : 70g. Only half of the power was enough to make it fly.

The quadcopter V1, and its effective and beautifull landing site

We had here a nice frame to start our experiments. The first version came with an accelerometer and a gyroscope that we decided to keep. We also decided to use an Arduino because it's really easy to use, and there is out there a massive list of existing libraries. Implementing a PID controller, and gathering the commands of a 4 channels radio-emmiter, we were able to make it slighly steady. So this is how it worked. The 2 sensors (accel and gyro) are constantly read by the Arduino, which compute the angle of the 3 orientations of the drone. Why using a combination of a accelerometer and a gyroscope ? Because the accelerometer is nice for a static use of the drone (i.e. it flies at a constant speed), but as soon as it start to move, the accelerometer can't be used. The gyroscope gives us an angular velocity, which means that we have to integrate the value to retrieve the angle. The wrong part is that, due to the integration, the obtained angle will slowly drift. We compensate with a negative term in our equations, which is found experimentaly.

 

Basically :

angle = k*angle_{accelero} + (k-1)*angle_{gyro}

Where, if the ADXL gives us a value between 0 and 1g:

 angle_{accelero}(deg) = \frac{180}{\pi}*\arcsin{ADXL_{value}}

And if the gyroscope gives us a value in ° per second, and d the drift value.

 angle_{gyro} (deg) = \int_{0}^{s} L3G4200D_{value}\, \mathrm dt-d

Then, we use a PID to control each of the drone axis :

 order=k_p*angle+k_i* \int_{0}^{s} {angle}\, \mathrm dt +k_d*\frac{\mathrm{angle}}{\mathrm t}

Now come the hardest part of that chemistry : find out k_p,k_i and k_d; which can bring the drone to destruction (actually, it did).

The tiny ADXL345 accelerometer and the L3G4200D gyroscope

But still, there is a lot of work there before this drone can fly on its own. We are currently working on a frame v2, which will be the object of a soon-coming article.

8 thoughts on “The quadcopter part 1 : genesis of the project

      1. Thank you dear. I appreciate your help.
        You replied to my comment two years after I posted it. I am now replying to your reply more than one year after you posted it.
        It's good we are still alive hahaha.

  1. Hi,

    Would you guys mind discussing how you tuned the PID controller for the quad? I've been trying to find adequate gain constants for my own Arduino quad but nothing has worked quite yet.

    Thanks so much, I'm a big fan of guys' work!!!

  2. After looking at the code of some other Arduino quads, I notice that they use two different PID controllers per axis, one to control the rate (dominated by the gyro readings) and one to control the position (which uses the output of the rate PID loop). Is this the approach that your quad used as well?

    1. Hi, and thanks for your comment!
      No we only used a single PID, which turned out to be satisfying in most cases. If you want a different flying behavior (such as needed for acrobatics, then you need this type of double PIDs)

  3. Could you talk about how you guys tested the quad to find the PID gains? That would be really helpful to me; otherwise, great work guys!

    1. Hi Harrison,

      We first started by increasing slowly the P gain until the quad would try to correct the angle, then we increased the D gain to stabilize it. It is actually pretty simple to get something stabilizing itself, but it's much harder to get the perfect tuning ! 😀

      Good luck 😉

Leave a Reply

Your email address will not be published. Required fields are marked *