You are on page 1of 86

PEOPLES DIMOCRATIC AND REPUBLIC OF ALGERIA

MINISTRY OF HIGHER EDUCATION AND SCIENTIFIC RESEARSH


- -
KASDI MERBAH UNIVERSITY -OUARGLA

Faculty of Sciences and Technology and Sciences of Matter


Specialty: Electrical Engineering
Option: Automatic

Final Year Dissertation


In the aim of obtaining a Master Degree
Presented by:
Abdellah Islam KAFI

Mohamed Baderddine AOUN


Topic

Design and Realization of Quadrotor


Control Platform
Discussed front of the jury composed of:
Noun

Grade

N. Melhegeug
D. Djarah
W.Benzaoui
M.R. Kafi
Z. Tidjani

MAA
MAA
A
MAA
MAA

Quality
President
Examiner
Examiner
Advisor
Co-Advisor

Academic year: 2010/2011

University
KASDI MERBAH
KASDI MERBAH
KASDI MERBAH
KASDI MERBAH
KASDI MERBAH

Dedications
I dedicate my dissertation work to, before anyone else, the heart and soul of my entire
existence:
My beautiful mother for the silent heartfelt prayers Mum! You are and always will be
a symbolism of hope, faith and love in my life.
And my wonderful father for the endless giving and the unconditional support.
I will always cherish what you two have done for me and I I equally love you forever
and ever.
I also dedicate this piece of work to my loving brothers and sisters,
Chaouki and Akrem Im totally incomplete without you by my side
My sister Imene you are not just a sister to me; you are actually a valuable part of my
world.
To my source of joy and laughter my precious little sister Sirine.
And my grandmother Safia and my aunt Nadia both mean the world to me.
I dedicate this work and give thanks to all my friends; especially my lifetime
friends Also, I cannot forget my friends in college with
you was such an amazing time.
Finally, I genuinely dedicate my graduation dissertation to anyone has ever believed in
me and helped channel my talent here on Earth.
A.I. KAFI

Dedications
I dedicate my dissertation work to, before anyone else, the heart and soul of my entire
existence:
My beautiful mother for the silent heartfelt prayers Mum! You are and always will be
a symbolism of hope, faith and love in my life.
And my wonderful father for the endless giving and the unconditional support.
I will always cherish what you two have done for me and I I equally love you forever
and ever.
I also dedicate this piece of work to my loving brothers and sisters,
Krimou, Chaouki, and Abdelkader Im totally incomplete without you by my side
My big sisters Mounia You are not just a sister to me; you are actually a valuable part
of my world.
And her husband Steve thanks for everything.
To my source of joy and laughter my precious little sister Lina (I love you
to pieces!)
And to the cute baby's angel my nieces Jasmine, Sarah and my hero Adam you gave me
the unique gift of being
To my grandfather, Abdelkader (may Allah rest their soul in peace)
And my grandmothers Fatima and kouya you both mean the world to me.
To my uncles and aunts; mainly, my Aunt Fatima zahra and my uncle Med.Laid With
special feelings
I dedicate this work and give thanks to all my friends; especially my lifetime
friends Nabil, Badri, Islem Also, I cannot forget my friends in college with
you was such an amazing time.
Finally, I genuinely dedicate my graduation dissertation to anyone has ever believed in
me and helped channel my talent here on Earth.
M.B.AOUN

Acknowledgements

We would like to fully acknowledge and thank Allah for all the blessings and
guidance we are granted. Very special thanks go to our supervisors
Mr KAFI Med Radouaane and, Mr. TIDJANI Zakaria
Who were more than generous with their expertise and precious time.
Also, we give lots of credit to all the personnel and teachers staff of Kasdi
Merbah University for all the facilities they have provided through all the
process of making this project.

Contents
Main used symbols
List of figure
List of tables
General Introduction.. 01
Chapter I: Overview on quadrotors and Problem statement
I.1 Historical...... 03
I.2 Quadrotor concepts ...... 06
I.2.1 Quadrotor manoeuvring ......... 06
I.2.2 Common quadrotor applications ..... 09
I.3 Problem Statement.... 09
Chapter II: Quadrotor control platform design
I.1 Introduction 11
I.2 Hardware architecture .. 11
I.3 Quadrotor structure 11
I.4 Sensors unit . 13
I.4.1 Overview on quadrotor sensors 13
I.4.2 Sensors selection.. 17
I.5 Actuators Unit........ 20
I.6 Wireless communication unit........ .. 22
I.7 Power unit........ ... 23
I.8 Control unit.. 24
I.9 Ground station unit........ ... 26
I.10 Programming of microcontrollers... 28
I.11 Conclusion........ ............... 29
Chapter III: Quadrotor dynamics modeling
III.1Introduction.........

30

III.2 Modeling with Newton-Euler Formalism ...........

30

III.2.1 Aerodynamic Forces and Moments..........

31

III.2.2 General Moments and Forces

32

III.3 Discussion 34
III.4 Determination of quadrotor parameter...

34

III.4.1 Inertiel moments....

34

III.4.2 Propeller constants..... 40


III.5 Open loop simulation.

43

III.6 Conclusion... 45
Chapter IV: Control design and software implementation
IV.1 Introduction....

46

IV.2 Platform devices configuration and setup 46


IV.3 Ground station............ ....... 50
IV.4 Development of the dsPIC code..

51

IV.5 Control Design............................................

52

IV.6 Experimental result ... 58


IV.7 Encountered problems... 62
IV.8 Conclusion... 63
General conclusion.. 64
Bibliography
Abstract

Main Used Symbols


a

Lift slope

Thrust factor

Propeller chord

Cd

Drag coefficient at 70% radial station

CH

Hub force coefficient

CQ

Drag coefficient

CRm

Rolling moment coefficient

CT

Thrust coefficient

Drag factor

Acceleration due to gravity

Vertical distance: Propeller center to cog

Hub force

Motor current

Ixx, yy, zz

Inertia moments

Jm

Motor inertia

Jr

Rotor inertia

Jt

Total rotor inertia seen by the motor

Horizontal distance: propeller center to cog

Overall mass

mbat

Battery mass

Number of propellers

Drag moment

Rotation matrix

Rrad

Rotor radius

Rm

Rolling moment

Thrust force

Motor input

Control inputs

x, y, z

Position in body coordinate frame

X, Y, Z

Position in earth coordinate frame

Position vector

Pitch angle

Pitch of incidence

tw

Twist pitch

Inflow ratio

Rotor advance ratio

Speed vector

Air density

Solidity ratio

Induced velocity

Roll angle

Yaw angle

Body angular rate

Propeller angular rate

Overall residual propeller angular speed

Acronyms
UAV:

Unmanned Aerial Vehicle

IMU:

Inertial Measurement Unit

MEMS:

Micro Electro - Mechanical Systems

VTOL:

Vertical Take-Off and Landing

PID:

Proportional Integral Derivative

dsPIC:

Digital Signal PIC

EKF:

Extended Kalman Filter

UART:

Universal Asynchronous Receiver Transmitter

SPI:

Serial Peripheral Interface

I2C:

Inter-Integrated Circuit

SRF:

Sonar range finder

ESC:

Electronic Speed Controllers

BLDC:

Brushless motors

PWM:

Pulse Width Modulation

MCU:

Micro Controller Unit

DMA:

Direct access Memory

PCB:

Printed circuit bord

PLL:

Phase locked loop

List of figures

Figure (I.1):

Brguet-Richet Gyroplane No.1.

Figure (I.2):

The Oemichen No.2. 04

Figure (I.3):

Quadrotor designed by Dr. Bothezat an Ivan Jerome . 05

Figure (I.4):

Sky car during a test flight .... 05

Figure (I.5):

Neutralization of the yaw torque.................. 06

Figure (I.6):

Throttle force illustration .. 07

Figure (I.7):

Roll torque illustration.. 08

Figure (I.8)

Pitch torque illustration.. 08

Figure (I.9):

Yaw torque illustration .. 09

03

Figure (II.1): Quadrotor system hardware architecture.. 12


Figure (II.2): GAUI 330 X-S quad flyer structure 13
Figure (II.3): Capacitive accelerometer .. 14
Figure (II.4):

Coriolis Effect in a Gyroscope.

14

Figure (II.5): GPS extracting position method ............................... 15


Figure (II.6): Sonar range finding method ................................. 16
Figure (II.7): Hall Effect sensor operation.. 17
Figure (II.8):

Inertial Measurement Unit CHR-6dm.. 18

Figure (II.9): Sonar range finder SRF10 (Front View) 19


Figure (II.10): Sonar range finder SRF10 pin connection (Back View). 19
Figure (II.11): UGN3503 Hall Effect sensor 20
Figure (II.12): Scorpion Brushless Motor 21
Figure (II.13): Propeller.

21

Figure (II.14): Electronic Speed Controllers..

22

Figure (II.15): Easybee3 Zigbee module 23


Figure (II.16): Battery (GAUI LiPo3s)..

24

Figure (II.17): dsPIC card.

25

Figure (II.18): PCB card.

25

Figure (II.19): Realized card 26


Figure (II.20): Labview main window ..

27

Figure (II.21): picready board....

27

Figure (II.22): Easypic6 (left) and lv24-33 (right) development board.

28

Figure (II.23): Assembled structure..

29

Figure (III.01): Coordinate system....

30

Figure (III.2): Scheme of input and output relation

34

Figure (III.3): Main quadrotor structure..

35

Figure (III.4): Solid cylinder to model motor.

35

Figure (III.5): Scorpion Motor Dimension and weight...

36

Figure (III.6): Quadrotor frame set 1 and set 2 size and weight. 37
Figure (III.7): Quadrotor central set size and weight..

38

Figure (III.8): dsPIC card size and weight.........................................................................

38

Figure (III.9): Battery modeled as rectangle...

39

Figure (III.10): The Developed Speed Sensor.

41

Figure (III.11): Lift force versus rotor speed....

42

Figure (III.12): Modified OS4 Simulator.

43

Figure (III.13): quadrotor variables evolution versus time.

44

Figure (IV.1): IMU configuration interface.......................................................................

46

Figure (IV.2): Structure of RX and TX packets..

47

Figure (IV.3): Short address read and writes procedure..

48

Figure (IV.4): Flowchart of Easybee3 configuration..

49

Figure (IV.5): Flowchart of sonar range finder configuration.

49

Figure (IV.6): Flowchart of second Easybee3 configuration...

50

Figure (IV.7): Emplacement of subVIs on the block diagram

51

Figure (IV.8): Flowchart of the dsPIC.

53

Figure (IV.9): PID simulation result

56

Figure (IV.10): PID simulation commands.

57

Figure (IV.11): PID experimental results

59

Figure (IV.12): Bouabdallah PID experimental results .

60

Figure (IV.13): Experimental PID commands

61

Figure (IV.14): Anti windup algorithm

62

List for tables

Table (III.1): Experimental results of Trust test.. 41


Table (III.2): Quadrotor constant parameters values..

42

Table (IV.1): Easybee3 identification parameter. 47


Table (IV.2): PID controller parameter values........

55

Table (IV.3): Real PID controller parameter values..

58

General introduction

General introduction

General Introduction
Today, several families of flying machines exist: fixed-wing aircrafts, rotary-wing
aircrafts, flapping-wing aircrafts and many others. Rotary-wing aircrafts use rotating wings (i.e. a
rotor with blades spinning about a shaft) to provide lift, they belong to the family of Vertical
Take-Off and Landing (VTOL) vehicles which are not only able to vertically take-off and land,
but also hover motionless in the air.
Unmanned aerial vehicles (UAV) where the computers replace human pilots exist as a
consequence of technological advances on electronic embarked systems and sensors, advances in
automatic control and artificial intelligence; they have become a widely used for many
applications for which human operation are considered unnecessary or dangerous.
It is a structure with a four rotors in a cross configuration. Each rotor is responsible for a
certain amount of thrust and torque about its center of rotation. This cross structure is quite thin
and light.
In order to define a quadrotor's orientation (or attitude) around its center of mass,
aerospace engineers usually define three dynamic parameters, the angles of yaw, pitch and roll.
This is very useful because the forces used to control the aircraft act around its center of mass,
causing it to pitch, roll or yaw.
Several works have been dedicated to quadrotor control especially for angle variables and
altitude regulation. But, majority of them used an existing platform (developed before or
purchased), where the designer has the only task to develop its proper control and implement it.
However, in our case we are in face of no exiting quadrotor system.
In this work; our goal is the design of control platform for UAV quadrotor; this last,
classified among the family of (RWVTOL) vehicles, must achieve quadrotor attitude and altitude
control by an onboard microcontroller (dsPIC). Most important quadrotor information has to be
collected and visualized in ground station, used also to start quadrotor flying.
The platform has been developed by creating a system of interconnected devices.
Two sensors have been used for measuring the quadrotor attitude and its height from the ground
reference. For the first purpose, an Inertial Measurement Unit (IMU) has been chosen, while the
distance has been estimated with sonar range finder module. The data processing and the control
algorithm are handled in the Micro Control Unit (MCU) dsPIC which provides the signals to the
motor drivers which are needed to amplify the power delivered to the motors.
This memory is organized as follows:
In first chapter, we will give a brief historical on quadrotor and an overview.
1

General introduction

The second chapter will be dedicated to develop the hardware part of the quadrotor. So, the
structure of the quadrotor and needed devices are examined. Furthermore, we will present the
selected devices and their main properties.
To take an overview on quadrotor behavior, the problem of dynamical modeling will be
addressed in third chapter. Also, it will facilities the determination of the control algorithm
parameter to achieve a better stabilization. The most parameters of our prototype including
moment of inertia, propeller constants, and motor characteristics will be calculated. The whole
system will be examined in Matlab Simulink.
In the fourth chapter, the concept followed in this thesis for system control was to
evaluate a control technique, tune its parameters in simulation and evaluate it experimentally.
Here, we will examine devices setting according to needed functionality.
Finally, we will conclude our work by conclusion and perspectives.

Chapter I

Overview on quadrotors and


Problem statement

I.1 Historical
I.2 Quadrotor concepts
I.2.1 Quadrotor manoeuvring
I.2.1 Common quadrotor applications
I.3 Problem Statement

Chapter I

Overview on quadrotors and Problem statement

I.1 Historical [Jor09]


This story of quadrotor begins in the 20th century, when Charles Richet, a French
scientist and academician, built a small, un-piloted helicopter. Although his attempt was not a
success, Louis Brguet, one of Richets students, was inspired by his tutors example. Later in
1906, Louis and his brother, Jacques Brguet began the construction of the first quadrotor.
In 1907, they had finished the construction of the aircraft which was named BrguetRichet Gyroplane No.1 as shown in Figure (I.1). This quadrotor is equipped with 8.1 meters
propellers, which weighting 578 kg in total and with only one 50 Hp (37.3 kW) internal
combustion engine. The first attempt of flight was done in between August and September of
1907 with witnesses saying they saw the quadrotor lift 1.5 m into the air for a few moments,
landing immediately afterwards.

Figure (I.1): Brguet-Richet Gyroplane No.1


Discouraged by the lack of success of the Gyroplane No.1, Brguet and his mentor
continued their pursuit to build vertical flight machines and afterwards also temporarily
dedicated themselves to the development of fixed-wing aircraft, area where they became very
successful. Louis never abandoned his passion for vertical flight aircraft and in 1932 he became
one of the pioneers of helicopter development.
Etienne Oemichen, another engineer, also began experimenting with rotating-wing
designs in 1920. He designed a grand total of six different vertical lift machines. The first model
failed in lifting from the ground but Oemichen was a determined person, so he decided to add a
3

Chapter I

Overview on quadrotors and Problem statement

hydrogen-filled balloon to provide both stability and lift. His second aircraft, the Oemichen No.
2, as illustrated in Figure (I.2), had four rotors and eight propellers, supported by a cruciform
steel-tube framework layout. Five of the propellers were meant to stabilize the machine laterally,
another for steering and two for forward propulsion.
Although rudimentary, this machine achieved a considerable degree of stability and
controllability, having made more than a thousand test flights in the middle of that decade. It was
even possible to maintain the aircraft several minutes in the air. In the 14th of May, the machine
was airborne for fourteen minutes and it flew more than a mile. But Oemichen was not satisfied
with the poor heights.

Figure (I.2): The Oemichen No.2


The army also had an interest for vertical lift machines. In 1921, Dr. George de Bothezat
and Ivan Jerome were hired to develop one for the US Army Air Corps. The result was a 1678
kg structure with 9m arms and four 8.1 m six-blade rotors see Figure(I.3). At the end of the
project Bothezad demonstrated the vehicle could be quite stable, however it was underpowered
and unresponsive, among other technical problems.

Chapter I

Overview on quadrotors and Problem statement

Figure (I.3): Quadrotor designed by Dr. Bothezat an Ivan Jerome


Later in 1956, a quadrotor helicopter prototype called Convert wings Model A was
designed both for military and civilian use. It was controlled by varying the thrust between
rotors, and its flights were a success, even in forward flight. The project ended mainly due to the
lack of demand for the aircraft.
Recently there has been an increasing interest in quadrotor designs. The famous design is
the Moller Sky car, a prototype for a personal VTOL flying car which is shown in figure (I.4).

Figure (I.4): Sky car during a test flight


Now, quadrotors are also available to the public through radio controlled toys. Some
enthusiasts as well as researches have been developing their own quadrotor prototypes. This is
5

Chapter I

Overview on quadrotors and Problem statement

possible due to the availability of cheap electronics and lightweight resistant materials available
to the public.

I.2 Quadrotor concepts


The quadrotor is a structure with a four rotors in a cross configuration. This cross
structure is quite thin and light. All the propellers axes of rotation are fixed and parallel.
Furthermore, they have fixed-pitch blades and their air flow points downwards (to get an upward
lift). The movements are directly related just to the propellers velocities. Even though the
quadrotor has 6 DOF (3 for attitude and 3 for position), it is equipped just with four propellers;
hence it is not possible to reach a desired set-point for all the DOF, but at maximum four.
However, it is quite easy to choose the four best controllable variables and to decouple them to
simplify the controller design.

I.2.1 Quadrotor maneuvering:


A quadrotor is lifted and propelled by four rotors, with two of them turning in the
opposite directions of the others to neutralize the yaw torque.
Unlike conventional helicopters (tail rotor counter the main rotor torque, see figure (I.5),
the lift of quadrotor helicopters is only controlled via the rotor speed. Pitch, roll, and yaw are
achieved by controlling the differentiate speed of the four rotors. More precisely, the differential
lift of the rotors generate pitch and roll torques, while the yaw control is achieved by the
differential rotor torques induced by drag forces acting on the four rotors.

Figure (I.5): Neutralization of the yaw torque

Chapter I

Overview on quadrotors and Problem statement

Another important situation is the hovering fly (attitude and altitude stabilization) which
occur when the lift force is equal to the quadrotor weight (F=Mg). Otherwise, we distingue two
cases:
1. F > Mg: rising flight.
2. F < Mg: falling flight
The quadrotor movements are the resultant of the interaction of the following produced force and
torques with respect to a fixed body frame:
a- Throttle force (U1 [N]):
This command is provided by increasing (or decreasing) all the propeller speeds by the
same amount. As shown in Figure (I.6), it leads to a vertical force which raises or lowers the
quadrotor.

Figure (I.6): Throttle force illustration


b- Roll torque (U2 [N.m]):
This command is provided by increasing (or decreasing) the left propeller speed and by
decreasing (or increasing) the right one. It leads to a torque along the X axis which produces
only roll angle acceleration, as shown in Figure (I.6).

Chapter I

Overview on quadrotors and Problem statement

Figure (I.7): Roll torque illustration


c- Pitch torque (U3 [N.m]):
This command is very similar to the roll and is provided by increasing (or decreasing) the
rear propeller speed and by decreasing (or increasing) the front one. It leads to a torque with
respect to Y axis. The figure (I.8) illustrates produced pitch angle acceleration.

Figure (I.8): Pitch torque illustration

d- Yaw torque (U4 [N.m]):


This command is provided by increasing (or decreasing) the front-rear propeller speed
and by decreasing (or increasing) that of the left-right couple. It leads to a torque with respect to
8

Chapter I

Overview on quadrotors and Problem statement

the Z axis. When the overall torque is unbalanced, the quadrotor turns on itself around Z axis.
This command leads only to yaw angle acceleration like shown in Figure (I.9).

Figure (I.9): Yaw torque illustration

I.2.2 Common quadrotor applications


In literature, we can find several applications of quadrotors. Among various domains like
industries, military and rescue operations quadrotors have realize great success. As example, we
give the following cases:
Sea rescue searches from the air;
Monitoring and control of road traffic and transportation;
Inspections of power lines, bridges and barrages;
Observation of oil and gas pipelines;
Forest monitoring, fire detection, firefighting: operation and management;
Landmine detection, operation in hazard or disaster zones;
Environmental and climate research: monitoring of air quality, meteorological.

I.3 Problem Statement


The design of quadrotor system must meet some consideration. In view of on board
power constraint, the quadrotor must be equipped with components of adequate size and weight.
To maintain availability of quadrotor information, high data flow should be treated online by
appropriate processor. Furthermore, the quadrotor dynamics are highly nonlinear, coupled, under
actuated and instable system. So, the processor has the task to provide necessary commands to
overcome such complexity.
9

Chapter I

Overview on quadrotors and Problem statement

Unfortunately, there is no existing platform dedicated to quadrotor control in our


university. So, our main goal in this work is the design of minimal system to perform basic
quadrotor stabilization. In regard of quadrotor consideration, it is necessary to create ground
station for control purpose. Communication with quadrotor when flying is established through
wireless network.

01

Chapter II

Quadrotor control platform design

II.1 Introduction
II.2 Hardware architecture
II.3 Quadrotor structure
II.4 Sensors unit
II.4.1 Overview on quadrotor sensors
II.4.2 Sensors selection
II.5 Actuators Unit
II.6 Wireless communication unit
II.7 Power unit
II.8 Control unit
II.9 Ground station unit
II.10 Programming of microcontrollers
II.11 Conclusion

Chapter II

Quadrotor control platform design

II.1 Introduction
This chapter discusses the hardware architecture of the quadrotor and the specification of
all parts and devices used in this project which includes: mechanical structure design, electronic
units, sensors and actuators. At the first, the selected hardware architecture will be presented.
Then, according to this architecture, the appropriate components should be selected depending
on available products from the local market and our objectives.

II.2 Hardware architecture


The project aims to develop a quadrotor structure capable of automatic hovering and
communicate with control station; a feedback control law must be implemented in order to
realize our objective. For that, we will need various sensors to perform data acquisition of system
state.
A control unit will compute and send required commands to actuators unit; this later will
adjust rotor speeds in manner to correct deviation from desired values of controlled variables.
Also the control unit performs the communication with all external units.
So, a wireless communication unit establishes data transfer between control unit and ground
control station.
This will guide us to propose a modular architecture as shown below in Figure (II.1). At follows,
we will sketch with explanation quadrotor system components.

II.3 Quadrotor structure


Some projects are based on commercially available platforms like Draganflyer, X-UFO and
MD4-200. Other researchers prefer instead to build their own structure.
The choice of the structure must respect some conditions:
The structure must be solid and lightweight. It is recommended to use a material which
has high strength to weight ratio, this will help us to minimize the power consumption
and reduce damage caused by crashes;
The structure must be rigid and symmetrical as possible; this will minimize the vibration
and give more precision when modeling the structure;
Choosing low cost structure.

11

Chapter II

Quadrotor control platform design

POWER UNIT

ACTUATORS UNIT

SENSORS UNIT

BLDC+ESC

IMU+SONAR
RANGE

CONTROL UNIT

COMMUNICATION
UNIT

dsPIC
WIRELESS MODULE1

GROUND STATION
PCB CARD

WIRELESS MODULE2

Figure (II.1): Quadrotor system hardware architecture


In the aim to save time, we decided to choose a commercially structure. We have purchasing the
GAUI 330 X-S quad flyer as shown in Figure (II.2).
This kit provides [GAUI 330X manual]:
Structure constructed with high strength carbon fiber;
Four brushless motors with their electronic speed controllers;
Four 8 inches propellers;
Crossing Distance: 330mm (Shaft to Shaft);
Flying duration: 7 ~ 20 minutes.

12

Chapter II

Quadrotor control platform design

Figure (II.2): GAUI 330 X-S quad flyer structure


With the equipped motors, the quadrotor can lift payload up to 700 grams. This capacity is
sufficient in most demonstrative quadrotor applications.

II.4 Sensors unit


A precise knowledge of the quadrotor state improves the performance of feedback control
laws; they are responsible for providing information like quadrotor attitude, acceleration,
altitude, global position, and other relevant data.
In our quadrotor prototype, all sensors must be light and small, among existing
technologies; we should consider MEMS (Micro-Electro-Mechanical Systems) technology. The
use of low-cost sensors of this type implies less efficient data result in addition to a weak drift
rejection; this will make the control process more challenging. Sensors to be used in quadrotor
conception came from various technologies. Following section will give an overview of different
sensor types. At next, we will present selected devices.

II.4.1 Overview on quadrotor sensors


In quadrotor research literature, different sensor types are depicted. Here, we recite some
frequently used one [Min09];
1. Accelerometers:
An accelerometer is a device that measures the proper acceleration. It behaves as a
damped mass on a spring. When the accelerometer experiences an external force, the mass is
displaced until the external force is balanced by the spring force. The displacement is translated
into acceleration. As example if a moving mass alters the distance between two metal plates,
measuring the change in their capacitance gives a measurement of the force that's acting. The
figure (II.3) illustrates principle of capacitive accelerometer.
13

Chapter II

Quadrotor control platform design

Force due to the


acceleration

Damped mass on a
spring

Figure (II.3): Capacitive accelerometer

2. Gyroscopes:
A gyroscope detects mechanical rotation and provides the measurement of the angular
velocity about its axis. A three-axis gyroscope strapped on a vehicle can measure the three
components of the angular velocity of a frame attached to the vehicle relative to an inertial
frame. Gyroscopes make use of the Coriolis Effect, which describes the effect that in a frame of
reference rotating at an angular velocity ( ), a mass (m) moving with velocity ( ) experiences a
force as shown in figure (II.4).
(

Figure (II.4): Coriolis Effect in a Gyroscope


14

Chapter II

Quadrotor control platform design

3. Magnetometers:
A magnetometer provides measurements of the intensity and/or direction of a magnetic
field. In particular, they can be used to measure the direction of the Earths magnetic field.
However, the major inconvenience of these sensors is the influence of magnetic perturbations on
their measurements. As example, electric motors can generate parasite magnetic field that can be
sufficient to disturb measurements.
4. Global Positioning System (GPS):
The GPS is a satellite-based navigation system developed by the United States of
America 'US' at department of defense in the early 1970s. Initially, it was developed as a military
system to fulfill US military needs, and it has been available to civilians since 1995. The GPS
consists, normally, of a constellation of 24 operational satellites which are placed such that at
any location on the Globe one can observe simultaneously from four to eight satellites.
Knowing distance from one satellite places the object to locate somewhere on a spherical surface
that's centered on the satellite. Knowing distances from two satellites places this object
somewhere along a circle that's between the two satellites, see figure (II.5).

The circle of the intersection

Satellite2

Satellite1

Figure (II.5): GPS extracting position method


Distances from three satellites usually intersect at two points, and if we are not flying around,
one of these points will be on Earth's surface. Distances from four or more GPS satellites will
intersect at just one point.
5. Inertial Measurement Unit (IMU):
An Inertial Measurement Unit, or IMU, is an electronic device that measures and reports
on a craft's velocity, orientation, and gravitational forces. The term IMU is widely used to refer
15

Chapter II

Quadrotor control platform design

to a system containing a three-axis accelerometer and a three-axis gyroscope. Some IMU also
contain a three-axis magnetometer and/or a GPS for the improved accuracy of attitude and
position estimation
6. Barometric altimeters:
A barometric altimeter measures the atmospheric pressure at its level and converts the
pressure measurement to an indication of altitude above sea level. As the air pressure decreases
at altitudes above sea level, the actual reading of the instrument is dependent upon its location.
7. Sonar range finder:
Sonar range finder measures the distance to an object based on the time of flight method.
They transmit ultrasonic waves and measure the time that it takes to reflect, if there is an object
in the path of these waves; part or all of these waves will be reflected back to the transmitter and
can be detected through the receiver path as shown in figure (II.6). By measuring the difference
in time between the transmitted waves and the received one, it is possible to determine how far
away the object is. They are rarely used due to their limited ranges. But they are often used for
automatic landing of VTOL vehicles or indoor applications.

Figure (II.6): Sonar range finding method


8. Hall Effect sensor:
A Hall Effect sensor is a transducer that varies its output voltage (e) in response to
changes in magnetic field (B) as shown in figure (II.7). It must be supplied with constant current
(I). Hall Effect sensors are used for proximity switching, positioning, speed detection, and
current sensing applications.

16

Chapter II

Quadrotor control platform design

Figure (II.7): Hall Effect sensor operation

II.4.2 Sensors selection


According to our goal, we decided to use the following sensors:
1. Inertial Measurement Unit;
2. Sonar range finder;
3. Hall Effect sensors.
1. Inertial Measurement Unit:
On the market many inertial measurement unit exists such us MT9-B from Xsens and the
3DM-GX1 from Microstrain, both of them is widely used in several projects but they have
inconvenient of expensive price for low budget projects [Bou07][ And04][ Seg011 ].
When choosing an Inertial Measurement Unit many factors justify the choice like:
Size and weight;
Data resolution;
Transmission rate;
Filtering capability.
We decided to buy the CHR-6dm Inertial Measurement Unit shown in Figure (II.8) from
CHRobotics; it looks the best unit available on the market with price less than 200 dollars.
As the CHR-6dm deliver the majority of state variables, various parameter setting must be tuned.

17

Chapter II

Quadrotor control platform design

Power supply
Pins

Additional
extra Pins

Regulated 3.3
Voltage
UART Pins
(Rx, Tx)

Figure (II.8): Inertial Measurement Unit CHR-6dm


As described in device datasheet [chr_datasheet], the IMU CHR-6dm provides yaw, pitch
and roll angle outputs at up to 300 Hz. All angle measurements are made with respect to a NorthEast-Down (NED) inertial frame. An Extended Kalman Filter (EKF) combines data from
onboard accelerometers, rate gyros, and magnetic sensors to produce angle estimates.
Communication with the CHR-6dm is performed over UART at 115200Baud as fixed
rate. The transmission rate can be configured in 1 Hz increments from 20 Hz to 300 Hz. the
CHR-6dm use an16 bits resolution analog to digital converter 'ADC'.
Alternatively, the CHR-6dm can operate in "silent mode," where data is transmitted only
when specific requests are received over the UART.
Regardless of the transmission mode and rate, internal angle estimates are maintained at over
500 Hz to ensure long-term accuracy.
We can summarize additional functionality of CHR-6dm as follows:
Automatic gyro bias calibration;
Onboard 3.3V regulator simplifies integration;
+3.3V output sources up to 400mA for powering other peripherals (ie. GPS);
Open-source PC software for data visualization and configuration.

The CHR-6dm makes 6 extra pins available, which can be configured as digital inputs,

digital outputs, as an SPI bus or even as a second UART bus.


The sequence of rotations used to give the orientation of the IMU is first yaw, then pitch,
then roll. Note that Euler angles (yaw, pitch, and roll) are used to represent the orientation of the
IMU.
18

Chapter II

Quadrotor control platform design

The CHR-6dm uses a continuous-discrete implementation of the EKF, where rate gyro
measurements are used to drive the prediction step, and the accelerometer and magnetometer are
used for drift correction in the update step.
2. Sonar range finder:
The Devantech SRF range finder family is the most popular choice; it has a simple interface
defined on the Inter-Integrated Circuit (I2C) bus, provides measurement at 15 HZ rate and
demonstrates high flexibility of configuration. In our project the SRF10, shown in Figure (II.9),
was chosen as it presents many features:
5V supply voltage;
Provide 15 Hz reading rate for 6m range;
Configurable rate and range.

Figure (II.9): Sonar range finder SRF10 (Front View)

Sensor pins are illustrated in Figure (II.10).

Figure (II.10): Sonar range finder SRF10 pin connection (Back View)

19

Chapter II

Quadrotor control platform design

3. Hall Effect sensors:


In our project, this sensor can be used to measure rotor speed which is useful for both propeller
constants determination and the control of rotor speeds.
Finally we select the UGN3503 from Allegro Company shown in Figure (II.11) which presents
these Features:
Extremely Sensitive;
Low-Noise Output;
4.5 V to 6 V operation.
With the advantage of accurate measurement, it can be powered with available voltage produced
by other parts of system.

Figure (II.11): UGN3503 Hall Effect sensor


II.5 Actuators Unit
This unit receives commands provided by the control unit and delivers appropriate
torques to adjust quadrotor position and orientation. It is composed from motors and its associate
electronics.
The motors usually implemented in this kind of application are electric Direct Current
(DC) motors. These motors available in the radio control hobby market are either brushed or
brushless. This later kind is relatively expensive but have higher efficiency, power, and do not
need regular maintenance [Jor09]. Brushed motors are cheap but have a shorter lifetime and their
brushes need regular replacements. Loss of structural integrity of the quadrotor due to motor
failure should be avoided by using more reliable equipment. For these reasons it is preferable to
use brushless motors.

20

Chapter II

Quadrotor control platform design

Brushless DC motors are a type of synchronous motor. This means the magnetic fields
generated by both the stator and the rotor rotates at the same frequency. These motors do not use
brushes for commutation; instead, they are electronically commutated by specialized circuit.
In the radio control hobby brushless motor is controlled by an Electronic Speed
Controllers (or ESC); it constitutes an easy interface between processor control unit and
brushless motor. Based on internal microcontroller, it receives signal control in PWM form and
generates corresponding powered signal sequence to adjust correctly the motor speed.
In our case the motors and ESCs are available with the GAUI 330x kit. It is dotted with
four (04) Scorpion (1050KV) brushless motors as illustrated in Figure (II.12); as stated by the
manufacturer, this type of motor, of weight 40g, is able to rotate at 11655 RPM when free of
load.

Phases wire
to be
connected to
esc

Figure (II.12): Scorpion Brushless Motor


These motors are delivered with 8 inch propeller. Their form differs depending on rotation sense.
Figure (II.13) shows one propeller to be fixed on motor shaft.

Figure (II.13): Propeller

21

Chapter II

Quadrotor control platform design

Also, as part of the kit, ESCs in number of four (4) ensure motor speed control. With light
weight of 9g and small size they can support current up to 10A from various battery types (Liion /Li-Poly 2-4 cell) and (NiMH/NiCd 5-12 cell). The frequency of PWM received signal from
processor can be set up to 400 Hz. Such rate minimizes considerably motor vibration and control
performance.
ESC must be wired to battery, motors and processor according to Figure (II.14).

Motors wire
Power supply

PWM Command signal

(Orange wire)

Regulated 5v output
(Black and red wires)
Figure (II.14): Electronic Speed Controllers (ESCs)
II.6 Wireless communication unit
Through this unit the quadrotor is able to communicate with a ground station, accepting
commands and reporting data. We need two modules one for the quadrotor and another in the
ground station computer that will handle all telemetry for system identification and control
purposes.
Many wireless protocols exist, but in our situation we must choose the one which gives
less power consumption with acceptable transmission speed. After reading some thesis and
articles we found that accommodate choice is the Zigbee protocol.
The Zigbee protocol is a wireless network protocol specifically designed for low data rate
sensors and control networks. There are a number of applications that can benefits from the
Zigbee including: building automation networks, home security systems, industrial control
networks, and remote metering and PC peripherals [Zig06].

22

Chapter II

Quadrotor control platform design

From available products, we recite the famous Xbee module which is equipped with this
protocol at rate up to 250Kbps. However, communication with the host controller is achieved
through serial interface.
To minimize the execution time of the control loop as possible, choosing a wireless
module which can communicate to the host at high speed is recommended. We are going to use
the Easybee3 module from Mikroelektronika company shown in Figure (II.15). It is developed
around the MRF24j40MA transceiver from microchip and equipped with 3.3v regulator. This
module has a SPI bus which allows us to communicate faster than the UART (RS232)
implemented on the Xbee.

Control socket
Data socket

Voltage level selection


Figure (II.15): Easybee3 Zigbee module

With typically operating Voltage as 3.3V and low current consumption, the data transmission
rate is up to 250Kbps.
II.7 Power unit
This unit provides necessary power for all units. It is recommended to choose a light
weight rechargeable battery to minimize the power consumption and increase the flight time.
Among the most used batteries in drone applications, especially quadrotor and helicopter,
we recite: Nickel Cadmium (NiCd), Nickel Metal Hydride (NiMh) and Lithium Polymer (Li-Po).
We decide to choose Lithium-ion Polymer GAUI 3s (LiPo3s) battery shown in Figure (II.16). It
is adequate with our prototype in view of dimension; under 11.1V as voltage, it has a capacity of
2000mAh with discharging factor equal to 20C and weight 150g.

23

Chapter II

Quadrotor control platform design

Power supply
Wires

Charger
Connector

Figure (II.16): Battery (GAUI LiPo3s)


II.8 Control unit
A stabilization system is necessary to drive the quadrotor; the implementation of control laws
requires using microcontrollers. According to our goal and selected devices, the microcontroller
must demonstrate at minimum the following capabilities:
Fast execution of instructions;
4 output compare module (4 PWM for ESCs);
4 input capture module (4 Hall Effect sensors for propellers speed);
Communication Modules:

1 UART modules (IMU);

1 I2C module (sonar);

1 Spi module (Zigbee module).

So, we decide to use the dsPIC 128gp710 from microchip. Mikroelektronika Company presents
Micro Controller Unit 'Mcu' cards equipped with this microcontroller as shown in Figure (II.17).
The dsPIC128gp710 provides the following features:
Up to 40 MIPS operation (at 3.0-3.6V);
Dsp engine;
Flash program memory, up to 256 Kbytes;
Data SRAM, up to 30 Kbytes (includes 2 Kbytes of DMA RAM);
8-channel hardware DMA;
24

Chapter II

Quadrotor control platform design

3-wire SPI (up to two modules);


I2C module (up to two modules);
UART (up to two modules);
Input Capture (up to eight channels);
Output Compare (up to eight channels).

dspic128gp710

10 MHZ oscillator

Pins
Figure (II.17): dsPIC card
In addition to the purchased MCU, we had developed a PCB card that connects all
devices (MCU, sensors and ESCs). It is equipped with 3.3V voltage regulator to give necessary
power to MCU card. Figure (II.18) illustrates the two sides of the developed PCB.

Figure (II.18): PCB card

The realized card is shown in Figure (II.19).


25

Chapter II

Quadrotor control platform design

Dspic power supply and Zigbee

All communication buses


pins
(Spi, uart1, uart2)
Input capture pins

Zigbee Module
IMU emplacement

Emplacement

(UART1)
UART2

General purpose

Outputs compare pins

ESCs
emplacement

Figure (II.19): Realized card


II.9 Ground station unit
A ground station control was developed. It allows us to perform bidirectional
communication. In one direction, we will be able to receive all quadrotor related data. Control
instruction will flow in the other direction to drive quadrotor. This will be useful for analysis,
monitoring, fault detection and system identification. We decide to build a Personal Computer
(PC) interface under Labview environment.
National Instruments (NI) Labview is an industry-leading software tool for designing
test, measurement, and control systems since its creation in 1986. Labview has the flexibility of a
programming language combined with built-in tools designed specifically for test, measurement,
and control.
Using NI Labview software, we developed a program in NI Labview environment (under
G programming language) that communicate with external module through serial port. A
graphical interface is designed to collect all necessary quadrotor data as shown in figure (II.20).

26

Chapter II

Quadrotor control platform design

Attitude and altitude information

Variables
rates

Commands and estimated rotor speeds

Flying time

ON/OFF
button

Figure (II.20): Labview main window


In addition to PC interface, a pic18f4520 was connected to PC through serial port; this pic reads
the received data from the Zigbee module and passes it to PC interface.
The pic18f4520 was mounted on the picready card (Figure II.21).
Usb port
(Virtual serial port)
Power supply
pic18f4520
Zigbee module
Connection

Figure (II.21): Picready board


27

Chapter II

Quadrotor control platform design

Picready board is a solution for fast and simple development of microcontroller applications. It is
equipped with FTRL232 circuit that ensures the conversion from serial to usb and the adaptation
of logical level between PC and pic.
II.10 Programming of microcontroller:
To program the dsPIC and pic18f4520, two development boards were utilized: Easypic6
and the Lv24-33. These boards are shown in Figure (II.22).
These widely used boards are development tools suitable for programming and
experimenting the PIC microcontrollers from MICROCHIP, includes an on-board programmer
microICD support (in-circuit debugger) providing an interface between the microcontroller and
the PC. We are simply expected to write a code in a compiler, generate a hex file and program
our controller using the PICflash programmer. Numerous on-board modules, such as 128x64
graphic LCD display, 2x16 LCD display, led array and push button etc. allow us to easily
simulate the operation of the microcontroller and to determine the software bugs quickly.
PICflash usb
cable

Microcontroller emplacement

Figure (II.22): Easypic6 (left) and Lv24-33 (right) development board

For safety reason we decided to add protection frame around the quadrotor to minimize
the risk of damage in case of crash. The figure (II.23) shows the assembled structure.

28

Chapter II

Quadrotor control platform design

Figure (II.23): Assembled structure

III.11 Conclusion:
In this chapter, all necessary hardware parts was selected, every choice was justified
according to available products and objectives. As main consideration, we focus on the
possibility that all devices work together in the system. The cost of the platform system was
reduced as possible. Additional to the selected devices a PCB card was developed; setting,
configuration and test of devices will be treated in chapter (IV).

29

Chapter III

Quadrotor dynamics modeling

III.1 Introduction
III.2 Modeling with Newton-Euler Formalism
III.2.1 Aerodynamic Forces and Moments
III.2.2 General Moments and Forces
III.3 Discussion
III.4 Determination of quadrotor parameter
III.4.1 Inertial moments
III.4.2 Propeller constants
III.5 Conclusion

Chapter III

Quadrotor dynamic modeling

III.1 Introduction
In this chapter, the derivation of the quadrotor model is provided. To derive the dynamic
model, we must write the physical equations that describe the quadrotor motions; this approach
makes it easy to build dynamic models of the system, since we dont have to perform closed loop
identification in flight.
Newton-Euler formalism, moment of inertia calculus, blade element and momentum theories
were used to model the quadrotor. The developed model assumes the following:
The structure is supposed rigid;
The structure is supposed symmetrical;
The propellers are supposed rigid;
Thrust and drag are proportional to the square of propellers speed.

III.2 Modeling with Newton-Euler Formalism [Bou07]:


We consider two coordinate systems as the figure (III.1) illustrates:
The earth inertial frame (E-frame);
The body-fixed frame (B-frame).

Figure (III.1): Coordinate System

The dynamics of a rigid body under external forces applied to the center of mass and expressed
in the body fixed frame are in Newton-Euler:

+[ ]

`30

* +

(III.1)

Chapter III

Quadrotor dynamic modeling

Where the vectors

and

the quadrotor. The applied force

respectively referred to translational and rotational speed of


and torque

are produced by the four motors.

III.2.1 Aerodynamic Forces and Moments:


The aerodynamic forces and moments are derived using a combination of momentum and
blade element theory, we recall some symbols:
: solidity ratio

: inflow ratio

a: lift slope

v: induced velocity

: rotor advance ratio

: air density

1. Thrust force (T):


This is the resultant of the vertical forces acting on all the blade elements. It is given by:

(III.2)

2. Hub force ( ):
This force is the resultant of the horizontal forces acting on all the blade elements.

3. Drag moment (

(III.3)

This moment about the rotor shaft is caused by the aerodynamic forces acting on the blade
elements.
The horizontal forces acting on the rotor are multiplied by the moment arm and
integrated over the rotor.
Drag moment determines the power required to spin the rotor.

`31

(III.4)

Chapter III

4. Rolling moment (

Quadrotor dynamic modeling

):

The rolling moment of a propeller exists in forward flight when the advancing blade is
producing more lift than the retreating one. It is the integration over the entire rotor of the lift of
each section acting at a given radius.

(III.5)

III.2.2 General Moments and Forces:


Quadrotor motion is obviously caused by a series of forces and moments coming from
different physical effects. This model considers the following ones (with c: cos, s: sin).
Rolling moments:

Body gyro effect

(III.6.a)

Propeller gyro effect

(III.6.b)

Roll actuators effect

(III.6.c)

Hub moment due to sideward flight

(III.6.d)

Rolling moment due to forward flight

(III.6.e)

Pitching moments:
Body gyro effect

(III.6.f)

Propeller gyro effect

(III.6.g)

Pitch actuators action

(III.6.h)

Hub moment due to forward flight

Rolling moment due to sideward flight

(III.6.i)
(III.6.j)

Yawing moments:
Body gyro effect
Inertial counter-torque

(III.6.k)

(III.6.l)

Counter torque unbalance

(III.6.m)

Hub forces unbalance in forward flight

(III.6.n)

Hub forces unbalance in sideward flight

(III.6.o)
`32

Chapter III

Quadrotor dynamic modeling

Forces along X axis:

Actuators action

(III.6.p)

Hub force in x axis

(III.6.q)

| |

Friction

(III.6.r)

Forces along Y axis:

Actuators action

(III.6.s)

Hub force in y axis

(III.6.t)

| |

Friction

(III.6.u)

Forces along Z axis:

Actuators action

(III.6.v)

Weight

(III.6.w)

The equations of motion are derived and all the forces and moments listed in Subsection
as below:

| |

`33

| |

(III.7)

Chapter III

Quadrotor dynamic modeling

III.3 Discussion
The previous dynamical model shows that quadrotor has four inputs (
outputs (

and six

Figure (III.2) illustrates scheme of input output relation.

Figure (III.2): Scheme of input and output relation


Angle variables are always controllable; however, positions variables will be also full
controllable only if only the following conditions hold:
{
As example, this is true if angles Roll and Pitch are in the interval

. So, the quadrotor in

vertical plan will be uncontrollable.

III.4 Determination of quadrotor parameter


III.4.1 Inertial moments:
In the body moment of inertia calculation, the main task is to identify the dynamic
behavior of the whole quadrotor in rotation around a defined axis. Since the structure shows a
high degree of symmetry, the body of inertia tensor can be simplified as a diagonal matrix.
Hence, in this part, the main goal is to derive the three body moments of inertia
and

. First of all, the structure of the quadrotor has to be modeled as several components with

easier geometry. Figure (III.3) illustrate main quadrotor structure.


`34

Chapter III

Quadrotor dynamic modeling

(Z)
M4

M3

M1

M2

22mm

(Y)

(x)
11mm
154mm

Figure (III.3): Main quadrotor structure

1. Motors:
Each motor can be modeled as a solid cylinder. The four motors show a high degree of
symmetry; therefore the computation were done just on the front motor and then transposed to
the other ones. In Figure (III.4), we consider a simplified geometry of the motor.

Cylinder A

Figure (III.4): Solid cylinder to model motor


The inertial matrix of the cylinder (A), with length (L) and radius (r), around frame passing
through gravity center is given by:

)
[

]
`35

Chapter III

Quadrotor dynamic modeling

Where; motor data are illustrated in figure (III.5).

m=41g

l =20mm

r =14mm

Figure (III.5): Scorpion Motor Dimension and weight


We apply Hwigenz theorem to obtain inertial moment around axes symmetrical axes of
quadrotor with distances h1=23mm, h2=185mm. it results:

2. Frame set 1 and 2:


The frame set1 and 2 were modeled as rectangular parallelepiped as shown in figure
(III.6); the inertial moment of rectangular parallelepiped was express:

`36

Chapter III

Quadrotor dynamic modeling

m=7g

A=177mm

C=26mm

m=2g

B=22mm

Figure (III.6): Quadrotor frame set 1 and set 2 size and weight

Frame set 1:
h1=11mm, h2=100mm.

Frame set 2:
h=154mm.

3. Central frame:
The central frame was modeled as rectangular parallelepiped as the figure (III.7) illustrate.
h=11mm.

`37

Chapter III

Quadrotor dynamic modeling

m=10g

L=85mm

Figure (III.7): Quadrotor central set size and weight

4. dsPIC card:
The dsPIC card was modeled as a rectangular plate.

m=30g

A=130mm

B=50
mm

Figure (III.8): dsPIC card size and weight


The inertial moment of rectangular plate was given by:

{
`38

Chapter III

Quadrotor dynamic modeling

Calculus gives the followed values with h1=36mm and h2=11mm:

5. Battery:
The battery was modeled as rectangular parallelepiped as shown in figure (III.9).
m=150g

A=130mm
C=35mm

B=20mm

Figure (III.9): Battery modeled as rectangle


According to x and y axis there are an offset from parallel axis passing by center of gravity of the battery
h=11mm.
It follows that:

At last, it is possible to compute the overall three body moments of inertia IXX, IYY and IZZ by
adding all the components around the same corresponding axis.

`39

Chapter III

Quadrotor dynamic modeling

6. Rotor inertia:
Rotor inertia is the total moment of inertia around the motor axis (parallel to the Z axis).
It is composed of two constants: the inertial rotational moment of the motor and of the propeller
[Tom08]. It is given by:

The propeller was modeled as a flat cylinder with variable density; this shape has been chosen
because it comes from a rotating (flat plate) propeller, furthermore the density depends on the
radius and it decreases by getting far from the center, so :

It yields that total moment of inertia corresponding to motor will be:

III.4.2 Propeller constants


1. Trust factor:
The quadrotor is equipped with four brushless motors and four nylon propellers driven by
the motors. For controlling the rotational speed of the propellers to stabilize the quadrotor, we
need to find the relationship between the rotational speed of the propeller and the generated lift
force. Hence, to identify the characteristic of the motors, we suggest performing identification
test on just one motor since all motors are considered identical.
For measuring the rotational speed of the propellers, we suggest using a permanent
magnet mounted on motor's rotor and place a Hall Effect sensor near to this magnet as illustrated
in the figure (III.10).
To estimate the lift force, an additional weight was added to avoid the structure being
lifted by the vertical force of the propeller. By placing the system on an electronic balance, it was
possible to measure the propeller lift through differential reading.
The rotational speed of propellers can be obtained by reading the value appeared on the
LCD screen of the Lv24-33 V6 development system.

`40

Chapter III

Quadrotor dynamic modeling

Hall Effect sensor

The rotor

Permanent magnet
Figure (III.10): The Developed Speed Sensor
The table (III.1) summaries the obtained result:
Table (III.1): Experimental results of Trust test.
Rotational speed (rad/s)

Lift force (N)

120

0.0784

130

0.1764

233

0.3430

311

0.6370

388

0.9898

446

1.3426

496

1.6660

571

2.2834

676

3.1458

Evolution of lift force versus rotor speed is illustrated in graph of figure (III.11)

`41

Chapter III

Quadrotor dynamic modeling

Figure (III.11): Lift force versus rotor speed

Using the Curve Fitting Tool of Matlab; the value of the trust factor is found
.
Note that the obtained result respects the relation

2. Drag factor:
To estimate the drag factor, we use the following relation [qua08]:

(
Numerical application gives d=9.3E-8

))

; this value can be adjusted using the Simulink

model and experimental tests.


The table (III.2) summarizes the quadrotor constants which will be used for the simulation task.

Table (III.2): Quadrotor constant parameters values.


mass

0.68
0.18 m

arm length
thrust coefficient

`42

Chapter III

Quadrotor dynamic modeling

drag coefficient

9.3E-8

motor inertia
Propeller inertia
Rotor inertia
inertia on x axis
inertia on y axis
inertia on z axis
twist pitch

0.07 rad

pitch of incidence

0.35 rad

propeller chord

0.018 m

III.5 Open loop simulation


In order to examine the quadrotor dynamic behavior, we choose the quadrotor OS4 simulator,
developed by Bouabdallah in EPFL. In order to accommodate this simulator to our application,
we introduce a modification. We add ESCs and motor dynamic after we implement our model
parameter values. Figure (III.12) illustrates the obtained Simulink model which will be used in
simulation.

Figure (III.12): Modified OS4 Simulator

`43

Chapter III

Quadrotor dynamic modeling

In this simulation, the initial values of all quadrotor variables are taken equal to zero;
except roll rate which is equal to 0.5 rad/s; the input control vector is chosen as U=[m.g 0 0 0]
where m.g is the quadrotor total weight. We obtain the following results depicted on Figure
(III.13).
From these figures, we see that all variables are unstable. The roll angle decreases with
negative values. The coupling effect which is due to gyroscopic effect appears in common

10

0.5

pitch (rad)

roll (rad)

oscillation; also the x and y position were affected by angles variation.

-10
-20
-30
-40

4
6
Time (s)

-1.5

10

4
6
Time (s)

10

4
6
Time (s)

10

4
6
Time (s)

10

10
0

altitude(rad)

0.3
0.2
0.1
0

-10
-20
-30
-40

4
6
Time (s)

-50

10

200
150

y(m)

100

x(m)

yaw (rad)

-0.5
-1

0.4

-0.1

50
-2

-4

4
6
Time (s)

10

-50

Figure (III.13): quadrotor variables evolution versus time

`44

Chapter III

Quadrotor dynamic modeling

III.6 Conclusion
In this chapter, we developed dynamical model of the quadrotor; we suggested the
modelling of quadrotor components with geometrical forms. It allows us to compute needed
physical quantities as inertia moments. Also, we proposed and performed an experimental test to
determine trust factor; the graphical representation of lift force versus rotor speed, in hyperbolic
form, is in accordance with theoretical law.
From previous theoretical development, the quadrotor can be considered as MIMO
nonlinear system with high coupling effect between angles and positions. With four inputs, we
are able to control only four variables from six at choice; so the quadrotor is considered as under
actuated system. Consequently, remained variables will change as solution of dynamical model
equations. Open loop simulation shows the instability of quadrotor.
In the aim to stabilizing quadrotor, in next chapter, we will investigate the design of
control law and perform their software implementation on the developed quadrotor system
platform.

`45

Chapter IV

Control design and software


implementation

IV.1 Introduction
IV.2 Platform devices configuration and setup
IV.3 Ground station
IV.4 Development of the dsPIC code
IV.5 Control Design
IV.6 Experimental results
IV.7 Encountered problems

Chapter IV

Control design and software implementation

IV.1 Introduction
This chapter treats the configuration and the setup of all devices to build a full system
that can stabilize the quadrotor. The stabilization requires the implementation of a control law;
we will perform synthesis of two control laws and tuning their parameters in the Simulink
Matlab.
We will explain in detail the architecture of the full software which will manage all the
functionality of the system. Finally the obtained parameters will be injected on the real system. If
necessary, these parameters will be tuned.

IV.2 Platform devices configuration and setup:


1. IMU:
The IMU provides the attitude information. It delivers its data through UART in two modes:
broadcast mode and silent mode; working with silent mode will make the synchronization
between the IMU and host microcontroller easier. To set the silent mode two solutions exists:
send a command packet with a microcontroller to the IMU or using the configuration interface
shown in Figure (IV.1).

Figure (IV.1): IMU configuration interface


Furthermore, we set only angles and angle rate channels in order to reduce the
communication time. In addition the diagonal elements of the process matrix noise of EKF must
be trusted less to reduce the sensitivity of the IMU against the magnetic field distortion produced
46

Chapter IV

Control design and software implementation

by motor wires; this will minimize the yaw drift. All previous set up was done using the
configuration interface.
The IMU communicates with microcontrollers using two packets RX and TX; the structure of
both packets is shown in figure (IV.2).

Value

's'

'n'

'p'

PT

Byte

1-3

CHK
6

N+5

N+6 N+7

Each received packet must begin with the three-byte (character) sequence
"snp" to signal the beginning of a new packet.

PT specifies the packet type.

N specifies the number of data bytes to expect.

6-(N+5)
(N+6)-(N+7)

to

contain the N data bytes in the packet.

CHK is a two-byte checksum.


Figure (IV.2): Structure of RX and TX packets.

2. Easybee3 module:
The Zigbee module has many parameters which must be set; these parameters define the
operation mode and the identification of the module in the network. The Table (IV.1) summaries
the parameters of identification:
Table (IV.1): Easybee3 identification parameter
Parameter

Description

Long address

The long address of the device

Short address

The short address of the device

PAN ID

The personal area network identifier

The memory of the device is divided into control registers and buffers which are accessible
through SPI bus with two addressing modes:
Short Addressing: give access to registers locate between 0X00 and 0X3F.
Long Addressing: give access to registers locate between 0X000 and 0X38F.
Each parameter can be set by writing the desired value in its appropriate control register.
The Figure (IV.3) explains case of short address read and writes procedure.

47

Chapter IV

Control design and software implementation

Figure (IV.3): short address read and writes procedure


In our project, we create header files 'transmiter.h and receiver.h' which contains all
functions needed in the configuration of devices (devices attached with quadrotor and the other
with the ground station); note that the used functions were a modified version of Easybee3
example provided by MIKROELEKTRONIKA Company. Our modification was oriented to
minimize the execution time by reducing the number of iteration of read_RX_FIFO function.
The operation mode and network configuration was taken from Easybee3 examples; for more
detail see [Mrf datasheet].
The schematic in Figure (IV.4) illustrates steps executed by the main program for Easybee3
module configuration.
3. Sonar module:
The first sensor used in this work was the MAXBOTIX sonar EZ1 which communicates
trough serial port; we suffer from communication problems due to the bad soldering of the
connector.
Then, we purchase second ultrasonic sensor under the reference SRF10 with maximum
range of 6 m. this range can be reduced to a few tens of centimeters by adjusting its maximum
gain which reflects the sensitivity of the sensor to detect distant objects. The maximum gain can
vary from 1 to 16 by modifying the registry sensor control at location 0x01.
According to experiment results mentioned in [Vin06], a range of 1.5m to 2m is possible
for a gain between 7 and 11. Also, we can control the maximum range by writing the desired
value in the range register at location 0X02; all this modification aim to reduce the time of
acquiring the altitude measurement. The used values are shown in figure (IV.5).
48

Chapter IV

Control design and software implementation

Figure (IV.4): Flowchart of Easybee3 configuration

Figure (IV.5): Flowchart of sonar range finder configuration

49

Chapter IV

Control design and software implementation

IV.3 ground station:


The ground station is composed of two parts; the first one is Picready board equipped
with pic18f4520 and 8 MHZ oscillator and the second Zigbee module. The Figure (IV.6)
illustrates the configuration of Zigbee module; also the pic18f4520 must be configured to run at
the maximum speed; for that we enable the PLL functionality.
The second part concerns the development of the labview interface; the built code in the labview
environment must accomplish the following operations:
Reading the available data in serial port;
Calculate all states of the quadrotor;
Recalculate commands and estimate rotor speeds;
Visualization of all variables;
Sending start and stop commands.

Figure (IV.6): Flowchart of second Easybee3 configuration


This code incorporates many subVIs (sub function in Labview environment):
read sensors (1): read available data in the serial port;
imu1 (2): calculate yaw and yaw rate from data provided by (read sensors);
imu2 (3): calculate pitch and pitch rate from data provided by (read sensors);
50

Chapter IV

Control design and software implementation

imu3 (4): calculate roll and roll rate from data provided by (read sensors);
alt (5): calculate altitude and altitude rate from data provided by (read sensors);
Cmd (6): calculate commands and rotor speeds from data provided by (read sensors);
The Figure (IV.7) illustrates the emplacement of each subVIs on the block diagram.

(1)
(2)

(1)

(3)

(6)
(4)

(5)

Figure (IV.7): Emplacement of subVIs on the block diagram


IV.4 Development of the dsPIC code:
The dsPIC code is composed from two parts:
1. Initialization and configuration ;
2. Main loop.
The main loop is composed from the following steps:
a. Send a get_data command to the imu by sending the packet:
Value

's'

'n'

'p'

0x01

0x00

Byte

51

0x01 0x52
6

Chapter IV

Control design and software implementation

The DMA channel 1 is dedicated to data transfer from DMA ram to IMU through the
UART; this allows the dsPIC to execute the program code when the DMA channel work
in background.
b. Reading the data provided by the IMU in the previous transfer; the DMA channel 2 is
responsible of data reading;
c. Reading the data from the sonar every four sample time;
d. Sending all available states to the ground station every six sample time;
e. Calculus both of commands and PWM if ON command was received; sending the PWM
to ESCs
f. Stopping control loops and motors if OFF command was received;
The diagram shown in Figure (IV.8) illustrates the code implemented on the dsPIC.
IV.5 Control Design:
In this section, we will synthesis a controller for altitude and attitude stabilization
followed by simulation results. This will be useful in implementation of an adequate real
controller. Therefore, we will develop a Proportional Integral Derivative controller (PID).
1. Modeling for control purpose:
The model developed in section (III.2) describes the differential equations of the system.
For control design we must simplify the model. Hence, hub forces and rolling moments are
neglected when thrust and drag coefficients are supposed constant. The system can be rewritten
in state space form with U as inputs vector and X as state vector chosen as follows:
State vector:

[
We obtain after simplification:

52

Chapter IV

Control design and software implementation

Begin

Initialization and configuration:


Setting of E/S port;
Configure dsPIC to run at 80 MHZ;
Modules: SPI1, UART1, I2C1, PWM1, PWM2, PWM3, PWM4, DMA1, DMA2;
Configure Zigbee and sonar.

While (1)

Sending get_data to the IMU

False
4 SP occur
True
Reading data from the sonar

False
6 SP occur
True
Sending data to the ground station

False
ON command

True
Run the control loop

False
OFF command

True
Stop the control loop and motors

53

Figure (IV.8): Flowchart of the dsPIC

Reading the last data provided by the IMU

Chapter IV

Control design and software implementation

(IV.1)

(
(

2. Synthesis and simulation with PID controller:


The first step is the synthesis of a PID controller to see its performance on such system, and
to examine the limitations of such control method against a more modern method.
a. Synthesis:
We will first take the model equations of angles, we have the four command:

(IV.2)

(IV.3)

(IV.4)

The control input U1 represents the total trust of quadrotor:

(IV.5)

So, on the full model; the four commands were done by the following expressions:

(
(
(

(
)

(
(

)
)

)
(

(
54

(IV.6)

)
)

(IV.7)
(IV.8)

Chapter IV

Control design and software implementation

(IV.9)

b. Simulation results:
For simulation purpose, we apply the previous controllers with following parameter values:

Table (IV.2): PID controller parameter values


Parameter

Z controller

controller

controller

controller

0.5

1.5

1.5

1.5

0.3

0.5

0.5

0.5

The desired values for angles are all zero, when that for altitude is 40 cm.
The altitude controller is composed of two parts: one to compensate the gravity effect which is
constant and equal to the quadrotor weight. However, the second part is the PID controller with
previous parameter values. It is to note that controller output is scaled with the factor
(cos( ).cos( )). This will reduce the coupling effect with roll and pitch angles.
The simulation results of angles and altitude evolution are presented in Figure (IV.9). After
transitory time, the controlled variables converge to their desired values. So, Roll and Pitch as
Yaw angles converges to zero values which correspond to quadrotor horizontal orientation.
Even the altitude evolution show a relatively slow convergence to the desired value (40 cm) in
08 seconds, it remains characterized by some amount of oscillations which reflect the difficulties
that the controller encounter in quadrotor stabilizing.

55

Control design and software implementation

0.6

0.6

0.5

0.5

0.4

0.4

0.3

0.3

pitch (rad)

Roll (rad)

Chapter IV

0.2

0.2

0.1

0.1

-0.1

-0.1

-0.2

-0.2

4
6
Time (s)

10

4
6
Time (s)

10

0.05

1.2

-0.05

0.8

altittude (m)

yaw (rad)

1.4

-0.1

0.6

-0.15

0.4

-0.2

0.2

-0.25

-0.2

4
6
time (s)

10

4
6
time (s)

Figure (IV.9): PID simulation result


The Figures (IV.10) illustrates the four control inputs. The force u1 is relatively big
which is necessary to compensate quadrotor weight. It becomes approximately constant in
56

10

Chapter IV

Control design and software implementation

permanent regime when hovering occurs. The torques u2, u3 and u4 are affected by
measurement noise, but their mean values are kept in zero neighborhood. They contribute mainly
to adjust deviation from desired angles.
1

12

0.5

10

-0.5

u1 (N)

u2 (N.m)

14

-1

-1.5

-2

4
6
time (s)

-2.5

10

4
6
time (s)

10

4
6
time (s)

10

1.4

1.2
0.5
1

0.8
0

u4 (N.m)

u3 (N.m)

0.6

-0.5

0.4

0.2
-1
0

-0.2
-1.5
-0.4

-2

4
6
time (s)

-0.6

10

Figure (IV.10): PID simulation commands

57

Chapter IV

Control design and software implementation

IV.6 Experimental result:


In this section, we are interested to validate the developed project, which means:
1- Control from ground station and data visualization and recording;
2- Communication between quadrotor and ground station through Zigbee network;
3- dsPIC processing
4- Quadrotor stabilization.
For that, we develop and implement the dsPIC program corresponding to the controller
parameters given in the Table (IV.3). These parameters are adjusted version of those in table
(IV.2).
Table (IV.3): Real PID controller parameter values
Parameter

Z controller

controller

controller

controller

0.5

1.2

0.5

0.5

0.5

The desired values of angles and attitude are: [roll=0, pitch=0, yaw=0, altitude50cm]
During experimental test, we recorded, through Labview program, the quadrotor information
given in figure (IV.11) and Figure (IV.13).
The attitude and altitude variables, given in figure (IV.11), are maintained in vicinity of their
corresponding desired values.

58

Chapter IV

Control design and software implementation

Figure (IV.11): PID experimental results

59

Chapter IV

Control design and software implementation

Relatively, the best results are obtained for roll and pitch angles where they error remain
inferior to 04 deg. furthermore, their controller respond quickly to perturbations introduced
manually at instants t=27, 34, 40, and 44 seconds for roll angle and at instants t= 33, 52 and 56
seconds for pitch angle. They are rejected and the desired values are reached again.
The Yaw deviation is with maximum of 10 deg in neighborhood of zero. This may be the
consequence of drift in magnetometer measurement. It can be reduced by an accurate adjustment
of Kalman filer. Peak appearing at moments t=32, 52 and 58 seconds are due to applied
perturbation; the controller arrive to compensate them.
The altitude is oscillating around desired value where the error is maintained inferior to
10 cm, at most time. The controller arrive to bring the quadrotor in vicinity of required altitude
(50 cm) even when perturbation is applied as in moments t=33, 44, 55 and 67 seconds.
The obtained results, especially roll and pitch are acceptable; in comparison with the work of
Bouabdallah [design and control of quadrotors with application to autonomous flying].

Figure (IV.12): Bouabdallah PID experimental results


The four control inputs are illustrated in figures (IV.13). The force u1 is oscillating
around the quadrotor weight. Its allure is in accordance with that of altitude. It remains bounded
and with no saturation which is true for other inputs.

60

Chapter IV

Control design and software implementation

Figure (IV.13): experimental PID commands

61

Chapter IV

Control design and software implementation

The control inputs associated to roll and pitch are more influenced by measurement
noise, which appear in control inputs through derivative action in the PID controller. It is to note
that control inputs remain admissible.
The torque u4 that influences on Yaw angle is less affected by noise but it is in
permanently applied, which may be necessary to compensate drifts.
IV.7 Encountered problems:
1. Integral windup:
Nonlinear effects require care, such as actuator saturation; this can lead to closed loop
instability, especially when the process is unstable in open loop. This problem occurs when
starting from huge initial conditions; this will charging more the integral action and the
discharging action will take lot of time. Firstly, we enable the integral action into small interval
(-10, 10); but the problem stays present; the second solution is the implementation of antiwindup algorithm [Bou07] shown in the Figure (IV.14) which gives good results.

If

> band limit OR

< band limit then

Else if U1 < saturation limit AND

< saturation limit then

+ * sampling period
Else if U1*

> 0 then
0

Else
End if
Figure (IV.14): Anti windup algorithm
2. Yaw drift:
Our IMU suffers from yaw drift, this problem due to the motors wires; we try to reduce
the diagonal elements of EKF; in spite of the problem was not resolved, but the PID controller
stabilizes the yaw angle.
3. Wireless communication problem:
In the development of code to manage the wireless communication, we were able to send
data from the quadrotor embarked system to the ground station, but when trying to send
commands from the ground station to the quadrotor, the dsPIC can't read the correct data, at
present we can't find the causes; but we think that is a code compatibility problem.

62

Chapter IV

Control design and software implementation

IV.8 Conclusion:
In this chapter, we explained the configuration of all devices to make the system works
properly, also the main subVIs on the Labview code was illustrated; then the PID controller was
applied in order to stabilize the quadrotor in both altitude and attitude position; the simulation
result show that all desired values can be achieved with acceptable.
Experimental results show the validity of both developed platform and control. dsPIC
communicate with all onboard devices. Quadrotor information are collected from on board
sensors, treated and transmitted to ground station.
Graphical interface in ground station offer a useful tool to follow variable evolution, to
enhance control design and certainly to record all necessary variables.
The attitude angles and altitude were controlled to be maintained near their desired
values. Roll and Pitch control show good performance, where Yaw angle control is also
maintained near its desired value but it needs to be enhanced to reduce oscillation.
Altitude control was realized by means of PD control. Except, slow oscillations, the
control error is less than 10 cm.
Control inputs remained bounded and admissible except noises caused mainly by used
instrumentation.
At last we recited some encountered problems and some solutions.

63

General conclusion

General conclusion

General conclusion
The goal of this thesis is to design and realize a control platform for an UAV quadrotor;
in order to stabilize the system and create a prototype that permits implementation of different
identification and control algorithms.
In the design of the platform, we had built a full system composed of different sensors
which communicate in various protocols with the host controller. Communication between
devices is established trough serial protocols as UART, I2C, and SPI which worked properly.
Protocol configuration was done in the main code of dsPIC. Furthermore, the system design
guarantees the adequate power for each device. With selected communication rate, the sampling
time was kept below 05 ms.
At next, we developed a dynamical model that describes all the forces and moments
acting on the quadrotor. This model revealed nonlinearities with coupling effect. Furthermore,
we computed our model parameters which are used later in control design. We tuned the
parameters of the controllers in SIMULINK and implement them in the real system.
In experimental test, the communication between quadrotor and ground station allowed
us to visualize and follow quadrotor variable evolution. So, the developed graphical interface
simplifies diagnostic of control design scheme.
The implemented PID controllers to regulate the four variables (Roll, Pitch, Yaw and
Altitude), had shown an acceptable performance. In despite of nonlinearities, the controlled
variables were stabilized near the desired values.
The controlled angles response were better than altitude one particularly the Roll and
Pitch.
At the end of this work, we give the following advices for future work:
Using longer propellers to save the power consumption;
Identify the drag factor by experimentation;
Update the IMU code to work with the SPI bus; this will reduce the sample time,
implement a control loop for motors speed (cascade loop)
Solve the wireless communication problem.

64

Bibliography

[ And 04]

Andr Noth, Synthse et Implmentation dun Contrleur


pour Micro Hlicoptre 4 Rotors, EPFL 2004

[Bou 07]

Samir Bouabdallah, Design and control of quadrotors with


application to autonomous flying, EPFL 2007

[Chr datasheet]:

www.chrobotics.com

[Min09]:

Minh Duc HUA Contributions au contrle automatique


de vhicules ariens, University of Nice-Sophia Antipolis
2009

[Mrf datasheet]

ww1.microchip.com/downloads/en/DeviceDoc/39776C.pdf

[Tom 08]

Tommaso Bresciani, Modeling, Identification and Control


of a Quadrotor Helicopter, Lund University 2008

[ Seg 011 ]

SEGHOUR Sofiane, Implmentation de lois de commande


sur une architecture embarque base de C pour le vol
autonome dun quadri-rotor, EPM 2011

[Jor09]

Jorge Miguel Brito Domingues Quadrotor prototype ,


University of Tcnica de Lisboa 2009

[Vin 06]

Vincent de Perrot, Implementation of an obstacle


avoidance controller on the OS4 mini-helicopter, EPLF
2006

[Zig06]

http://ww1.microchip.com/downloads/en/AppNotes
/ZigBee2006%20Application%20Note%20AN1232A.pdf

Abstract :
The idea of this work was born in the context to produce an autonomous and intelligent
quadrotor UAV. So we have developed an embedded real time control system based on:
microcontroller, inertial measurement unit used as attitude sensor, a power stage containing
four speed controllers and two modules Zigbee for the wireless communication. We have
implemented PID controller to stabilize the quadrotor.

Rsum :
Lide de ce travail est ne dans le contexte de produire un quadrotor autonome et intelligent.
Pour ce faire, nous avons dvelopp un systme de commande en temps rel embarqu
contenant : une unit de commande que nous avons ralis base de microcontrleur, une
unit de mesure inertielle utilise comme capteur dattitude, un tage de puissance base de
quatre variateurs de vitesse et deux modules Zigbee pour la communication sans fils. Nous
avons implment une loi de commande PID pour la stabilisation.

:
. .
''Microcontrleur''

.'' PID'' '' Zigbee''

You might also like