black and white image of top of building

Engineering a Quadcopter with Collision Avoidance

By Aidan Melen

Abstract 


In this paper, a quadcopter (also known as a quad for short) capable of detecting and reacting to nearby objects is explored. The purpose of this research is to reduce the responsibilities a pilot will have in regards to crash avoidance. The quadcopter is expected to contain the following attributes: stability will be determined by the flight controller, an array of onboard sensors will provide object detection, and an Arduino microcontroller will execute the avoidance algorithm. As a result, the quad will remain fixed in a relative point in space until an object triggers the aircraft to perform an avoidance maneuver, hence, directing the craft to a safe location. 

Keywords:

Introduction

Despite the current state of quadcopter technology, it may still require numerous hours of practice for a rookie pilot to become comfortable flying a remote controlled (RC) aircraft. In fact, it is quite common for inexperienced RC pilots to crash due to a number of compounding factors. For example pilots often become disoriented during flight since quadcopters are typically controlled from a third person perspective; wind currents can cause turbulence and lead to instability; distractions may shift the pilots focus away from the quadcopter, and lastly, a pilot might lack the skills necessary to avoid physical obstacles. By outfitting a quadcopter with collision avoidance capabilities, the likelihood of collisions will be reduced.

Background

amazons package delivery quadcopter

Figure 1: Amazon’s package delivery quadcopter


The conception of this project is largely inspired by recent news from Amazon, the largest Internet-based retailer in the United States, announcing its plans to unveil “Amazon Prime Air — a new delivery method that will see autonomous quadcopters deliver your order within 30 minutes”.[1] The company — which has already automated its warehouses — now hopes to implement autonomous quadcopters or drones to increase the speed of package deliveries in urban areas. Although the program has already been launched, Amazon’s engineers continue to develop collision avoidance technologies in order to address the FAA’s ever increasing regulations as well as the public’s growing concerns regarding the danger of drone technology. In this way, developing a quadcopter capable of collision avoidance is a very contemporary and formidable task.

Preliminary Work

Introduction

It is to be assumed that the collision avoidance system will be integrated into a pre-existing quadcopter flight system. For this reason, constructing a programmable quadcopter onto a preexisting technology is the most practical. It is important to note that conducting preliminary research in regards to quadcopter basics is required before understanding the collision avoidance sensors as well as the circuitry.

quadcopter rotations

quadcopter configuration types

Figure 2: Quadcopter Rotations

Figure 3: Quadcopter Configuration Types

 

Quadcopter Movements

A quadcopter is a type of multirotor aircraft which uses four fixed counter-rotating propellers in order to produce lift. As illustrated in Figure 2, a quad’s movements are defined by three degrees of motion: yaw, pitch, and roll.[2]

Quadcopter Configurations

Furthermore, movements are relative to the type of configuration. Historically, quadcopters have flown with plus configurations, as highlighted in Figure 3, because increasing the pitch merely requires reducing the thrust of the front motor while increasing the rear motor.[3] Theoretically, this will move the quad forward while maintaining a constant altitude. In addition to the plus configuration, the modern quadcopter design favors the ‘X’ configuration despite the need for more complex motor coordinations. For example, moving forward requires decreasing the thrust of the two front motors as well as increasing the two rear motors. This added complexity is negligible because modern flight controllers are easily programmed to account for this added control. As a result, this configuration has become popular amongst the contemporary quadcopter community. More specifically, it is more suitable for adding camera systems and sensors as it allows for clearance looking forward, left, right, and rear. For this reason, an ‘X’ configuration will provide the optimal structure for this project.

PID Control Method

RC quadcopters are typically aided by flight controllers because quadcopters are largely unstable. Flight controllers are specialized proportional-integral-derivative (PID) controllers. A PID system uses a feedback loop which continuously calculates an "error value" as the difference between a measured process variable and the desired setpoint.[1] In other words, when an RC pilot applies roll to the craft it effectively offsets the tilt to some degree from absolutely level (or zero degrees). The offset angle is then measured by the accelerometer. With this evaluation, the motors can either increase or decrease thrust to correct for the particular error, resulting in a level quadcopter.

Components

There are a number of conventions which modern quadcopter designers use. More specifically, quadcopters typically use Brushless motors because they are strong and lightweight. An Electronic speed controller (ESC) is used to dynamically control the speed of the motors. Nevertheless, raw motor power is not enough to get a quad off the ground; in fact, the quad also relies on propeller length and pitch for correct amounts of upward trust. As for the power source, quads are traditionally powered by lithium-ion polymer battery  (LiPo). These batteries are commonly found in laptop computers and mobile phones because of their high capacities and light weight. LiPo batteries provide high voltage power for the motors as well as low voltage power for the onboard computers through the use of a universal battery eliminator (UBEC) circuit. Finally, the pilot will need a remote controller that can bind with the onboard receiver in order to test the stability of the craft and prepare it for the automated flight.[6]

Flight Controller

As discussed earlier, the flight controller will be used to stabilize the aircraft by performing PID. The quads flight controller, in this case, will be DJI’s Naza M V2. The Naza platform comes with a graphical user interface for PID adjustments. Building a flight controller from scratch requires knowledge of aerospace engineering and could potentially take years to implement and test. Therefore, integrating a system with a fully functional flight controller, the scope of this project is drastically narrowed which subsequently increases the project's feasibility. Furthermore, the Naza is embedded with a cluster of necessary sensors which includes: accelerometer (acceleration), gyroscope (3-axis rotations), magnetometer (cardinal directions), barometer (altitude), and GPS — all of which are accessible by a series of general input/output pins on the Naza.[5]

Materials and Methods

Peripheral Sensors

Due to financial compromises, distance measurements will be made from a set of four HC-SR04 ultrasonic or sonar sensors. Sonar sensors more affordable than Lidar and can perform decently well in contrived environments. Ultrasonic sensors are similar to lidar sensors except they measure with ultrasound instead of light. By choosing an inferior sensor for this project, it is important to understand its strengths and weaknesses. Ultrasonic sensors can detect objects up to thirteen feet in the distance while having an effective angle of approximately fifteen degrees. Nonetheless, for optimal measurements, it will require flat surfaces which are perpendicular to the ultrasonic sensor. By understanding the ultrasonic sensors physical limitations, it can be noted that clever programming must be implemented in order to filter out false-positive detections. Despite this concern, it is believed that four ping sensors will allow for sufficient object detection.[3]

sonar sensor sonar range

Figure 4: Sonar Sensor

Figure 5: Sonar Range


RC Input Management

As highlighted in Figure 7, the Arduino Mega ADK will be configured such that it manages the input from the RC transceiver and the ping sensors to the flight controller. In this way, the pilot will always be able to toggle between two modes: ‘pilot mode’ and ‘avoidance mode’. More specifically, the pilot will be able to override the collision avoidance functionality if the quad becomes unpredictable and unsafe. This design choice will serve as an important failsafe mechanism and hopefully reduce the risk of crashing during aerial testing and demonstrations.

Collision Avoidance Algorithm

The Arduino will continuously gather collision avoidance abstractiondistance measurements from an array of ultrasonic sensors. When an object comes within 5 feet of the quadcopter, one of the 4 sensors will be triggered and the avoidance maneuver will initiate. With the direction of the nearby object relative to quadcopter computed, the microcontroller will assign the opposing direction as the avoidance direction. With the avoidance direction determined, the Arduino will relay an avoidance maneuver to the flight controller, which in turn will result in the physical avoidance movement of the craft.

Testing Avoidance Algorithm and Circuitry

The collision avoidance circuitry will be prototyped on a breadboard. As for the aerial tests, the risk of crashing and injury is thereby removed during initial experiments. Furthermore, when full-scale tests are finally conducted, the avoidance maneuvers will be performed in a contrived space with little to no obstacles such as a gymnasium or soccer field. Under these circumstances, objects which approach the quadcopter are forced to do so in perpendicular fashion. Therefore, it is to be assumed that the quadcopter will be able to perform detections reasonably well under these conditions. 

Results

Embedded System

abstraction of quadcopter circuitry

Figure 7: Abstraction of Quadcopter Circuitry

When adding hardware components to an Arduino platform, it is a common practice to create a shield or a permanent circuit which sits on top of the Arduino taking advantage of all the general input/output pins. The Collision Avoidance Shield hides the complexity of the circuitry while making a new, more convenient set of input/output pins. As a result, the shield provides six pins for RC input signals, six pins for the analog output signals destined for a flight controller, 4 sets of 4 pin terminals for the HC-sr04 Ultrasonic Distance Sensors, and two pins for a regulated external power source input via the Arduino Vin and GND. 

collision avoidance shield

 
collision avoidance shield

Figure 8: Collision Avoidance Shield For Arduino Mega ADK (bottom)

Figure 9: Collision Avoidance Shield For Arduino Mega ADK (mounted on Arduino)

Quadcopter with Collision Avoidance System

Figure 10: Quadcopter with Collision Avoidance System

The final design follows a modular approach. In fact, the system has been tested to work with a variety of flight controllers. More specifically, the system was tested with a MultiWii V2.5 and a Naza M V2. The system is simply set up as a middleman, sitting between the receiver and the flight controller.  As a result, this additional system does not add any complicated installation.

Full-scale Collision Avoidance Test Results

The full-scale tests were mostly successful. Full-scale tests were conducted in a favorable environment, such that the collision objects were controlled. During such a test, the quadcopter can toggle from ‘pilot mode’ to ‘collision avoidance mode’. While in ‘pilot mode’, the RC pilot will position the quadcopter hovering approximately four feet above the ground or chest level and wait for the sonar sensors to be triggered. A human is holding a flat block of Styrofoam, a flat material that reflects ultrasound, will start by walking a trajectory towards an arbitrary side of the quad which has a sensor. During a successful performance, the quad will determine the direction of an approaching object and consequently redirect the aircraft approximately five feet horizontally in a safe (opposite) direction.

Full-scale Markov Collision Avoidance Test Results

Similarly to the approach for testing simple avoidance, testing Markov avoidance will begin by the RC pilot will position the quadcopter hovering approximately four feet above the ground. At this point, the Markov avoidance algorithm may be activated. During Markov avoidance, when a nearby object is detected, there will be a 60% chance it will perform an avoidance maneuver in the opposite direct, a 20% chance it will move relative left from the incoming object, and another 20% chance it will move relative right. As a result, in the case where an object is persistently triggering one sensor causing it to go in the opposite direction, eventually is would move out of the path of the incoming object.

Discussion

Challenges

This project faced some challenges from the very beginning. First, learning how to build and operate an RC quadcopter presented a fairly severe learning curve for this project. It was imperative that I learned how to pilot the craft safely and responsibly pilot before moving on to automated tests.

Second, it would have been ideal to make the collision avoidance system as small and lightweight as possible since weight drastically affects the time a craft can hover before the battery is drained and maneuverability. Hence, using an Arduino Micro, one of the smallest the Arduino microcontroller on the market, would have been ideal. However, the smaller models lack the number of necessary input/output pins for this project. As a result, I was forced to implement the embedded system with an Arduino Mega ADK.

Third, since my research is self-funded, I initially choose a flight controller that was cheap. I began flight tests with a MultiWii flight controller. However, I quickly found that it was largely unstable during flight. I soon switched to the Naza-M V2 flight controller because I needed a reliable system to test autonomous maneuvers safely.

Fourth, despite the advantages of Lidar over Sonar, Lidar sensors sell for around $100 a unit whereas a Sonar sensor cost around $5. Since I would need four sensors in total to get approximately 360°s of detection, the price of this option exceeded my budget. Instead, I purchased cheap Sonar sensors which caused many problems. Sonar works by sending out a burst of ultrasound through the air and listening for the echo when it bounces off of an object. This works well under normal conditions but becomes a  problem when introducing turbulence from the quadcopter propellers. In fact, turbulence causes frequent false-positive distance measurements. The problem was solved by implementing digital filters that essentially double check a triggering distance measurement with the median measurement from five individual pings.

Impacts Of Collision Avoidance Quadcopters

Drones are being purchased at an increasingly rapid rate, a trend that does not seem to be slowing down anytime soon. The US government has already implemented some measures in an attempt to regulate the massive boom in drone technology. For instance, the FAA has established new regulations and NASA has been testing their unmanned aircraft systems (UAS) traffic management (UTM) concept. By creating an avoidance system that is modular and can be adapted to any flight controller, it allows pilots to implement this new technology efficiently. By providing drones with the ability to react to their surrounding environment, I have developed a system that will make piloting easier and safer for recreational RC pilots. As for a commercial application, avoidance sensors may assist drones duration automated package deliveries. For these reasons, collisions avoidance system will make smart copters that much more intelligent.


Aidan Melen headshot

Computer Science Major, Art Minor

Shelburne, Vermont

I competed on the Westminster Snowboard team for 3 Years. I enjoy making and teaching pottery. I was the treasurer of the Ceramics Club. I also like spending time outdoors whenever I can.

I enrolled in an Embedded Systems Course during May-term at Westminster University. Here I was introduced to Arduino a small/affordable programmable microcontroller. I have created my appliances with it, such as: a Motion Sensor Box, a Alcohol Breathalyzer with an LED display, I have even uses it for art projects where once I create a human brain wire sculpture and outfitted it with RBG LEDs. I enjoy photograph and I very much wanted to get into airelle photography. Through this I became interested in drones.