You are on page 1of 7

Available online at www.sciencedirect.

com

Procedia Engineering 41 (2012) 458 464

International Symposium on Robotics and Intelligent Sensors 2012 (IRIS 2012)

Low-Cost Microcontroller-based Hover Control Design of a Quadcopter


Bernard Tat Meng Leong, Sew Ming Low, Melanie Po-Leen Ooi*
School of Engineering, Monash University, Sunway Campus, Bandar Sunway, 46150 Selangor Darul Ehsan, Malaysia

Abstract
In this paper, a low-cost hover control mechanism is developed and implemented on low-cost microcontroller for a type of aircraft
configuration known as the quadcopter. Flight control becomes simpler as the quadcopter hovers at a constant level from ground by itself,
at the same time allowing anyone to easily maneuver it at that height and perform tasks such as imaging. When successfully implemented,
the proposed hover control design will simplify the flight control of a quadcopter, especially for beginners and unskilled individuals.

2012 The Authors. Published by Elsevier Ltd. Selection and/or peer-review under responsibility of the Centre of
Humanoid Robots and Bio-Sensor (HuRoBs), Faculty of Mechanical Engineering, Universiti Teknologi MARA.
Keywords: hover control; quadcopter; microcontroller.

1. Introduction
The hover stability of a quadcopter is important for many of its applications such as security surveillance, crop
monitoring and on-board imaging to allow clear still images to be taken in surveillance operations [1]. It also prevents the
quadcopter from crashing in the event of strong wind or due to its weight. Fig. 1 shows the six degrees of freedom of the
quadcopter. In Fig. 1(a), x and y represents the translational motion along the x- and y-axes respectively and represents
yaw, the rotational motion about the z-axis, while in Fig. 1(b), represents roll, the rotational motion about the x-axis,
represents pitch, the rotational motion about the y-axis and z represents the translational motion in the direction
perpendicular to ground. The label 1 signifies the front propeller.

'

Fig. 1 The six degrees of freedom of a quadcopter at (a) Birds eye view, (b) Frontal view

With a hover control unit, the quadcopter will hover at a constant height z (see Fig. 1(b)), with its roll and pitch angles
stabilised by the gyroscope. The person at the command base will only need to control the quadcopters motion along the xand y-axes and also its rotation about the z-axis (to turn corners), reducing the degree of complexity from six to only three.
This defines the purpose and aim of this paper, which is to obtain a stable quadcopter hover that will last for at least 5
minutes with an acceptable error of within
of the hover altitude.

* Corresponding author. Tel.: +6-035-514-6238; fax: +6-035-514-6207.


E-mail address: melanie.ooi@monash.edu

1877-7058 2012 Published by Elsevier Ltd.


doi:10.1016/j.proeng.2012.07.198

459

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464

A significant number of research works have been performed to obtain a mathematical model which describes the
quadcopter flight dynamics [2][3][4][5]. As a result, controller boards have been developed and mass produced to be sold in
the market. A few notable off-the-shelf controller board developers are KKmulticopter, Hoverfly and DJI Naza, which
usually have good performance but can be costly (up to USD 260 [6]).
This paper proposes a Hover Control System which will operate on a low cost microcontroller board, Arduino
Duemilanove, which costs USD 24[7]. As opposed to the controller boards available in the market, the implementation of
the Arduino board in this research does not require the original quadcopter gyroscope to be removed. This makes the
proposed prototype portable as it can be installed in other quadcopter units without affecting their existing operation.
Successful implementation of the proposed prototype hover controller will enable the quadcopter hover control to be
achieved at approximately 10% of the current controller market price in addition to being customisable to suit users needs.
1. Control Theories
1.1. PID Control
The PID (Proportional-Integral-Derivative) control algorithm has been considered and implemented in literature to
control the hover altitude of the quadcopter [8][9]. PID control is a type of linear control that is widely used in the robotics
and automation industry [10]. The PID algorithm is popularly used mainly because [11]:
It has a simple structure
It provides good performance
It can be tuned even if the specific model of the controlled plant or system is not available
The last factor is important as it was not easy to obtain the exact mathematical model of the quadcopter [11]. A PID
controller functions by calculating the error, or difference between a measured output and a desired setpoint and adjusts the
system control inputs such that the calculated error is minimised. The PID algorithm consists mainly of three control
parameters, P Proportional, I Integral and D Derivative. The mathematical expression of the discrete-time PID
algorithm is given in (1). P determines the reaction to the current error, I determines the reaction based on a sum of recent
errors while D responds to the rate at which the error has been changing. Table 1 summarizes the effects of increasing these
parameters to the system.
k

u (k ) = K P e(k ) + K I e(i ) + K D (e(k ) e(k 1) )

(1)

i =0

Table 1. Effects of Independent P, I and D Tuning [11]


Closed Loop Response
Increasing Kp
Increasing Ki
Increasing Kd

Rise Time

Overshoot

Decrease

Increase

Small
Decrease
Small
Decrease

Settling Time
Small
Increase

Steady-State Error
Decrease

Stability
Degrade

Increase

Increase

Large Decrease

Degrade

Decrease

Decrease

Minor Change

Improve

1.2. Linear Quadratic Regulator


Calculation of the control input by control algorithms such as PID control may return a control input gain which may be
too high for the quadcopter system. This results in a large control input magnitude which may be out of the limits
recognisable by the system. To solve this problem, the linear quadratic regulation (LQR) method was employed. LQR is a
form of linear optimal control regulation which aims to reduce the magnitude of the control input without affecting the
performance of the control algorithm [12]. The LQR algorithm is used to obtain the parameter settings that will minimise
the undesired deviations (in this research, altitude) while at the same time limiting the energy expended by the control action
by using a mathematical algorithm that minimises a cost function or performance index with weighting factors. The cost
function or performance index refers to the sum of deviations of measured values from its desired values [12]. For a
discrete-time LQR, the performance index is defined as (2). By adjusting the weight parameters Q and R, the optimal
control sequence that minimises the performance index is given by (3).
N

J = x kT Qx k + u kT Ru k
k =0

(2)

460

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464

u k = Fk x k 1

(3)

2. Hover Control System Design


The hover control system consists of three major subsystems: quadcopter, sensor and microcontroller. The quadcopter
subsystem forms the physical system that requires control while the sensor subsystem provides altitude information to the
control system. The microcontroller subsystem combines the electronic signals with the hardware in the hover control
routine, thus achieving automatic hover control.
2.1. Quadcopter subsystem
The quadcopter model used in this research is the GAUI 330-X Quadflyer. The quadcopter subsystem consists of a
receiver module, a gyroscope unit, electronic speed controller (ESC) circuits, propeller DC motors and a Lithium-Polymer
battery. Fig.2 shows the components of the quadcopter subsystem. The command signal is a pulse-width modulated (PWM)
signal that is received by the receiver module. The gyroscope unit will modify this signal by incorporating the attitude (roll,
pitch and yaw angles) information before transmitting the signal to the ESC circuits. This modification is performed to keep
the quadcopters chassis level with respect to ground. The ESC modules functions to smoothen the speed variation of the
DC motors.
>W


^

Z
D

'
D

^
D

W
D

ZW
z

Fig. 2 Components in the Quadcopter Subsystem

2.2. Microcontroller (MCU) Subsystem


The Arduino Duemilanove MCU is placed in between the receiver and the gyroscope module (see Fig.2) to manipulate
the throttle command signal for hover control, based on the height information provided by the sensor subsystem. The main
function of the MCU is to obtain altitude readings from the sensor module and determine if hover control mode is asserted.
If hover control mode is on, the PID control algorithm would be executed by the MCU.
2.3. Sensor Subsystem
The sensor subsystem functions to provide the altitude information to the microcontroller subsystem. In this research,
the PING))) Ultrasound Sensor, a low-cost ultrasound sensor unit developed by Parallax Inc. was used. The height
information is transmitted by the sensor module to the MCU in terms of a PWM signal pulse width, and the actual altitude
can be computed using the formula given in [13].
2.4. Integration of Subsystems
To integrate the subsystems into a complete system, the microcontroller subsystem is used as the common interfacing
point for all hardware and subsystems. Fig. 3 illustrates the integration of the hardware and subsystems to form the hover
control system.
When hover control is activated, the ultrasound sensor captures the current altitude as the reference point. The flight
altitude is then continuously monitored and communicated to the controller board. The PID control algorithm programmed
into the MCU determines the throttle control signal that is transmitted to the gyroscope module based on the error computed
in (1). Depending on the throttle control signal, the propeller speed is either increased or decreased to bring the quadcopter
altitude to the reference level.

461

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464

Fig. 3 Component and hardware design of the hover control unit

3. Results and Discussion


3.1. Software Simulation
A model of the quadcopters dynamics along the z-axis is empirically obtained by performing system identification on
the input-output data. It was found to be closely modeled by (4). The step responses of the model using different PID tuning
parameters were simulated using MATLAB Simulink. Three types of control were tested and evaluated: P (Proportional), PI
(Proportional-Integral) and PID (Proportional-Integral-Derivative). The simulation results, with the corresponding tuning
parameters are displayed in Fig. 4(a), (b) and (c). Table 2 summarizes the results obtained from software simulation.
G( z) =

0.0228
z + 1.0025

(4)

Plot of System's Step Response

Plot of System's Step Response


2

Reference
System Response

1
0.5
0

Control Input Magnitude

Altitude (m)

1.5

10

15

20

25

30

35

40

6
4
2
0
0

10

15

20

25

Time (s)
(a)

30

35

40

45

Reference
System Response

1
0.5
0

45

Time (s)

-2

1.5

Control Input Magnitude

Altitude (m)

10

15

20

25

30

35

40

45

30

35

40

45

Time (s)
6
4
2
0
-2

10

15

20

25

Time (s)
(b)

462

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464

Plot of System's Step Response


Altitude (m)

1
0.5
0

Control Input Magnitude

Reference
System Response

1.5

10

15

20

25

30

35

40

45

30

35

40

45

Time (s)
30
20
10
0
-10

10

15

20

25

Time (s)
(c)
Fig. 4 The system response for (a) Proportional Control, P = 3.1557,; (b) Proportional-Integral Control, P = 3.1557, I = 1.0; (c) Proportional-IntegralDerivative Control, P = 7.0, I = 4.0, D = 1.0
Table 2. Software Simulation Results
Control Type
Proportional (P)
Proportional-Integral (PI)
Proportional-Integral-Derivative (PID)

Settling Time (s)


5.7
12.4
7.3

Overshoot (%)
0
22.81
17.9

Steady State Error (cm)


5.6
0
0

Simulation results show that the PID control returns zero steady state error with lower settling time and overshoot
compared to P and PI control. In this research, it is desirable to have a low overshoot percentage and settling time with zero
steady state error, thus the PID control is selected.
3.2. Hardware Implementation
The software simulation provided a good platform to understand the effects of the control parameters on the system.
However, a actual hardware implementation using the software-obtained parameters showed unstable hovering of the
quadcopter. This could be caused by inaccurate mathematical modelling of the actual quadcopter system. Thus an empirical
method was developed to empirically obtain the control parameters. The tuning of the control system was performed based
on the theoretical control effects summarised in Table 3. The steps involved in the empirical approach are shown in Fig.5.
Set an initial Kp
(Ki and Kd = 0)

Large
Overshoot?

Yes

Decrease Kp or Increase
Kd

No

Stable?

No

Increase Kd

Yes
Steady State
Error?
No
Optimum Control
Achieved

Yes

Increase Ki

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464
Fig. 5 Empirical Methodology to Obtain Control Parameters

Acceleration, m/(s 2) Acceleration, m/(s 2) Acceleration, m/(s 2)

Using the empirical approach in Fig 5, the optimal P, I and D values were found to be 0.005, 0.01 and 0.003 respectively.
Using a 3-axis accelerometer, the stability of the quadcopter can be evaluated. Fig. 6 displays the acceleration profile
obtained in the hardware implementation test. The new acceleration profile shows that the quadcopters hover is stable at
the reference altitude, thus achieving stable hover control.

Acceleration Profile (x-dimension)


2
0
-2

200

400

600

800

1000

1200

Sample Number
Acceleration Profile (y-dimension)
1
0
-1

200

400

600

800

1000

1200

Sample Number
Acceleration Profile (z-dimension)
11
10
9

200

400

600

800

1000

1200

Sample Number
Fig. 6 Acceleration Profiles in the x-, y- and z- dimensions

4. Conclusion
The quadcopter configuration generally has a greater stability as compared to the other configurations. In addition to that,
the quadcopter is able to hover close to its target, unlike its other counterparts. However, the hovering of the quadcopter can
be unstable, making it difficult to navigate and be used in precise monitoring operations. The purpose of this research was to
address this hover stability issue and develop a hover control system that is not only low cost, but fully customisable to suit
its users needs. The results of the hardware implementation show that the quadcopter has a stable hover with an error of 2
cm for a total flight time of 5 minutes with a total implementation cost of USD 24.

Acknowledgements
The authors would like to thank Monash University for their support and resources to conduct this research, and Mr.
Khoo Boon How for provision of the use of his data acquisition module.

References
[1] Semsch, Eduard; Jakob, Michal; Pavlicek, Duan; Pechoucek, Michal; , "Autonomous UAV Surveillance in Complex Urban Environments," Web
Intelligence and Intelligent Agent Technologies, 2009. WI-IAT '09. IEEE/WIC/ACM International Joint Conferences on , vol.2, no., pp.82-85, 15-18
Sept. 2009
[2] T. Bresciani, Modeling, Identification and Control of a Quadrotor Helicopter, masters thesis, Department of Automatic Control, Lund University,
Sweden, October 2008.
[3] H. Huang, G. M. Hoffmann, S. L. Waslander, C. J. Tomlin, Aerodynamics and Control of Autonomous Quadrotor Helicopters in Aggressive
Maneuvering in Proceedings of IEEE International Conference on Robotics and Automation (Kobe, Japan) May 2009.
[4] S. Bouadballah, R. Siegwart, Full Control of a Quadrotor in Proceedings of the 2007 IEEE/RSJ International Conference on Intelligent Robotics and
Systems (San Diego, CA, USA) October 29- November 2, 2007.
[5] Bouabdallah, S.; Murrieri, P.; Siegwart, R.; , "Design and control of an indoor micro quadrotor," Robotics and Automation, 2004. Proceedings. ICRA
'04. 2004 IEEE International Conference on , vol.5, no., pp. 4393- 4398 Vol.5, 26 April-1 May 2004
[6]DJI Naza (multicopter), [Online] Available: http://quadcopter.heliguy.com/Extras/DJI-Naza/DJI-Naza-multicopter/ [Accessed 20 May 2012]
[7]Arduino Duemilanove w/ Atmega 328, [Online] Available:
http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11&products_id=74 [Accessed 20 May 2012]
[8] Erginer, B.; Altug, E.; , "Modeling and PD Control of a Quadrotor VTOL Vehicle," Intelligent Vehicles Symposium, 2007 IEEE , vol., no., pp.894-899,
13-15 June 2007

463

464

Bernard Tat Meng Leong et al. / Procedia Engineering 41 (2012) 458 464

[9] Tayebi, A.; McGilvray, S.; , "Attitude stabilization of a VTOL quadrotor aircraft," Control Systems Technology, IEEE Transactions on , vol.14, no.3,
pp. 562- 571, May 2006
[10] K. Nonami, F.Kendoul, S. Suzuki, W. Wang, D. Nakazawa, Autonomous Flying Robots Unmanned Aerial Vehicles and Micro Aerial Vehicles,
Tokyo: Springer, 2010, pp.48-52.
[11] Kiam Heong Ang; Chong, G.; Yun Li; , "PID control system analysis, design, and technology," Control Systems Technology, IEEE Transactions on ,
vol.13, no.4, pp. 559- 576, July 2005
[12] Prasad, L.B.; Tyagi, B.; Gupta, H.O.; , "Optimal control of nonlinear inverted pendulum dynamical system with disturbance input using PID controller
& LQR," Control System, Computing and Engineering (ICCSCE), 2011 IEEE International Conference on , vol., no., pp.540-545, 25-27 Nov. 2011
[13] PING)))TM Ultrasonic Distance Sensor (#28015) [Online] Available: www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf

You might also like