Droning On: PID Controllers and Bullet Connectors

droning-on-hill Not all drones are multirotors – Posing in our title photo are Maynard Hill and Cyrus Abdollahi. Maynard’s plane, TAM5 aka The Spirit of Butts Farm, is the smallest aircraft to make a transatlantic flight (YouTube link). Retracing the path of Alcock and Brown from Newfoundland to Ireland, the 6 pound (dry weight) model made the trip in just under 39 hours. All this happened in 2003, and was the cap on a lifetime of achievements for Hill. These are the types of pursuits that will be banned in the USA if the FAA restrictions go into effect.

Flight Controllers

Quite a few of you thought the Naze32 was left out of last column’s flight controller roundup. I hear you loud and clear! I’ll add the Naze to the controllers which will be tested on The Hackaday Testbed. The hard part is finding the darn things! I currently have an Acro Naze32 on its way to Droning On HQ.  If I can find a full version, I’ll add that.

PID Controllers Deep Dive

I’ve gotten a few questions on Proportional Integral Derivative (PID) controllers, so it is worth diving in a bit deeper to explain what a PID controller is. PID controllers are often found in process controls managing parameters like temperature, humidity, or product flow rate. The algorithm was initially designed in the late 1800’s as a method of controlling the helm of large naval ships. In fixed wing drones, PID keeps the plane’s wings level and on course. In multicopters, PID loops control heading, but they also provide the stable flight which allows the quadcopter to fly in the first place. A full explanation of PID loops would be beyond the scope of a single article, but let’s try a 10,000 foot explanation.

pidP: This is the “Present” parameter. P Has the most influence on the behavior of the aircraft.  If the wind blows your quadcopter from level flight into a 30 degree right bank, P is the term which will immediately take action to level the quad out. If the P value is too high, The quadcopter will overshoot level flight and start banking the other way. In fact, way too high a P value can cause a quadcopter to shake as it oscillates or “hunts” for level. Too Low a P value? the quadcopter will be very slow to react, and may never quite reach level flight again.

I: This the “Past” parameter. The I term dampens the overshoot and oscillations of the P term, and avoids the tendency of P to settle above or below the set point. Just like with P, too high an I term can lead to oscillation.

D: This is the “Future” parameter, and has the smallest impact on the behavior of the aircraft. In fact, some flight controllers leave it out entirely.  If P and I are approaching a set point too quickly, overshoot is likely to occur. D slows things down before the overshoot happens.

So why do multicopter pilots dread PID tuning?  Quite simply, it’s a tedious process. Couple a new pilot and an unproven aircraft with un-tuned PID values, and you have a recipe for frustration – and broken propellers. Things get even more complex when you consider the fact that there are at least 3 sets of PID variables to be tuned – Pitch, Roll, and Yaw. Some flight controllers now support multiple PID values depending on the style of flight. Want your plane or multicopter to fly around like a hotrod? You need a totally different set of PID values than a docile trainer craft. Rolf Bakke (KapteinKUK himself) made a video illustrating how multicopters behave when tuning PID values. You can easily see how a quad can go from “drunk” to “angry bee” with just a few value tweaks. All this is coming together with The Hackaday Testbed, which will help me in posting a few PID tuning videos of my own.

Hackaday Testbed Update

As for the testbed itself, it’s nearly complete! You can follow the progress on my Hackaday Projects Page. Most of the assembly has been relatively straightforward.   though of course there are always a few snags. It seems I always forget something when ordering up parts for coils-bada build. In this case it was 2.5mm banana plugs and motor mounting screws.

The Hobbyking motors attach to the frame with 3mm screws. The problem is that there really is no way to know how long the screws should be until you have the motors, mounting plates and drone frame on hand. I have a bunch of 3mm screws of various lengths, and thankfully there were enough screws of the correct length to mount the motors. Murphy is always at my side, as I accidentally grabbed a screw that was 1mm too long and, you guessed it, screwed right into the windings of the motor. Doh! Thankfully I had spares.

bullet-solderBullet connectors can be a real pain to solder. There are some jigs out there which help, but I’ve always found myself going back to the old “helping hands” alligator clips. Bullets tend to use lower gauge wire than we’re used to with regular electronics. 14, 12, even 8 gauge wires are used on R/C aircraft. A low power soldering iron with a surface mount tip just won’t cut it. Those irons just doesn’t have the thermal mass to get the connectors up to soldering temperature. This is one of those places where a decent 40 watt or better Weller iron (yes, the kind that plugs right in the wall) can be a godsend. I’m using an Metcal iron here, with a wide flat tip.

bullet-solder-2Bare bullet connectors and alligator clips can also create a problem – the metal clips create even more thermal mass. Years back an old-timer showed me a trick to handle this. Slip a piece of silicone R/C plane fuel tubing on the bullet, and then clip the helping hands onto the tube. The tube will act as insulation between the bullet and the clip. Silicone can easily withstand the temperatures of soldering. I’ve also used the silicone tube on the jaws themselves – though eventually the jaws will cut the soft tubing.

That’s about it for this edition Droning on! Until next time, keep ‘em flying!

Title photo credit Cyrus Abdollahi.

Comments

  1. strevo says:

    nice silicone sleeve trick, I always had an issue not with heat, but with the alligator clips pinching the barrel connector out while full of liquid solder.

    Another thing I do differently, I simply hold the barrel connectors upside down in an alligator clip, I place the soldering iron tip into the hole on the side while literally FILLING UP the thing with solder. While hot and liquid, I insert the pre-tinned wire and remove the soldering iron tip at the same time. In this way I can do them in just 10-20 seconds each and inserting the wire helps cool off the solder shortly after it’s adhered, so it can be removed within 5 seconds.

    • dave says:

      cold wire in that setup usually leads to a cold joint.

      • Static says:

        I do the same thing, but let the wire “boil” in the connector for a bit, with the soldering iron applied. You don’t need to hold it too long, the rate of thermal transfer from the hot liquid solder to the wire is massive. The last batch that I did, I had my second set of helping hands holding the tip against the connector. I find I need to keep desoldering braid at the ready for spillage. I haven’t noticed any cold joints.

      • Megol says:

        Not necessarily. The molten tin have some heat capacity that can melt the solder in the wire. But one should of course check the quality of connection when learning a new method of soldering something.

  2. HV says:

    I ended up ordering my Naze 32 right from abusemark.com in Japan because their vendors are always sold out it seems.

  3. Da says:

    “The I term dampens the overshoot and oscillations of the P term”

    Not really. There is such a thing as integral windup, where the system has too much inertia and ends up oscillating because the integral takes too much time to wind down from its cumulative value. The D term dampens oscillations by reacting to the rate of change of the signal.

    And there are simple algorithms for automatically/manually tuning PID parameters:

    http://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method

    • Adam Fabio says:

      Any of the terms will have major negative impact if they are set far from the optimal value. Rolf shows a good example of integral windup in the video I linked in the article. He describes it as similar to P oscillation, but at a lower frequency. The KK board he’s using doesn’t have a D term, so one must correct by dropping that I value back down.
      In terms of the ZN method, I wouldn’t want to subject any of my aircraft to an ultimate gain determination. Even mechanically restrained, that would put quite a bit of stress on the airframe.

      • AMS says:

        Or just use an integrator that saturates to the output’s limit, or stop integrating when the output is on the rails. There’s a number of methods that take care of integrator wind-up without putting in noise-sensitive, non-physical D terms.

      • Dax says:

        “I wouldn’t want to subject any of my aircraft to an ultimate gain determination.”

        One can in theory infer the ultimate gain by trying different P values below oscillation and observing how the system behaves and making a simple guess, because presumably the system behaves more or less like a damped oscillator where increasing P has the effect of exciting it at a higher and higher frequency when you make a step control change.

  4. Oh BOY do bullet connectors and Dean’s-style T connectors *STINK*

    I’ve gone through and standardized on XT-60 for a couple of reasons:
    * They’re easier to solder precisely because of the thermal mass problem (and the thermal insulation afforded by the housing
    * They’re polarized (and decent ones are labelled on the housing for soldering time)
    * They’re gendered, so you cannot accidentally connect batteries to one another (as you can, very easily, with bullet connectors)
    * You can, in fact Panel and/or PCB mount them! (this is a feature I’ve been exploring as I start work again on my https://hackaday.io/project/398-Ridiculously-Bright-Flashlight)

    • HV says:

      All of those things describe a Deans connector as well. Though there are huge differences between a ‘Deans Style’ connector and an actual Deans connector. Actual Deans connectors way outshine any clone that’s ever been made of them, but they cost significantly more. This is a good example where counterfeits have ruined a product’s reputation, even to normally knowledgeable users who may have not ever used a real product for comparison. If you didn’t pay ~$3 for a set of Deans connectors, you probably got counterfeits. With counterfeit Deans the plastic case melts while you’re soldering it, and the pins can shift, and the springs and contacts are terrible crap metal and can spring out and short. Real Deans are made with fiber filled nylon which is very hard to melt and quality materials for the pins/springs.

      I’ve switched to the XT-60’s on the 12S packs on my heli mainly because you can get a quality XT-60 connector set for much less than a Deans set, but I don’t see any huge advantages one over the other quality/functionality wise.

      All of that said, everyone’s bound to have favorites.

      • Adam Fabio says:

        I’ve used deans connectors (real ones) for years. The fakes are incredibly bad compared to the real deal.
        The only beef I have with deans is that they are difficult to solder with heavy gauge wire. I like a bit more physical separation on the solder side of the wires in big packs.

    • Liam Jackson says:

      I like hxt connectors for bullets. Really cheap and bullets really arent that difficult to solder, a hot air gun or soldering iron on a high heat has always worked for me!

  5. David says:

    I just don’t understand how anyone could possibly confuse silicon and silicone. How could 2 things be more different?

  6. Peter says:

    I’d advice to read a lecture and a good book on PID controllers or control theroy in general. The explanation above is not completely off track, but it’s just not that simple. Too keep it short: it heavily depends on what you’re actually controlling, what you input and outputs are and basically the (physical) description of the system to be controlled…

  7. joee says:

    I cut/drilled holes into a block of wood to accept deans and bullet connectors. I fill the bullet connectors up with solder then dunk the tinned wire in. It works every time. Now I just try to directly solder my wires together when possible and never use bullet connectors on batteries.

  8. timmy says:

    Adam Fabio – you could just use contact form on abusemark if you really need one for testing I’ll see if I can find some extra…

  9. MrTrick says:

    To anyone writing PID control code, I can’t recommend this enough;

    http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

    It incrementally goes through all the steps to go from a naive PID implementation to something bullet-proof, including handling windup issues, manual override, all sorts of things.

  10. Marty Lawson says:

    By the way, you can put real physical units on PID gains. For a 2nd order angle controller “P” has units of N-m/rad aka the same as a spring. “D” has units of N-m/(rad/s) or the same units as a rotary damper. “I” has units of N-m/(rad-s) this has no analogous component, but can be measured experimentally.

    Just like with a physical mass-spring harmonic oscillator, If you want to speed up the response while maintaining an approximately critically damped response, you must raise BOTH the “P” and “D” term. Of course, the limitations of the real control system can quickly get in the way. The “D” term in particular can be hard to implement without amplifying sensor noise. (the best solution is to use a model of the system to implement an observer. The “D” term is then based off the observer while the observer’s controller lets you trade system disturbance rejection for lower noise)

    Also, I’ve yet to see a system where the “I” term makes the system more stable. It’s always had a neutral or destabilizing effect that must be balanced with the improvement in low frequency disturbance rejection intrinsic to the “I” term.

    Regarding integrator windup, my favorite way to deal with it is to simply zero out the “I” integrator every time the system is overloaded. If the system can’t push any harder, accumulating corrections to past errors just makes recovering from an overload take longer.

  11. Galane says:

    That plane should be on display in the Smithsonian for a while.

    What’s the name of the Empire’s biggest museum? The Sithsonian.

  12. InverseInductor says:

    does anyone know where you can get plans for the tam5?

  13. Andrew says:

    You know, if you have a bunch of screws that are too long you can use them as raw material to make shorter ones. Subscribe to my newsletter and I’ll show you how this is possible.

    Also, you should be crimping connectors. It’s the Right Thing to do, but let me guess, the ‘proper tool’ is too expensive, right?

    • Adam Fabio says:

      I don’t mind shortening coarse threaded screws, but cutting down fine thread steel screws which are going to into aluminum can be asking for trouble – even when using a nut to remove the burr.

      As for crimping, I do have several “expensive” crimpers on hand for things like berg and AMP connectors. The general standard in RC for bullets and battery connectors is solder cups. Unless one wants to go to PowerPole connectors (which aren’t the best for this application) there just isn’t a crimp solution available.

  14. Andrew says:

    Here’s my simple description of P, I & D, there are some points where I strongly disagree with most autopilot tuning tutorials and even this article:

    P: this one is quite clear, controls the speed of response to the control variable (quad’s orientation) becoming out of balance. But contrary to what all these “experts” say there is no value too high for P. Too low == too slow response, too high == increase D, be done.

    I: this one is very useful, just keep the value very low, you won’t even have to worry about it being a source of oscillations. I is what makes the copter deal with manufacturing differences between the motors and propellers (you can even 4 totally different motors & props), and allows the center of gravity to be almost anywhere. It “calibrates” the flight controller to your vehicle’s physical parameters. Low == slow calibration, high == faster calibration. 0.01 is quite high.

    D: the “look this far into the future” parameter, prevents oscillations. There are some ways to determine the ideal value. Every P value has a corresponding good value of D. Too low for your P == oscillation, too high == slightly slower convergence, but not much of an issue.

  15. Andrew says:

    Also note, that on an ariplane things become more difficult because the response to actuating a control surface depends on current airspeed. You can’t use a fixed P or D, they need to be divided by airspeed from the pitot tube sensor.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,890 other followers