Building A Quadcopter! – Part 5 – PID problems

Posted: February 11, 2014 in Hard Projects, Projects, Quadcopter
Tags: , , , , , ,

Quadcopter Problems, circuit boards, and where to go from here? That is the topic for today’s post.

First off, hello again after the long break! To get down to business though, this quadcopter project has been holding me back on many project things. For the model railroad enthusiasts, I’ve worked more on the layout, and have two buildings so far. I’ll get to them soon as I can in the coming weeks.

So the title is, PID problems. This has been the focus of the problems from the quadcopter, for the last few months. It isn’t the only cause, but seemingly is the only thing keeping the quad from leaving the ground.

What is PID? Well, to put it simply, it means Proportional-Integral-Derivative. This is used in many control systems for electrical circuits. You’re A/C controller on the wall probably has a PID controller. Your fridge/freezer has a PID controller. Same goes for your car and other various electronics. In short, a PID takes an error and compares it to a set point (i.e., your thermostat is set at 70 degrees F). If the error is too low or too high, it adjusts the output of the controller to bring the error to zero.

If you’re confused by this, here’s a simple example. When you’re driving, you normally have to correct for error to stay in a lane of traffic. Sources of error include wind, tires, steering, road, etc. You can change the set point also, by moving to a different lane of traffic or turning onto another road. That is the concept of PID controllers.

I won’t go into any more detail about the PID controller, but here’s the wiki: [ link ].

Now, the quadcopter isn’t a car, but the principals remain the same. If the craft starts tilting in one direction (from level), adjust the motors to level the quadcopter. In writing, it sounds simple, but applying it is another story.

 photo IMG_0726.jpg

Original Setup: DA’ QCB V1

     The above photo shows the original plan I came up with the quad controller. Nicknamed: “DA QCB”, it stands for DragonAir Quadrotor Controller Board. This board was based on the MPU-6050 IMU, which contains an accelerometer and gyroscope. Why do I need both? An accelerometer can show angles in rate of change (think of a smartphone), but is prone to vibrations (notice the delay sometimes it takes to rotate a smartphone’s screen). A gyro will measure rotation (in degrees) on a axis, but is prone to drifting ( you start at x=0, fly a little, and x now equals 5). By combining rate of chance with rotational angle on a axis, you can get stable x,y,z coordnances for the quadcopter. There are various was to combine these values, such as Kalman and IIR filters, as well as quaternion. I got lucky and found some code online to process the quaternion, as [ the math can get complicated ]. Here’s a link to some possible code implementation too: [ link ].

After multiple test runs of the quadcopter, with no success, I decided that I was still having problems with vibrations. Thus, enters v2 of DA’ QCB:

 photo IMG_0727.jpg

Experimental Setup: DA’ QCB V2

     After struggling with the MPU-6050, I discovered the device is prone to vibrations ( go figure). I decided to get a separate gyro and accelerometer, the [ ADXL 345 and IMU3000 ], which are very popular, commonly used chips. I then redesigned the board to fit the new chips, as well as made a more reliable angle indicator with LEDs. I also decided to make everything labeled, and made the board into a ‘semi’ Arduino shield.

     After a little redoing of the code, testing commenced again. And guess what? Little success. Big surprise there (sarcasm). At one point, I was able to get it to hover for about 2 seconds, but was never able to recreate the same conditions for that again.

 photo IMG_0725.jpg

Current Setup: KK2.1 Control Board (left ) and Turnigy Radio Receiver (right) 

     After much trouble with the previous two custom controllers, I decided to do a sanity check and purchased a known-to-work controller board. It also contains the MPU-6050, which I know is prone to vibrations, so even though it is known to work, I’m still a little skeptical. This system is the setup in the above photo “Current Setup”.  After going through guides on testing and then going through the system’s menus, I applied throttle to make the quadcopter lift.

     And it fell over. Again.

     More adjustments, falls again. Repeat many times. After changing every possible number in the system, I still can’t get the quadcopter to fly. I’m now officially stuck on the project.

Possible problems I could be dealing with:

– Weight distribution: Although checked multiple problems, I’m still not 100% sure the weight is evenly distributed. This is mostly due to the frame design of the craft.

– Motors: I bought $7 Chinese motors. That’s enough information to leave the imagination to you.

– Frame: The frame is known to vibrate. Even with the other IMU not showing vibration problems, there could be some inherent vibrations that are affecting the PID controller

– Code: When I got the KK2.1 board, I noticed there were a lot of code problems that I had in my custom controller. I’m currently fixing those errors.

     I do have one last idea, before putting the project on the shelf. And I’ll let you know soon!

     Stay tuned, since I can’t really work on the quadcopter now, I think I might be able to get some of these small projects I’ve been putting off done finally!

Till next time,

Eastern FireTail

  1. […] Building A Quadcopter! – Part 5 – PID problems […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s