Designing Purpose-Built Drones for Ardupilot Pixhawk 2.1

5 (1 reviews total)
By Ty Audronis
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Drones 101

About this book

The Ardupilot platform is an application ecosystem that encompasses various OS projects for drone programming, flight control, and advanced functionalities.The Ardupilot platform supports many Comms and APIs, such as DroneKit, ROS, and MAVLink. It unites OS drone projects to provide a common codebase. With the help of this book, you will have the satisfaction of building a drone from scratch and exploring its many recreational uses (aerial photography, playing, aerial surveillance, and so on). This book helps individuals and communities build powerful UAVs for both personal and commercial purposes. You will learn to unleash the Ardupilot technology for building, monitoring, and controlling your drones.This is a step-by-step guide covering practical examples and instructions for assembling a drone, building ground control unit using microcontrollers, QgroundControl, and MissionPlanner.

You can further build robotic applications on your drone utilizing critical software libraries and tools from the ROS framework. With the help of DroneKit and MAVLink (for reliable communication), you can customize applications via cloud and mobile to interact with your UAV.

Publication date:
December 2017


Chapter 1. Drones 101

Congratulations! You've taken the first step into the exciting world of designing and developing your very own purpose-built drone. Humankind has constantly been pushing the edges of their technology. Our technological progression is built into our DNA so thoroughly that we mark complete eras of our history with the technological state of the art. The Bronze Age, the Industrial Era, Space-Age, Information Age, and now the "Drone Era." It truly is exciting to live in the drone era. Well, we have a lot to cover, so let's get started:

We'll be covering the following topics in this chapter:

  • Introduction to drones
  • Purposes for drones
  • Types of drones
  • Ardupilot 101
  • Safety and best practices

Introduction to drones

What is a drone? Twenty years ago, the answer was easy. Ignoring the definitions having to do with insects, a drone was a term strictly used for a military autonomous flying vehicle. Drones were (mostly) used for target practice or for gathering intelligence (reconnaissance). Along came a company called Dragan that made one of the first commercially available quadrocopters (the DraganFlyer) and the term Quad Helicopter was born.

Their first commercially available multicopter was simply called the Quad Helicopter and came out in 1997 (it is shown in the following image):

The original DraganFlyer Quad Helicopter (1997). Picture courtesy of DraganFlyer

In the 2000s, the term drone became synonymous with military strikes. Between the United States Presidents Bush and Obama, the United States racked up many attacks on targets with connections to terrorism. So, the term "drone" had an ominous implication.

In 2010, Parrot came out with a multicopter that implemented augmented reality (AR) on a cell phone. This game allowed players to shoot down each other's real-life multicopters. The multicopter was titled the AR Drone (probably as a marketing attempt to capitalize on the ominous nature of the term drone). Really, it was the first multicopter you could buy in your local shopping mall and plaza (it was available at all Sharper Image stores). The public finally had its first look at multicopters. There it was—Drone stamped in all-caps on the front of the box.

Who could resist? I had spent days, weeks, years (even) building drones by tearing apart other electronics to get accelerometers, GPS modules, and other components to build my own drone. Could it really be so easy that all I had to do was go down to the mall and buy one? Yes. The following image shows me in 2010 testing out an AR Drone bought from Sharper Image:

Testing an AR Drone (1.0) in 2010 from "Sharper Image" (Pacifica, CA)

In 2011, the glory of military drones got a big stain. It turned out that these surgical drone strikes were sometimes taking out civilians, US citizens in foreign countries, and missing terrorists all together. Suddenly the term drone was becoming something that the general public associated with fear and even rage. Protests ensued (as shown in the following image):

Creative Commons Picture by: Fibonacci Blue

Soon, turnkey systems (like the DJI Phantom) were available with cameras already installed and sold at big-box retailers. This led to privacy concerns from opponents to the craft. They had been handed a new term for multicopters on a silver platter, a term that struck fear and loathing into the hearts of people all around the planet. A term even synonymous with murder-drone. In the following image, you can see the first in the line of DJI Phantom drones:

The DJI Phantom (version 1) - The first of the most popular drone line ever created. Those three prongs on the center of the hull are a mount for a GoPro camera

The multicopter community resisted the term drone with all its might. People were in hysterics. In Santa Rosa, California (2013), a police officer even confiscated a property owner's drone. He was flying it over his own vineyards and posting the videos on YouTube. The police officer stated that it would be a matter of months before you saw fly by shootings. The police department had no legal standing and was forced to return the Phantom.

Legislators around the country were making local laws against drones. In Los Angeles (the area that hosts Hollywood and the bulk of the aerial cinematography industry), drones were outlawed. (Later these laws would be overturned as the FAA finally stepped in and stated that local and state governments had no jurisdiction over airspace.) At the time, it looked as if drones may just go the way of the condor. But then something wonderful happened.

The industry stopped resisting the term drone. I remember on my first drone book with Packt, Building Multicopter Video Drones, resisting the word drone in the title. But they convinced me it would be good for search engine food. As we (in the industry) stopped resisting the term and started educating the public about the safety, best practices, and usefulness of drones the negative implications lost all meaning. And (as in the following image), drones even took on an entirely new meaning:

A group of drone pilots from "Humanitarian Drones" and FEMA team members assisting in Port Arthur, TX during Hurricane Harvey relief efforts. Photo by Daniel Herbert (of Humanitarian Drones)

Suddenly, drones were saving lives (with search and rescue), helping people recover from disasters (with assessment of damage, as shown in the following image), and responsible for great shots in feature films and people's favourite documentaries. Then, something completely weird happened:

A DJI Inspire 2 conducting damage assessment and mapping in the aftermath of Hurricane Harvey in Houston, Texas. Photo taken by Brian Scott of Humanitarian Drones

Drones were no longer multicopters. The term covered anything that flew under remote control. This happened with the FAA's small Unmanned Aerial System (sUAS) rules. The media dubbed these rules drone legislation. Suddenly, drones had wings, even jet engines. Now, they didn't even have to fly autonomously, the radio-controlled airplane that grandpa flew on weekends was a drone.

Then, it went further. The guidance systems used in multicopter drones were being repurposed to control ground vehicles (rovers) and water vehicles (boats and submersibles). Now, in 2017, you actually hear companies coming out with underwater drones.

In short, the answer to the original question, "What (exactly) is a drone?" is simply a robot-a vehicle of any type that is either not controlled by a human (autonomous) or controlled by a human via remote control. It may not be the Oxford English Dictionary's definition, but it is the definition that the common public accepts when they hear the word drone.

And, as for the proof that we're living in the Drone Era? In the height of the space age (the mid-1980s), men on rocket packs flew into stadiums for the opening ceremonies for the 1984 Olympics, and even during the Super Bowl XIX half-time show. Now, we have drone-shows for those same venues. Of course, we still have a ways to go for full-tilt drone acceptance. After all, the drone part of the half-time show had to be filmed days earlier for fear of a drone attack during the show, or at least fear of mass hysteria in the venue. But we'll take it.


Purposes for drones

Drones are just for taking pictures, right? Wrong! Drones can be useful for just about anything and everything. Here are just a few examples:

  • Suffering in a drought (hello, California) but need to water your crops? You can use a drone to map your whole farm. Then, run analysis on crop health, so that you know where to direct water. All the while sipping iced tea on your porch.
  • Want to walk the golf course, but don't want to hire a caddy or carry your own clubs? Caddy drone to the rescue! Make a motorized golf trolley, and have it follow the GPS signal on your cell phone as your walk the golf course.
  • Maybe you're a herpetologist on an expedition to a remote location and you found a new species of tree frog. Get it back to base-camp from miles away in an autonomous powered glider. Just load the frog into the payload bay, give it a toss above the treeline and let it fly (and land at) home! Then, just wait for base camp to get the specimen and send the powered glider back to you for your expedition to continue.
  • You're a lifeguard at a beach and see someone having trouble. Launch an aerial drone that drops a boat-drone to tow the person back to shore. All the while, you don't have to leave your station (leaving the rest of the beach-goers without a lifeguard). You can meet the victim at the beach with medical supplies you may need and you're not too exhausted to help out!

The list goes on and on and on. If you can think of something requiring delivery of an item, manual labour requiring movement to another location, or just something to save time, a purpose for a drone will be found. The possibilities are quite literally limitless.

The following image shows the (Israeli Defense Force) Air Mule. It is an autonomous ambulance drone designed to go into the battlefield and airlift wounded soldiers and civilians back to a medical facility at over 100 miles per hour, all with no pilot onboard:

There is some fear that drones will eventually replace people on certain jobs. This fear is slowly being realized with autonomous cars (as UBER is talking about rolling out). After all, these are drones too. However, I prefer to think of it as freeing people from the mundane tasks in favour of the pursuit of their imaginations (like figuring out more uses for drones). Besides, people are still needed to maintain drones, monitor them, and analyse the data they provide. (At least until artificial intelligence (AI) is better at abstracting ideas and problem solving.)

It goes even further than a single drone for a single purpose though. With swarming, multiple drones can specialize in parts of a task and cooperate to achieve a very complicated result. For instance:

  • Geologists deploying swarms of aerial drones to get infra-red imagery of fault lines while additional swarms of rovers (with seismic sensors) can monitor those fault lines for activity. That sort of purpose can save thousands of lives.
  • Swarms of submersible micro-drones in the oceans can monitor currents and track tidal-waves headed toward land. They could even be powered using the kinetic energy of the currents to generate their electricity. People could be evacuated in time to save them.
  • In the event of a natural disaster, electricity (and therefore communications) is the cause of many casualties. A swarm of communication drones (cell tower repeater replacements) can fan out across a country to re-establish the communication networks in a matter of minutes.

These are certainly some altruistic and noble uses for swarming, but the military also sees the benefit of drone swarms. The following image shows a recent test of drone swarms (deployed by dropping them from a pair of f-18 Hornets) used to map out a battle-field in real-time for mission commanders and soldiers on the ground:

Drone swarms can also be used by the entertainment industry to cover sporting events, if one drone is running low on batteries, another takes off to take its place. Drone swarms could be deployed over golf courses to help enthusiasts find their ill-hit balls that have gone off into the weeds. Farmers could use drone swarms to monitor crops, plant seeds, monitor watering patterns (and waste from evaporating water, or atomized sprinklers going into the air).

Again, the uses for drones are limitless.

We could list potential uses for drones all day, all night, every day, and every year, for our lifetimes. So, how do we realize this potential?

Well, to figure out how to make drones, we'll always first start off with how to implement existing tech and components to make what we want. The first step is to think in terms of what types of drones exist currently.

Types of drones

Drones come in two categories with several subcategories. There are surface/subsurface drones, and aerial drones. Let's dive further into each.

USV drones

USV simply stands for either Unmanned Surface Vehicle or Unmanned Submersible Vehicle. The same acronym of USV is used for both. These types of drones are usually referred to as Rovers or Submersibles respectively.


Rovers usually either have treads (like a tank) or wheels (like a car). The Mars Rovers are great examples of USV Rovers. They move along the surface of Mars taking various readings and measurements in an effort to explore the surface of another planet without the risk to human life. The following picture shows one of these Mars Rovers:

Not every endeavor for a rover needs to be quite so lofty as to explore another planet. Rovers are currently used in aspects of our daily lives (the iRobot Roomba is a daily life example of a USV Rover) all the way through exploring our own planet (rovers designed to explore lava flows—areas far too dangerous and inhospitable to humans).

However, rovers don't have to simply be driven across the ground. Some rovers are actually boats designed to skid across the surface of water for various purposes. An example of boat-drone USV is the one designed by the US Navy to escort ships through pirate-ridden waters, and protect naval vessels from other hostile vessels in dangerous waters (eliminating, or at least reducing, the need for bloated battle-groups).

In this book, we will be designing three surface rovers:

  • A basic autonomous RC car which serves no purpose other than your education on the basics of implementing the Ardupilot interface.
  • A water USV that serves the purpose of a duck decoy which autonomously navigates pre-planned routes around a pond for hunters. Hmm... one wonders what that might go for in a store?
  • A ground USV golf caddy. This will show you how to make a rover follow a GPS tracker (in the form of the user's cell phone). This caddy is designed to move your clubs around the golf course without having to carry your bag, nor even tell the caddy where to go. It will simply follow you.

Submersibles are vehicles designed to go beneath the surface of a liquid. Traditionally, this liquid is water. However, submersible vehicles could potentially be used to monitor other liquids, such as fermentation tanks at breweries, mixing tanks at chemical plants, and diving into raw sewage tanks. Other than diving into a vat of beer, I'm sure you can see how using drones is preferable to diving in yourself.

We won't be attempting to create a submersible in this book. However, the techniques employed are very similar to the subject matter of this book. Submersibles should only be attempted by highly experienced drone designers, as they'll have to contend with reduced ability to utilize GPS, reduced radio transmission distance, and highly reduced visibility in water (or other liquids). Therefore, technologies such as forward looking infrared (FLIR), signal repeaters, and collision avoidance (via SONAR) should be considered. However, as you can see from the following image, the similarities between underwater drones and fixed-wing aerial drones (airplanes) are fairly obvious:

The similarities between the Navy's "Ocean Glider" submersible drone and the original X-1 airplane (the airplane which first broke the sound-barrier) are rather astounding.

UAV drones

UAV stands for Unmanned Aerial Vehicle. Simply stated, this is any drone that flies. However, much like the term USV can also include submersibles, this category can also cover vehicles that go into space (such as the Pioneer satellites, the Cassini probe, or even the Air Force's replacement for the Space Shuttle—the X37B.

The US Air Force's X37b can be drop-launched from a high-flying airplane, or mounted to a rocket. It can also autonomously stay in space for several years, change orbital paths, and return to the ground for an autonomous landing. The actual payloads and missions are classified. You didn't really think we'd rely on Russia and civilian agencies for all the United States' needs in space, did you?

We won't bother to get into space any further. After all, if you're working for NASA you probably don't need this book. Still, it was cool to mention. In the air, UAVs can be broken into five essential categories:


Sometimes, people refer to these as quadcopters or quadrocopters. Technically, this isn't accurate unless the multirotor has four-propellers. There are also hexacopters (six-propellers), octacopters, (eight-propellers), and even all the way up to thirty-two-propellers (although I have no idea what that word would even be). So, you can see how multirotor simplifies it all. After all, they are essentially the same type of aircraft, just with more or less motors and propellers. (It's like calling a monofoil and a biplane an airplane, but calling a monofoil a biplane is incorrect).

How do multicopters fly?

The principle is simple. So simple (in fact) that you may wonder why these weren't a thing until recently. Propellers blow air down to provide lift and the airframe (the whole body) tilts to direct that thrust behind (to go forward), in front (to go backward), or to either side (to slide left or right). You can see this in the following illustration:

But then there's controlling it.

It requires thousands of calculations per second to decide exactly how much power should go to each motor to keep the aircraft level and stable in the air. No two motors come out exactly the same. So, it's not just a matter of providing equal voltage to each motor. It's a matter of adjusting that voltage to each motor based on what's currently happening to the aircraft. So, in essence the aircraft doesn't fly it reacts to its inability to fly and compensates for it. And then there's turning (yaw).

You may notice there's no tail rotor on a multicopter. Tail rotors on traditional helicopters serve two functions:

  • Keep the airframe (the body) of the aircraft from spinning out of control. After all, Newtonian Physics tells us that for every action, there is an equal and opposite reaction. If the motor is turning the primary rotor, what's to stop it from spinning the body in the opposite direction?
  • By varying the pitch of the blades on the tail rotor, more or less thrust (as well as the direction of the thrust) can be controlled. This lets the pilot yaw the aircraft (turn it).

So, how does a multirotor achieve yaw? The answer is in the preceding first reason. There are (usually) even numbers of rotors on a multicopter. Half of these rotors spin in one direction (clockwise) and the other half in the other direction (anti-clockwise). When you want to turn left, the blades spinning to the right speed up and the blades spinning to the left slow down. This way, the effective lift remains the same but the torque from the motors yaws the aircraft to the left. The opposite happens when turning to the right. The following illustration shows this in action:

This is also why tricopters (three rotors) are largely not used. They were notoriously unstable and battery-inefficient. They looked super cool though. Rather like the drop ship from the movie Aliens. However, a variation of the hexacopter (six-rotors) uses that motif (which brings us to yet another variation on blade-configuration). A flat-hexacopter has all-six blades stationed on a single plane. The over-under version of a hexacopter looks like a tricopter with three basic lift points, but counter-rotating blades stacked atop one another so one plane of blades moves in one direction; while the one following moves opposite.

The following picture shows a standard quadcopter (upper left), an over-under hexacopter (upper-right), and a flat-hexacopter (bottom). Most configurations for multicopters are now flat, as it's more efficient for battery time and lift capabilities:

So, as you can see, multicopters are a platform based on a simple principle that is extremely complicated to make work. You (the pilot) don't actually fly a multicopter. It flies itself. Instead, you really just tell it where to go and what to do. You don't pilot a multicopter, you wrangle it.

For the guidance system (in our case we'll be using Pixhawk 2.1—an Ardupilot-based system) to accurately calculate what each motor should be doing there is a plethora of sensors it needs:

  • Accelerometers: Measure the attitude of the aircraft to see whether it's level, what direction it's moving in (relative to last attitude). These essentially measure the linear velocity. So, there need to be several of these sensors in order to measure all axis of movement. The Pixhawk has three accelerometers which are quite good and very fast. However, more can be added.
  • Gyroscopes: These differ from accelerometers in that they sense angular movement (roll, pitch, and yaw). Each gyroscope measures one axis of movement, so three are needed. Pixhawk includes three gyros.
  • Magnetometers: This sensor functions essentially as a compass. They measure the Earth's magnetic field and can tell the vehicle's relative heading to north. However, as aircraft can roll and pitch, one should be implemented for each axis and compared to each other (as one magnetometer may get locked if perpendicular to north). Pixhawk has three of these.
  • Barometers: A barometer measures air pressure. Because air pressure changes at various altitudes, this method can tell the relative altitude to the takeoff point. Amazingly, these can be quite accurate (down to individual inches) depending on the number of sensors, and their sensitivity. Pixhawk has two built in.
  • Global positioning system (GPS): GPS tells the Pixhawk where it is (on the planet). We'll get deeper into GPS and how it works in a later chapter, but let's just say that not all GPS receivers are created equally. GPS is an approximation and various factors determine how accurate it is. GPS is not included with Pixhawk. You must buy your own GPS module for it.

So, accuracy of sensors is extremely important (as you can see) with regard to flying multicopters. If it's truly flying itself and you're just telling it where to go, you want that robot brain to have as much information (which is as accurate) as possible.

The myth with multicopters is that they're extremely simple. This is probably because they are fairly easy to fly. That myth should be dispelled right here and now. Of all the drone-types, they are the most difficult to design and build. You'll find that parts should work together, but don't. You'll find that balancing lift to flight-time is extremely difficult. And you'll find that when things go wrong, they go very wrong. Trust me I have the scars to prove it. So, when we get into multicopters, please pay the utmost attention to safety. They are essentially flying Cuisinarts.

Fixed-wing drones – airplanes

Airplanes are considered by many as the Holy Grail of UAVs. They can generally fly for a lot longer than multicopters (as they have wings and don't have to use up battery power on lift). They are much easier to fly (as they can actually glide and, if the motor cuts out, they don't drop like a rock). However, the difficulty with airplanes is takeoff and landing.

Since airplanes don't hover, they must be moving at speed to take off and land. Landing an airplane isn't too easy either. They must touch the ground softly, or they may bounce up again, stall, and crash. So, how do you design a drone to land at speed softly? It's not easy. But Pixhawk has been known to do this pretty well.

Also, since an airplane needs to maintain a certain speed in the air to keep wind flowing over the wings in order to provide lift (called air speed); the guidance system needs to know how fast it's moving through the air (not just in relation to the ground). In addition to all of the sensors employed by the Pixhawk for a multicopter; one more sensor is needed for an airplane a pitot tube.

You'll find a pitot tube on any real airplane to measure airspeed. This device is the little sticks you see protruding from the sides or nose of the airplane. The following image shows how a pitot tube works:

Image courtesy of Wikimedia commons

The following image shows a pitot tube on a piloted aircraft:

The Pixhawk does not have this sensor, but one can be purchased to use with it.

Fixed-wing drones can also be launched in a variety of ways. Some are thrown; others are launched on catapult systems, while still others are launched by taking off like traditional aircraft (rolling takeoff with wheels).

The following image shows one of my drones (2012) being launched via a catapult system known as a Jetapult:

Since this drone had a seven-foot wingspan, it was far too large to launch by throwing it. The system was very simple. It used PVC pipe to angle the aircraft and slide it up at a slight angle while a bungie cord pulled the aircraft forward at a high rate of acceleration. If you look closely, you can see the black bungie cord wadded up on the ground just behind the (now flying) drone. The release was a simple foot-pedal that slid a ring off a peg.

Although this is a simple mechanism, even military drones are sometimes launched from catapults (as shown in the following image):

Hybrid drones – VTOL

You may wonder why we spent so much time on takeoff and landing. Vertical Takeoff and/or Landing (VTOL) drones solve a lot of issues, but present a high degree of complexity. These drones can take off like a helicopter (or multicopter), fly like an airplane, and land again like a helicopter/multicopter.

The XplusOne (by Xcraft) takes off and can even fly like a quadcopter, but then it can transition into forward flight like an airplane. As you can see though, designing such an aircraft is incredibly difficult. Wind resistance from the wing (when vertical) can create instability during multirotor flight and transitioning to airplane flight can be equally difficult. However, the most difficult proposition of all is coming back to quad-flight for landing. How do you keep the aircraft from ballooning (gaining altitude) and then stalling into a crash? You should only attempt this when you have a high degree of funding and experience, because it's virtually guaranteed that you'll crash it several times before tuning your design to be just right.

Helicopter drones

Traditional helicopters do have some advantages. They can fly faster than multicopters (usually) and are more stable during forward flight (due to a tail fin and horizontal fins). They can also (sometimes) stay in the air longer, as they do not require the quick responsiveness of electric motors. Therefore, they can fly using combustion engines or even turbo-shaft engines, meaning they can carry more fuel and fly for longer. The following picture shows a US Navy helicopter drone:

However, traditional helicopters shift the pitch of their blades through the use of a swash plate. They also (usually) shift the pitch of their tail rotor blades using a similar method (albeit less complicated). A swash plate is basically two plates that rotate and move up and down the rotor shaft to alter the pitch of the blades. How does a helicopter tilt forward to start moving? The swash plate tilts and shafts going down to the swash plate make the blades bite into the air more at the back of the helicopter, and bite less toward the front (producing more downforce at the rear and less at the front).

All of these moving mechanical parts require lubing and maintenance between every flight. The more complex a machine is, the more opportunity there is for failure. So, although there are advantages to traditional helicopters the disadvantages (in terms of cost and maintenance schedule) make them a nonstarter for many.

The following image shows how a swash plate works. The red disk remains stationary and rotates or moves up and down. Meanwhile, the beige parts turn with the rotor head and the aqua control rods shift the pitch of the blades depending on where they are positioned during their rotation cycle:

That's the end of helicopters for the purposes of this book. As there really is little difference between helicopters and multicopters for the purposes of our Pixhawk, we have chosen to cover multicopters in this book.

Dirigible drones – Blimps

Blimps are actually pretty great. They can stay aloft for extremely extended periods of time. They are very stable as well. However, they can be a bit of an eyesore to landscapes as they have to be quite large to carry any sort of payload. The following image shows a Navy dirigible drone:

There are some other drawbacks to dirigible drones. They must be inflated, costing large amounts of money each time you fly in whatever lighter-than-air gas you choose to use (helium, hydrogen, and so on). They are also highly susceptible to strong wind currents (due to their lighter-than-air nature). So, strong engines must be employed to counteract those currents. This adds more weight and therefore more size to the blimp. Due to these limitations and costs, dirigibles are not widely used.

It's a shame, because mechanically, they are the simplest drones to design. It is just that in practice, they are expensive and largely impractical.


Ardupilot 101 – A quick overview of Pixhawk 2.1

The Ardupilot platform (based on the Arduino robotics platform) has been around for a long time. In 2007, it was conceived by a company called 3D Robotics. It's an open code-base (fully programmable), and has exploded in its versatility and capabilities since 2013 with the advent of the Pixhawk line. The latest version (2.1 at the time of the authoring of this book) implements even more versatility and stability through the capabilities of expanding the processing power via the optional Intel Edison Compute Module, and the addition of the cube. The cube contains a triple-redundancy sensor array of gyros, accelerometers, magnetometers, and barometers housed in a cushioned cube-shaped platform designed to minimize vibration and electronic interference.

In addition to Intel Edison, you can use Rasberry Pi, ODroid, NVidia TX1, and BeaglePilot project coprocessors to customize the functionality of your Pixhawk 2.1 in any way you wish. Although not every Pixhawk 2.1 has the Edison port (if you're planning on using Edison, the listing for the Pixhawk you buy should explicitely say Edison Ready), the other coprocessors can be added to any Pixhawk board.

Feel overwhelmed? Good. Then the goal is achieved with regard to showing you that the Pixhawk's capabilities are vast. So vast, in fact, that it is a full-on robotics platform brain capable of virtually anything you can imagine. The Pixhawk's limitations are only within the grasp of your programming skills.

Full-disclosure here, we won't be venturing too deeply into the programming languages and commands therein for customizing Pixhawk. That could be a whole book, or rather a series of books, all by itself. Instead, we'll be venturing into Pixhawk as it can be applied to practical purposes in its stock state (with minor tweaks).

The important point is that if DJI represents proprietary systems (although very high quality proprietary systems), Pixhawk represents open architecture. DJI would be like Apple and Pixhawk would be like Linux.

Now, you can breathe. We won't be terrifying and overwhelming you with screens and screens of coding. Let's get into the device itself.

The following image shows the Pixhawk 2.1:

Although, at first glance, the interface for plugs on the device itself looks complicated, you should take a closer look. Each plug type has a unique size and shape with a very clearly written label. We'll get deeper into all of the plugs and whatnot later in the book. But just for the sake of familiarity, let's take a quick look at a few:

  • CAN ports: Think of a CAN port as a CAN do port. A CAN bus is a common method of communication between devices (such as sensors) and the Pixhawk. You can also daisy-chain these devices. For instance, one device you may want to plug into a CAN port could be a (digital) pitot tube.
  • TELEM ports: Telem stands for telemetry. These are essentially ports that can send and receive commands and information about exactly what's happening on the Pixhawk. Devices such as coprocessors (except Edison), and Head's Up Display (HUD) which overlays information on top of a video feed for transmission to the ground would plug into these ports.
  • ADC ports: ADC ports are for analog sensors. Analog sensors usually return a voltage (rather than a digital information signal). These are usually used for analog pitot tubes.
  • I2C ports: Much like the CAN ports, I2C ports can handle many different types of devices via a hub.
  • GPS ports: This is simply where your GPS sensor plugs in. But why are there two? This has been a request that 3D Robotics listened to from users. Dual GPS can yield a better location sensing. Whichever sensor has a better signal is what the Pixhawk uses. If only one sensor is plugged in, it uses that sensor full time.
  • Power ports: Contrary to what you may think, these ports are not meant to supply power to the devices that the Pixhawk controls. Rather, these ports read the status of the power source (battery) and supply voltage to the sensors and unit itself. Power to the servos, speed controllers, or other devices that the Pixhawk controls must be supplied to the servo rail via a BEC (which we'll get into when we design our first drone in Chapter 2, Your First Drone - An Autonomous RC Car.
  • MAIN OUT/AUX OUT: These are the ports that whatever we're controlling with our Pixhawk plug into. These will usually be servos and speed controllers for motors.

Safety and best practices

This is all going to sound very obvious and like common sense. Well, it is. Unfortunately though, sometimes common sense can go right out the window when someone is excited about testing out a new vehicle. Being overly nervous can have the same effect. So, here are some basic guidelines to follow for reference:

  • Never test a new setting around people: This is true with all types of drones. It doesn't matter if you're at a designated flying field, RC car track, or missile testing range. Choose a time when there are as few observers as possible. If things go wrong, you don't want to hurt someone.
  • Take baby steps in testing: Did you just build a new drone? Don't go full autonomous. You never want to go full autonomous. At least not right out of the gate. First, run at full manual control to make sure all of the linkages are working properly. Then, step it up to some small autonomous maneuvers, and work your way up to flat out speed, or takeoffs and landings.
  • Leave the propellers off: When you're making sure that power gets to the system and programming the system; remove the propellers on any air vehicles. Put any rovers up on stands to get the wheels off the ground. Elevate any boats to keep the screws off the table. If the throttle suddenly goes wide open, you don't want any personal or property damage.
  • Always remember that your drones are experimental: The drones you build yourself are not full production machines. They don't have an entire team of engineers and quality assurance technicians, and they certainly aren't made by a corporation that can be held responsible for faulty assembly in the case of an accident. You are responsible for anything that may go wrong. Therefore, be responsible. These things can hurt or even kill people. A large 20 lb drone falling from the sky into a crowd of people is not going to make for a pleasant day for anybody.
  • Have a spotter with you: Testing drones is a team effort. As you'll probably have your face buried in a screen monitoring telemetry data, or have target fixation on your drone trying to keep your financial investment in the air, on all four wheels, or skitting across the surface of a pond; have someone with you to advise you of obstacles and problems you may face. They can also help keep onlookers that happen by back from the danger zone. In the event of something catastrophic, they can also help you find all the pieces.


Wow, that was certainly a lot of information to take in, but at least the foundation is laid and now we can get to the fun parts! In this chapter, we learned about all the different types of drones. We also discussed some potential uses and markets for drone technology. Finally, we went over the power of the Pixhawk platform and gave you a high-level overview of how the connections plug into the Pixhawk and what each port is for. Don't worry if you're a bit confounded. It was an awful lot of information, but it will become much clearer when you see it in practice in the chapters to follow.

Now, get ready, because we're diving straight into implementing the Pixhawk into your first vehicle. In the next chapter, we'll be altering a simple RC car and using a Pixhawk to make it into an autonomous rover. A rover with an added boost, that is.

About the Author

  • Ty Audronis

    Ty Audronis has been called a "technology-age renaissance man." He’s a professional drone pilot, post-production specialist in the entertainment and media industries, a highly experienced interactive game developer, and an accomplished digital artist. He’s worked for companies ranging from frog Design to California Academy of Sciences in roles where he’s worn many hats.

    Ty’s been programming software and games since 1981 (when he was 8 years old) professionally. He majored in “Computer Generated Animation and Visual Effects” in college (where he won “Best Animation” for the entire CSU system – a Rosebud Award). His music and sound design have been the soundtrack on several major productions; he has also served as a visual effects supervisor on feature films and was the supervising editor and animator for award-winning science visualizations. He has been building drones since the days when sensors and components had to be torn out of cell phones and game controllers.

    Ty is also a mentor, having taught many interns his skills, and speaks regularly at venues including Interdrone. He also serves on the advisory board for the Society of Aerial Cinematographers and for Genarts (now Boris) Sapphire.

    Browse publications by this author

Latest Reviews

(1 reviews total)
Elearning top !!!!!!!!👍👍👍

Recommended For You

Designing Purpose-Built Drones for Ardupilot Pixhawk 2.1
Unlock this book and the full library FREE for 7 days
Start now