FYP Thesis Final v2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 61

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/355023499

Design and Fabrication of a Quadcopter Delivery Drone

Thesis · August 2021


DOI: 10.13140/RG.2.2.21600.61442

CITATION READS
1 16,877

1 author:

Muneeb Ullah
University of Engineering and Technology, Peshawar
1 PUBLICATION   1 CITATION   

SEE PROFILE

All content following this page was uploaded by Muneeb Ullah on 02 October 2021.

The user has requested enhancement of the downloaded file.


Design and Fabrication of a Quadcopter
Delivery Drone

Submitted by
ABDUL BASIT
MUHAMMAD AWAIS
MUNEEB ULLAH
SYED UZAIR ALI SHAH
Supervised by
ENGR. MUHAMMAD KALEEMULLAH KHALIL

DEPARTMENT OF MECHANICAL ENGINEERING


UNIVERSITY OF ENGINEERING AND TECHNOLOGY
PESHAWAR, PAKISTAN
August 2021
1
Design and Fabrication of a Quadcopter
Delivery Drone

by
Abdul Basit 17PWMEC4296
Muhammad Awais 17PWMEC4426
Muneeb Ullah 17PWMEC4347
Syed Uzair Ali Shah 17PWMEC4382

A thesis
presented to the University of Engineering and Technology, Peshawar
in partial fulfillment for the degree requirement of
Bachelor of Science
in
Mechanical Engineering

2021

Peshawar, Khyber Pakhtunkhwa, Pakistan

2
Abstract

The need for parcels delivery has increased due to rise of E-commerce industry. Drone based
technology is the solution to overcome the limitation of surface road capacity in cities. With
recent advances in drone technologies and increased commercial demand, the last-mile
shipping industry can be disrupted positively by delivery drones. Drones can significantly
reduce delivery times and the labor cost associated with delivery operations. This report tests
an X-Quadcopter as a low-weight, low-cost, autonomous flight capable, UAV for delivering
small parcels. The quadcopter follows commands from a Ground Control Station to locate and
navigate to its destination. The goal is to develop a control system for the quadcopter in order
to enable it to achieve stable flight and perform delivery. The system is simulated, tested, and
tuned for stability in MATLAB Simulink. The range and flight time of the quadcopter is also
tested, and a maximum load capacity, flight time, and speed is determined. A prototype was
fabricated, and the control system was tested in actual environment. The resulting design for
quadcopter delivery system is cost effective, faster, and convenient than traditional delivery
system. The control system stabilized the quadcopter and achieved desired tasks in simulation.
The fabricated prototype suffered from vibrations and instability. It also contributed greatly to
noise pollution. Recommendations are made to make the quadcopter less noisy and more
stable.

Keywords: quadcopters, autonomous, delivery drone, control system, UAV

3
Acknowledgements

We, the members of the final year project, have gratitude for our honorable supervisor Engr.
Muhammad Kaleemullah Khalil who provided us with guidance and courage to complete
our final year project.

We are grateful to the faculty of Department of Mechanical Engineering, UET Peshawar


for providing us with the knowledge and tools to work on this project.

4
Table of Contents
CHAPTER 1 INTRODUCTION .................................................................................................... 8
1.1 Quadcopters ....................................................................................................................... 8
1.2 Background ......................................................................................................................... 8
1.3 Objectives ............................................................................................................................ 9
1.4 Scope of Thesis ............................................................................................................... 10
CHAPTER 2 VEHICLE DESIGN ............................................................................................... 11
2.1 Requirements ................................................................................................................... 11
2.2 Vehicle Selection ............................................................................................................. 11
2.3 Components Selection ................................................................................................... 14
2.3.1 Powertrain ................................................................................................................. 14
2.3.2 IMU............................................................................................................................... 15
2.3.3 Flight Controller ....................................................................................................... 16
2.3.4 Power .......................................................................................................................... 18
2.3.5 Positioning and Navigation................................................................................... 19
2.4 Sensors .............................................................................................................................. 21
2.4.1 MPU-6050 Inertial Measurements Unit ............................................................... 21
2.4.2 BMP180 Barometer ................................................................................................. 21
2.4.3 uBlox NEO-6M GPS Module .................................................................................. 22
2.4.4 HMC5883L Magnetometer ..................................................................................... 23
2.4.5 HC-SR04 Ultrasonic Sensor .................................................................................. 23
2.5 PID Controller ................................................................................................................... 23
PID Controller Tuning ............................................................................................................. 24
CHAPTER 3 Modelling and Simulation................................................................................. 26
3.1 Mathematical Modelling ................................................................................................. 26
3.1.1 Translational Kinematics ....................................................................................... 27
3.1.2 Rotational Kinematics ............................................................................................ 27
3.1.3 Brushless Motor Equations of Motion ............................................................... 28
3.1.4 Translational Dynamics ......................................................................................... 30
3.1.5 Rotational Dynamics............................................................................................... 31
3.1.6 Equations of Motion................................................................................................ 32
3.2 Model Verification............................................................................................................ 33
3.2.1 Propeller Moment of Inertia .................................................................................. 34

5
3.2.2 Motor System Parameters ..................................................................................... 34
3.2.3 Motor Dynamics Identification ............................................................................. 35
3.2.4 Thrust Coefficient .................................................................................................... 36
3.3 Controller Design ............................................................................................................ 37
3.3.1 General Control Strategy ....................................................................................... 37
3.3.2 Simplified Equations of Motion ........................................................................... 38
3.3.3 Simplified PID Control ............................................................................................ 40
3.3.4 Nested Control Loops ............................................................................................ 41
3.3.5 Position Control ....................................................................................................... 41
3.3.6 Attitude and Altitude Control ............................................................................... 42
3.3.7 Angular Velocity Control ....................................................................................... 43
3.3.8 Motor Control............................................................................................................ 44
3.3.9 PID Modifications – Derivative Kick....................... Error! Bookmark not defined.
3.3.10 PID Modifications – Anti-Windup ........................... Error! Bookmark not defined.
3.4 Simulation Environment ................................................................................................ 46
3.4.1 Simulink Model ......................................................................................................... 46
3.5 Autopilot ............................................................................................................................ 53
CHAPTER 4 Results and Observations ............................................................................. 54
CHAPTER 5 Conclusion and Future Work ......................................................................... 58
References............................................................................................................................................ 59

6
List of Acronyms
BLDC Brushless Direct Current Motor

ESC Electronic Speed Controller

PWM Pulse Width Modulation

GPS Global Positioning System

PID Proportional, Integral, Derivative

Tx Transmitter

Rx Receiver

PPM Pulse Position Modulation

VTOL Vertical Take Off and Landing

LIDAR Light Detection and Ranging

ALU Arithmetic Logic Unit


MCU Microcontroller Unit
ICSP In-Circuit Serial Programming
GCS Ground Control Station
GSM Global System for Mobile communications

7
CHAPTER 1 INTRODUCTION

1.1 Quadcopters
A quadcopter or a quadrotor is a rotary-wing aircraft with four rotors [1]. The rotors rotate in
clockwise and counterclockwise pairs so that the overall torque on the aircraft is zero. A
quadcopter has six degrees of freedom. It can move forward and backward, left and right, and
up and down. It can also rotate around these three axes. The aircraft is controlled entirely by
changing the rotational speed of the rotors. Each rotor is powered by a brushless DC motor.
The BLDC motors are controlled by ESCs which can control its speed with accuracy.

Quadcopters have been used for aerial photography, surveillance and search and rescue
operations. During the COVID-19 pandemic, drones have been used to deliver medical
supplies to remote locations. In Ghana a fixed wing drone called Zipline has been used to
deliver blood to emergency locations[6]. Drones have been tested to be used as delivery
vehicles by big tech companies. However, a drone delivery system has not been implemented
on a large scale.

Amazon, UPS, and DHL have been testing their own delivery drones such as Parcelcopter and
PrimeAir. But these projects have never reached commercially viable states [7]. Civil Aviation
Authorities around the world has strict rules regarding autonomous drones. For public safety
and other reasons, civilian drones must always be operated within line of sight. Autonomous
drones must also have an emergency pilot who can take control of the drone at any time. These
regulations will have to be reviewed as UAV technology is rapidly evolving and autonomous
drones now have automatic safety measures incorporated within the design.

1.2 Background
With advances in UAV technology and microcontrollers, drone industry has seen exceptional
growth rate in the previous fifteen years. Drones have become very popular in the civil sector.
Global commercial drone market was valued at 27.4 billion U.S. dollars, and it is projected to
reach the size of around 58.4 billion U.S. dollars in 2026 (Statista, June 2021).

Advances in drone technology and introduction of new features has created new areas of
applications for drones. They are now being used for various applications such as:

• Aerial photography

8
• Search and rescue
• Agriculture
• 3D Terrain mapping
• Aerial and ground surveillance
• Border patrol and other military applications

The idea of using quadcopters as delivery drones is a popular idea. Delivery drones may
become widespread over the next decade, specifically for what is known as the “last-mile”
logistics of small or light items. Companies such as Amazon, Google, the United Parcel
Service, DHL, and Alibaba have been running experiments testing drone delivery systems. In
the future, drones could augment, or in some situations even replace, truck fleets and could
have important implications for energy consumption, public safety, personal privacy, air
pollution, city noise, air traffic management, road congestion, urban planning, and goods- and
service-consumption patterns in urban areas [8].

As the demand for commercial deliveries increases within cities, companies face a
fundamental limitation in surface road capacity. Drone delivery aims to overcome that
limitation by exploiting the vertical dimension above city streets.

A successful delivery system will have to cover all of the urban areas of the country. These
are the areas that experience the highest numbers in online shopping and food deliveries. The
average area of the 7 most populous cities in Pakistan is 1240 square kilometers. If we consider
the area of cities as circles, the average radius turns out to be 20 kilometers. This shows that
most urban areas will be covered by a drone having the range of 20 kilometers. However, a
single drone fulfillment center in the middle of the city will not be ideal. A better solution
would be to have multiple drone fulfillment centers. Four fulfillment centers per 20-kilometer
radius area are taken in this thesis. This will reduce the required range of drone to 5 kilometers.

1.3 Objectives
• To design a quadcopter that has the required load capacity and range as discussed in
the previous section, using components that are easily available and cost effective.

9
• Design of the quadcopter also includes a flight controller that can fulfill the
requirements of the system. The PID control system will be created in Simulink and
then translated into C++ code to be used in the microcontroller.
• To tune the PID controller in order to make the quadcopter stable and efficient.
• To perform analysis of the drone delivery system and compare it with traditional
delivery system.
• To study the implications of drone delivery system on environment, energy
consumption, public safety, personal privacy, air pollution, noise pollution, air traffic
management and urban planning.

1.4 Scope of Thesis


A UAV will be designed for our required task in this thesis. A control system will be developed
for the vehicle. The vehicle and control system will be modelled in MATLAB Simulink and
tested. Based on the design, a prototype will be fabricated and tested in real environment.

A fully functional delivery system requires a Ground Control Station (GCS) for operation. The
scope of this thesis does not include a GCS. A prototype will be fabricated for basic testing of
the control system. Since GCS is not included in the prototype, the autopilot system will be
tested in simulation only. The simulation will not include wind interference, change in gravity
due to height change, and mechanical and electrical losses.

10
CHAPTER 2 VEHICLE DESIGN

2.1 Requirements
In the previous sections, we determined that a drone with a total range of 5 kilometers is
sufficient to cover the urban areas in the country. However, for the purposes of this paper, we
will fabricate a prototype with lower specifications. The reason is to keep the prototype
inexpensive, easy to build easy to test.

Apart from load capacity and range, the UAV must have some other features as well. It will
have to be able to take off from small platforms and hover at the target destination, as to wait
for the parcel to be collected. Ideally the UAV should be equipped with a camera for security
reason. It should also be connected to a network so that any change in destination or
cancellation of the flight can be sent to the vehicle. These features are not going to be included
in our prototype due to time and budget constraints. They are discussed with more detail in
chapter 5.

Our requirements for the UAV are as follows:

• The vehicle must have VTOL capabilities.


• The range of the vehicle must be at least 3 kilometers.
• The load capacity of the vehicle should be at least 1 kilogram.
• The weight of the vehicle must be kept minimum. Ideally, less than the carrying load.
• The vehicle must be able to maintain a constant altitude of 20 meters.

2.2 Vehicle Selection


The two broad categories of aerial vehicles are fixed-wing aircraft and rotary-wing aircraft. A
rotary-wing aircraft has some advantages and disadvantages compared to fixed-wing aircraft.
The most important advantage of rotary-wing aircraft over fixed-wing aircraft is that it can
take off and land vertically. Rotary-wing aircraft also has the abilities of hovering and headless
flight. On the other side, rotary-wing aircraft have lower maximum speeds compared to fixed-
wing aircraft. Building fixed-wing aircraft is relatively harder because the control surfaces
have to be made using advanced manufacturing techniques. On the other hand, propellers for
rotary-wing aircraft are mass produced and are available in all sizes on the market.

11
There are several different types of rotary-wing aircraft, depending on the number of and
position of rotors. The most recognized type is the helicopter. It has one horizontal rotor that
is used for lift and horizontal movement and one vertical tail rotor to counter the torque of the
main rotor. The pitch of the main rotor can be varied dynamically and that’s how the helicopter
is able to move forward, backward, or sideward. Rotors with dynamic pitch are much more
complicated than simple fixed pitch rotors. These complications make a helicopter harder to
control. Therefore, a helicopter is not considered an ideal vehicle for this application.

Other types of rotary-wing aircraft that have been developed and tested are bicopters,
tricopters, quadcopters, hexacopters, and octocopters. Aircraft with even number of rotors in
symmetric formation are easy to build and operate because the torques generated by the rotors
can counter one another. This eliminates the need for a separate rotor for stabilization such as
in the case of helicopter. Bicopters require a moveable platform for both its rotors to achieve
stability and forward motion. Having a moveable platform for rotors allow bicopters to achieve
greater speeds than other rotary-wing aircraft. But it adds to the complexity of the system and
control.

Figure 2.1 Bell’s Boeing V-22 Osprey is an example of a bicopter.

12
Quadcopters, hexacopters and octocopters are basically the same. The only difference is that
more rotors increase load capacity. However, BLDC motors are nowadays available in bigger
sizes, and it is more efficient to use 4 large rotors compared to six or eight small rotors. For
applications similar to ours, such as aerial photography, quadcopters are widely used.

Figure 2.2 Types of Rotary-Wing Aircraft depending on rotor configuration.


Basic design of a quadcopter consists of four rotor assemblies, attached at the end of four arms
to a central hub. All rotors are in one plane, and they all generate thrust in the same direction,
perpendicular to the aircraft. Unlike bicopters, the rotor platforms are fixed. The aircraft is
symmetric in shape. All the rotors have to be able to produce equal amount of thrust given a
specific input. The angular momentums of the rotors generate a torque at the center of mass of
the aircraft, which causes it to spin around vertical axis. To overcome this effect, opposite
rotors spin in the same direction while adjacent rotors spin in opposing directions. This is an
advantage of the quadcopter design because the vehicle does not need additional gyroscopes
or rotors with the sole purpose of countering unwanted torques on the aircraft.

An X-quadcopter is selected for our application. X-quadcopter means two rotors are tilted
down and two are tilted up in order to move horizontally. The motors used to power the rotors
are BLDC motors. BLDC motors have higher efficiency compared to brushed DC motors and
are controlled by a PWM signal, which means their speed can be controlled digitally with high
precision.

13
2.3 Components Selection
The main components of a quadcopter are its four rotor assembles, a flight controller, an
Inertial Measurements Unit (IMU) and a frame. For autonomous flight, the drone also needs
to have a GPS module and a magnetometer. Additional sensors such as a barometer and
proximity sensors can be used for altitude hold and obstacle detection.

2.3.1 Powertrain
The four rotor assemblies of a quadcopter make up its powertrain. Each rotor assembly consists
of a propeller, a motor driving the propeller and the assembly supporting it.

Propellers
Commercially available carbon fiber propellers are used for the prototype quadcopter.
Propellers are categorized by number of blades, pitch of the blades, and its diameter. Higher
number of blades increase the thrust produced by propellers and reduces vibrations. But they
require more powerful motors. For the purpose of this project, propellers with a diameter of 10
inches and pitch of 4.7 inches are used.

Motors
A Brushless DC Electric Motor (BLDC) is an electric motor powered by a direct current
voltage supply and are commutated electronically instead of brushes like in conventional DC
motors. BLDC motors are more popular than the conventional DC motors nowadays, but the
development of these type of motors has only been possible since the 1960s when
semiconductor electronics were developed. To drive the propellers, BLDC motors are used.
For the purpose of this paper, four outrunner BLDC motors with 1000kv rating have been used.

Frame
The sole purpose of the frame of a quadcopter is to provide structural support for the rotors
and the electronics. The shape of the frame is not designed aerodynamically because
quadcopters don’t need any control surfaces. The center of gravity of the aircraft must be near
the center. For that reason, all the rotors are placed symmetrically while the battery and other
electronics are placed evenly in the center of the frame.

For the purpose of this paper, the F450 frame was selected for the quadcopter. Its dimensions
are as given below:

14
Figure 2.3 F450 Frame dimensions
2.3.2 IMU
A quadcopter is inherently an unstable system. If a small force is applied on any arm of the
quadcopter while it is hovering, it will flip the whole aircraft over. In real world, there will
always be some factors like wind that will disturb the balance of the quadcopter. Therefore, to
stabilize the drone, it must react to all external disturbances in real-time. For this purpose, an
IMU is equipped on all quadcopters. IMU consists of an electronic three-dimensional
gyroscope and an accelerometer.

When some external force is applied on the drone, the aircraft experiences a rotational
acceleration which is detected by the gyroscope. Based on the direction and magnitude of
rotational acceleration, the flight controller directs the motors to apply an equal rotational
acceleration in the opposite direction. This is how the effect of external disturbance is negated.

The accelerometer is used to determine whether is the drone is ascending or not. It is also used
to measure translational acceleration. These functions can also be performed by a barometer
and a GPS module respectively. But for better results, more than one sensor is used. Their
outputs are combined using sensor fusion.

15
The acceleration data from the IMU can be used to estimate the current position of the drone
and the trajectory to destination. This is performed using a method called dead reckoning.
Although the quadcopter does have GPS module for position and navigation, dead reckoning
is used when the GPS is not working.

For the purpose of this paper, an MPU 6050 module is used as an IMU. MPU 6050 includes a
three-axis gyroscope and a three-axis accelerometer.

2.3.3 Flight Controller


Flight controller is the most important component of the quadcopter. Flight controller receives
data from sensors and performs calculations, designed in control strategy to control the
behavior of the vehicle while performing different maneuvers. An Arduino based flight
controller is used in this project. Flight controller receives data from IMU using I2C protocol.
it controls the speeds of all four motors using PWM signals.

I2C Protocol
I2C communication can connect single master to multiple slaves and multiple masters to single
or multiple slaves. To establish I 2C communication between MCU and IMU only two wires
are needed, SCL and SDA. All data is transferred through one wire SDA in the form of bits,
while SCL synchronize the data with the clock signal which is always controlled by master.

Figure 2.4 I2C Communication Protocol

Arduino Microcontroller
A microcontroller is an Integrated Circuit (IC) that is designed to perform arithmetic and
logical operations on data in binary form. Microcontrollers have an IO system, memory, and
ALU. Microcontrollers can be programmed to perform custom tasks.

16
An Arduino Nano is an example of a microcontroller based on Atmega328P. It has 14 digital
input/output pins. 6 of these pins can be used as PWM outputs. It also has 6 analog input/output
pins. The board also provides a USB interface, a power delivery system and an ICSP header
for I2C communication.

Arduino IDE is a software for Windows that allows us to write programs Arduino boards.
Arduino code is written in C++ with an addition of special methods and functions. Arduino
boards are inexpensive and widely available in Pakistan compared to other microcontrollers
such as Pixhawk and Raspberry Pi.

PWM
Pulse Width Modulation is a technique for getting analog results with digital means. Digital
control is used to create a square wave, a signal switched between on and off. This on-off
pattern can simulate voltages in between the full Vcc of the board (e.g., 5 V on Nano) and off
(0 Volts) by changing the portion of the time the signal spends on versus the time that the
signal spends off. The duration of "on time" is called the pulse width. To get varying analog
values, the pulse width is changed or modulated. PWM is not true analog output, however.
PWM “fakes” an analog-like result by applying power in pulses, or short bursts of regulated
voltage.

PWM can also be used to transmit data digitally. For that purpose, pulse width is measured in
milliseconds. The ESCs for BLDC motors require a PWM signal between pulse width of 1000
milliseconds and 2000 milliseconds. By providing a PWM signal between 1000ms and
2000ms, we can control the speed of the motor from minimum to maximum.

17
Figure 2.5 Pulse Width Modulation

The flight controller is responsible for providing the required PWM signals for each motor.
Inputs to the flight controller, such as Thrust, Roll, Pitch, and Yaw along with auxiliary inputs
are also in the form of PWM signals.

The emergency remote control for the drone also reads the joysticks and button inputs as PWM
signals before converting them to bytes to be sent over the radio.

2.3.4 Power
The BLDC motors used in the prototype require 12v DC to operate. BLDC motors consume
very high currents. According to specifications, a 30A ESC is required to operate one 1000kv
BLDC motor. There are total of four motors, so we have a maximum current consumption of
120A for the motors running at full speed. For this reason, a battery with high discharge rate
is required. The weight of the battery is also a huge factor. Therefore, common lead acid battery
is not an option because they are very heavy. One commonly used battery type used in
quadcopters is Lithium-Polymer or LiPo battery. LiPo batteries are light and have high

18
discharge rate. They are available in 4.2v cells. A 12v battery pack consisting of three cells
(3S1P) is selected for the prototype. The capacity of the battery pack is 2200mAh.

The microcontroller, sensors, and other components require much less current compared to
motors. The main consideration here is signal interference. We need to minimize interference
in sensors such as magnetometer. Therefore, the components and their wires are placed away
from high current wires.

High currents in the circuit also requires special wires to be used for power delivery. For
connections between the battery and the motors, 12 AWG silver wires are used. For the rest of
connections, smaller gauge wires are used.

2.3.5 Positioning and Navigation


UAVs rely on GPS for positioning and navigation. Other methods such as LIDAR are used in
areas where GPS cannot operate.

Global Positioning System consists of an array of satellites in low earth orbit. The satellites
send out signals transmitting their location and time. A GPS module picks up these signals and
calculates the distance from the module to the satellite. When signals from three or more
satellites are received, the module can determine its position by method of triangulation. The
module can also determine its altitude.

GPS works best in open environment with accuracy of about 1-4 meters. Its accuracy decreases
to around 11 meters in dense areas [3]. For this reason, UAVs that rely on GPS are exclusively
used in open areas or at high altitudes.

Figure 2.6 GPS Triangulation

19
GPS can also determine the velocity of the module. Dead reckoning can be used to estimate
the position of the module even when the signal is lost. The accuracy of determined position
decreases with time.

The prototype designed in this project uses a GPS module for positioning. GPS can determine
heading and altitude of the vehicle, but the signal is expected to be lost at any time. To make
the system more robust and redundant, additional sensors are used. These include a
magnetometer, a barometer, and an accelerometer.

Magnetometer is used to determine the heading of the vehicle with respect to earth’s magnetic
north. Barometer can measure the atmospheric pressure. Atmospheric pressure changes with
change in altitude. By measuring this change, the barometer can determine the altitude of the
vehicle. Accelerometer measures the acceleration on all three axes.

The data from the GPS, magnetometer, and accelerometer is combined using Kalman Filters
to estimate position, heading, velocity, and acceleration of the vehicle. The design is able to
handle uncertainty in reading or complete loss of one sensor.

Figure 2.7 Estimating position using Dead Reckoning

20
Keeping the requirements of this project, the following components were selected using an
online tool called eCalc [2].

• Outrunner 1000kv BLDC motors (4)


• 30A ESCs (4)
• F450 Quadcopter frame
• 2200mAh LiPo 3S1P Battery
• MPU 6050 IMU
• BMP 180 Barometer
• uBlox NEO-6M GPS Module
• HMC5883L Magnetometer

2.4 Sensors
The following sensors are used in the quadcopter prototype.
2.4.1 MPU-6050 Inertial Measurements Unit

The MPU-6050 is a low-cost, highly accurate 6 DoF IMU. It communicates with Arduino
using I2C interface. It has a built-in 16-bit ADC for conversion. MPU 6050 has a 3-axis
accelerometer and a 3-axis gyroscope. The angular acceleration measured by IMU is critical
for stability of the quadcopter.

Figure 2.8 MPU 6050 IMU


2.4.2 BMP180 Barometer
BMP180 is a high precision sensor designed measure the absolute pressure of the air around
them. As atmospheric pressure varies with change in altitude, it can be used to measure
21
altitude. The BMP 180 also measures temperature to compensate for the changes in density of
air as a result of changes in temperature.

The range of measured pressure is 300hPa to 1100hPa with resolution of 0.01hPa (1hPa =
100Pa). It also uses I2C protocol for communication.

Figure 2.9 BMP180 Barometer


2.4.3 uBlox NEO-6M GPS Module
The NEO-6M is a stand-alone GPS receiver module. The module receives signals from
multiple satellites and determines longitude, latitude, and altitude. The data, encoded using
NMEA (National Marine Electronics Association), is sent to Arduino using a serial port with
a baud rate of 9600.

uBlox NEO-6M also has an EEPROM with battery backup. In case of signal loss, the module
determines its estimated position using previous velocity and position data. The module
includes a ceramic antenna for better signal reception.

Figure 2.10 uBlox NEO-6M GPS module

22
2.4.4 HMC5883L Magnetometer
HMC5883L is a 3-axis digital compass used to measure the magnetic field at a point in space.
It communicates with Arduino using I2C interface. Magnetic declination needs to be set in
code for location where the magnetometer is used.

Figure 2.11 HMC5883L Magnetometer


2.4.5 HC-SR04 Ultrasonic Sensor
The HC-SR04 uses non-contact ultrasound sonar to measure the distance to an object. Its range
is 2cm to 400cm. It consists of two ultrasonic transmitters, a receiver, and a control circuit. A
signal is sent to the trigger pin and its echo is detected on the echo pin. The time taken by the
wave can be used to measure distance.

Figure 2.12 HC-SR04 Ultrasonic Sensor


2.5 PID Controller
A proportional-integral-derivative (PID) controller is a control loop feedback mechanism
widely used in industrial control systems. A PID controller calculates an error value as the
difference between a measured process variable and a desired setpoint. The controller attempts
to minimize the error by adjusting the process through use of a manipulated variable.

23
The PID controller involves three separate constant parameters, and is sometimes called three-
term control: the proportional, the integral and derivative values, denoted P, I, and D. These
values can be interpreted in terms of time: P depends on the present error, I on the accumulation
of past errors, and D is a prediction of future errors, based on current rate of change. The
weighted sum of these three parameters is used to adjust the process via a control element such
as the power supplied to a heating element.

The ideal version of the PID controller is given by the formula:

𝑡
𝑑
𝑢(𝑡) = 𝐾𝑝 𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝜏)𝑑𝜏 + 𝐾𝑑 𝑒(𝑡)
0 𝑑𝑡

Figure 2.13 PID Control Loop


u is the control signal and e is the control error (e = r − y). The reference value, r, is also called
the setpoint. The control signal is thus a sum of three terms: a proportional term that is
proportional to the error, an integral term that is proportional to the integral of the error, and a
derivative term that is proportional to the derivative of the error. The controller parameters are
proportional gain Kp, integral gain Ki and derivative gain Kd.

PID Controller Tuning


PID tuning is the process of finding the values of proportional, integral, and derivative gains
of a PID controller to achieve desired performance and meet design requirements. A PID
controller can be tuned through various methods such as mathematical methods i.e., Root locus
method, which requires a system model. It can also be tuned through Traditional methods

24
which are based on setting the system parameters and monitoring its response. In this project,
MATLAB software is used to tune the PID controller.

Parameter Rise Time Overshoot Settling Steady- Stability


Time State Error
Kp Decrease Increase Small Change Decrease Degrade
Ki Decrease Increase Increase Eliminate Degrade
Kd Minor Change Decrease Decrease No Effect Improve
Table 2.1 Effects of PID terms on system behaviour

25
CHAPTER 3 Modelling and Simulation

3.1 Mathematical Modelling


The equations of motion that define the quadrotor system are developed and analyzed. Non-
linear equations which make accurate simulation as well as control difficult are simplified by
making assumptions. The resulting model is simple while still being as realistic as possible.

Figure 3.1 Euler angles of roll, pitch, and yaw


Euler angles of roll, pitch, and yaw, a body coordinate frame {b}, and the global coordinate
frame {G} are shown in figure above. The following assumptions are made:
• The structure is rigid and symmetrical with a center of mass aligned with the center of
the body frame of the vehicle.
• The thrust and drag of each motor is proportional to the square of the motor velocity.
• The propellers are considered to be rigid and therefore blade flapping is negligible.
• Curvature of earth and change in gravity due to altitude is ignored.
State variables are shown in below list. This notation used is North, East, Down (NED)
coordinate system.
𝑋 𝐺 = 𝐺𝑙𝑜𝑏𝑎𝑙 𝑛𝑜𝑟𝑡ℎ 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)
𝑌 𝐺 = 𝐺𝑙𝑜𝑏𝑎𝑙 𝑒𝑎𝑠𝑡 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)
𝑍 𝐺 = 𝐺𝑙𝑜𝑏𝑎𝑙 𝑑𝑜𝑤𝑛 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)
𝑥 𝑏 = 𝐿𝑜𝑐𝑎𝑙 𝑛𝑜𝑟𝑡ℎ 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)
𝑦 𝑏 = 𝐿𝑜𝑐𝑎𝑙 𝑒𝑎𝑠𝑡 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)

26
𝑧 𝑏 = 𝐿𝑜𝑐𝑎𝑙 𝑑𝑜𝑤𝑛 𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑜𝑓 𝑡ℎ𝑒 𝑣𝑒ℎ𝑖𝑐𝑙𝑒 (𝑚)
𝜙 = 𝑟𝑜𝑙𝑙 𝑎𝑛𝑔𝑙𝑒 𝑎𝑙𝑜𝑛𝑔 𝑥 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠)
𝜃 = 𝑝𝑖𝑡𝑐ℎ 𝑎𝑛𝑔𝑙𝑒 𝑎𝑙𝑜𝑛𝑔 𝑦 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠)
𝜓 = 𝑦𝑎𝑤 𝑎𝑛𝑔𝑙𝑒 𝑎𝑙𝑜𝑛𝑔 𝑧 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠)
𝑝 = 𝑟𝑜𝑙𝑙 𝑟𝑎𝑡𝑒 𝑎𝑙𝑜𝑛𝑔 𝑥 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠/𝑠𝑒𝑐𝑜𝑛𝑑)
𝑞 = 𝑝𝑖𝑡𝑐ℎ 𝑟𝑎𝑡𝑒 𝑎𝑙𝑜𝑛𝑔 𝑦 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠/𝑠𝑒𝑐𝑜𝑛𝑑)
𝑟 = 𝑦𝑎𝑤 𝑟𝑎𝑡𝑒 𝑎𝑙𝑜𝑛𝑔 𝑧 𝑏 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠/𝑠𝑒𝑐𝑜𝑛𝑑)
3.1.1 Translational Kinematics
Velocity is in body frame and position is in global frame. A rotation matrix is defined to
transform variables between body frame and global frame.

𝑥 𝑏 = 𝑅 𝑏 𝐺 𝑋 𝐺 = 𝑅(𝜙)𝑅(𝜃)𝑅(𝜓)𝑋 𝐺
cos(𝜓) sin(𝜓) 0 cos(𝜃) 0 − sin(𝜃)
𝑅(𝜓) = [− sin(𝜓) cos(𝜓) 0] 𝑅(𝜃) = [ 0 1 0 ]
0 0 1 sin(𝜃) 0 cos(𝜃)
1 0 0
𝑅(𝜙) = [ 0 cos(𝜙) sin(𝜙) ]
0 −sin(𝜙) cos (𝜙)

cos(𝜓) cos(𝜃) sin(𝜓) cos(𝜃) −sin(𝜃)


𝑅𝑏 𝐺 = [cos(𝜓) sin(𝜙)sin(𝜃) − cos(𝜙)sin(𝜓) sin(𝜙)sin(𝜓)sin(𝜃) + cos(𝜙)cos(𝜓) cos(𝜃)sin(𝜙) ]
cos(𝜙) cos(𝜓)sin(𝜃) + sin(𝜙)sin(𝜓) cos(𝜙)sin(𝜓)sin(𝜃) − cos(𝜙)sin(𝜓) cos(𝜙)cos(𝜃)

𝑋 𝐺 = 𝑅 𝐺 𝑏 𝑥 𝑏 = 𝑅(𝜙)𝑇 𝑅(𝜃)𝑇 𝑅(𝜓)𝑇 𝑥 𝑏 = (𝑅 𝑏 𝐵 )𝑇 𝑥 𝑏

cos(𝜓) cos(𝜃) cos(𝜓) sin(𝜙) sin(𝜃) − cos(𝜙)sin(𝜓) cos(𝜙)cos(𝜓)sin(𝜃) + sin(𝜙)sin(𝜓)


𝑅𝐺 𝑏 = [ sin(𝜓) cos(𝜃) sin(𝜙)sin(𝜓)sin(𝜃) + cos(𝜙)cos(𝜓) cos(𝜙)sin(𝜓)sin(𝜃) − cos(𝜓)sin(𝜙)]
−sin(𝜃) cos(𝜃)sin(𝜙) cos(𝜙)cos(𝜃)

3.1.2 Rotational Kinematics


The above rotation matrix is used to determine the relationship between angular rates and time
derivatives of the Euler angles. The angular velocities are vectors pointing along each axis of
rotation and are not equal to the time derivative of the Euler angles. The derivation below
assumes that the time derivative of each Euler rate is small.

27
𝑝 0 0 𝜙˙ 𝜙˙
𝜔 = [𝑞 ] = 𝑅(𝜙)𝑅(𝜃) [ 0 ] + 𝑅(𝜃) [𝜃˙] + [ 0 ] = 𝑆 [ 𝜃˙ ]
𝑟 𝜓˙ 0 0 𝜓˙
1 sin(𝜙) tan (𝜃) cos(𝜙) tan (𝜃)
0 cos(𝜙) −sin(𝜙)
𝑆 −1 =
sin(𝜙) cos(𝜙)
0
[ cos(𝜃) cos(𝜃) ]
1 sin(𝜙) tan (𝜃) cos(𝜙) tan (𝜃)
𝜙˙ 𝑝
0 cos(𝜙) −sin(𝜙)
[ 𝜃˙ ] = [𝑞 ]
sin(𝜙) cos(𝜙)
𝜓˙ 0 𝑟
[ cos(𝜃) cos(𝜃) ]
Euler angles are assumed to be very small. The S matrix becomes identity and time derivative
of Euler angles becomes roughly equal to angular rates.

3.1.3 Brushless Motor Equations of Motion


Brushless motors are used to generate thrust and torques needed to control the vehicle. Each
motor is controlled by ESCs which receive the desired motor speed from the flight controller
and send those commands to each individual motor. Free body diagram of quadcopter is shown
in figure.

Figure 1 Quadcopter Free Body Diagram


28
Motor resistance and current with no load is assumed zero. Equations of torque and power are
derived below. All four motors are the similar to each other.

𝜏 = 𝑚𝑜𝑡𝑜𝑟 𝑡𝑜𝑟𝑞𝑢𝑒 (𝑁𝑚)


𝐾𝑡 = 𝑡𝑜𝑟𝑞𝑢𝑒 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙𝑖𝑡𝑦 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
𝐼 = 𝑖𝑛𝑝𝑢𝑡 𝑐𝑢𝑟𝑟𝑒𝑛𝑡 (𝐴)
𝐼0 = 𝑐𝑢𝑟𝑟𝑒𝑛𝑡 𝑤𝑖𝑡ℎ 𝑛𝑜 𝑙𝑜𝑎𝑑 (𝐴)
𝑉 = 𝑣𝑜𝑙𝑡𝑎𝑔𝑒 𝑑𝑟𝑜𝑝 𝑎𝑐𝑟𝑜𝑠𝑠 𝑚𝑜𝑡𝑜𝑟 (𝑉)
𝑅𝑚 = 𝑚𝑜𝑡𝑜𝑟 𝑟𝑒𝑠𝑖𝑠𝑡𝑎𝑛𝑐𝑒 (𝑂ℎ𝑚)
𝐾𝑣 = 𝐵𝑎𝑐𝑘 𝐸𝑀𝐹 𝑐𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡
𝑃𝑚 = 𝑚𝑜𝑡𝑜𝑟 𝑝𝑜𝑤𝑒𝑟 (𝑊)
𝜏 = 𝐾𝑡 (𝐼 − 𝐼𝑜 )
𝑉 = 𝐼𝑅𝑚 + 𝐾𝑣 𝜔
(𝜏 + 𝐾𝑡 𝐼𝑜 )(𝑅𝑡 𝐼𝑜 𝑅𝑚 + 𝜏𝑅𝑚 + 𝐾𝑡 𝐾𝑣 𝜔)
𝑃𝑚 = 𝐼𝑉 =
𝐾𝑡 2
𝐴𝑠𝑠𝑢𝑚𝑒 𝑡ℎ𝑎𝑡 𝑅𝑚 ≈ 𝐼𝑜 ≈ 0
𝐾𝑣 𝜏𝜔
𝑃𝑚 =
𝐾𝑡
A generalized thrust equation is derived. The consumed power at hover is the ideal power
required to generate thrust by moving a column of air. Vehicle speed is assumed low, so the
velocity at hover is the velocity of the air when hovering. This equation shows that larger
propellers result in less power consumed. Each rotor leaves behind a wake as it moves. The
velocity of free stream air is assumed zero. This results in the thrust of each motor being
proportional to the product of the square of the angular velocity of the rotor shaft and a lift
coefficient. This equation depicts the relationship between motor speed and resultant force of
thrust, which is the basis for stable control of the vehicle.

𝑃ℎ = 𝑝𝑜𝑤𝑒𝑟 𝑡𝑜 ℎ𝑜𝑣𝑒𝑟 (𝑊), 𝑃𝑚 = 𝑚𝑜𝑡𝑜𝑟 𝑝𝑜𝑤𝑒𝑟 (𝑊)


𝑇 = 𝑡ℎ𝑟𝑢𝑠𝑡 𝑡𝑜 ℎ𝑜𝑣𝑒𝑟 (𝑁)
𝑣ℎ =induced velocity at hover (𝑚/𝑠)
𝜔 = 𝑚𝑜𝑡𝑜𝑟 𝑎𝑛𝑔𝑢𝑙𝑎𝑟 𝑣𝑒𝑙𝑜𝑐𝑖𝑡𝑦 (𝑟𝑎𝑑𝑖𝑎𝑛𝑠 /𝑠𝑒𝑐)
𝜌 = 𝑎𝑖𝑟 𝑑𝑒𝑛𝑠𝑖𝑡𝑦 (𝑘𝑔/𝑚3 )
𝐴 =area swept by rotor blades (𝑚2 )
29
𝐾𝑣 = 𝑏𝑎𝑐𝑘 𝐸𝑀𝐹 𝑐𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡
𝐾𝜏 = 𝑡𝑜𝑟𝑞𝑢𝑒 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙𝑖𝑡𝑦 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
𝐾𝑇 = 𝑡ℎ𝑟𝑢𝑠𝑡 𝑐𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡
𝜏 =motor torque (𝑁𝑚)
𝑃ℎ = 𝑇𝑣ℎ
𝑇 = 2𝜌𝐴𝑣ħ2
𝜏 = 𝐾𝜏 𝑇
𝐾𝑣 𝜏𝜔 𝐾𝑣 𝐾𝜏 𝑇𝜔
𝑃𝑚 = =
𝐾𝑡 𝐾𝑡
𝜋
𝑇2
𝑃ℎ =
√2𝜌𝐴
1
𝐾𝑣 𝐾𝜏 𝑇𝜔 𝑇2
=
𝐾𝑡 √2𝜌𝐴
2
𝐾𝑣 𝐾𝜏 √2𝜌𝐴
𝑇 = [( ) 𝜔] = 𝐾𝑇 𝜔2
𝐾𝑡

3.1.4 Translational Dynamics


The acceleration of the quadrotor in the global frame is equal to the sum of force of gravity,
the thrust force of the motors, and linear friction force resulting in drag. The thrust vector in
the body frame is transformed into the global frame using the rotation matrix defined
previously. The resultant force generated by the four motors in the global coordinate frame is
defined below. Additionally, the resultant global drag force along each translational axis is
defined below as the product of drag coefficients and linear velocities in each direction in the
global frame. This is a simple model of fluid friction. More complex modeling would involve
separate friction constants for each axis as well as modeling the friction in the body frame
instead of the inertial frame.

𝑚 = mass of the quadrotor (𝑘𝑔)


𝑔 = acceleration due to gravity (𝑚/𝑠 2 )
𝑿¨𝐺 = acceleration in the global coordinate frame (𝑚/𝑠 2 )
𝑿˙𝐺 = velocity in the global coordinate frame (𝑚/𝑠)
𝐹𝑔 = force of gravity in the global coordinate frame (N)
𝐹𝑑 = force of drag in the global coordinate frame (N)
𝐺
𝐹𝑇 = total force of thrust in the global coordinate frame (𝑁)
𝐹𝑇𝑏 = total force of thrust in the body coordinate frame (N)
𝑅𝑏𝐺 = body to global coordinate frame rotation matrix
𝐹𝑖 = thrust of each motor (𝑁)

30
𝜔 = motor angular velocity (radians/sec)
𝐾𝑇 = thrust coefficient
𝐾𝑑𝑥 = 𝐾𝑑𝑦 = 𝐾𝑑𝑧 = drag coefficient

𝑚𝐗¨ 𝐺 = 𝐹𝑔 − 𝐹𝑇𝐺 − 𝐹𝑑

𝑋¨ 𝐺 0
¨𝐗 𝐺 = [𝑌¨ 𝐺 ] and 𝐹𝑔 = [ 0 ]
𝑍¨ 𝐺 𝑚𝑔

𝐾𝑑𝑥 0 0 𝑋˙ 𝐺
𝐹𝑑 = [ 0 𝐾𝑑𝑦 0) ] [𝑌˙ 𝐺 ]
0 0 𝐾𝑑𝑧 𝑍˙ 𝐺
𝐺 𝐺 𝑏
𝐹𝑇 = 𝑅𝑏 𝐹𝑇

𝐹𝑇𝑏 = ∑4𝑖=1  𝐹𝑖


0
𝐹𝑇𝐺 = 𝑅𝑏𝐺 ∑4𝑖=1  𝐹𝑖 =[ 0 ]
𝐾𝑇 ∑4𝑖=1  𝜔𝑖2
3.1.5 Rotational Dynamics
The rotational equations of motion are defined in the body frame. The vehicle is symmetrical,
so the moment of inertia matrix is also symmetrical. These equations are comprised of three
terms including aerodynamic effects and motor torques. First, the gyroscopic effect resulting
from the rigid body rotation. Second, the motors produce a rolling, pitching, and yawing
torque. The torque due to drag is shown to be proportional to the product of a drag constant
and the square of the rotor’s angular velocity. This drag equation assumes that the quadrotor
is operating in stable flight and that the propellers are maintaining a constant thrust and not
accelerating. This assumption results in the torque about the global z axis being equal to the
torque due to drag. Third, the cross product which describes the gyroscopic effect resulting
from the propeller rotation coupled with the body rotation. This is due to the fact that the rotor’s
axis of rotation is itself moving with the angular velocity of the frame.

𝜔 = rate of angular velocities (radians/s)


𝜔˙ = rate of angular accelerations (radians/s 2 )
𝑱𝑏 = quadrotor body moment of inertia (𝑘𝑔. 𝑚2 )
𝐽𝑚 = motor moment of inertia (𝑘𝑔. 𝑚2 )
𝐽𝑟 = rotor moment of inertia (𝑘𝑔. 𝑚2 )
𝐽𝑥 = quadrotor moment of inertia in 𝑥𝑏 ( 𝑘𝑔. 𝑚2 )
31
𝐽𝑦 = quadrotor moment of inertia in 𝑦𝑏 ( 𝑘𝑔. 𝑚2 )
𝐽𝑧 = quadrotor moment of inertia in 𝑧𝑏 ( 𝑘𝑔. 𝑚2 )
𝜏𝑚 = body torques from motors (𝑁𝑚)
𝜏𝑔 = gyroscopic effect torques (𝑁𝑚)
𝜏𝜙,𝜃,𝜓 = torques along the body axes (𝑁𝑚)
𝜏𝑑 = drag torque (𝑁𝑚)
𝐾𝑑 = drag torque proportionality constant
𝐾𝑇 = thrust coefficient
𝑅 = propellor radius (𝑚)
𝐴 = propellor cross section (𝑚2 )
𝐶𝐷 = dimensionless coefficient
𝜌 = air density (𝑘𝑔/𝑚3 )
ℓ = length of 𝑎𝑟𝑚 (𝑚)
𝜏𝜙 ℓ𝐾𝑇 (𝜔42 − 𝜔22 )
𝜏𝑚 = [ 𝜏𝜃 ] = [ ℓ𝐾𝑇 (𝜔12 − 𝜔32 ) ]
𝜏𝑣 2 2 2 2
𝐾𝑑 (𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 )

𝜏3 = 𝜔 × 𝐆𝐙 ∑4𝑖=1  𝐽𝑟 𝜔𝑖

𝜃˙ 𝐽1 𝜃˙(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 )
4 𝑖+1
𝜏𝑔 = [−𝜙˙] 𝐽𝑟 ∑𝑖=1  (−1) 𝜔𝑖 = [−𝐽7 𝜙(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 )]
0 0
3.1.6 Equations of Motion
Solving for the quadrotor’s global translational acceleration and body frame angular
accelerations leads to the following equations. We use the global frame for translational
position since that is the same coordinate frame as our GPS sensor. Similarly, the body frame
is chosen for attitude since the IMU (accelerometer, magnetometer, and gyroscope) also make
measurements in the body frame. These equations are both non-linear and highly coupled.
They can be simplified using reasonable assumptions in order to design and implement stable
control systems.

𝐽𝑏 𝜔˙ = 𝜏𝑚 − 𝜏𝑔 − (𝜔 × 𝐽𝑏 𝜔)
𝐽𝑥 0 0 𝜙¨ 𝜃˙ 𝜓˙(𝐽𝑧 − 𝐽𝑦 )
𝐽𝑏 = [ 0 𝐽𝑦 0 ] 𝜔˙ = [ 𝜃¨ ] (𝜔 × 𝐽𝑏 𝜔) = [𝜓˙𝜙˙(𝐽𝑥 − 𝐽𝑧 )]
0 0 𝐽𝑧 𝜓¨ 𝜃˙𝜙(𝐽𝑦 − 𝐽𝑧 )

𝐽𝑚 𝜔˙ = 𝜏𝑚 − 𝜏𝑣

32
𝐴𝑡 ℎ𝑜𝑣𝑒𝑟: 𝜔˙ = 0, 𝑠𝑜 𝜏𝜓 = 𝜏𝐷
1
𝜏𝐷 = 𝑅𝜌𝐶𝐷 𝐴(𝜔𝑅)2 = 𝐾𝑑 𝜔2
2
𝜏𝜙,𝜃 = ∑ 𝑟 × 𝑇
𝜏𝜙 = ℓ𝐾𝑇 (𝜔42 − 𝜔22 )
𝜏𝜃 = ℓ𝐾𝑇 (𝜔12 − 𝜔32 )
𝑋˙ 𝐺 cos (𝜓)cos (𝜃) cos (𝜓)sin (𝜙)sin (𝜃) − cos (𝜙)sin (𝜓) cos (𝜙)cos (𝜓)sin (𝜃) + sin (𝜙)sin (𝜓) 𝑥˙ 𝑏
[ 𝑌˙ 𝐺 ] = [ sin (𝜓)cos (𝜃) sin (𝜙)sin (𝜓)sin (𝜃) + cos (𝜙)cos (𝜓) cos (𝜙)sin (𝜓)sin (𝜃) − cos (𝜓)sin (𝜙)] [𝑦˙ 𝑏 ]
𝑍˙ 𝐺 −sin (𝜃) cos (𝜃)sin (𝜙) cos (𝜙)cos (𝜃) 𝑧𝑏

1
(−[cos (𝜙)cos (𝜓)sin (𝜃) + sin (𝜙)sin (𝜓)]𝐹𝑇𝑏 − 𝐾𝑑𝑥 𝑋˙ 𝐺 )
𝑚
𝑋¨ 𝐺 1
[ 𝑌¨ 𝐺 ] = (−[cos (𝜙)sin (𝜓)sin (𝜃) − cos (𝜓)sin (𝜙)]𝐹𝑇𝑏 − 𝐾𝑑𝑦 𝑌˙ 𝐺 )
𝑚
𝑍¨ 𝐺 1
[ (−[cos (𝜙)cos (𝜃)]𝐹𝑇𝑏 − 𝐾𝑑𝑧 𝑍˙ 𝐺 ) + 𝑔 ]
𝑚

1 sin (𝜙)tan (𝜃) cos (𝜙)tan (𝜃)


𝜙˙ 0 cos (𝜙) −sin (𝜙) 𝑝
[ 𝜃˙ ] = sin (𝜙) cos (𝜙) [𝑞]
𝜓˙ 0 𝑟
[ cos (𝜃) cos (𝜃) ]
1
[(𝐽 − 𝐽𝑧 )𝑞𝑟 − 𝐽𝑟 𝑞(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 ) + ℓ𝐾𝑇 (𝜔42 − 𝜔22 )]
𝐽𝑥 𝑦
𝜙¨ 1
[𝜃¨ ] = [(𝐽 − 𝐽𝑧 )𝑝𝑟 + 𝐽𝑟 𝑝(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 ) + ℓ𝐾𝑇 (𝜔12 − 𝜔32 )]
𝐽𝑦 𝑧
𝜓¨
1
[(𝐽 − 𝐽𝑦 )𝑝𝑞 + 𝐾𝑑 (𝜔12 − 𝜔22 + 𝜔32 − 𝜔42 )]
[ 𝐽2 𝑥 ]
3.2 Model Verification
The moments of inertia can be calculated several ways. In the equations below, the stack-up
of the frame is modeled a hollow sphere. The stack-up is the center of the quadrotor which
holds the flight controller and receiver, IMU and other sensors, 2200mAh 3S 30C LiPo
battery, Power Distribution Board and four 30 Amp ESCs. We model the 1000Kv motors as
cylinders and use Huygens–Steiner to move the reference axis of the cylinders towards the
sphere. These equations as well as the appropriate values are computed below.

𝐽𝑥 = quadrotor moment of inertia in 𝑥𝑏 ( 𝑘𝑔 − 𝑚2 )


𝐽𝑦 = quadrotor moment of inertia in 𝑦𝑏 ( 𝑘𝑔 − 𝑚2 )
𝐽𝑧 = quadrotor moment of inertia in 𝑧𝑏 ( 𝑘𝑔 − 𝑚2 )

33
𝑚𝑔 = mass of the stack-up frame and electronics (kg)
𝑟𝑠 = radius of the stack-up (m)
𝑚𝑚 = mass of the motor (kg)
𝑟 = radius of the motor (𝑚)
ℎ = height of the motor (m)
ℓ = length of 𝑎𝑟𝑚 (𝑚)
1
Motor: 𝐽𝑧 = 𝐽𝑦 = 𝑚m (3𝑟 2 + ℎ2 )
12
1
Motor: 𝐽𝑧 = 2 𝑚𝑚 𝑟 2
2
Stack-up: 𝐽𝜋 = 𝐽𝑦 = 𝐽𝑧 = 3 𝑚𝑘 𝑟𝑧2

2 1
𝐽𝑧 = 𝐽𝑦 = 𝑚𝑠 𝑟𝑠2 + 2 ( 𝑚𝑚 (3𝑟 2 + ℎ2 ) + 𝑚𝑚 ℓ2 )
3 12
2 1
𝐽𝑧 = 𝐽𝑦 = (1.1 ∗. 082 ) + 2 ( . 072(3 ∗. 0282 +. 0362 ) + .072 ∗. 562 )
3 12
𝐽𝑧 = 𝐽𝑦 = .04989 kg − m2
2 1
𝐽𝑧 = 𝑚𝑠 𝑟𝑥2 + 4 ( 𝑚𝑚 𝑟 2 + 𝑚𝑚 ℓ2 )
3 2
2 1
𝐽𝑧 = (1.1 ∗. 082 ) + 4 ( (. 072 ∗. 0282 ) + .072 ∗. 562 )
3 2
𝐽𝑧 = .24057 kg − m2
3.2.1 Propeller Moment of Inertia
The work of Tomas J’s Master’s thesis [4] was used to calculate the moment of inertia for
propellers. Section 4.1.1 calculates the motor of inertia for an APC 10×4.7 propeller which is
also used for this project. He measures the weight and density of the propeller, divides the
propeller into sections, and estimates the total moment of inertia as the sum of the sections
using the parallel axis theorem. He estimates the moment of inertia to be 0.04439 kg-m2.

3.2.2 Motor System Parameters


Four 1000Kv motors are used in this quadrotor. Simplified electrical equation
(Kirchhoff’s Law) and the dynamic equation for the motor coupled to a load (Newton’s Second
Law) is defined below in the time domain. Back emf is proportional to the angular velocity of
the motor. Faraday’s law can be used to describe the voltage created by the changing magnetic
field in a coil. Lorentz’s law which describes the force upon a coil in a magnetic field result in
the produced torque being proportional to the motor current. These equations are shown below
in the time domain.

34
𝑃𝑊𝑀𝑎𝑝𝑝 = Applied PWM signal (s)
𝑢𝑒𝑚𝑓 = Back EMF (volts)
𝑖 = Motor current (amps)
𝑅 = Resistance of the coils and windings (ohms)
𝐿 = Inductance of coils (Henries)
𝐽 = Inertial load (𝐾𝑔 − 𝑚2 )
𝐾𝑒 = 𝐸𝑀𝐹 constant (volt-s /𝑟𝑎𝑑)
𝐾𝜏 = Armature constant (𝑁 − 𝑚/𝑎𝑚𝑝)
𝐾𝑓 = Motor friction constant (𝑁 − 𝑚 − 𝑠/𝑟𝑎𝑑)
𝜔 = Motor speed (𝑟𝑎𝑑/𝑠)
𝑑𝑖(𝑡)
𝑃𝑊𝑀𝑎𝑝𝑝 (𝑡) = 𝑅𝑖(𝑡) + 𝐿 + 𝑢𝑒𝑚𝑓 (𝑡)
𝑑𝑡
𝑑𝜔
𝐽 = ∑𝜏𝑖
𝑑𝑡

𝑢𝑒𝑚𝑓 (𝑡) = 𝐾𝑒 𝑤(𝑡)


𝜏(𝑡) = 𝐾𝑟 𝑖(𝑡)

𝑑𝑖(𝑡)
𝑃𝑊𝑀𝑎𝑝𝑝 (𝑡) = 𝑅𝑖(𝑡) + 𝐿 + 𝐾𝑒 𝑤(𝑡)
𝑑𝑡
𝑑𝜔
𝐽 = 𝐾𝜏 𝑖(𝑡) − 𝐾𝑓 𝑤(𝑡)
𝑑𝑡
3.2.3 Motor Dynamics Identification
In order to model the system dynamics of the motor, The transfer function that describes the
motor dynamics is calculated. The TF’s output is the propeller speed, and the input is the motor
voltage. The TF is used to calculate the time constant of the motor and the DC gain. In the
equations below, the equations are converted from the time domain to the frequency domain
using the Laplace transform.

𝑃𝑊𝑀𝑎𝑝𝑝 (𝑠) = (𝑠𝐿 + 𝑅)𝐼(𝑠) + 𝐾𝑒 𝑤(𝑠)


𝐾𝜏 𝐼(𝑠) = (𝐽𝑠 + 𝐾𝑓 )𝑤(𝑠)

𝑤(𝑠) 𝐾𝜏
𝐺(𝑠) = =
𝑃𝑊𝑀𝑎𝑝𝑝 (𝑠) (𝑠𝐿 + 𝑅)(𝐽𝑠 + 𝐾𝑓 ) + 𝐾𝑒 𝐾𝜏
𝐾𝜏
𝐺(𝑠) =
𝐽𝐿𝑠 2 + (𝑅𝐽 + 𝐾𝑓 𝐿)𝑠 + 𝑅𝐾𝑓 + 𝐾𝑒 𝐾𝜏

35
𝑅𝐽 >> 𝐾𝑓 𝐿
𝐾𝑒 𝐾𝜏 >> 𝑅𝐾𝑓

𝐿≈0
1
𝐾𝜏 𝐾𝑒
𝐺(𝑠) = =
𝑅𝐽𝑠 + 𝐾𝑒 𝐾𝜏 𝑅𝐽
𝐾𝑒 𝐾𝑟 𝑠 + 1

1
DC Gain: 𝐾𝐷𝐶 = 𝐾
𝑒
𝑅𝐽
Time constant: 𝜏 = 𝐾
𝑒 𝐾𝜏

Several assumptions are made to reduce the transfer function to approximate a first order
system. The force due to friction in a brushless DC motor is primarily due to bearing drag and
is thus very small. Also, since the motor is small, we can assume the inductance is low and
neglect this term as well. This results in the transfer function above. Additionally, the equations
for the time constant and DC gain are calculated.

3.2.4 Thrust Coefficient


Thrust coefficient is a proportional constant that relates the thrust of each motor to the square
of the angular rate of the propeller. It can be estimated using the motor parameters defined
above. This is easiest to calculate at the hover point since we know that the thrust of each motor
is equal to a quarter of the mass of the quadcopter, and we can estimate the propeller speed
from the data previously collected. The calculation of the thrust coefficient is detailed below.

𝑇ℎ = thrust to hover (𝑁)


𝜔ℎ = motor angular velocity at hover (𝑟𝑎𝑑/𝑠)
𝐾𝑇 = thrust coefficient (𝑘𝑔 − 𝑚)
𝑚 = mass of the quadrotor (𝑘𝑔)
𝑔 = acceleration due to gravity (𝑚/𝑠 2 )
𝑇ℎ = 𝐾𝑇 𝜔ℎ2
𝑚𝑔
= 𝐾𝑇 𝜔ℎ2
4
𝑚𝑔 1.5 ∗ 9.8
𝐾𝑇 = 2 = 4 ∗ (392)2
4𝜔ℎ
𝐾𝑇 = 2.39 ∗ 10−5

36
3.3 Controller Design
Control systems is developed based on the quadcopter model. Lower-level control systems
will run at a high rate and control the quadrotor’s attitude. These controllers rely on the onboard
IMU measurements. At higher level, the translational position of the quadrotor is controlled
using a GPS sensor. Since translational movement is dependent on attitude adjustments, the
outputs of the translational controllers will become the inputs of the attitude controller.

3.3.1 General Control Strategy


The quadrotor is an underactuated system. The quadrotor is able to move in 6 degrees of
freedom (3 translational and 3 rotational) but only has 4 control inputs (the speeds of each
motor). While the quadrotor can move directly on the vertical z axis without changing any
other state, it must change its attitude to move on the horizontal x and y axes. Since it is not
possible to control 6 degrees of freedom with only 4 control inputs, the controllers are design
to stabilize around desired x, y, z positions and a desired heading. The quadrotor should be
able to safely move to this desired position while maintaining stable roll and pitch angles. ESCs
control the angular velocities of each rotor. This results in the following direct control inputs:

• u(1) = The resulting thrust of the four rotors


• u(2) = The difference of thrust between the motors on the x axis which results in roll
angle changes and subsequent movement in the lateral x direction.
• u(3) = The difference of thrust between the motors on the y axis which results in pitch
angle changes and subsequent movement in the lateral y direction.
• u(4) = The difference of torque between the clockwise and counterclockwise rotors
which results in a moment that rotates the quadrotor around the vertical z axis.

Equations for the net thrust and moment are used to define the control inputs to the quadcopter.
The control inputs are defined below. Inverting this matrix allows us to solve for the desired
motor speeds given values for the four control inputs. Therefore, if the control inputs are
computed, these values can be mapped to the desired speeds for each motor. These speeds can
then be sent to the ESCs.

𝐹𝑇𝑏 = total force of thrust in the body coordinate frame (N)


𝜔 = motor angular velocity (radians/sec)
𝜏𝜙,𝜃,𝜓 = torques along the body axes (𝑁 − 𝑚)
𝐾𝑑 = drag torque proportionality constant

37
𝐾𝑇 = thrust coefficient
ℓ = length of arm (𝑚)
𝑢1 = total thrust of all motors
𝑢2 = roll control input
𝑢3 = pitch control input
𝑢4 = yaw control input
2
𝐹𝑇𝑏 𝐾𝑇 𝐾𝑇 𝐾𝑇 𝐾𝑇 𝜔1 𝑢1
𝜏𝜙 0 −ℓ𝐾𝑇 0 ℓ𝐾𝑇 𝜔22 𝑢2
=[ ] 2 = [𝑢 ]
𝜏𝜃 ℓ𝐾𝑇 0 −ℓ𝐾𝑇 0 𝜔3 3
𝜏
[ 𝜓] 𝐾𝑑 −𝐾𝑑 𝐾𝑑 −𝐾𝑑 [𝜔 ]
2 𝑢4
4

The general control strategy will rely on 3 control subsystems. The sensors on-board the
quadrotor measure the angular velocity and translational acceleration. These values are
compared to the desired attitude and positions to calculate an error signal that is fed into the
control systems.

In the first subsystem, a position error is the input and desired roll and pitch angles are the
outputs. The roll, pitch, and yaw errors are input into an attitude subsystem. This system
outputs desired angular velocities for each axis. These are fed into the final control system.
The outputs of this system are the control inputs that can then be mapped into desired motor
speeds.

3.3.2 Simplified Equations of Motion


The complex model of the quadcopter’s motion makes it difficult to gain accurate insight into
the quadrotor’s behavior and to troubleshoot control systems in simulation. For this research,
only the primary elements that describe the quadrotor’s behavior at hover, our desired
operational state, are considered. The elements that significantly impact the quadrotor’s
behavior at high speeds are ignored. We can make several assumptions that reduces the
complexity of the non-linear equations described above to develop basic control strategies. We
can then increase the complexity of the system model to develop more precise control systems
in the future. The model derived in the System Modeling section is reproduced below with the
control inputs introduced.

38
1
(−[𝑐𝑜𝑠 (𝜙)𝑐𝑜𝑠 (𝜓)𝑠𝑖𝑛 (𝜃) + 𝑠𝑖𝑛 (𝜙)𝑠𝑖𝑛 (𝜓)]𝑢1 − 𝐾𝑑𝑥 𝑋˙ 𝐺 )
𝑚
𝑋¨ 𝐺 1
[𝑌¨ 𝐺 ] = (−[𝑐𝑜𝑠 (𝜙)𝑠𝑖𝑛 (𝜓)𝑠𝑖𝑛 (𝜃) − 𝑐𝑜𝑠 (𝜓)𝑠𝑖𝑛 (𝜙)]𝑢1 − 𝐾𝑑𝑦 𝑌˙ 𝐺 )
𝑚
𝑍¨ 𝐺 1
˙𝐺
[𝑚 (−[𝑐𝑜𝑠 (𝜙)𝑐𝑜𝑠 (𝜃)]𝑢1 − 𝐾𝑑𝑧 𝑍 ) + 𝑔 ]

1 sin (𝜙)tan (𝜃) cos (𝜙)tan (𝜃)


𝜙˙ 0 cos (𝜙) −sin (𝜙) 𝑝
˙
[𝜃 ] = [𝑞 ]
sin (𝜙) cos (𝜙)
𝜓˙ 0 𝑟
[ cos (𝜃) cos (𝜃) ]
1
[(𝐽 − 𝐽𝑧 )𝑞𝑟 − 𝐽𝑟 𝑞(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 ) + 𝑢2 ]
𝐽𝑥 𝑦
𝜙¨ 1
[ 𝜃¨ ] = [(𝐽 − 𝐽𝑥 )𝑝𝑟 + 𝐽𝑟 𝑝(𝜔1 − 𝜔2 + 𝜔3 − 𝜔4 ) + 𝑢3 ]
𝐽𝑦 𝑧
𝜓¨
1
[(𝐽 − 𝐽𝑦 )𝑝𝑞 + 𝑢4 ]
[ 𝐽𝑧 𝑥 ]
The quadrotor is operated around a stable hover with small attitude angles and minimal
rotational and translational velocities and accelerations. Since there are no aerodynamic lifting
surfaces, we will assume that the aerodynamic forces and moments are negligible. The effects
that are considered negligible are treated as disturbances in the control system and can be
compensated for with appropriate control system design. The simplified equations are shown
below.

𝑋˙ 𝐶 = 𝑌˙ 𝐺 = 𝑍˙ 𝐺 = 0
𝜓˙ = 𝜃˙ = 𝜙˙ = 0
𝜙=𝜃=0
cos (𝜙) ≈ cos (𝜃) ≈ 1
sin (𝜙) ≈ sin (𝜃) ≈ 0
𝑝 1 0 0 𝜙˙ 𝜙˙
[𝑞 ] ≈ [0 1 0] [ 𝜃˙ ] ≈ [ 𝜃˙ ]
𝑟 0 0 1 𝜓˙ 𝜓˙
1
(−[cos (𝜙)cos (𝜓)sin (𝜃) + sin (𝜙)sin (𝜓)]𝑢1 )
¨ 𝐺 𝑚
𝑋 1
[𝑌¨ 𝐺 ] = (−[cos (𝜙)sin (𝜓)sin (𝜃) − cos (𝜓)sin (𝜙)]𝑢1 )
¨ 𝐺 𝑚
𝑍 1
[ (−[cos (𝜙)cos (𝜃)]𝑢1 ) + 𝑔 ]
𝑚
𝜓=0
39
cos (𝜓) = 1
sin (𝜓) = 0
1 1
(−[𝜃cos (𝜓) + 𝜙sin (𝜓)]𝑢1 ) − 𝜃𝑢1
𝑚 𝑚
𝑋‾ 𝐺 1 1
[𝑌‾ 𝐺 ] = (−[𝜃sin (𝜓) − 𝜙cos (𝜓)]𝑢1 ) = 𝜙𝑢
‾ 𝐺 𝑚 𝑚 1
𝑍 1 1
(𝑢 )
[ −
𝑚 1 + 𝑔 ] [ 𝑚 (𝑢1 ) + 𝑔]

1
(𝑢 )
𝐽x 2
𝜙˙ 1
[ 𝜃¨ ] = (𝑢 )
𝑗𝑦 3
𝜓¨
1
(𝑢 )
[ 𝐽z 4 ]
3.3.3 Simplified PID Control
The controller calculates the difference between the actual and desired state and produces an
error value. The measurements from the quadrotor’s sensors are fed back to compute this error
signal. The output of PID control system is a control value u that will drive the system closer
to the desired state. A block diagram representation of the basic PID controller is shown below.

Figure 3.2 PID Control


The PID controller is tuned to determine the best values of the control gains given specific
system response parameters. For this project, the values were first determined in simulation
and then refined on the actual system. Note that for manual RC flight of the quadrotor, only
the attitude controller is necessary. The position controller is only needed when using an
external localization sensor such as a GPS and conducting waypoint navigation. There are
some characteristics of the physical system that a basic PID controller may not accurately
account. These include delays in sensor measurements and motor response as well as the inertia
of the vehicle.

40
3.3.4 Nested Control Loops
Nested control loops are implemented for control. The inner most loop controls the angular
velocities of each axis of the quadcopter. It needs to run at high frequency due to the fast
dynamics of the quadrotor. The benefit of running the rate control loop at a high frequency is
that the high frequency of onboard sensors such as the accelerometer and gyroscope is utilized.
This means we can take advantage of the most recent and accurate measurements when
calculating control values. The next highest loop controls the attitude and altitude of the
quadrotor. This altitude/attitude controller can receive desired altitude and attitude from a
remote controller or from a translational control outer loop.

The outer loop controls translational movement along the x and y axis. This controller outputs
desired roll and pitch angles for the inner controller based on the error in the x and y axis.
There are multiple inputs for this outer loop controller. These could be waypoints generated
from a Ground Control Station or a path planning algorithm for example. A block diagram
demonstrating these nested control loops and the quadcopter plant system is shown below.

Figure 3.3 Nested Control loops


3.3.5 Position Control
While the attitude/altitude controller can maintain a stable hover for the quadrotor and track
desired attitude/altitude inputs from a RC or GCS, it is unable to control the translational
motion of the quadrotor. No matter how accurate the attitude controller may be, small attitude
angles will result in translational movement or drifting of the quadrotor. In order to prevent

41
this translational drifting behavior, a position controller is implemented. In order for this
controller to function, some sort of relative or global localization must be done. Typically, this
is done with a GPS for global frame positioning. The inputs to the position controller are
position measurements and the outputs are desired roll and pitch angles to maneuver the
quadrotor to the desired x and y position. This controller also enables trajectory following
where a series of successive waypoints can be fed to the position controller to get the quadrotor
to follow a specific three-dimensional path.

𝑘𝑃 = Proportional control gain


𝑘𝐼 = Integral control gain
𝑘𝐷 = Derivative control gain
𝑋𝑑𝐺 = Desired global 𝑋 position (m)
𝑌𝑑𝐺 = Desired global Y position (m)
𝜙𝑑 = Desired roll angle (radians)
𝜃𝑑 = Desired pitch angle (radians)
𝑡
𝜃𝑑 (𝑡) = 𝑘𝑃 (𝑋𝑑𝐺 − 𝑋 𝐺 ) + 𝑘𝐼 ∫0  (𝑋𝑑𝐺 − 𝑋 𝐺 )𝑑𝑡 + 𝑘𝐷 (𝑋˙𝑑𝐺 − 𝑋˙ 𝐺 )
𝑡 𝐺
𝜙𝑑 (𝑡) = 𝑘𝑃 (𝑌𝑑𝐺 − 𝑌 𝐺 ) + 𝑘𝐼 ∫0  (𝑌𝑑𝐺 − 𝑌 𝐺 )𝑑𝑡 + 𝑘𝐷 (𝑌˙𝑑 − 𝑌˙ 𝐺 )

3.3.6 Attitude and Altitude Control


This section details the development of the attitude and altitude control system. Initially, we
want to implement this controller to stabilize the quadrotor around a stable hover. This means
that all desired angles are 0 and we set the desired altitude to some low value for tuning
purposes. Later, these desired attitude and altitude values can vary based on RC or outer loop
controller inputs. Since our simplified model removed any cross coupling in the equations of
motion, attitude control can be implemented with an independent control input for each Euler
angle.

Controlling the altitude is analogous to controlling the total thrust of the quadrotor. This is
important since this control input also influences movement along the x and y axis. This can
be seen in the translational equations of motion where u1 is an input in the x and y directions.
Therefore, higher values of throttle result in more aggressive movements in the x and y
directions given constant roll and pitch angles. In our simplified model, vertical acceleration
is decoupled from attitude angle. However, this doesn’t hold when the quadrotor rotates since
components of vertical acceleration are also in the x and y planes. Therefore, the altitude

42
control compensates for both the offset of gravity and the deflection of the generalized thrust
vector due to tilt. The full PID controllers are detailed below.

𝑢1 = total thrust of all motors


𝑝𝑑 = Desired angular velocity along 𝑥 𝑏 (radians/second)
𝑞𝑑 = Desired angular velocity along 𝑦 𝑏 (radians/second)
𝑟𝑑 = Desired angular velocity along 𝑧 𝑏 (radians/second)
𝑘𝑃 = Proportional control gain
𝑘𝐼 = Integral control gain
𝑘𝐷 = Derivative control gain
𝜙𝑑 = Desired roll angle (radians)
𝜃𝑑 = Desired pitch angle (radians)
𝜓𝑑 = Desired yaw angle (radians)
𝑍𝑑𝐺 = Desired altitude (𝑚)
𝑚 = mass of the quadrotor (𝑘𝑔)
𝑔 = acceleration due to gravity (𝑚/𝑠 2 )
𝑒(𝑡) = error value at time 𝑡
1 𝑡 𝑒𝑧 (𝑡) − 𝑒𝑧 (𝑡 − 1)
𝑢1 (𝑡) = (𝑘𝑃 𝑒𝑧 (𝑡) + 𝑘𝐼 ∫0  𝑒𝑧 (𝑡)𝑑𝑡 + 𝑘𝐷 + 𝑚𝑔)
cos (𝜙)cos (𝜃) 𝑑𝑡

𝑡 𝑒𝜙 (𝑡) − 𝑒𝜙 (𝑡 − 1)
𝑝𝑑 (𝑡) = 𝑘𝑃 𝑒𝜙 (𝑡) + 𝑘𝐼 ∫0  𝑒𝜙 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡

𝑡 𝑒𝜃 (𝑡) − 𝑒𝜃 (𝑡 − 1)
𝑞𝑑 (𝑡) = 𝑘𝑃 𝑒𝜃 (𝑡) + 𝑘𝐼 ∫0  𝑒𝜃 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡

𝑡 𝑒𝜓 (𝑡) − 𝑒𝜓 (𝑡 − 1)
𝑟𝑑 (𝑡) = 𝑘𝑃 𝑒𝜓 (𝑡) + 𝑘𝐼 ∫0  𝑒𝜓 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡
The yaw/heading control is often accomplished sufficiently with only PD control so the
integrator gain would be 0. The code for implementing these control algorithms in discrete
time in addition to some modifications to improve performance from the basic PID format are
shown in the Autopilot Implementation Section.

3.3.7 Angular Velocity Control


The rate controller is the lowest level controller developed for the quadrotor system. This
controller receives desired angular rates from the attitude controller. Then, it computes the
error between the desired rates and the rates measured by the gyroscope. This error is then used

43
to compute the three moment control inputs. These are combined with the thrust control input
calculated by the altitude controller which are then converted to desired motor speeds and sent
to the motors via the ESCs.

𝑢2 = roll control input


𝑢3 = pitch control input
𝑢4 = yaw control input
𝑘𝑃 = Proportional control gain
𝑘𝐼 = Integral control gain
𝑘𝐷 = Derivative control gain
𝑝 = Desired angular velocity along 𝑥 𝑏 (radians/second)
𝑞 = Desired angular velocity along 𝑦 𝑏 (radians/second)
𝑟 = Desired angular velocity along 𝑧 𝑏 (radians/second)
𝑒(𝑡) = error value at time 𝑡
𝑡 𝑒𝑝 (𝑡) − 𝑒𝑝 (𝑡 − 1)
𝑢2 (𝑡) = 𝑘𝑃 𝑒𝑝 (𝑡) + 𝑘𝐼 ∫0  𝑒𝑝 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡

𝑡 𝑒𝑞 (𝑡) − 𝑒𝑞 (𝑡 − 1)
𝑢3 (𝑡) = 𝑘𝑃 𝑒𝑞 (𝑡) + 𝑘𝐼 ∫0  𝑒𝑞 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡

𝑡 𝑒𝑟 (𝑡) − 𝑒𝑟 (𝑡 − 1)
𝑢4 (𝑡) = 𝑘𝑃 𝑒𝑟 (𝑡) + 𝑘𝐼 ∫0  𝑒𝑟 (𝑡)𝑑𝑡 + 𝑘𝐷
𝑑𝑡
3.3.8 Motor Control
Given the control inputs, it is possible to compute the individual motor speeds required for
each motor. These speeds will be sent to the ESC which will then send commands to the
attached motor to make it spin at the desired speed to produce the desired thrust and control
moments. The desired motor speeds can be computed by taking the inverse of the control
matrix produced in the section above as shown below. Note that all of the motors contain some
component of thrust and yaw control inputs plus the appropriate inputs for each axis. The
motors controlling the pitching moment include components of the pitch control input and the
motors controlling the rolling moment include components of the rolling control input. These
equations are for a “+” quadrotor orientation and would need to be modified if the quadrotor
was to be flown in the “X” configuration.

𝜔 = motor angular velocity (radians/sec)


𝐾𝑑 = drag torque proportionality constant

44
𝐾𝑇 = thrust coefficient
ℓ = length of arm (𝑚)
𝑢1 = total thrust of all motors
𝑢2 = roll control input
𝑢3 = pitch control input
𝑢4 = yaw control input
𝜔12 𝐾𝑇 𝐾𝑇 𝐾𝑇 𝐾𝑇 −1 𝑢1
2 𝑢2
𝜔2 0 −ℓ𝐾𝑇 0 ℓ𝐾𝑇
2 = [ℓ𝐾 0 −ℓ𝐾𝑇 0
] [𝑢 ]
𝜔3 𝑇 3
2
[𝜔4 ] 𝐾𝑑 −𝐾𝑑 𝐾𝑑 −𝐾𝑑 𝑢4

𝑢1 𝑢3 𝑢4
𝜔12 = + +
4𝐾𝑇 2ℓ𝐾𝑇 4𝐾𝑑
𝑢1 𝑢2 𝑢4
𝜔22 = − −
4𝐾𝑇 2ℓ𝐾𝑇 4𝐾𝑑
𝑢1 𝑢3 𝑢4
𝜔32 = − +
4𝐾𝑇 2ℓ𝐾𝑇 4𝐾𝑑
𝑢1 𝑢2 𝑢4
𝜔42 = + −
4𝐾𝑇 2ℓ𝐾𝑇 4𝐾𝑑
It is also important to place limits on the control inputs that can be calculated by the control
system. These control inputs are converted into motor speeds that are then sent to the ESCs
and eventually the motors. Therefore, we don’t want to use control gains that result in desired
motor speeds that are not possible on the actual system. The computations of the control limits
are depicted below based on the physical system.

𝜔 = motor angular velocity (𝑟𝑎𝑑/𝑠𝑒𝑐)


𝜔𝑚𝑎𝑥 = Maximum motor speed (920𝑟𝑎𝑑/𝑠)
𝜔𝑚𝑖𝑛 = Minimum motor speed (0𝑟𝑎𝑑/𝑠)
𝐾𝑑 = Drag torque proportionality constant (1.39 × 10−6 𝑘 − 𝑚2 )
𝐾𝑇 = Thrust coefficient (1.33 × 10−5 𝑘𝑔 − 𝑚)
ℓ = length of 𝑎𝑟𝑚 (0.56 𝑚)
𝑢1 = total thrust of all motors (𝑘𝑔 − 𝑚/𝑠 2 )
𝑢2 = roll control input (𝑘𝑔 − 𝑚2 /𝑠 2 )
𝑢3 = pitch control input (𝑘𝑔 − 𝑚2 /𝑠 2 )
𝑢4 = yaw control input (𝑘𝑔 − 𝑚2 /𝑠 2 )
2
𝑢1 𝐾𝑇 𝐾𝑇 𝐾𝑇 𝐾𝑇 𝜔1
𝑢2 0 −ℓ𝐾𝑇 0 ℓ𝐾𝑇 𝜔22
[𝑢 ] = [ ] 2
3 ℓ𝐾𝑇 0 −ℓ𝐾𝑇 0 𝜔3
𝑢4 𝐾𝑑 −𝐾𝑑 𝐾𝑑 −𝐾𝑑 [𝜔2 ]
4

45
𝑢1max = 4𝐾𝑇 𝜔max
2
= 43.5
min 2
𝑢1 = 4𝐾𝑇 𝜔min = 0

𝑢2max = 𝑢3max = ℓ𝐾𝑇 𝜔max


2
= 6.25
𝑢2min min 2
= 𝑢3 = −ℓ𝐾𝑇 𝜔max = −6.25

𝑢4max = 2𝐾𝑑 𝜔max


2
= 2.25
min 2
𝑢4 = −2𝐾𝑑 𝜔max = −2.25
3.4 Simulation Environment
An accurate simulation combines the equations of motion derived in the System Modeling
section, the specific parameter values estimated in the Model Verification section, and the
controller designed in the Controller Design section. All of these pieces are necessary to create
an accurate simulation environment. An accurate simulation environment enables operators to
design and test control designs, filters, observers, and path planning algorithms before they are
implemented on the physical system in the real world. The following sections outline the code
necessary to implement a quadrotor simulator in MATLAB. Where appropriate, specific code
or blocks are highlighted in greater detail.

3.4.1 Simulink Model


A Simulink block diagram is developed for quadcopter simulation. The diagram consists of
several layers. Simulink blocks such as scopes and step inputs can be used to analyze and tune
the controller parameters. An overview of the simulation is shown in below figure.

Figure 3.5 Overview of Simulation


46
At the top level, the block diagram is broken down into 3 primary blocks. These include the
outer loop position controller, the inner loop altitude controller, and the quadrotor dynamics.
This series of blocks as well as their inputs and outputs are shown below.

Figure 3.6 Top level control blocks


Translational position controller is shown below. These equations calculate a desired yaw rate
based on a desired yaw angle input. The desired yaw rate is typically taken directly from the
RC command inputs.

Figure 3.7 Translational Position Controller


Desired roll and pitch angles are combined with the desired altitude and heading in the
attitude/altitude controller as shown in below figure.

47
Figure 3.8 Attitude/Altitude Controller
The altitude controller computes the desired thrust control input from the desired altitude. The
attitude controllers take the desired angles and compute desired angular velocities for the final
rate controllers.

Figure 3.9 Attitude/Altitude Controller


48
The angular velocity controller computes the final three moment control inputs. Each PID
block contains the individual Proportional, Integrator, and Derivative gains shown in the
generic block diagram below.

Figure 3.10 Angular Velocity Controller


The final inputs are then fed into the quadcopter dynamics block. As shown below, this system
is made up of several smaller subsystems.

Figure 3.11 Quadcopter Dynamics Block

The motor speed calculator limits the control inputs to the physical motor parameters.

49
Figure 3.12 Motor Speed Calculator
The rotational dynamics calculate the angular accelerations.

Figure 3.13 Rotational Dynamics

50
These values are fed into the angular velocities transformation block which computes the
angular velocities.

Figure 3.14 Angular Velocities Transformation Block

The angles are also fed into the translational dynamics block which computes the translational
accelerations.

51
Figure 3.15 Translational Dynamics Block
A plot depicting the system’s response to step inputs is shown below.

Figure 3.16 System Response to Step Input


52
3.5 Autopilot
Autopilot enables the vehicle to operate without the need of a human pilot. For delivery
application, a basic form of autopilot is required. At a high altitude, the flight controller
measures its current position and orientation, read the commands from the autopilot via the
RC, calculate and send those commands to the motor.

A GCS is required for autopilot functionality. The flight controller receives destination
coordinates from the GCS, determines its own coordinates from the GPS, and calculate a path
towards the target. Autopilot calculates required pitch, roll, throttle, yaw commands required
to get to target location and send them to the flight controller. The flight controller calculates
required motor commands and send them to the motors.

ArduPilot’s Mission Planner can be used as a GCS. It has many command modes such as Acro,
Stabilize, Loiter, Altitude hold, Return-to-Launch, Land, Follow Me, GeoFence, etc.
Advanced failsafe options are available in an emergency situation such as in the event of low
battery, lost control signal, or other failures. 3-Axis camera control and stabilization, shutter
control, live video link is also supported. Data is logged for comprehensive post mission
analysis.

Figure 3.17 ArduPilot Mission Planner

53
CHAPTER 4 Results and Observations

Multiple simulations were run on the Simulink model to determine the relations between load
capacity, range, speed, and flight time of the quadcopter.

Prototype

Table 1 Prototype of the Quadcopter

54
The total weight of the quadcopter, including all components and battery, is 944 grams. Loads
are added with increments of 100 grams and resulting speed, flight time, and range are noted.
The capacity of the battery is 2200mAh and it is directly proportional to the flight time. A
bigger capacity battery adds more weight and significantly more flight time.

One-way Two-way
Load Speed Flight Time Tilt Range Range
(grams) (kmph) (mins) (Degrees) (km) (km)
944 64 17.8 67 18.98 9.49
1044 63 16.7 65 17.53 8.76
1144 61 15.8 62 16.06 8.03
1244 59 14.9 59 14.65 7.32
1344 57 14.2 56 13.49 6.74
1444 55 13.5 53 12.37 6.18
1544 53 12.9 50 11.39 5.69
1644 50 12.3 46 10.25 5.12
1744 46 11.8 43 9.04 4.52
1844 43 11.4 39 8.17 4.08
1944 38 11 34 6.96 3.48
2044 33 10.6 29 5.83 2.91
2144 26 10.3 23 4.46 2.23
2244 16 10 14 2.66 1.33
Table 4.2 Speed, Flight Time, and Range of Quadcopter
Our desired range for the drone was 5 kilometers. The drone will also have to return to the
fulfillment center after delivery. In some cases, the delivery might not be completed and so the
drone will have to fly back with the package still attached. We will assume this case. From
the above table, the quadcopter can lift 700 grams of load to a range of 5 kilometers.

55
10
9
8
7
6
5
4
3
2
1
0
900 1100 1300 1500 1700 1900 2100 2300
Weight (Grams)

Range (km) Delivery Time (minutes)

Figure 4.1 Range and Delivery TIme Vs Weight


The prototype of the quadcopter suffered from severe vibrations. This was due to imperfections
on the surfaces of propellers and loosely mounted motors. The stability of the quadcopter was
mediocre. The reason for that was the low processing power and memory of the
microcontroller and random wind patterns for which the Simulink model was not tested.

The electronic components available locally were of very bad quality. Several components
stopped working abruptly and new components had to be purchased. This added to the overall
cost of the project. The base cost for the prototype is given below.

S. No. Component Quantity Price Per Unit Price


1 1000kv Outrunner BLDC Motor 4 850 3400
2 Max 30A ESC 4 850 3400
3 F450 Quadcopter Frame 1 1800 1800
4 Arduino Nano 3 500 1500
5 MPU 6050 1 200 200
6 BMP 180 1 350 350
7 HMC 5883L 1 420 420
8 HC-SR04 1 160 160
9 uBlox NEO-6M 1 900 900

56
10 nRF24L01 Transceiver 2 200 400
10 2200mAh 3S1P LiPo Battery 1 2600 2600
11 1047 Carbon Fiber Propellers 2 220 440
12 Power Distribution Board 1 600 600
13 iMax RC B3 Pro LiPo Charger 1 600 600
Total 16770
Table 4.3 Prototype Cost
The prototype was very noisy, similar to other rotary-wing aircraft. The propellers are very
susceptible to breaking and damaging people or objects nearby.

2200mAh at 12 volts or 26.4Wh battery is fully discharged when delivering 700 grams load to
5 kilometers in 12 minutes. The cost of 1 kWh of electricity for commercial connection (less
than 5kW load) is 20.66 Rs as of 2021. The electricity cost to deliver 700 grams payload to 5
kilometers turns out to be 0.54 Rs.

Traditional Delivery system uses motorcycles. The average fuel consumption of motorcycle is
4.4 liters per 100 kilometers [5] or 0.22 liters per 5 kilometers. The cost of petrol as of August
2021 is 118 Rs per liter. The cost to deliver a package to 5 kilometers turns out to be 25 Rs
minimum.

The quadcopter delivery system is at least 48 times more cost effective than traditional delivery
system. Traditional delivery system also requires more maintenance and labor cost which
makes the drone delivery system even more cost effective.

57
CHAPTER 5 Conclusion and Future Work

The quadcopter is a feasible vehicle for performing small packages delivery. The vehicle can
deliver up to 700 grams to any location within 5 kilometers radius in less than 6 minutes. The
cost of delivery is 48 times less than traditional delivery system. With relatively low cost, less
delivery time, and much more convenience; delivery drones are bound to succeed in making
the last-mile deliveries. Warehouses or fulfillment centers will have to be established near
population centers in order to compete with traditional delivery mechanisms.

The problems of noise, vibrations, instability, and propeller damage needs to be addressed in
future work. One way to reduce noise is to operate each propeller at slightly different speed.
The size of the propellers will also be slightly different in order to produce equal thrust. This
method spreads the sound frequencies over a greater range and thus results in less apparent
noise. Vibrations can be reduced by using high quality propellers with tight tolerances. To
increase stability, a better flight controller such as Pixhawk Cube or BetaFlight F4 is
recommended. These flight controllers operate at higher frequencies and thus reaction to
disturbances becomes much more rapid.

To protect the propellers from breaking or damaging people/objects nearby, protective cages
around the propellers are recommended. A camera can also be mounted on the quadcopter in
order to protect it from theft and to ensure package delivery.

A Ground Control Station is required for fully autonomous delivery system. Traditional GCS
communicates with the quadcopter using a 2.4Ghz radio signal. This signal usually sends up
to 9 channels of data. A better approach would be to use GSM network or internet for
communication between the customer, the drone, and the fulfillment center.

A consumer authentication framework is proposed to ensure a complete and reliable last-mile


delivery through autonomous drones. Through the proposed consumer authentication
framework, the drone first reaches the exact GPS location of a customer, it verifies the
customer via a two-factor Authentication method which involves customer authentication via
OTP. If the authentication is successful, it delivers the package otherwise it returns without
delivering the package.

58
References

[1] Hoffman, G.; Huang, H.; Waslander, S.L.; Tomlin, C.J. (20–23 August 2007). "Quadrotor Helicopter
Flight Dynamics and Control: Theory and Experiment". In the Conference of the American Institute of
Aeronautics and Astronautics. Hilton Head, South Carolina.

[2] eCalc. (n.d.). xCopter Calculations. https://www.ecalc.ch/xcoptercalc.php

[3] Merry K, Bettinger P (2019) Smartphone GPS accuracy study in an urban environment. PLOS ONE
14(7): e0219890. https://doi.org/10.1371/journal.pone.0219890

[4] Tomáš, J (2011). “Stabilization and Control of Unmanned Quadcopter”. CZECH TECHNICAL
UNIVERSITY IN PRAGUE

[5] Chen, Kang & Wang, W & Chen, H & Lin, C & Hsu, H & Kao, J & Hu, M. (2003). Motorcycle emissions
and fuel consumption in urban and rural driving conditions. The Science of the total environment. 312. 113-
22. 10.1016/S0048-9697(03)00196-7

[6] James, V (March 2021), “Self-flying drones are helping speed deliveries of COVID-19 vaccines in
Ghana”, The Verge

[7] Axel, M (August 2021), “Why delivery drones are struggling to take off – even with DHL and Amazon on
board”, TechRadar

[8] Jia, X (2017), “Design Perspectives on Delivery Drones”, RAND Corporation, Santa Monica, California

[9 ]Stolaroff, J.K.; Samaras, C.; O’Neill, E.R.; Lubers, A.; Mitchell, A.S.; Ceperley, D. Energy use and life
cycle greenhouse gas emissions of drones for commercial package delivery. Nat. Commun. 2018 , 9, 409.

59

View publication stats

You might also like