Final Report Design, Implementationt, and Testing of a...

65
Final Report Design, Implementationt, and Testing of a UAV Quadcopter DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING SUMBMITTED FOR BACHELOR OF SCIENCE IN ENGINEERING DEGREE SUBMITTED BY: GROUP 11 MICHAEL HOANG TIK WAI (KIRAL) POON FACULTY ADVISOR: DR. WITOLD KINSNER March 28, 2013 c MICHAEL HOANG & TIK WAI POON

Transcript of Final Report Design, Implementationt, and Testing of a...

Final Report

Design, Implementationt, and Testing of a

UAV Quadcopter

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

SUMBMITTED FOR BACHELOR OF SCIENCE IN ENGINEERING DEGREE

SUBMITTED BY: GROUP 11

MICHAEL HOANGTIK WAI (KIRAL) POON

FACULTY ADVISOR: DR. WITOLD KINSNER

March 28, 2013c©MICHAEL HOANG & TIK WAI POON

Abstract

A quadcopter can achieve vertical flight in a stable manner and be used to monitor or collectdata in a specific region such as mapping terrains. Technological advances have reduced the costand increase the performance of the low power microcontrollers that allowed the general publicto develop their own quadcopter. The goal of this project is to build, modify, and improve anexisting quadcopter kit to obtain stable flight, gather and store GPS data, and perform auto-commands, such as auto-landing. The project used an Aeroquad quadcopter kit that included aframe, motors, electronic speed controllers, Arduino Mega development board, and sensor boardsand used with the provided Aeroquad software. Batteries, a transmitter, a receiver, a GPS module,and a micro SD card adaptor were interfaced with the kit. The aeroquad software was modified toproperly interface the components with the quadcopter kit. Individual components were tested andverified to work properly. Calibration and tuning of the PID controller was done to obtain properstabilization on each axis using custom PID test benches. Currently, the quadcopter can properlystabilize itself, determine its GPS location, and store and log data. This report also described theauto-commands that can be implement at a later stage. Most of the goals in this project have beenachieved, resulting in a stable and maneuverable quadcopter.

Contributions

Dr. W. Kinsner was our faculty advisor. The project was conceived by him. He provided valuableexperience, knowledge, and guidance to us throughout the project.

Michael Hoang and Kiral Poon, made up the two student team who undertook the project anddesigned and implemented the system.

Michael Hoang was responsible for the building and wiring up the frame, testing and programmingthe electronic speed controllers (ESC), motors, and interfacing and testing of the Global PositioningSystem (GPS) receiver and external memory for data logging. He was also responsible for compilingthe final report using LATEX.

Kiral Poon was responsible for the soldering parts, interfacing, testing and verifying the 9 degreeof freedom sensor board, barometer, transceiver, receiver and flying the quadcopter. He was alsoin charge of the stabilization and tuning of the system.

Both Michael and Kiral were responsible for the maintenance of the quadcopter. This would behelpful on a continuous development on the quadcopter project.

- i -

Acknowledgements

We would like the following people for their role in this project:

• Our parents, families and friends for encouraging and supporting us throughout this project.

• Our Advisor Dr. W. Kinsner whose insight and guidance were invaluable.

• The Electrical and Computer Engineering department for providing us with an education andbeing supportive throughout this project.

• The Electrical and Computer Engineering Tech Shop for their technical help and knowledge-ment.

• The Electrical and Computer Engineering Machine Shop for their fine work and expertise.

• University of Manitoba IEEE for providing us plenty of workspace and the tools we neededto complete this project.

• Our friend Matt McQuaker for helping us to make a wood stand for the quadcopter.

• Out friend Mike Lambeta for helping us solder connectors for our ESC.

• Our peers and school-mates at the University of Manitoba IEEE.

- ii -

Contents

Contributions i

Acknowledgements ii

List of Figures iv

List of Tables v

Glossary vi

1 Introduction 1

2 Background 32.1 UAV Quadcopter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.1.1 Flight Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.2 Advantages of a Quadcopter . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Specifications and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 System Design 83.1 Project Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1.1 The Research Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.1.2 Building & Interfacing Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.1.3 The Tuning/Calibration Stage . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1.4 The Programming Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.2 Quadcopter Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.3 Physical Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.3.1 Aeroquad Cyclone Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.3.2 Electric Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.4 Electronic Speed Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4.1 Aeroquad Control Board v2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.4.2 Transmitter and Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.4.3 GPS Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.4.4 SD Card Adaptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.4.5 Battery/Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.5 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.5.1 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.5.2 Aeroquad Flight Software & Configurator . . . . . . . . . . . . . . . . . . . . 203.5.3 GPS Reading Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.5.4 Data Logging Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.5.5 Auto-commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

- iii -

3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

4 Experimental Results and Discussion 254.1 System Verification and Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.1.1 Aeroquad Control Board v2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 254.1.2 Orientation Kinematics algorithm . . . . . . . . . . . . . . . . . . . . . . . . 274.1.3 Motors and Electronic Speed Controller . . . . . . . . . . . . . . . . . . . . . 314.1.4 GPS and Data logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.1.5 PID Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

4.2 Flight Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.2.1 Initial Test Flight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.2.2 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.3.1 Difficulties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.3.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

4.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5 Conclusions 45

References 47

Appendix A - Curriculum Vitae 1

Appendix B - Budget 1

Appendix C - AI Command Flow Charts 1

Appendix D - DVD Content 1

- iv -

List of Figures

1.1 Flying Quadcopter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2.1 Quadcopter: Motor rotation directions. . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Quadcopter: Vertical thrust movement. . . . . . . . . . . . . . . . . . . . . . . . . . 42.3 Quadcopter: Pitch movement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.4 Quadcopter: Roll movement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.5 Quadcopter: Yaw movement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.1 Aeroquad Cyclone Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 BP A2217-9 electric brushless motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.3 30A Hobbywing Flyfun brushless ESC. . . . . . . . . . . . . . . . . . . . . . . . . . . 133.4 Aeroquad Control Board v2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.5 Spektrum DX7S receiver(left) and transmitter(right). . . . . . . . . . . . . . . . . . . 163.6 MicroSD Adaptor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.7 Battery and Balancer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.8 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.9 Arduino Configurator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4.1 Pitch Test Up: (a) Graphical representation . (b) 3D rendering of quadcopter. . . . 284.2 Pitch Test Down: (a) Graphical representation. (b) 3D rendering of quadcopter. . . 294.3 Diagram of the the frame representations . . . . . . . . . . . . . . . . . . . . . . . . 304.4 Motor & ESC test bench: (a) Block diagram. (b) Test bench. . . . . . . . . . . . . . 324.5 Flowchart of GPS data logging program. . . . . . . . . . . . . . . . . . . . . . . . . . 344.6 Output of testing program, using the PMB-648 GPS receiver. . . . . . . . . . . . . . 354.7 GPS test results mapped on Google Maps[1]. . . . . . . . . . . . . . . . . . . . . . 374.8 GPS/SD Card Shield: (a) Top view. (b)Bottom view. . . . . . . . . . . . . . . . . . 384.9 Block diagram of PID controller in feedback loop. . . . . . . . . . . . . . . . . . . . . 394.10 PID test stand design 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.11 PID test stand design 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.12 Initial flight test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.13 Damaged arms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

5.1 Auto-land command flow chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2 Auto-hold command flow chart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.3 Auto-move/home command flow chart. . . . . . . . . . . . . . . . . . . . . . . . . . . 4

- v -

List of Tables

3.1 GPS comparision table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4.1 Data sheet and measured values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1 Project Budget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

- vi -

Glossary

9DOF 9 Degrees of freedom sensor board that has a 3-axis gyroscope, 3-axis accelerometer,and 3-axis magnetometer.

Accelerometer A sensor that measures acceleration.

AM Amplitude modulation. A technique used to strengthen radio waves.

Arduino Mega A development based board based on the ATMega microcontroller family.

Arduino Uno A development based board based on the ATMega microcontroller family.

Barometer A sensor that measures air pressure.

Baud rate The maximum number of signal changes allowed in a second. I can be interpretedas symbols per second, where each symbols can transmit one or more bits.

Bluetooth Standardized technology used to transfer data wirelessly.

BoB Break out board. BoB is a electrical board made specifically for easier access to the pinsof a electrical component.

DCM Direction cosine matrix.

DSM, DSM2 Digital spectrum modulation. An application of DSSS.

DSSS Direct sequencing spread spectrum. A technique used to avoid radio channels that cancause inteference.

ESC Electronic speed controller. A ESC is an electric circuit that controls the speed of a motor.

FM Frequency modulation. A technique used to modulate radio waves to transmit information.

GPS Global Positioning System. A GPS receiver acquires information from multiple satellitesto calculate its current position.

Gyroscope A sensor that measures orientation.

GUIC Globally unique identification code. A unique identification code that is assigned toevery radio transmitter.

IDE Integrated Development Environment.

ISM Industrial, scientific, and medical radio bands. A radio band reserved specifically for

- vii -

industrial, scientific, and medical purposes.

LiPo Lithium polymer battery.

Magnetometer A sensor that measures the strength of magnetic fields.

NiCad Nickel Cadmium battery.

NiMH Nickel-Metal Hydride battery.

NMEA National Marine Electronics Association. Repsponsible for the GPS statndard sen-tences.

RC Radio Control

RF Radio frequency.

Roll The roll axis lies along the aircraft centerline. Movevement in a particular direction byturning on this axis.

Rotor (motor) Rotating part of the motor.

Rotor (wing) Rotary wing of a rotorcraft, helicopter, quadcopter, hexacopter.

RTF An acronym for Ready-to-Fly.

RPM Revolutions per minute. Unit to measure speed of a motor.

SD card Secure Digital memory device. Non-volatile meory card.

MIT Massachusetts Institute of Technology.

PID controller Proportional-Integral-Differential controller.

Pitch The pitch axis is perpendicular to the aircraft centerline. A pitch motion is an up ordown movement of the nose of the aircraft.

PWM Pulse width modulation. A technique used to change the pulse width of a signal.

Stator Stationary part of a motor.

SPI Serial Peripheral Interface Bus. SPI is a full duplex synchronized serial bus.

UAV Unmanned aerial Vehicle. An aerial vehicle that with no onboard human controller.

- viii -

UTC Coordinated universal time.

WiFi Standardized technology used to transfer signals wirelessy.

Yaw Movement about the vertical axis of an aircraft.

- ix -

1. Introduction

This document is a final report for the ECE4600 - Group Design Project at the University of

Manitoba, the Department of Electrical and Computer Engineering; It is a record of the project

undertaken. This document is available electronically.

A quadcopter is an aerial vehicle that uses four rotors for lift, steering, and stabilization. Unlike

other aerial vehicles, the quadcopter can achieve vertical flight in a more stable condition. The

quadcopter is not affected by the torque issues that a helicopter experiences due to the main rotor.

Furthermore, due to the quadcopter’s cyclic design, it is easier to construct and maintain [2]. As

the technology becomes more advanced and more accessible to the public, many engineers and

researchers have started designing and implementing quadcopters for different uses [3].

Figure 1.1: Flying Quadcopter.

Various groups such as the military, engineers, researchers, and hobbyists have been developing

quadcopters to understand different technical areas. For example, quadcopters can be used for re-

connaissance and collecting data. This could range from searching for survival victims in a disaster

area to checking the state of electrical power lines. Some quadcopters in production today can hold

light payloads, such as food and medical supplies, and deliver them to areas where normal planes

can not reach [4]. Many amateur radio operators have designed and built their own multi-copters.

Universities, such as MIT, have been studying and doing research for the quadcopter over the past

couple of years [5]. This would be a great opportunity for students of the University of Manitoba

to join this area of study.

- 1 of 47 -

The aim of this project was to build and program a quadcopter that can be used to collect

GPS information of a surrounding area. This project was a great learning opportunity for us to

apply our engineering knowledge. The thesis addresses the difficulties our group faced throughout

the project. Choosing the quadcopter parts was not a simple process. In order to complete the

quadcopter a battery, transmitter, receiver, GPS module, and micro SD adaptor was selected. Each

component was then interfaced, tested, and verified to be working properly. The tuning of the PID

control system was accomplished using a custom test benches. This was a long process because

three different PID control systems for pitch, roll, and yaw had to be tuned carefully for proper

stabilization. A secondary goal of this project is to use this platform for future innovative projects

that could include stabilization, image processing and artificial intelligence.

- 2 of 47 -

2. Background

This section includes the general background information on an unmanned aerial vehicle (UAV)

quadcopters. This section also covers our goals and specifications for the project undertaken.

2.1 UAV Quadcopter

A UAV quadcopter is an unmanned aerial vehicle with four rotating rotors used for lift and

movement. It uses an electronic control system and electronic sensors to help stabilize itself.

Quadcopter parts have been decreasing in price over the past couple of years due to technological

advances. As a result more hobbyists, universities, and industries are taking advantage of this

opportunity to design and develop applications for the quadcopter.

2.1.1 Flight Control

A quadcopter consists of four motors evenly distributed along the quadcopter frame as can be

seen in figure 2.1 below. The circles represent the spinning rotors of the quadcopter and the arrows

represent the rotation direction. Motors one and three rotate in a clockwise direction using pusher

rotors. Motor two and four rotate in a counter-clockwise direction using puller rotors. Each motor

produces a thrust and torque about the center of the quadcopter. Due to the opposite spinning di-

rections of the motors, the net torque about the center of the quadcopter is ideally zero, producing

zero angular acceleration. This eliminates the need for yaw stabilization.

A vertical force is created by increasing the speed of all the motors by the same amount of throt-

tle. As the vertical forces overcome the gravitational forces of the earth, the quadcopter begins to

rise in altitude. Figure 2.2 shows the vertical movement of the quadcopter. As above, the circles

represent the spinning rotors, the larger arrows represent the direction the rotors are spinning, and

the black arrows represent the forces caused by the spinning rotors.

Pitch is provided by increasing (or decreasing) the speed of the front or rear motors. This

causes the quadcopter to turn along the x axis. The overall vertical thrust is the same as hovering

due to the left and right motors; hence only pitch angle acceleration is changed. Figure 2.3 shows

an example of pitch movement of a quadcopter. As the front motor slows down, the forces created

by the corresponding rotor are less then the forces created by the back rotor. These forces are rep-

resented by the blue arrows. These forces cause the quadcopter to tip forward and this movement

is represented by the red arrow.

- 3 of 47 -

Figure 2.1: Quadcopter: Motor rotation directions.

Figure 2.2: Quadcopter: Vertical thrust movement.

Roll is provided by increasing (or decreasing) the speed of the left rotor speed and right motors.

This causes the quadcopter to turn along the y axis. The overall vertical thrust is the same as

hovering due to the front and back motors; hence only roll angle acceleration is changed. Figure 2.4

shows an example of roll movement of a quadcopter. As the right motor slows down, the forces

created by the corresponding rotor are less then the forces created by the left rotor. These forces are

represented by the blue arrows. This causes the quadcopter to tip to the right and this movement

is represented by the red arrow.

Yaw is provided by increasing (or decreasing) the speed of the front and rear motors or by

increasing (or decreasing) the speed of the left and right motors. This causes the quadcopter to

turn along its vertical axis in the direction of the stronger spinning rotors. Figure 2.5 shows an

- 4 of 47 -

Figure 2.3: Quadcopter: Pitch movement.

Figure 2.4: Quadcopter: Roll movement.

example of yaw movement of a quadcopter. As the front and back motor slows down, the forces

created by the corresponding rotors are less then the forces created by the left and right rotors.

The quadcopter will begin to rotate in the same direction as the faster spinning rotors due to the

differencen in torque forces. This movement is represented by the red arrow.

2.1.2 Advantages of a Quadcopter

There are many advantages to quadcopters compared to other aircrafts. A quadcopter does not

require a large area to obtain lift, like a fixed wing aircraft does. The quadcopter creates thrust

with four evenly distributed motors along its frame. A helicopter suffers from torque issue due

to its main rotor. The design of the quadcopter does not suffer from the same torque issues as

the helicopter. The counter balancing forces of the spinning motors cancel out the torque forces

caused by each motor causing the quadcopter to balance itself. Because the quadcopter uses four

rotors instead of one main rotor, it requires less kinetic energy per rotor for the same amount of

thrust when compared to the helicopter. Due to this and its symmetrical design, a quadcopter

- 5 of 47 -

Figure 2.5: Quadcopter: Yaw movement.

maintenance and manufacturing costs are relatively lower then other aircrafts [6].

2.2 Motivation

This project created a platform to learn about unmanned aerial vehicles such as a quadcopter.

This expands the scope of the computer engineering education to include the control and the un-

derstanding of the mechanical components. The quadcopter has many applications that we are

interested to develop like mapping and reconnaissance especially in a disaster and dangerous area.

It also open up the possibilities to broaden the understanding and applications of control systems,

stabilization, artificial intelligence and computer image processing as it applies to the quadcopter.

2.3 Specifications and Goals

The goal of our project is to design, implement, and test a stable flying UAV quadcopter that

can be used to collect and save Global Positioning System (GPS) data. Our plan was to choose an

existing quadcopter kit and add the required components to give the quadcopter the capabilities to

gather and log data autonomously. A GPS module will be used to determine the current position

and an SD card will be used to store the information needed. If this goal is accomplished, our team

would also like to design and implement some autonomous commands that may help aid a user

in collecting the data. These commands include the auto-landing command, auto-move command,

auto-homing command, and hold position command.

The final quadcopter design had to meet the following specifications:

1. The quadcopter must be capable of flying and landing in stable manner.

2. The quadcopter must be capable of determining its current location using GPS data.

- 6 of 47 -

3. The quadcopter must be capable to storing and logging data.

4. The quadcopter must be able to perform the following commands:

• auto-landing

• auto-move

• auto-homing

• hold position

2.4 Summary

The aim of this project was to build and program a quadcopter that can be used to collect

GPS information of a surrounding area. This project was a great learning opportunity for us to

apply our engineering knowledge. The thesis addresses the difficulties our group faced throughout

the project. The tuning of the PID control system was accomplished using a custom test benches.

It also open up the possibilities to broaden the understanding and applications of control systems,

stabilization, artificial intelligence and computer image processing as it applies to the quadcopter.

- 7 of 47 -

3. System Design

This section explains in details how the project was approached. All hardware and software

components that will be used will be explained in this section of the report. Problems encountered

and solutions to these problems will not be mentioned in this section of the report.

3.1 Project Overview

The ultimate goal of this project is to design a UAV quadcopter that is able to store and log

information. This project could be used in many applications, ranging from checking the condition

of power lines to searching for survival victims in a disaster area. The end result of this project

could be used for these applications in future developments in this field.

Due to the time constraints of our project, it was not possible to design and build a quadopter

from scratch. Therefore, it was decided that our group would purchase an existing quadcopter kit

and interface the necessary components to fly, stablize and log data. This project was split into

four main stages; the research stage, the building and interfacing stage, the tuning and calibration

stage, and the programming stage. Each stage will be explained more thoroughly in the following

sections of this document.

3.1.1 The Research Stage

The research stage was a critical stage that provided our team with the knowledge necessary to

complete the other stages of our project. This stage was an ongoing process that our team had to

return to many times during the development process to gain the knowledge needed to continue on

with the project. Our research encompassed a wide range of sources, which included studies done

at different universities and hobby enthusiast sources. Our reseach included the aerodynamics of

the quadcopter, theory and principle of each quadcopter component, and how the Aeroquad soft-

ware [7] should be modified to fit the purposes of our project.

3.1.2 Building & Interfacing Stage

This stage started when the ordered parts started arriving. During this stage we focused on

verifying and testing each component thoroughly. The testing process will be explained in greater

detail in a later section in this document. After each part was verified to be working correctly, we

combined the components together. The frame and control board were assembled, the motors and

- 8 of 47 -

electronic speed controllers (ESC) were mounted, and the GPS module, SD card adapter, and the

transmitter and receiver were interfaced. The next step was to tune and calibrate the quadcopter.

3.1.3 The Tuning/Calibration Stage

During this stage the quadcopter proportional-integral-derivative (PID) control system was

tuned. A tuning stand was built to mount the quadcopter on to help us tune the PID system of

the quadcopter. This was a tedious process. After some initial tuning, the quadcopter was ready

for its first flight test. The PID testing process and results of the flight test will be explained in

greater detail later section in this document.

3.1.4 The Programming Stage

In this stage of our project we were to design four different commands for our quadcopter.

The preliminary designs for these commands have been drawn out and will be explained in greater

detail in a later section of this document. Unfortunately we did not get very far in this stage and

programming for these commands has yet to be started.

3.2 Quadcopter Kit

Below is a list of quadcopter kits that we considered purchasing to use for our project. Each

kit had its advantages and disadvantages. We compared each kit and explain why we chose the

Aeroquad Cyclone kit over the others.

AR Drone 2.0

• $330.00, comes with camera and smart phone capability

• Programmable, comes with software development kit

• Replacement parts are rare, hard to modify

• Does not support RF equipment

• Support a maximum altitude of 50m

Parallax Elev-8 Quadcopter Kit

• $599.00, no battery and RF radio equipment

• Open source hardware, design files available online

- 9 of 47 -

• Modular, easy to modify and replace parts

• No room to add GPS and OSD

• Out of stock from September to October

Aeroquad Cyclone Kit

• $535.00, no battery and RF radio equipment

• Open source hardware, design files available online

• Open source software, software available online

• Arduino Mega used as microcontroller

• Many available ports for additional add-ons

• Modular, easy to modify and replace parts

In the past, a programmable quadcopter that included the frame, ESC, motors, and microcon-

troller would cost more than $1500-2000. In the last couple of years, prices have greatly dropped due

to the advancement in technology. After some research was done by the members of the group and

a discussion with our student advisor, one of three different quadcopters was chosen for our project.

The three different quadcopters included the AR drone 2.0, the ELEV-8 quadcopter kit devel-

oped by Parallax, and the Cyclone kit developed by Aeroquad. The AR Drone 2.0 was did not

need any assembly and was ready-to-fly out of the box. It also comes with a software development

kit that can be used to program the quadcopter. However for our applications a GPS module and

SD card adaptor were needed for data collection. These components would be extremely hard to

interface with the AR Drone due to the lack of space and available ports on the quadcopter. The

AR Drone was not chosen due to this reason.

The ELEV-8 quadcopter kit and Cyclone quadcopter kit both had very similar advantages.

Both came with similar components at similar price range. Both quadcopter kits were built in

a modular design that allowed for easy modification of hardware. The main reason we chose the

Aeroquad Cyclone kit over the Parallax ELEV-8 kit because the Aeroquad Cyclone kit used an

Arduino Mega as its controller board. An Arduino is a development board that has easy to use

hardware and software. Both members of the group is familiar with this development board. This

would save time of having to learn in a different development environment used by the controller

of the Parallax kit. Furthermore, parts of the frame of the Aeroquad quadcopter were made of

- 10 of 47 -

simple parts that could be found at any local hardware store. Therefore replacement parts could

be easily found for repair and maintenance. In addition, the ELEV-8 quadcopter was out of stock

for the months of September and early October. Thus, the Aeroquad Cyclone kit was chosen over

the Parallax ELEV-8 kit.

3.3 Physical Components

This subsection describes all the physical components of our project and how they work. As

well as the reasoning for choosing the GPS module, SD card, battery, and transmitter and receiver

that were not included with the Aeroquad Cyclone kit.

3.3.1 Aeroquad Cyclone Frame

Figure 3.1: Aeroquad Cyclone Kit

The Aeroquad Cyclone frame that comes with the kit is strong and durable. It uses a combina-

tion of carbon fiber plates and aluminum arms for strength and durability. The frame is designed

in such a way that many different configurations could be used, supporting up to eight different

motors in an octocopter configuration. The design is also very modular, in a way that you could

easily add components to the frame by adding an extra carbon plate onto the quadcopter. The

arms are made of regular 5/8 inch hollow square aluminum bars and uses common nuts and bolts

to hold the frame together. Other than the carbon fiber plates, everything can be found at a local

hardware store. This allows easy accessible replacement parts for replacement or maintenance.

Figure 3.1 shows a completed Aeroquad Cyclone Kit.

- 11 of 47 -

3.3.2 Electric Motors

Figure 3.2: BP A2217-9 electric brushless motor.

The Aeroquad kit came with four BP A2217-9 electric brushless motor. These motors are shown

in figure 3.2. These motors run at maximum efficiency at 15 amperes of current and can handle

currents of up to 18 amperes for up to sixty seconds. The maximum revolutions per minute per

volt is 950 kpv and the maximum amount of power the motors can handle is 200 watts. These

motors are also relatively light, weighing about 73.4 grams.

There are two types of motors, brushless and brushed. A basic brushless motor has three

electromagnetic windings separated evenly on the stationary part of the motor, called a stator.

Permanent magnets are located on the rotating part of the motor, called a rotor. The rotor will

begin to rotate when two of the three windings are supplied with a voltage, creating a magnetic

field. The magnetic field created by the windings pushes and pull against the magnetic field cre-

ated by the magnets on the rotor. When the magnetic fields are aligned, two different windings

are driven and a new magnetic field is created causing the rotor to continue to turn. A controller

is used to determine the current rotor position relative to the windings and drive the necessary

windings in certain sequence to turn the rotor in the proper direction. The rotor will turn in the

opposite direction if the sequence is reversed.

A brushed motor works in a similar fashion. A brushed motor has the opposite orientation

of brushless motor. The electromagnetic windings are located on the rotor and the magnets are

located on the stator. Like a brushless motor, the rotor on a brushed motor turns due to the

attractive and repulsive forces of the two magnetic fields created by the windings and the magnets.

The main difference between these two motors is that a brushed motor uses a mechanical switch to

change the polarity of the windings to turn the rotor. A brushed motor is more susceptible to wear

and tear because it uses a mechanical mechanism to check and change the polarity of its windings.

It is also limited in speed due to the same reason [8].

- 12 of 47 -

3.4 Electronic Speed Controllers

Figure 3.3: 30A Hobbywing Flyfun brushless ESC.

The Aeroquad kit came with four Hobbywing FlyFun brushless ESC rated at 30 amperes. These

ESC can be seen in figure 3.3. These ESC can push 30 amperes of current continuously, can push

currents up to 40 amperes for ten seconds based on voltage output, and handle speeds up to 210,000

rotations per minute (RPM). One ESC was found to be malfunctioning during testing and extra

ESCs were purchased. We will go into more details about this later in the document.

An electronic speed controller is an electrical circuit that controls the speed of an electric motor

and the direction a motor rotates. A motor turns because of the magnetic forces created by the

windings and the magnets within the motor.

For a brushless motor, the speed of the motor will depend on the frequency of the winding drive

sequence. On a basic brushless motor, there are three windings that are controlled using pulse

width modulated (PWM) signals. Two windings will be driven at a time to create the necessary

magnetic forces to turn the rotor. The greater the frequency sent to the motors, the faster the

rotor will turn due to the magnetic forces. The frequency of the signals is adjusted by changing

the pulse width of the signal. Smaller pulse widths will increase the frequency of a PWM sig-

nal because more pulses can be sent to the windings in the same time duration, and vice versa for

large pulse widths. A brushed ESC works in the same manner but only two control signals are used.

- 13 of 47 -

3.4.1 Aeroquad Control Board v2.1

The controller board that came with the quadcopter kit purchased consists of an Arduino Mega

2560 development board, an Aeroquad shield, a barometric sensor, and 9 degrees of freedom (9DOF)

sensor board, which includes a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetometer.

The assembled control board can be seen in figure 3.4.

Figure 3.4: Aeroquad Control Board v2.1

The 9DOF board measures roll, pitch, and yaw by measuring orientation, angular momentum,

and magnetic forces by using the 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetome-

ter respectively. The barometric sensor measures the surrounding air pressure. After assembling

the Aeroquad shield, testing on the each of the sensors was done. Example test programs were

provided with our quadcopter kit to help test the precision and accuracy of each sensor. There

were some problems with the software though. These issues will be explained in detail later in the

document.

3.4.2 Transmitter and Receiver

Our group came up with three different options for wireless communication system for our

quadcopter. There are three main options to choose from which include a radio transmitter and

receiver, a WiFi module, or a Bluetooth module. For our purposes we would need at least six

channels to control our quadcopter. The six channels correspond to throttle, roll, yaw, pitch, one

channel to switch between acrobatic mode and stable mode, and one or more channels for our

auto-commands. More details of the of the two different modes will be discussed in a the PID

tuning section. Below is a list of the options we looked at.

- 14 of 47 -

Spektrum DX7S transmitter and AR800 receiver

• Price: $334.00

• Support up to 7 channels at 2.4 GHz

• Range up to 305 meters (1000 feet)

• Support DSM2

• Easy to interface

Sparkfun WiFi module

• Price: $95.00

• Smartphone compatibility

• Support up to 8 channels

• Range only up to 50 meters

BLTE Arduino Bluetooth shield

• Price: $45.00

• Bluetooth 4.0

• Low power consumption

• Range only up to 10 meters

Our group decided to choose the Spektrum DX7S transmitter and the AR800 receiver because

it had the required amount of channels needed for our quadcopter purposes. The transmitter and

receiver also had the greatest range of transmission was also easy to interface with our control

board. If we were to interface the other WiFi module or the Bluetooth module, separate channels

need to be programmed and large amounts of programming would be needed. Therefore the Spek-

trum transmitter and receiver was chosen and shown in figure 3.5.

The Spektrum DX7S transmitter and receiver were properly interfaced with the quadcopter

controller board. Some difficulties encountered during interfacing were that both the controller

board and receiver used male pins. The quadcopter kit that was purchased did not come with the

necessary cables to connect these two components together. Female-to-female servo cables were

- 15 of 47 -

Figure 3.5: Spektrum DX7S receiver(left) and transmitter(right).

purchased to solve this problem.

Wireless telecommunication is the transfer of information between two or more points that are

not physically connected. Radio is the transmission of signals through free space by electromagnetic

waves. The frequency range in radio is from 3 kHz to 300 GHz [9]. There are different techniques

used in electronic communication; which include Amplitude modulation (AM), frequency modula-

tion (FM), DSSS, DSM, and DSM2.

AM works by varying the strength of the transmitted signal in relation to the information being

sent. In the other hand, FM works by varying the frequencies of the transmitted signal.

In the past, radio technologies like FM are widely used in radio control (RC). The 27 MHz

to 49 MHz frequencies bands are designated by law for use with RC airplanes and aircraft. The

designated frequencies for RC planes or aircraft fall into the 72 MHz band and each separate fre-

quency has been given a unique channel number. The dedicated remote control frequencies avoid

interference by unlicensed use [10]. Frequency checker is used to make sure no one is occupying the

same channels. If there are two people using the same channel to control the aircraft, interference

would occur and aircraft might crash.

In RC control the latest technology to avoid interference of signal occurs is Direct Sequencing

Spread Spectrum (DSSS). DSSS operates within the 2.4GHz frequency band. This new technology

was a form of secure radio signal transmission. DSM and DSM2 are applications of DSSS. A Glob-

ally Unique Identification Code (GUIC) is assigned to every radio transmitter during manufacture.

The receiver is programmed to identify that unique in what is known as the ”‘binding process”’,

- 16 of 47 -

and so the transmitter and receiver lock together with the same code which will block out other

code [11]. The binding process occurs a couple of seconds every time the system is powered up.

Once the transmitter and receiver locked together, the transmitted signal is spread out over a wide

band before being identified, collected and re-assembled by the receiver.

3.4.3 GPS Module

Our quadcopter needed a GPS module that was small, fast and accurate, consume as little

power as possible, and was easy to interface with the existing control board. We looked at three

different GPS receivers and chose the best one that would meet our requirements. Table 3.6 shows

a list of features we looked at when comparing the GPS modules.

Table 3.1: GPS comparision table.

We initially chose the GS407 Helical GPS receiver because it was the smallest, lightest, and

most accurate module. Although it did not have the fastest baud rate, we thought that it was quick

enough for the purposes we were using it for. Another reason why we chose the GS407 receiver over

the others was because it came with a break out board that was specifically made to directly connect

to the Aeroquad control board. This allowed for easy interfacing between the two components. Un-

fortunately we ran into a few problems that we will mention in further detail later in this document.

The second GPS receiver module purchased was the Parallax PMB-648 receiver using the SiRF-

starIII chipset. Although this module was slower and heavier than the GS407 module, the PMB-648

receiver cost less and was readily available at time of purchase. The module was also easy to in-

terface because it came with a connector with wires already connected to the module instead of a

fragile break out board.

A GPS is a satellite network operated by the United States of America Department of Defense.

This network of satellites transmits data about its current location and time. A GPS receiver

passively retrieves this data from multiple satellites to estimate its position. By estimating the

distance between more than three satellites, a GPS receiver can determine its current position in

- 17 of 47 -

three dimensions.

3.4.4 SD Card Adaptor

For our project we needed a hardware component to store data. This component needed to be

light weight, easy to interface, low cost, and reliable. A micro SD card only weighs 0.5 grams and

there are many different Arduino libraries available, for easy interfacing.

Figure 3.6: MicroSD Adaptor.

The micro SD card adaptor chosen for our project was developed by Gravitech, and is shown

in figure 3.6. Most models of SD card adaptors are very similar in performance, price, and are all

easily interfaced with the SPI ports of an Arduino board. This model was chosen over the others

because it had smaller dimensions (1.4x0.8), can use micro SD cards up to 2GB in size, and can

transfer data up to 12.5 MB/sec. The microSD card adaptor will be used for data logging purposes

for our project, logging GPS data such as longitude, latitude, and altitude.

3.4.5 Battery/Power Supply

For our project we need a power supply that is low cost, light weight, reusable, and has enough

power for at least ten minutes of flight. Rechargeable batteries were chosen for our project due to

reuse value. Currently there are three main types of rechargeable batteries available commercially

for radio controlled models, nickel-cadmium (NiCad), nickel-metal hydride (NiMH), and lithium

polymer (LiPo) batteries.

NiCad batteries have a low internal resistance that allows for high-power output, can operate a

large temperature range, but suffers from “memory” loss. This term memory refers to the amount

of capacity the battery can store after each discharge. The overall capacity of the NiCad battery

will decrease over a duration of time. NiMH batteries are similar to NiCad batteries except they

can hold 30% more capacity, but suffer from a larger memory loss [12].

- 18 of 47 -

LiPo batteries can hold 30% more capacity and are much lighter than a NiMH battery. LiPo

batteries also suffer from a lower memory loss compared to the NiMH battery. The disadvantages

to this battery are that these type of batteries are prone to overheating and overcharging the bat-

teries could lead to fire. Extreme care must be taken when using these type of batteries [12].

Due to these reasons, our group has chosen to use a LiPo battery. At this point and time we

had just started choosing parts for our quadcopter. To choose the size of battery we had to make

some calculations. All calculations and measurements were based on datasheet specifications. To

calculate the amount of thrust we needed to overcome gravity, the overall weight of the quadcopter

and all its components was found to be about 1550 grams. We may want to add extra components

in the future, so we made these calculations with that in mind and assumed the total weight to be

1800 grams. Our quadcopter has four motors, therefore 450 grams of thrust was needed for each

motor to overcome the forces of gravity.

Using the data sheets we estimated the amount of power needed to run the motors and other

components to be about 70 watts. Using the following equation,

I =P

V=

70W

11.1V= 6.3A. (3.1)

where I is current in amperes, P is power in watts, and V is voltage in volts. We calculated the

amount of current needed for a 3 celled LiPo battery running at 11.1 volts to be about 6.3 amperes.

Multiply this by the amount of motors and we needed about 22.2 amperes to fly the quadcopter.

Using Peukert’s Law [13], we can determine the capacity amount needed for a estimated flight

duration of about 10 minutes.

C =T × Ik

60=

10min× 22.2A

60= 3.7AH (3.2)

C is battery capacity measured in amperes-hour, k is Peukert’s constant which we assumed to

be 1, and T is time measured in minutes. The calculated capacity per hour was calculated to be

3.7 amperes-hour. We rounded this value up and chose to purchase the Turnigy 3 cell LiPo battery

with a capacity of 4000 milliamperes-hour. All these calculations were based on rough estimates,

since we did not any components available for testing at the time of purchase of the battery. We

over specified the weight to make had enough power to fly ourquadcopter. The estimated weight

- 19 of 47 -

was 1800 grams. The final measured weight of the quadcopter kit and all of its components were

measured to by 1684 grams. Figure 3.7 shows the battery we chose and the balancer needed to

charge the battery safely.

Figure 3.7: Battery and Balancer.

3.5 Software

This subsection describes all the software components of our project and how they work. The

GPS and data logging routines, and AI commands will also be mentioned in this section of the

document.

3.5.1 Arduino IDE

For our project we will be focusing on programming in the Arduino IDE. The Arduino IDE is

a development environment that uses a simple user interface for adding and editing in the Arduino

coding language, which is a based on the C++ programming language. Figure 3.8 shows the Ar-

duino IDE.

3.5.2 Aeroquad Flight Software & Configurator

The included Aeroquad software is a combination of two programs, the Aeroquad flight software

and Aeroquad configurator. The Aeroquad flight software can be directly uploaded to an Arduino

board via the Arduino IDE. Aeroquad flight software also included some test programs for the

various sensors. This flight software supports multiple flight configurations. Our group chose the

Quad+ configuration because it made the PID tuning process easier. The Quad+ configuration

- 20 of 47 -

Figure 3.8: Arduino IDE

has the front and back of the microcontroller aligned with one set of motors on the same axis and

perpendicular to the other. The Quad+ configuration is shown in figure 2.1

The Aeroquad flight software [7] also supports a heading hold command using the magnetome-

ter or gyroscope sensors, altitude hold command using the barometer or ultrasonic sensor. Our

quadcopter can support both these commands, but an ultrasonic sensor is needed for proper op-

eration of the altitude hold command. The flight software supports up to 10 channels. For our

project only six channels are required. Five channels are used for throttle, yaw, pitch, roll, and one

channel for changing modes. And another channel for our auto-commands.

The Aeroquad flight software was made for a range of different quadcopters. The settings

are not specific to any existing quadcopter. Certain settings and changes were made in the pro-

gram to make it work specifically for our quadcopter. These modifications will be discussed later in

the report. Figure 3.9 shows the Aerquad configurator that is available with the Aeroquad software.

The Aeroquad configurator is a tool with an easy-to-use graphical user interface (GUI) provided

by Aeroquad to setup and check the quadcopter flight characteristics of a quadcopter. The config-

urator provides a direct environment to change parameters in the Aeroquad flight software. You

- 21 of 47 -

Figure 3.9: Arduino Configurator

- 22 of 47 -

can also perform calibration and PID tuning, and check vehicles status, transmitter commands,

and motor controls using the configurator. The alternative is directly accessing and changing data

using the Arduino IDE. The alternative method of controlling quadcopter is not recommended by

our group because of the unnecessary complication. This will be discussed more below.

3.5.3 GPS Reading Routines

For testing, GPS data will be retrieved from the GPS receiver using the TinyGPS library writ-

ten by Mikal Hart. The output of the GPS receiver is connected to serial port 1 of the arduino

board. The library then decodes the GPS data it receives and time (UTC), latitude, longitude,

and altitude is extraced from the GPS object and stored on a SD card.

When the test code was ported over to the Aeroquad software. The TinyGPS library could

not be used. The programmer of the Aeroquad software, Ted Carancho, had created his own GPS

library. That was used in place of the TinyGPS library. Both libraries were very simimlar, so

modifying the initial code was simple.

3.5.4 Data Logging Routines

The Arduino SD library written by William Greiman, was used to handle SPI comminication

between the Arduino board and micro SD card adaptor. The data being collected was stored in a

comma separated value file format. This routine is called twice every second (this duration can be

set) store the data from the GPS module.

3.5.5 Auto-commands

The auto-commands that we designed and planned to implement include the auto-landing com-

mand, the auto-move command, the auto-homing command, and the hold position command. Each

command will be using a combination of sensors to perform each action. The preliminary flow charts

can be found in Appendix C.

The auto-landing command will use the barometeric sensor to determine the current altitude

of the quadcopter. This altitude will be compared to the quadcopter startup altitude. The startup

altitude will be recorded and saved when the quadcopter motors are first armed. When the auto-

landing command is called, the quadcopter will check its current altitude. If this altitude is within

a set deviation (to be determined), the quadcopter will begin to decrease throttle of the motors.

This command will continue to be called until the user disables it or the current quadcopter altitude

is equivalent to the initial quadcopter altitude.

- 23 of 47 -

The auto-move command and auto-homing command are both very similar. They both use

GPS feedback to determine which direction it will need to go to reach the target location. This is

done by comparing its current GPS location with a target GPS location stored in memory. The

microcontroller would adjust the motors accordingly to move the quadcopter in the correct direc-

tion. The main difference between these two commands are when and how the target location is

stored. For the auto-homing command, the target GPS location will be stored when the motors of

the quadcopter are first armed. For the auto-move command, the target location will have to be

stored in memory before setup.

The hold position command will use both the GPS module and the barometric sensor to deter-

mine its position in a three dimensional plane. The altitude, longitude, and latitude will be stored

when the command is first called and be known as the target position. Then after some time dura-

tion, if the quadcopter is still holding its position, the quadcopter will compare its current position

with the target location. If the position are the same, then nothing happens. If the positions are

not, then the microcontroller will need to adjust the motors accordingly to move the quadcopter

back to the target position.

3.6 Summary

In this section the hardware and software components were explained in detail. The reasons for

choosing each component was made clear.

- 24 of 47 -

4. Experimental Results and Discussion

In this section of the document we will be discussing the verification and testing of each hard-

ware and software component. All problems will be described in detail and the solutions we made

to solve these problems. In this section we will also discuss our overall results of the project and

what we could have done to improve upon our project. Future work for this project will also be

mentioned in this section of the document.

4.1 System Verification and Testing

In this section of the document we will be discussing the methods we used to test each compo-

nent of our quadcopter, the problems we faced, and how we solved them.

4.1.1 Aeroquad Control Board v2.1

For testing, the Arduino Mega 2560 board and the Aeroquad shield v2.1 were used. The

Aeroquad shield includes a 3-axis accelerometer (ADXL345), 3-axis gyroscope (ITG-3200), 3-axis

magnetometer (HMC5883L), and a pressure sensor (BMP085 Barometer). The Windows 7 oper-

ating system was used in these tests. The testing process was as follows:

1. Verifying sensors board and Arduino Mega connection

By using the blinking template from the Arduino IDE and looking at the corresponding LED

on the Arduino board and shield, we verified that both the boards were connected properly

by changing the delay of the blinking LED.

2. Testing on Aeroquad flight software library

To modify the Aeroquad flight software, the user configuration header file had to be changed.

Certain variables needed to be defined according what components our quadcopter had and

what functions we wanted our quadcopter to perform. This was done by both commenting

and un-commenting the necessary definition statements in the user configuration header file.

If the software uploads successfully, then no mistakes were made in the user configuration

header file.

- 25 of 47 -

3. Testing of sensors separately

Most of the testing programs for the sensors that came with the Aeroquad software did not

work at all. There were some errors in each program that needed to be solved before any

testing could be done.

• The 3-axis gyroscope test program was not working properly. The program was missing

a variable and the address to the gyroscope was addressed incorrectly. This was solved

after adding the missing variable and changing the address to the correct location of

where the gyroscope sensor was located.

• The 3-axis magnetometer test program was not working properly. The program was

missing header files. This was solved after adding the necessary header files.

• The 3-axis accelerometer test program was also not working properly. No matter how

the sensor was moved, the readings did not change. The problem with this program was

that the scaling factors being used were set to zero. After setting the scaling factors

to the correct numbers, the program worked properly and accelerometer measurements

could be made.

• The barometeric pressure sensor program worked without any problems.

4. Testing quadcopter orientation with sensors board on the Aeroquad configurator software

After testing and verifying that all the sensors worked. We used the Aeroquad configurator

to graph the outputs of our sensor measurements. The configurator uses a kinematics algo-

rithm to calculate pitch, roll, and yaw of a quadcopter by using the measurements from the

gyroscope, accelerometer, and magnetometer. The kinematics algorithm will be explained in

further detail in the next section of the report.

Figure 4.1a and figure 4.2a shows a calculated graphical output for roll, pitch, and yaw with

respect to time using the 9DOF sensor board. The red line keeps track of pitch, the blue

line keeps track of roll, and the green line keeps track of yaw. The right image shows a 3D

rendering of what the quadcopter orientation should be according to the measurements of

its current roll, pitch, and yaw compared to its initial calibrated position. Through testing

- 26 of 47 -

we were able to find the maximum and minimum pitch to be 84.2◦ and −88.2◦ respectively.

Similar tests were preformed to get measurements for roll and yaw. The maximum and min-

imum roll that was 179.3◦ and −178.2◦ respectively. The maximum and minimum yaw that

was 179.9◦ and −179.9◦ respectively. All these measurements are in respect to the initial

calibrated position. Figure 4.1b and figure 4.2b shows the three dimensional representation

of the orientation the Aeroquad configurator estimates the position to be. This estimation is

referenced and compared to the calibration values of the quadcopter.

The attitude sensors worked properly. The range and values obtained from this test is highly

dependent on the calibration data that is stored in the quadcopter. It is also important to note that

the initial values for yaw are not zero. This is because the reference position used during calibration

is different from the current position. Overall the sensors board worked perfectly as soon as the

calibration process was performed correctly. It is worth mentioning again that the result of pitch,

roll, and yaw is a combined result of the gyroscope, accelerometer, and magnetometer readings

calculated by the kinematics algorithm.

4.1.2 Orientation Kinematics algorithm

By using an Arduino board and a 3-axis gyroscope and 3-axis accelerometer data, the quad-

copter orientation in space can be estimated using a couple of different algorithms which can include

the ”‘Simplified Kalman Filter” or ”‘Direction Cosine Matrix”(DCM) [14]. The Aeroquad software

uses DCM to determine the oreintation of the quadcopter. DCM will be explained as follows:

Let i, j, k to be unity vectors co-directional with the body frame’s x, y, z axes and call it Oxyz.

Also let I, J,K be the vectors of the global frame X,Y, Z and call it OXY Z. The capital symbols

represent the global frame and the non-capital symbols represent the body frames. These frames

are represented in figure 4.3.

In terms of global coordinates vectors I, J,K,

IG = {1, 0, 0}T , JG = {0, 1, 0}T ,KG = {0, 0, 1}T

By definition, in terms of body coordinates vectors i, j, k

iB = {1, 0, 0}T , jB = {0, 1, 0}T , kB = {0, 0, 1}T

- 27 of 47 -

(a)

(b)

Figure 4.1: Pitch Test Up: (a) Graphical representation . (b) 3D rendering of quadcopter.

- 28 of 47 -

(a)

(b)

Figure 4.2: Pitch Test Down: (a) Graphical representation. (b) 3D rendering of quadcopter.

- 29 of 47 -

Figure 4.3: Diagram of the the frame representations

Writing i with its global coordinates

iG = iGx , iGy , i

Gz

T

Project vector i on to the global X axis.

iGx = |i|cos(X, i) = cos(I, i)

where |i| is the norm (length) if the unity vector i and cosine of the angle between the vectors I and i.

Since |I| and |i| = 1, they are both unity vector. This implies that,

iGx = cos(I, i) = |I||i|cos(I, i) = I.i

where I.i indicate the scalar dot product.

Since the rotation does not change the angle between vectors

I.i = IB.iB = IG.iG = cos(IB.iB) = cos(IG, iG)

for simplicity the superscript in scalar products can be skipped.

Thus, no matter which coordinate system iGx = I.i. Similarly, iGy = J.i and iGz = K.i

This implies that vector i is able to be shown in terms of global coordinate system:

iG = {I.i, J.i,K.i}T

Similarly,

- 30 of 47 -

jG = {I.j, J.j,K.j}T , kG = {I.k, J.k,K.k}T

The whole set of coordinates of global coordinates for the body i, j, k can be write as:

DCMG = [iG, jG, kG] =

I.i I.j I.k

J.i J.j J.k

K.i K.j K.k

=

cos(I.i) cos(I.j) cos(I.k)

cos(J.i) cos(J.j) cos(J.k)

cos(K.i) cos(K.j) cos(K.k)

(4.1)

The reason it is called Direction Cosine Matrix is because the whole matrix are consists of cosines

of angle. Since IG, JG,KG is symmetrical in nature with IB, JB,KB, results can be achieved by

simply swapping the notations I, J,K with i, j, k then

IB = I.i, I.j, I.kT , JB = I.i, I.j, I.kT ,KB = K.i,K.j,K.kT

DCMB = [iB, jB, kB] =

I.i J.i K.i

I.j J.j K.j

I.k J.k K.k

=

cos(I.i) cos(J.i) cos(K.i)

cos(I.j) cos(J.j) cos(K.j)

cos(I.k) cos(J.k) cos(K.k)

(4.2)

Combining 4.1 & 4.2

DCMB = (DCMG)T orDCMG = (DCMB)T

DCMB, DCMG = (DCMG)T .DCMG = (DCMB)T .DCMB = I3

where I3 is the 3x3 identity matrix. DCM matrices are orthogonal.

The DCM matrix which may also be called rotation matrix plays an important roles in orienta-

tion kinematics because it defines the rotation of one frame relative to another.In addition, DCM

matrix is also use for calculate the global coordinates of an arbitrary vector if the coordinates in

the body frame is given (vice versa).

4.1.3 Motors and Electronic Speed Controller

Testing of the motors and ESC was done to verify that each component was working properly.

The ESC needed some assembly, barrel connectors were soldered onto the ends of the ESC. A motor

was mounted to an arm of the quadcopter and securely attached the arm to a table edge using a

C-clamp. The motor was then wired up according to the block diagram of Figure 4.4.

- 31 of 47 -

(a)

(b)

Figure 4.4: Motor & ESC test bench: (a) Block diagram. (b) Test bench.

Before starting the test, each ESC was programmed to the same settings and throttle range.

For verification, the voltage, current, and power were measured using a power meter. The mea-

surements were made at throttle speeds at 10% increments. This was done three to five times for

each motor and ESC.

Unfortunately, one of the ESC could not be programmed properly. This seemed to be solved

after setting the proper throttle range for the ESC. But during testing, the measurements for the

ESC were much lower then the readings when compared to the other ESC. All the other ESC/motor

measurements were very similar, but the measurements for this ESC started dropping off at about

50% throttle and the power to the motor from the ESC was cut at about 95% - 100% throttle. A

different motor was tested with the same ESC, but the same measurements were observed. The

ESC was assumed to be malfunctioning.

As a result, more ESCs were purchased to replace the malfunctioning ESC. After receiving the

new ESC, we soldered the necessary connectors and re-tested the ESC using the same setup shown

in the block diagram above. However during one of these test, the connectors of a ESC were not

heat shrunk properly. The connectors were touching and caused a short circuit when the battery

was connected and warped the wire casing. Fortunately, this did not affect the ESC and the ESC

is still working properly.

Another thing to note is that the voltage and current measurements made during the test

seemed a little bit higher than the voltage and current values recommended on the data sheets.

- 32 of 47 -

To solve this problem we have decided to limit the maximum throttle to about 80% throttle. Ac-

cording to the measurements and data sheets, our motors can handle about 90% throttle, but we

chose to limit maximum throttle to 80% to make sure that we were outside the range of error.

At this throttle range, the voltage and current measurements were well below the recommended

voltage and current ranges in the data sheets, but there was still enough throttle to stablize the

quadcopter. Table 4.1 shows the data sheet values and measured values.

Table 4.1: Data sheet and measured values.

4.1.4 GPS and Data logging

A program was designed and coded using the Ardunio IDE to test the GPS receiver and SD card

adaptor. Two libraries were used in this program. The TinyGPS library developed by Mikal Hart

was used to decode the NMEA data received by the GPS receiver. The SD card library was used

to help read and write information to SD cards. This library was built on the sdfatlib developed

by William Greiman. The library supports FAT16 and FAT32 file systems. A basic flow chart of

how the program works can be seen in figure 4.5.

During testing with the GS407 GPS receiver, we ran into many different problems. The first

problem we encountered was that the BoB that came with our GPS module did not match up with

the control board, as expected. We found out it was designed for an older version of our control

board. This was easily solved, the wires just needed to be re-soldered differently to connect the

ports to each other.

The second problem also included the same BoB. The BoB was extremely fragile. The BoB

connector used to connect the BoB to the GPS module came off. Our quickest solution was to

solder wires directly to the GPS unit. This was hard to do because the pins were extremely small.

A smaller gauge of wire was needed to solve this problem.

After the wiring was completed, we started testing the GS407 GPS receiver using the program

mentioned earlier. Data was being transferred between the GPS unit and the microcontroller, but

GPS receiver could not get a satellite fix. We tried testing in many different locations, indoors and

- 33 of 47 -

Figure 4.5: Flowchart of GPS data logging program.

- 34 of 47 -

outdoors, to no success. We assumed that the GPS was not working properly and purchased a new

GPS module, the Parallax PMB-648, for comparison.

The new GPS receiver module ordered was the PMB-648 using the SiRFstarIII chipset. Al-

though this module was slower and heavier than the GS407, the module was easily to interface with

the Arduino boards. The GPS module got a satellite fix almost immediately after connecting the

GPS to power. The overall speed differences were unnoticeable during testing. In figure 4.6 below,

shows the output of PMB-648 module, using the testing programmed developed above.

Figure 4.6: Output of testing program, using the PMB-648 GPS receiver.

The new GPS module could get readings from 10 different satellites and the latitude and lon-

gitude readings from the testing location were found to be 49.88464, -97.20846. When these coor-

dinates were entered into Google maps, the coordinates matched the address of the testing location.

The next step was to test the SD card adaptor. The Arduino Uno was connected to a 9 volt

battery and the SD card code was added to the program to log data from the GPS receiver. During

initial tests this was causing strange errors due to memory issues on the Arduino Uno board. The

test bench was moved onto an Arduino Mega board, and the program worked properly. We later

- 35 of 47 -

found out that the serial output statements being used to check for errors were causing the memory

issues. When these were removed, the testing program could be used on the Arduino Uno board

as well.

The next test was to test the micro SD card adaptor. The Arduino Uno was connected to a

9 volt battery and the SD code was added to the test program. Then the test bench was used to

collect GPS information for a bus trip on the 78 Cambridge bus from the University of Manitoba to

Polo Park. The data collected was saved in a comma separated value file format and uploaded to

a program on www.GPSvisualizer.com. This website help mapped the GPS information in Google

maps. The mapped data was compared to the 78 Cambridge bus route, the results were almost

identical. The mapped information is shown in Figure 4.7.

Everything was working correctly and was moved from the test bench to the quadcopter control

board. Most of the code from the test program was easily ported to the Aeroquad software, with

the exception of the TinyGPS library. A GPS library developed by the Aeroquad software engineer,

Ted Carancho, was used instead. The libraries were very similar. Initially there was some confu-

sion, because there was limited commenting in the Aeroquad software. After thoroughly examining

the program, our data logging program was added to the Aeroquad software and everything now

is working properly.

After everything was found to be working properly the GPS module and SD card adaptor were

mounted onto a prototype board with hot glue and used as a temporary shield for the control

board. The prototype board is mounted onto the control board via connecting male pins into the

unused port of the control board. This can be seen in figure 4.8 shown below.

4.1.5 PID Tuning

There are three proportional-integral-derivative controller (PID) controllers performing error

correction for pitch, roll, and yaw using inputs from the 9DOF sensor board. The output of each

PID controller is used to adjust the orientation and stabilize the quadcopter along one axis. Each

PID controller algorithm involves three separate constant parameters, the proportional, the inte-

gral and the derivative values, denoted P, I and D. P indicates the present errors, I indicates the

accumulation of past errors, and D indicates the prediction of future errors. Figure 4.9 is a block

diagram of a PID controller.

In the process of PID tuning, the gains of the proportional, integral, and derivative terms have

to be chosen correctly. Otherwise, the quadcopter may not be able to stabilize itself. For example,

the higher the P value, the stronger the motor responds. If P is set to be too high, oscillations can

- 36 of 47 -

Figure 4.7: GPS test results mapped on Google Maps[1].

- 37 of 47 -

(a)

(b)

Figure 4.8: GPS/SD Card Shield: (a) Top view. (b)Bottom view.

- 38 of 47 -

be observed because of overshooting.

Figure 4.9: Block diagram of PID controller in feedback loop.

PID tuning required that the quadcopter was supported along its axis to check how the quad-

copter reacted to certain forces applied on the axis. For our first test bench, we modified a aluminum

camera stand shown in figure 4.10 and mounted the quadcopter to the stand.

The advantage of this PID tuning design is that the stand is portable. However, the stand was

not strong enough to hold the weight of the quadcopter and the thrust created by the quadcopter

tipped the stand over.

Our group decided to make a custom stand for our PID tuning purposes. The quadcopter was

mounted on a copper pipe, held together by a wooden stand shown in figure 4.11. This only allowed

the quadcopter to turn on one axis, allowing us to test and tune the PID one axis at a time. The

wooden stand was much sturdier than the camera stand and was unaffected by the forces caused

by the quadcopter.

The quadcopter has two modes, acrobatic mode and stable mode. These mode are controlled

by the mode channel of the transmitter. acrobatic mode uses only gyroscope data to stabilize

the Aeroquad. Acrobatic mode detects changes in angular rates on a single axis and adjust the

motor to resist the angular change, from a level position. On the other hand, stable mode uses

both gyroscope data and accelerometer data to maintain a level position. The quadcopter is able

to stabilize itself after PID tuning. To perform the PID tuning, acrobatic mode tuning was done

before the stable mode tuning because stable mode isolates the parameters of roll and pitch. Then

- 39 of 47 -

Figure 4.10: PID test stand design 1.

tuning was done for the stable mode.

The quadcopter was tuned using the method mentioned above. In acrobatic mode, we slowly

adjusted the PID values and checked how responsive the motors were. When we felt that the quad-

copter could adjust to the angular changes, we changed to stable mode to check if the quadcopter

could automatically stabilize itself when a force was applied to one of the axis. The PID was slowly

adjusted so that the quadcopter could adjust itself with minimal oscillations. This was done for

both the pitch, roll, and yaw axis.

4.2 Flight Test

In this section of the document we will discuss how our initial flight test went and the problems

we encountered during this flight test.

4.2.1 Initial Test Flight

After the PID tuning, the quadcopter was able to ready for its first flight test. The quadcopter

was able to fly in a very stable manner without any observable osciallations, as can be seen in fig-

- 40 of 47 -

Figure 4.11: PID test stand design 2.

Figure 4.12: Initial flight test.

- 41 of 47 -

ure 4.12. The first landing of the quadcopter was quite bad. The quadcopter landed on the ground

with a strong impact that caused the arms of the frame to bend. After a third test flight, one of the

motor wires came loose causing the motor to turn off and flip the quadcopter. Fortunately, none

of the electronic parts were damaged. The average flight duration we were able to achieve through

these test was 12 minutes.

4.2.2 Problems

The damaged arms seen in figure 4.13 needed to be replaced. The bent arms would affect the

stabilization of the quadcopter because the motors would not be aligned properly. Luckily we found

some replacement arms at the local hardware store. A hollow U-bar was purchased and cut into

the necessary lengths at the mechanic shop at the University of Manitoba. The metal bar was

about 2mm too thick. One quick solution was to buy longer bolts to hold the arms and the frame

together. We are currently still in the process of fixing our quadcopter.

Figure 4.13: Damaged arms.

4.3 Discussion

4.3.1 Difficulties

1. We encountered delays in ordering parts. We ordered parts in late September and early Oc-

tober and parts did not arrive at the expected times. Our initial parts started arriving early

November but some parts did not arrive until the last week of November. This delayed our

schedule and caused us to fall behind. To make up for this, we focused on other aspects of

the project. We focused on learning the Aeroquad software and testing the components that

- 42 of 47 -

had arrived.

2. There were many safety issues during testing the quadcopter with rotors. The spinning rotors

could spin quick enough to cause serious harm to a person. Before each test with the rotor

attached, our group would have to clear the room and make sure that no one would come

into contact with the rotors of the quadcopter. During testing of the motors, all non-group

members were told to leave the room. The room was locked and testing was done only care-

fully starting at minimum throttle. If the quadcopter ran properly for a duration of time,

then we would increase the throttle by 10%. This tedious process was used to ensure safety.

3. There was a problem with the battery connectors being different. We did not notice the dif-

ference in connectors at the time of purchase. The JST-HX connectors on the battery did not

match the EC3 connectors on the quadcopter. Fortunately we were able to find the necessary

connectors at a local RC hobby shop and we were able to re-solder the new connectors to the

battery.

4. Setting up the channels of the transmitter and receiver was also very important. The initial

transmitter channel configurations did not match the quadcopter channel configurations. To

solve this problem each channel of the transmitter needed to be tested separately to identify

what it was controlling on the quadcopter and set to the correct corresponding channels.

4.3.2 Future Work

Our overall plans were too ambitious. Our team goals were to design, test, and build a quad-

copter kit, interface a data logging system, and design and implement AI commands for our quad-

copter. Unfortunatley, we were not able to complete all these goals. There was not enough time to

implement the auto-commands in the Aeroquad software. In the future, if time permits, we would

like to implement these commands. There were many problems that we did not account for through

out the project. These problems delayed our progress and we were not able to finish what we set out

to do in the beginning. We have learned that we must allow time for solving problems in the future.

Other plans in the future include adding a sonic sensor for more accurate altitude determination.

Currently the only methods to determine altitude is by using the barometric pressure sensor and

the GPS receiver. There is no actual way to safely determine the quadcopters altitude relative to its

landing surface. A sonic sensor could solve this problem, and be used to help aid the auto-landing

- 43 of 47 -

command.

Another future plan would be adding more methods of collecting data. Many ports still remain

unused on the control board. Adding a camera could allow for digital photos or video to be taken.

Adding some way to stream data from the quadcopter to the controller could be another great

feature to add to our quadcopter, this would allow for even easier access to the data collected by

the quadcopter. Smart phone capabilities could be another feature our group may want to add in

the future.

4.4 Summary

Each component was tested was verified to be working as intended. Test flights have been

conducted and the results confirm that the quadcopter can fly in a stable manner.

- 44 of 47 -

5. Conclusions

This section discusses the results of the project. All information here is repeated from earlier

sections of this report.

With the supervision of Dr. Kinsner at the University of Manitoba, a quadcopter was built and

lab tested. The Aeroquad Cyclone kit was chosen and the individual components were interfaced,

tested, and verified to be working properly. Tuning was done on the PID controllers using custom

test benches. The parameters were adjusted and stabilization of the quadcopter was acheived. The

quadcopter can maintain stable flight without any observable oscillations. Currently, the quad-

copter weighs roughly 1685 grams, maintains an average flight duration of 12 minutes, and can be

controlled within a range of 300 meters. The GPS receiver used can determine the quadcopters

current position within 5 meters and can log data using the interfaced micro SD adaptor. A maxi-

mum of 2GB of data can be stored at a rate of 12 MB/sec. The GPS data logger on the quadcopter

stores its current latitude, longitude, and altitude in a comma separated value file format and can

be used for mapping purposes. This project required members not only to interface and program

the components of the quadcopter, but also exposed them to mechanical components and reality

of project management to accomplish the project objectives.

- 45 of 47 -

Bibliography

[1] “Map of winnipeg, manitoba,” February 2013. [Online]. Available: https://maps.google.ca/

[2] R. Mahony, P. Pounds, and P. Corke. (2006, December) Modelling and control of a

quad-rotor robot. In the Proceedings of the Australasian Conference on Robotics and

Automation. Auckland, New Zealand. Accessed: September 2012. [Online]. Available:

http://www.araa.asn.au/acra/acra2006/papers/paper 5 26.pdf

[3] I. Sa and P. Corke. Vertical infrastructure inspection using a quadcopter and

shared autnomy control. Brisbane, Austrailia. Accessed: September 2012. [Online].

Available: https://wiki.qut.edu.au/download/attachments/107284164/FSR2012 Inkyu 5th

sub.pdf?vers%20ion=1&modificationDate=1336532095000

[4] V. Ross. (2011, August) In development: Networks of unmanned quadcopters to ferry

medicine to isolated areas. Discover Magazine. Accessed: September 2012. [Online]. Avail-

able: http://blogs.discovermagazine.com/80beats/2011/08/30/in-development-networks-of-%

20unmanned-quadcopters-to-ferry-medicine-to-isolated-areas/#.UTqfsxxgCXg

[5] G. Elliot. (2005, November) Development of an autonomous quadro-

tor flying platform. Accessed: September 2012. [Online]. Avail-

able: http://blogs.discovermagazine.com/80beats/2011/08/30/in-development-networks-of-%

20unmanned-quadcopters-to-ferry-medicine-to-isolated-areas/#.UTqfsxxgCXg

[6] G. M. Hoffman, H. Huang, S. L. Waslander, and C. J. Tomlin. Quadrotor helicopter flight

dynamics and control: Theory and experiment. Accessed: October 2012. [Online]. Available:

http://hoffmann.stanford.edu/papers/Quadrotor Dynamics GNC07.pdf

[7] T. Carancho. aeroquad software. Accessed: September 2012. [Online]. Available:

https://code.google.com/p/aeroquad/

[8] S. W. Colton. (2010, June) Design and prototyping methods for brushless motors and

motor control. Massachusetts, United States. Accessed: October 2012. [Online]. Available:

http://web.mit.edu/scolton/www/SCThG.pdf

[9] R. F. Graf, “Dictionary of electronics,” 1974., accessed: January 2013. [Online]. Available:

http://www.rc-airplane-world.com/spread-spectrum.html

[10] “Canadian municipalities and the regulation of radio antennae and their support structures,”

accessed: January 2013. [Online]. Available: http://www.ic.gc.ca/eic/site/smt-gst.nsf/eng/

sf09386.html

- 46 of 47 -

[11] “72 mhz vs 2.4ghz radio systems compared,” February 2013, accessed: January 2013.

[Online]. Available: http://sjrcf.com/docs/72mhz%20vs%202.4%20ghz.pdf

[12] P. Energy, “Battery types: Which batteries to use?” accessed: October 2012. [Online].

Available: http://www.pureenergybattery.com/pdf/batterytypes.pdf

[13] “Peukert’s law, a nerd’s attempt to explain battery capacity,” ac-

cessed: September 2012. [Online]. Available: http://www.batterystuff.com/kb/tools/

peukert-s-law-a-nerds-attempt-to-explain-battery-capacity.html

[14] Starlino, “Dcm tutorial - an introduction to orientation kinematics,” accessed: January 2013.

[Online]. Available: http://www.starlino.com/dcm tutorial.html

- 47 of 47 -

Appendix A - Curriculum Vitae

- A1 -

Appendix B - Budget

Table 5.1: Project Budget

Our initial budget for our quadcopter project was about $1000. This budget was supplied by

mainly the two members of the team. Our team went over budget by roughly 50%. Most of the

extra costs was due to the replacement parts purchased.

- B1 -

Appendix C - AI Command Flow Charts

- C1 -

Figure 5.1: Auto-land command flow chart.

- C2 -

Figure 5.2: Auto-hold command flow chart.

- C3 -

Figure 5.3: Auto-move/home command flow chart.

- C4 -

Appendix D - DVD Content

Software

• GPS test program

• Modified sensor test programs

• Modified Aeroquad Flight Software

Test Results

• Datalogging

Busroutedata

• ESC & Motor Measurements

ESCMotordata

Report

• G11-UAVquadcopterFinalReport.pdf

- D1 -