unmanned aerial vehicle for surveillance

95
i UNMANNED AERIAL VEHICLE FOR CAMPUS SURVEILLANCE A PROJECT REPORT Submitted in partial fulfillment of the requirement for the award of the Degree of BACHELOR OF TECHNOLOGY in ELECTRONICS AND COMMUNICATION ENGINEERING By Vedant Kumar (11BEC1033) Kamlesh Kumar Verma (11BEC1017) Amol Sehgal (11BCE1091) Under the Guidance of Prof.V.Umamaheswari Prof. Nisha V M SCHOOL OF ELECTRONICS ENGINEERING VIT University CHENNAI. (TN) 600127 MAY 2015

Upload: vedant-srivastava

Post on 15-Jul-2015

603 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Unmanned Aerial Vehicle for Surveillance

i

UNMANNED AERIAL VEHICLE FOR CAMPUS

SURVEILLANCE

A PROJECT REPORT

Submitted in partial fulfillment of the

requirement for the award of the

Degree of

BACHELOR OF TECHNOLOGY

in

ELECTRONICS AND COMMUNICATION ENGINEERING

By

Vedant Kumar (11BEC1033)

Kamlesh Kumar Verma (11BEC1017)

Amol Sehgal (11BCE1091)

Under the Guidance of

Prof.V.Umamaheswari

Prof. Nisha V M

SCHOOL OF ELECTRONICS ENGINEERING

VIT University

CHENNAI. (TN) 600127

MAY 2015

Page 2: Unmanned Aerial Vehicle for Surveillance

i

UNMANNED AERIAL VEHICLE FOR CAMPUS

SURVEILLANCE

A PROJECT REPORT

Submitted in partial fulfillment of the

requirement for the award of the

Degree of

BACHELOR OF TECHNOLOGY

in

ELECTRONICS AND COMMUNICATION ENGINEERING

By

Vedant Kumar (11BEC1033)

Kamlesh Kumar Verma (11BEC1017)

Amol Sehgal (11BCE1091)

Under the Guidance of

Prof.V.Umamaheswari

Prof. Nisha V M

SCHOOL OF ELECTRONICS ENGINEERING

VIT University

CHENNAI. (TN) 600127

MAY 2015

Page 3: Unmanned Aerial Vehicle for Surveillance

i

CERTIFICATE

This is to certify that the Project work titled ―Unmanned Aerial Vehicle for Campus

Surveillance‖ that is being submitted by ―Vedant Kumar”, ―Kamlesh Kumar Verma‖ and

―Amol Sehgal” is in partial fulfillment of the requirements for the award of Bachelor of

Technology, is a record of bonafide work done under my guidance. The contents of this Project

work, in full or in parts, have neither been taken from any other source nor have been submitted

to any other Institute or University for award of any degree or diploma and the same is certified.

Guide

The thesis is satisfactory / unsatisfactory

I n t erna l Ex a mi n er E x t ern a l E x a mi n er

Approved by

Program Chair

Page 4: Unmanned Aerial Vehicle for Surveillance

ii

ACKNOWLEDGEMENTS

The team would like to take this opportunity to thank those who have helped make this project a

success. First, the team would like to thank their guide, Professor V.Umamaheswari, Professor.

Nisha V M who were influential in providing guidance and direction to the project. In addition,

the team would also like to thank Embedded System Lab staff for helping in components. The

team would also like to thank Professor Venkatasubramanian.K for his guidance and suggestion.

Nishant Kumar Singh is another individual who helped during the implantation and flight test

deserves gratitude. Lastly, the team would like to thank our families for their continued love and

support in our education and personal development.

Reg. No. 11BEC1033

11BEC1017

11BCE1091

Page 5: Unmanned Aerial Vehicle for Surveillance

iii

ABSTRACT

This project, aims at monitoring the real time environment with help of Unmanned Aerial

Vehicle (UAV), like surveillance of banks, highly crowded areas, aerial traffic and security

watch etc. This project is intended to design and fabricate low cost, light weight surveillance

UAV. A drone in structure of quad rotor that houses a camera with a wireless transmission

system was designed. This provides a live feed from camera to the ground station via telemetry.

It is also intended to carry a payload for future developments. GPS is used to predict the location

of UAV and inertial measurement unit (IMU) sensors will be used to predict proper acceleration

and detection of changes in rotational attributes roll, pitch and yaw. IMU consists of 3-axis

accelerometer, 3- axis gyroscope and 3-axis digital compass. PID control system is used to

maintain the stability of flight.

Page 6: Unmanned Aerial Vehicle for Surveillance

iv

TABLE OF CONTENTS

Chapter No. Description Page No.

LIST OF TABLES vii

LIST OF FIGURES viii

LIST OF ABBREVIATIONS xi

1 INTRODUCTION 1

1.1 Objective 1

1.2 Motivation 2

1.3 Background 4

1.3.1 Quadcopter Dynamics 4

2 PROJECT DESCRIPTION AND GOALS 6

3 TECHNICAL SPECIFICATIONS 7

3.1 Specification of Mechanical & Electrical module 8

3.1.1 Quad Rotor Frame 8

3.1.2 Electrical Motors 10

3.1.3 Propellers 12

3.1.4 Battery 13

3.1.5 Power Distribution System 16

3.2 Sensor Technology Module 17

3.2.1 IMU / 3 Axis Digital Compass/ Digital Pressure Sensor 17

3.2.2 On Board Camera 18

3.2.3 Telemetry 19

3.2.4 GPS (Global Positioning System) 20

3.3 Embedded System & other Electronics Module 21

3.3.1 Flight Controller Using Arduino UNO board 21

3.3.2 On-board Processor using Raspberry Pi 23

Page 7: Unmanned Aerial Vehicle for Surveillance

v

Chapter No. Description Page No.

3.3.3 ESC 24

3.3.4 Transceiver (RF Remote Control) 25

3.4 Software Module 26

3.4.1 Fritzing 26

3.4.2 Matlab/ Simulink 26

3.4.3 Multiwii 27

3.4.4 Arduino IDE 28

4 DESIGN APPROACH AND DETAILS 29

4.1 Design Approach 29

4.1.1 Design of quadcopter 30

4.1.2 Quadcopter Architecture 30

4.1.3 Mathematical model of quadcopter 33

4.1.4 Wireless Transmission System 35

4.1.5 PID Control theory and algorithm 36

4.2 Codes and Standards 38

4.2.1 Standard used in Interface of camera with board 38

4.2.2 Standard used in GPS Receiver 38

4.2.3 Standard Used to interface sensors to Arduino Board (I²C) 38

4.2.4 Standard Used in RF Transceiver (2.4 GHz FHSS technology) 38

4.2.5 Standard Used in wireless transmission: IEEE 802.15.4 38

4.3 Constraints, Alternatives and Tradeoffs 39

4.3.1 Constraints 39

4.3.1.1 Legal Constrains 39

4.3.1.2 Power shortage and flight duration 40

4.3.1.3 Improper weight distribution 40

4.3.2 Alternatives 41

Page 8: Unmanned Aerial Vehicle for Surveillance

vi

Chapter No. Description Page No.

4.3.3 Tradeoff 41

4.3.3.1 Development Cost 41

4.3.3.2 Weight 41

4.3.3.3 Power System 41

5 SCHEDULE, TASKS AND MILESTONES 42

6 PROJECT DEMONSTRATION 43

6.1 Complete module of quadcopter 43

6.2 Interfacing of MUP 6050 with Arduino 49

6.3 Interfacing of Bluetooth with Arduino 50

6.4 Interfacing of GPS with Arduino 51

6.5 Establishing communication beween 2 XBees radio modules 53

7 MARKETING AND COST ANALYSIS 58

7.1 Marketing Analysis 58

7.1.1.1 DJI 59

7.1.1.2 3D Robotics 59

7.1.1.3 FireBox 59

7.2 Cost Analysis 59

8 SUMMARY 61

REFERENCES 62

APPENDIX A 63

1. Binding of RF Transceiver 63

2. Calibration of ESC & Programming 63

3. First flight test for throttle 64

APPENDIX B 65

1. Code interfacing of MPU6050 with Arduino Board for 65

2. Code for interfacing of GPS with Arduino Board 76

Page 9: Unmanned Aerial Vehicle for Surveillance

vii

LIST OF TABLES

Table No. Description Page No.

3.1 Engineering Module 7

3.2 Comparison matrix of glass fiber 10

3.3 Battery Comparison 14

3.4 Battery Capacities and Flight Times 15

3.5 Component Power Needs 16

3.6 Specification of Arduino UNO board 22

3.7 Comparison matrix of different development board 23

4.1 Interface protocol and communication type 32

Page 10: Unmanned Aerial Vehicle for Surveillance

viii

LIST OF FIGURES

Figure No. Description Page No.

1.1 ARES 2

1.2 Global Hawk 2

1.3 Parrot AR Drone 3

1.4 Amazon‘s PrimeAir 3

1.5 SWARM MAV 3

1.6 Quadcopter rotation 5

3.1 Quadcopter Frame 9

3.2 Brushless DC Motor 11

3.3 Representation of CCW and CW rotation of motor 11

3.4 Propellers 13

3.5 2300 mah LiPo Battery 14

3.6 Flight times with various battery sizes 15

3.7 MPU 6050, HMC5883L, BMP180 17

3.8 Camera 19

3.9 XBee Pro S1 Module 20

3.10 Ardiuno board 22

3.11 Raspberry pi 24

3.12 EMAX 20A, ESC 24

3.13 Avionic 6 channel RF Transceiver 25

3.14 PID Tuner tool box 26

3.15 Multiwii GUI Platform 27

3.16 Quadcopter throttle‘s value of each motor 27

Page 11: Unmanned Aerial Vehicle for Surveillance

ix

Figure No. Description Page No.

4.1 Flow Diagram 29

4.2 Quadcopter Design 30

4.3 Quadcopter Architecture 31

4.4 The inertial and body frames of a quadcopter 33

4.5 PID Control Block Diagram 36

4.6 PID Control graph 37

4.7 Improper throttle 40

5.1 Schedule of the project 42

6.1 Complete setup of quadcopter 43

6.2 Integral part of the project mentioned individually 44

6.3 Electrical and mechanical components of quadcopter 45

6.4 Integral component of embedded system module 46

6.5 XBEE PRO as a base station telemetry 46

6.6 GUI from Mutiwii on Base Station 47

6.7 Top view of quadcopter 47

6.8 Side view of quadcopter 48

6.9 Quadcopter as in flight. 48

6.10 Interfacing of MPU6050 with Ardunio board 49

6.11 Data of accelerometer, gyro, temperature 50

6.12 Interfacing of Bluetooth module 51

6.13 NMEA Format 52

6.14 GPS Output 52

Page 12: Unmanned Aerial Vehicle for Surveillance

x

Figure No. Description Page No.

6.15 System Data Flow Diagram in a UART‐interfaced - 53

Environment

6.16 UART data packet 0x1F (decimal number ʺ31ʺ) as - 53

Transmitted through the RF

6.17 Complete setup of XBee module in X-CTU software, 55

you can see the MAC NO. and port of device.

6.18 Configuring two XBee to communicate 55

6.19 Communication in AT Mode- XBee 1 56

6.20 Communication in AT Mode- XBee2 56

6.21 Communication of XBee in API Mode 57

Page 13: Unmanned Aerial Vehicle for Surveillance

xi

LIST OF ABBREVIATIONS

API Application programming interface

APM ArduPilot Mega

BEC Battery Eliminator Circuit

DARPA Defense Advanced Research Projects Agency

DARO Defense Airborne Reconnaissance Office

ESC Electronic Speed Controller

FPS Frames per Second

GPS Global Positioning System

GUI Graphical User Interface

HD High Definition

I/O Input/Output

IR Infrared

Kv Revolutions per Minute / Volt

MSP MultiWii Serial Protocol

MW MultiWii

NMEA National Marine Electronics Association

PCB Printed Circuit Board

PID Proportional-Integral-Derivative

PPFS Project Proposal and Feasibility Study

PPS Picture Parameter Set

PWM Pulse Width Modulation

OS Operating System

RAM Random Access Memory

RC Radio Controlled

UAV Unmanned Aerial Vehicle

USB Universal Serial Bus

VDC Volts Direct Current

Page 14: Unmanned Aerial Vehicle for Surveillance

1

CHAPTER 1

INTRODUCTION

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

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

Furthermore, due to the quadcopter‘s cyclic design, it is easier to construct and maintain. As the

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

researchers have started designing and implementing quadcopter for different uses. One of the

main use is surveillance. Surveillance is critical for security operations. In the past, helicopters

were used for these types of missions. Recently, Unmanned Aerial Vehicles (UAVs) are (have

grown in popularity and are an excellent resource that can be) utilized for surveillance missions.

The unmanned aerial vehicles are helpful to observe, analyze and get information and transfer it

to base station. UAVs are able to perform missions with high level of complexity and at the same

time, they require less human operator involvement due to their autonomous behavior. The

additional advantage is, they are agile in nature and can have degree of freedom up to 10.

The goal of this project is to build an UAV in in structure of x shaped quad rotor that

houses a camera with a wireless transmission system. This unmanned aerial vehicle will be used

for campus surveillance. Aerial surveillance will be done by monitoring the real time

environment with help of UAV. Surveillance of banks, highly crowded areas, aerial traffic and

security watch can be easily done with the help of this UAV.

1.1 Objective

The objective of this project is to build an UAV in structure of quad rotor which can

maintain safe and stable flight and houses a camera with a wireless transmission system to

provide surveillance of real time environment. These are the following objective

a) Design and implementation of UAV in structure of ‗X‘ shaped quadcopter.

b) Development of flight controller by proper interfacing of sensor and tuning of PID

control values.

Page 15: Unmanned Aerial Vehicle for Surveillance

2

c) Apart from the stable flight, a camera is interfaced with quadcopter‘s processor to record

the aerial view for surveillance.

d) A wireless transmission system developed to telemeter the video and GPS data to ground

station.

1.2 Motivation

From observation of prior art in UAV, one can say that future is full of unlimited

potential and possibilities of UAV. Now days, UAVs are everywhere. It is not only used for civil

and commercial but also in scientific research as well. Fig. 1.2 shows the UAV Global Hawk

High-Altitude Endurance Unmanned Aerial Vehicle from Defense Advanced Research Projects

Agency (DARPA) and Defense Airborne Reconnaissance Office (DARO) is used for NASA's

airborne Hurricane and Severe Storm Sentinel or HS3 mission. NASA is redoubling its efforts to

probe the inner workings of hurricanes and tropical storms with two unmanned Global Hawk

aircraft flying over storms and two new space-based missions. UAVs are also considered as a

potential unmanned candidate for future mars mission over rover and landers. A mission named

ARES (Aerial Regional Scale Survey of Mars) was under evaluated mission, developed by

Langley Research Center to build a powered aircraft that would fly on Mars as shown in Fig. 1.1.

Fig. 1.1 ARES Fig. 1.2 Global Hawk

Page 16: Unmanned Aerial Vehicle for Surveillance

3

Although some UAVs like General Atomics MQ-1 Predator, General Atomics MQ-9 Reaper

were also considered as Human killing machine, yet there are several UAVs used for benefit and

improvement of society. For example, S.W.A.R.M. (Search with Aerial RC Multi-Rotor) is a

worldwide volunteer search and rescue network of over 1,100 SAR Drone Pilots dedicated to

searching for missing persons. Not only in the serious situation, but for entertainment UAVs are

used. Commercial available Parrot AR Drone [14] and DJI Phantom are best quadcopters for

aerial photography and videos. A drone from DJI Global have recently used in Golden Globe

Event.

Fig 1.3 Parrot AR Drone Fig 1.4 Amazon’s PrimeAir

Several attempts were also made in logistic and transport like delivery of Amazon‘s product by

Amazon‘s PrimeAir as shown in Fig 1.4 or pizza delivery in Mumbai. On the other hand, small

drone also known as micro and nano-copter are small, lightweight, spontaneous and very agile in

nature gives them advantage in flight. According to Vijay Kumar, GRASP Lab, University of

Pennsylvania micro drones are capable of 1850◦ /sec roll and pitch, performs a 360◦ flip in 0.4

seconds and exhibits a lateral step response of 1 body length in 1 second [1].

Fig. 1.5 SWARM MAV

Page 17: Unmanned Aerial Vehicle for Surveillance

4

1.3 Background

Quadcopter, also known as quadrotor, is a helicopter with four rotors. The rotors are

directed upwards and they are placed in a square formation with equal distance from the center

of mass of the quadcopter. The quadcopter is controlled by adjusting the angular velocities of the

rotors which are spun by electric motors. Quadcopter is a typical design for small UAV because

of the simple structure. Quadcopter are used in surveillance, search and rescue, construction

inspections and several other applications.

Quadcopter has received considerable attention from researchers, as the complex

phenomena of the quadcopter have generated several areas of interest. The basic dynamical

model of the quadcopter is the starting point for all of the studies but more complex aerodynamic

properties has been introduced as well. Different control methods has been researched, including

PID controllers, back stepping control, nonlinear H1 control, LQR controllers, and nonlinear

controllers with nested saturations. Control methods require accurate information from the

position and attitude measurements performed with a gyroscope, an accelerometer, and other

measuring devices, such as GPS, and sonar and laser sensors. PID controllers have been chosen

for this project.

1.3.1 Quadcopter Dynamics

Each rotor produces both a thrust and torque about its centre of rotation, as well as a drag

force opposite to the vehicle's direction of flight. Quad-copter achieves lift, yaw, roll and pitch

simply via a manipulation of the thrusts of four motors relative to each other as shown in Fig.1.6.

This way, fixed rotor blades can be made to manoeuvre the quad rotor vehicle in all dimensions.

Similar to other flying objects, a quadrotor has a group of forces and torques acting on it while it

flies. There are four main forces acting on the drone: drag, lift, weight, and thrust. In order for

the drone to fly, these different forces need to be balanced. This can be seen by utilizing

Newton‘s Second Law.

Page 18: Unmanned Aerial Vehicle for Surveillance

5

Fig. 1.6 Quadcopter rotation

Applying Newton‘s Second Law

𝐹 = 𝑚𝑎 (1)

For constant velocity acceleration is zero (a=0). Thus the sum of the forces is equal to zero. So

for steady, constant velocity flight, completing a force balance in the horizontal direction on the

diagram obtains:

𝐹𝑡𝑕𝑟𝑢𝑠𝑡 − 𝐹𝑑𝑟𝑎𝑔 = 0 (2)

𝐹𝑡𝑕𝑟𝑢𝑠𝑡 = 𝐹𝑑𝑟𝑎𝑔 (3)

Since this is for a constant velocity, the aircraft is either moving or at rest. An analysis in the

vertical direction will produce similar results.

𝐹𝑙𝑖𝑓𝑡 − 𝐹𝑤𝑒𝑖𝑔𝑕𝑡 = 0 (4)

𝐹𝑙𝑖𝑓𝑡 = 𝐹𝑤𝑒𝑖𝑔𝑕𝑡 (5)

Page 19: Unmanned Aerial Vehicle for Surveillance

6

CHAPTER 2

PROJECT DESCRIPTION AND GOALS

The goal of this project is to build an UAV in structure of quad rotor that houses a camera

with a wireless transmission system. This unmanned aerial vehicle will be used for campus

surveillance.

Quad rotor must hover in place, take off and land vertically, maintain stable flight and perform

flight attributes (like roll, pitch and yaw). These attributes are essential for surveillance. To do

these above mentioned flight traits, PID control system was utilized. The tuning of the PID

control system is very crucial because three different PID control systems for pitch, roll, and yaw

had to be tuned carefully for proper stabilization. Inertial measurement unit (IMU) sensors will

be used to collect data of 3-axis accelerometer, 3- axis gyroscope which can be exploited by PID

control algorithm to maintain the auto stable flight.

Wireless transmission system provides a live feed from camera to the ground station. Wireless

transmission system will help monitoring the real time environment like surveillance of banks,

highly crowded areas, aerial traffic and Security watch etc. A GPS module will be used to

determine the current position of UAV. Telemetry will be used as a wireless transmission system

(XBee Radio Modules works on RF 2.4 GHz frequency under the zigbee protocol, IEEE

802.15.4). Data from camera and GPS will be wirelessly transferred from uav to base station via

telemetry. Flight of quad rotor will be also controlled wirelessly through RF Transceiver working

at 2.4 GHz. Finally, this project intended to design and fabricate a low cost, light weight

surveillance UAV. The project has been divided into b following broad areas to achieve the

targeted functionality:

Maintain the stable flight and perform flight attributes (like roll, pitch and yaw).

Develop a wireless transmission system provides a live feed from camera to the ground

station.

Page 20: Unmanned Aerial Vehicle for Surveillance

7

CHAPTER 3

TECHNICAL SPECIFICATIONS

While the overall goals, strategies and objectives have been stated, the specifications of

the components will be determined as they are identified for their applicability in the project. The

technical specifications are divided in the following in engineering module on the basis of

application and engineering involved. The modules are represented in Table 3.1.

Table 3.1 Engineering Module

Mechanical & Electrical Module

Quad rotor Frame

Landing Stand

4 x Electrical Motor

4 x Propellers

2300 mAh LiPo Battery & charger

Power Distribution System

Sensor Technology Module

IMU / 3 Axis Digital Compass/ Digital

Pressure Sensor

On board camera

GPS

Telemetry

Embedded System & other Electronics

Module

Flight Controller Using Arduino UNO

board

On-board Processor using Raspberry Pi

ESC (Electronic Speed Control)

Transceiver (RF Remote Control)

Software Module

CadSoft EAGLE, Fritzing

Matlab/Simulink (Drake Tool Box)

Arduino IDE, Linux, Opencv

Python

Page 21: Unmanned Aerial Vehicle for Surveillance

8

3.1 Specification of Mechanical & Electrical module

These are the following main mechanical and electrical module whose specification are

described.

a) Quad rotor Frame

b) Electrical Motor

c) Propellers

d) LiPo Battery & Charger

e) Power Distribution Board

3.1.1 Quad Rotor Frame:

Quad copter is a novel appearance, superior performance VTOL aircraft, which has a simple

structure, flexible operation, high load capacity and other characteristics, have important civilian

and military value. According to our design, we have select the necessary materials and

structures that meet the strength and stiffness the system needs. They are designed to be strong

and lightweight.

To decide the appropriate frame for the copter three main factors, i.e. weight, size and materials

have taken in consideration. The frame should be flexible enough to minimize the vibrations

from the motors. Our frame is consisting of these following fragments:

1) The center plate where the electronics are mounted.

2) Four arms mounted to the center plate.

3) Four motor brackets connecting the motors to the end of the arms.

Strong, light and sensible configuration including suspension system that allows for a clean and

easy build is highly recommended. Parts and accessories that are 100% compatible and

interchangeable are always preferred.

Frames are usually made of:

a) Carbon Fiber: Carbon fiber is the most rigid and vibration absorbent but it is the most

expensive too.

b) Aluminum: Hollow aluminum square rails are the most popular for the arms due to its

light weight, rigidness and affordability. However aluminum can suffer from motor

Page 22: Unmanned Aerial Vehicle for Surveillance

9

vibrations, as the damping effect is not as good as carbon fiber. In cases of severe

vibration problem, it could mess up sensor readings.

c) Wood: Wood/ Plywood could be used for the arms as they are better at absorbing the

vibrations than aluminum and carbon fiber. Unfortunately the wood is not a very rigid

material and can break easily if the quad copter crashes. For the center plate, plywood is

most commonly used because of its light weight, easy to work factor and good vibration

absorbing features. As for arm length, ―motor-to-motor distance‖ is sometimes used,

meaning the distance between the 12 centers of one motor to that of another motor of the

same arm. The motor to motor distance usually depends on the diameter of the propellers

in order to have enough space between the propellers.

d) Glass Fiber: Fig. 3.1 shows the Quadcopter Frame is made of glass fiber. The glass fiber

is the most flexible and vibration absorbent very less expensive compared to carbon fiber.

An individual structural glass fiber is both stiff and strong in tension and compression—

that is, along its axis. The main frame is glass fiber while the arms are constructed from

ultra-durable polyamide nylon [2].

Fig. 3.1 Quadcopter Frame

Page 23: Unmanned Aerial Vehicle for Surveillance

10

Table 3.2 Comparison matrix of glass fiber

Fiber type Tensile strength

(MPa)

Compressive

strength

(MPa)

Density

(g/cm3)

Softening T

(°C)

Price

($/kg)

E-glass 3445 1080 2.58 846 2

S-2 glass 4890 1600 2.46 1056 20

3.1.2 Electrical Motors

Four motors drive the propellers and provide thrust for the quad copter.

Requirements

The motors shall be powerful enough to spin the propellers, lift the quad copter, and

move the quad copter at the required speed of 50 km/hr for the production model, and 15

km/hr for prototype

Alternatives

On the basis of design, the motors were 935 Kv brushless motors with a 3.17 mm

diameter shaft. The weight of each motor was 55 grams. The max current draw is 17A.

Decision Criteria

The motors chosen for the final design depended on weight, power (Kv), current

draw, and cost. The motors must have a maximum current draw lower than the ESC output

rating. The shaft diameter is another factor as a thicker shaft makes for a more durable

motor.

Implementation

Motors are mounted to the end of the quadcopter‘s four arms as shown in

Figure.3.1.2.1 They are each connected to an ESC with three wires. The order of wiring

simply affects the direction that the motor turns. As such, two motors (opposite each other)

are connected to spin counter-clockwise and two connected to spin clockwise. See the

Page 24: Unmanned Aerial Vehicle for Surveillance

11

quadcopter block diagram in Figure 3.2 and accompanying Table for more information.

Figure 3.3 below shows the direction of the motors on prototype.

Fig.3.2 Brushless DC Motor

Fig.3.3 Representation of CCW and CW rotation of motor

Page 25: Unmanned Aerial Vehicle for Surveillance

12

The motors were tested to lift the quadcopter and its components successfully.

Above that, the motors were able to lift an additional 0.149 kg. The proposed design was

able to fly over 15 km/hour meeting the prototype requirement, but the maximum speed was

not tested out of concern for a crash that could occur during this test.

3.1.3 Propellers

Requirements

The propellers shall be large enough to provide adequate lift for the quadcopter, but

small enough to fit on the chosen frame. Propellers are also specific to the direction of

rotation, making it necessary to match propellers with motors.

Alternatives

Carbon fiber or plastic propellers both fit project needs. There are propellers that

range in length from 4 to 22 inches and with pitches ranging from 2 to 12 degrees.

Decision Criteria

The choice between plastic or carbon fiber propellers depended on multiple factors.

The blades needed to be robust enough to handle moderate collisions, balanced enough to

limit vibrations, and have appropriate length and pitch values. Motors driving the propellers

are rated for specific propeller sizes, so this was taken into effect as well. Larger propellers

(and those with a higher pitch) can provide more lift because they move more air, but they

also require more power. Cost was another factor, as multiple crashes were anticipated with

a new quad copter design.

Decision

The team chooses to continue using plastic propellers. Carbon fiber propellers are

more expensive and much stronger, making them even more dangerous if they were to

contact an object or a person. Due to the nature of the project with many new components of

hardware and software coming together, the team anticipated multiple crashes. Keeping this

in mind, the team chose plastic propellers to help stay under budget while providing a safer

product for the user. The team specifically selected APC propellers for their build quality

which is shown in Fig. 3.4. The length chosen 8 inch with a pitch of 4.5 degrees as this

provided the best balance of lift without sacrificing stability.

Page 26: Unmanned Aerial Vehicle for Surveillance

13

Propellers were not tested in a specific way other than during test flights of the

quadcopter. The team observed that propellers of 10 inch and with a pitch equal to 4.5

degrees made the quadcopter too sensitive to user input. However, the larger the propeller,

the more lift the quadcopter experienced. As such, the team settled on 8 inch, 4.5 degree

propellers because they have good lift while leaving the quadcopter stable.

Fig. 3.4 Propellers

3.1.4 Battery

The battery provides stable voltage, high current power to all of the components on

the quadcopter.

Requirements

The battery powering the quadcopter shall provide power for all on-board sensors

and computers, as well as the ESCs and motors. The battery shall provide power for the

equipment for a minimum of approximate six minutes without overheating. The battery

shall also have protective circuitry to prevent overcharging and over-discharging which can

cause batteries to catch fire and explode.

Page 27: Unmanned Aerial Vehicle for Surveillance

14

Fig.3.5 2300 mah LiPo Battery

Decision Criteria

Cost was a portion of the decision for the battery chosen, but voltage output,

discharge rate, capacity, and weight were major criteria as well. The battery needed to

operate at a voltage of 11.1 V and have a discharge rate of at least 30 C. Batteries with

larger capacities weigh more, creating a need for more power, and eventually diminishing

the advantages of having a high capacity battery. Table 3.3 shows the capacity, weight, cost,

and charge time of several batteries that were considered. All of the listed batteries had the

required voltage and discharge rates needed.

Table3.3 Battery Comparison

Capacity

(mAh) Cost Weight (g)

Charge Time

(min)

2450 Rs. 1176 218 29.4

3000 Rs.1307 269 36.0

3600 Rs.1482 321 43.2

5000 Rs.2400 414 60.0

11,975 Rs.5400 1050 143.7

Page 28: Unmanned Aerial Vehicle for Surveillance

15

Prototype Decision

The prototype decision was to use originally use a 2300 mAh battery as shown in

Fig. 3.5 which was available on website (RC Hyderabad) and meet the design specification

of the project. The team was able to reach the prototype flight time requirement of six

minutes, so this battery was the final team decision.

Fig. 3.6 Flight Times with various Battery Sizes

Table 3.4 Battery Capacities and Flight Times

Capacity (mAh) Flight Time (min)

2450 6.5

3000 7.55

3300 8.78

5000 10.50

11,975 30.00

Page 29: Unmanned Aerial Vehicle for Surveillance

16

3.1.5 Power Distribution System

The multiple electrical components on the quad copter are powered by a power

distribution system that is connected to the battery.

Requirements

The power distribution system shall provide adequate and stable current and voltage

that is required for all components on the quad copter. Table 3.5 shows the specific

requirements of power nodes.

Table 3.5 Component Power Needs

Flight Controller RC Receiver Raspberry

Pi ESCs

Voltage (V) 4.5-5.5 4.5-6.5 4.75 - 5.25 12

Max

Current (A)

Not Available Not Available 0.7 25

Alternatives

There were two main alternatives for this section: a custom printed circuit board or

a power distribution board.

Decision Criteria

The decision was based on cost, size, weight, and ability to scale for more

components. With the expandable nature of the project, the power distribution system

needed to be able to handle extra components necessary for the project.

After replacing the malfunctioning UBECs with a Simon EMAX ESC, the power

distribution system was able to power all quad copter components successfully.

3.2 Sensor Technology Module

These are the following main sensor technology module whose specification are described -

IMU / 3 Axis Digital Compass/ Digital Pressure Sensor

On board camera

GPS

Telemetry

Page 30: Unmanned Aerial Vehicle for Surveillance

17

3.2.1 IMU / 3 Axis Digital Compass/ Digital Pressure Sensor

The sensors MPU 6050, HMC5883L, BMP180 were used to for data acquisition and

make the flight stable using PID Control system. Serial communication is used to

interface the all these sensors to Arduino UNO board using the jumper wires.

Fig. 3.7 MPU 6050, HMC5883L, BMP180

a) MPU 6050:

MPU-6050 sensor contains a MEMS accelerometer and a MEMS gyro in a single chip. It

is very accurate, as it contains 16-bits analog to digital conversion hardware for each

channel. Therefor it captures the x, y, and z channel at the same time. The sensor uses

the I2C-bus to interface with the Arduino.

b) HMC5883L:

HMC5883L, a 3-axis digital magnetometer designed for low-field magnetic sensing. The

sensor has a full-scale range of ±8 Guass and a resolution of up to 5 milli-Gauss.

Supplied voltage should be between 2.16 and 3.6VDC. Communication with the

HMC5883L is simple and all done through an I2C interface. All registers and operating

modes are well described in the datasheet below. Comes in a low-height, LCC surface

mount package. For a breakout board, see below.

Page 31: Unmanned Aerial Vehicle for Surveillance

18

c) BMP180:

This precision sensor from Bosch is the best low-cost sensing solution for measuring

barometric pressure and temperature. Because pressure changes with altitude you can

also use it as an altimeter! The sensor is soldered onto a PCB with a 3.3V regulator, I2C

level shifter and pull-up resistors on the I2C pins. This board is 5V compliant - a 3.3V

regulator and an i2c level shifter circuit is included so you can use this sensor safely with

5V logic and power. Arduino, simply connect the VIN pin to the 5V voltage pin, GND to

ground, SCL to I2C Clock (Analog 5) and SDA to I2C Data (Analog 4).

3.2.2 On Board Camera

The camera which provides surveillance capability for the Quadcopter is a Linksprite JPEG

color camera (Fig 3.8) that employs a transistor-transistor-level (TTL) logic signal. The

camera has the ability to display a series of images through a serial communication output as

well as 30 frames per second (fps) National Television System Committee (NTSC)

formatted output. All of The sensors and electronic hardware used in this project

communicate over a TTL serial connection, including the wireless telemetry module we are

using. The ability to integrate the video over the serial connection seamlessly was the main

reason that we chose this camera. Other reasons included the fact that it operated from a 5 V

power supply, just like the rest of our sensors, and that the power consumption was low at

less than 100 mA.

The camera has the ability to capture VGA, QVGA, and QQVGA picture formats as well as

allow the image to be compressed with various degrees of compression. This allowed us to

shrink the image file size to under 30 kb per image frame which is small enough to allow us

to reach a frame rate of about 2.5 fps while transmitting at 115200 bps. This frame rate

should be sufficient to guide navigation or to perform surveillance. The camera module is

shown in Fig. 3.8. The camera is controlled by the Arduino processor board. A series of hex

commands are sent to the camera from the Arduino to initialize and then start a series of

image collects. The images are sent from the camera serially in hex format to the Arduino

and then transmitted via the XBee-PRO telemetry modules to the ground-based computer for

processing.

Page 32: Unmanned Aerial Vehicle for Surveillance

19

Fig. 3.8 Camera

3.2.3 Telemetry

A telemetry module was needed in order to telemeter the GPS to the ground station. It was also

needed to communicate payload camera images and video data back to the ground control

computer. The module chosen for the project was a 2.4 GHz, XBee-PRO S1 Module as shown in

Fig. 3.9. The XBee-PRO modules are capable of deploying point-to-point, peer-to-peer and

point-to-multipoint networks. Designed for maximum range, the XBee-PRO is ideal for solutions

where RF penetration and absolute transmission distance are paramount to the application. The

XBee-PRO communicates with the computer serially, through a virtual com port at a baud rate of

57600.

XBee-PRO S1 Modules are designed to operate within the ZigBee protocol and support

the unique needs of low-cost, low-power wireless sensor networks. The modules require minimal

power and provide reliable delivery of data between remote devices. This is the Pro (higher-

power) version of the popular XBee. This module is series (IEEE 802.15.4 protocol) 60mW

wireless module, good for point-to-point, multipoint and convertible to a mesh network point.

These XBees are much more powerful than the plain XBee modules, great for when you

need more range. Series 1 modules is that they are so easy to get set up. If two are in range, they

will automatically form a serial link with no configuration, so you can send TTL serial data back

and forth. Baudrate can also be configured, as well as sleep modes, power modes and tons more

Page 33: Unmanned Aerial Vehicle for Surveillance

20

stuff using the Digi XBee tool. The pins on an XBee are 2mm spacing, not 0.1" so they will not

fit into a breadboard.

Key Feature

Indoor/Urban: up to 300‘ (90 m), 200' (60 m) for International variant

Outdoor line-of-sight: up to 1 mile (1600 m), 2500' (750 m) for International variant

Transmit Power: 63mW (18dBm), 10mW (10dBm) for International variant

Receiver Sensitivity: -100 dBm

RF Data Rate: 250,000 bps

Advanced Networking & Security

Retries and Acknowledgements

DSSS (Direct Sequence Spread Spectrum)

Each direct sequence channels has over 65,000 unique network addresses available

Source/Destination Addressing

Unicast & Broadcast Communications

Point-to-point, point-to-multipoint and peer-to-peer topologies supported Low.

Fig. 3.9 XBee Pro S1 Module

3.2.4 Global Positioning System (GPS)

A GPS device is a helpful and commonly used sensor for a UAV. As most people

know, a GPS device can be used to help determine its own altitude, longitude, and latitude

Page 34: Unmanned Aerial Vehicle for Surveillance

21

positions. A GPS device typically receives a signal from a satellite to calculate these

positions. Depending on the GPS device chosen, some devices give the internal clock and

standard deviations of its positions. The GPS section of code interfaces directly with the

GPS module. The first major choice was where to interface with the GPS module. It could

either be connected to the flight controller, or connected directly onto the RASPBERRY PI.

Initially, data is received in NMEA format. The NMEA 0183 standard defines an electrical

interface and data protocol for communications between marine instrumentation. NMEA

0183 devices are designated as either talkers or listeners (with some devices being both),

employing an asynchronous serial interface with the following parameter:

Baud rate: 4800

Number of data bits: 8 (bit 7 is 0)

Stop bits: 1 (or more)

Parity: none Handshake: none

3.3 Embedded System & other Electronics Module

These are the following main ‗Embedded System & other Electronics Module‘ whose

specification are described -

Flight Controller Using Arduino UNO board

On-board Processor using Raspberry Pi

ESC (Electronic Speed Control)

Transceiver (RF Remote Control)

3.3.1 Flight Controller Using Arduino UNO board

Arduino UNO board has chosen as a flight control for on board processing and PID as shown in

Fig. 3.10. The Arduino is the computer controller which does all the calculations for stability and

control. Both Arduino UNO and Arduino Mega are capable of flying a Quad Copter. All the

features currently available are supported on both boards, but the future development will focus

on the UNO as it has more analog inputs to support various other sensors such as barometer,

magnetometer, GPS, and possibly more. A USB A-to-B cable is necessary for uploading the

Page 35: Unmanned Aerial Vehicle for Surveillance

22

code to the Arduino from the PC. The gyros are for sensing rotational motion around the three

axes (x y z) and the accelerometers are for sensing linear acceleration about those same axes.

Fig. 3.10 Ardiuno board

Table 3.6 shows the Arduino UNO board with technical specifications.

Table 3.6 Specification of Arduino UNO board

Microcontroller ATmega328

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB (ATmega328)

SRAM 2 KB (ATmega328)

EEPROM 1 KB (ATmega328)

Clock Speed 16 MHz

Length 68.6 mm

Width 53.4 mm

Weight 25 g

Page 36: Unmanned Aerial Vehicle for Surveillance

23

3.3.2 On-board Processor using Raspberry Pi

The team considered the Raspberry Pi Model B, Arduino Uno, Arduino Due,

Arduino Mega, and Beagle Bone Black as viable options for the RC interface module

microcontroller. For a final product, a board with the exact capabilities needed would likely

be custom made to minimize cost. Table 3.7 shows a list of the boards the team looked at

and their hardware specifications (Note: this board is required to be compatible with an

Adafruit GPS module; however, all alternatives met this requirement.)

Table 3.7 comparison matrix of different development board

Raspberry Pi B

(Rs.) Arduino Uno

(Rs.) Arduino

Due(Rs.) Arduino Mega

(Rs.) BeagleBone

Black(Rs.)

Price 2400 1400 2400 2400 2600

I/O (Pins) 20 20 66 70 92

Adafruit

Compatible Yes Yes Yes Yes Yes

Pin Output 50 mA at 3.3 V

or 5 V

50 mA at

3.3 V

800 mA at

3.3 V or 5 V 50 mA at 3.3 V 3.3 V, 5 V

USB Type 2 ports A B Micro B B A

Price was a factor, as well as the number and capabilities of Input/output pins to

ensure that all communication could be received from the laptop and sent to the remote

control transmitter. This includes serial ports and pulse width modulation (PWM) analog

outputs. Although not a requirement, it would be ideal if developers of the flight controller

and the RC interface module could use the same communication cable (USB micro Type B)

for fast interchangeability with computers used for programming. The power consumption

was not considered for this section, as all boards were reasonably small (less than 5 watts).

The chosen Raspberry pi board is shown in Fig. 3.11.

Page 37: Unmanned Aerial Vehicle for Surveillance

24

Fig. 3.11 Raspberry pi

3.3.3 Electronic Speed Controller (ESC)

An electronic speed control or ESC is an electronic circuit with the purpose to vary

an electric motor's speed, its direction and possibly also to act as a dynamic brake. ESCs are

often used on electrically powered radio controlled models, with the variety most often used

for brushless motors essentially providing an electronically generated three-phase electric

power low voltage source of energy for the motor.

Fig. 3.12 EMAX 20A, ESC

Page 38: Unmanned Aerial Vehicle for Surveillance

25

ESC supplies power from battery but not constant, it varies according to input signal.

ESC also has BEC (Battery Eliminated Circuit). BEC is nothing but 5V output from ESC that

can power up receiver, servo motor (for camera gimbal) and FC. But how to select ESC for our

multirotor? Well it's really simple. One only need to keep in mind that Ampere rating of ESC

should be higher than max amp rating of motor. For example the motor we selected draws

maximum 15Amp so your ESC rating should be higher than 15amp. Say 18-20Amp. One can

select ESC between ranges of 18A to 22A. 20 Amps was selected as our designed requirement.

3.3.4 Transceiver (RF Remote Control)

A transceiver is a device comprising both a transmitter and a receiver which are

combined and share common circuitry or a single housing. The RF Transceiver uses RF modules

for high speed data transmission. The transceiver used for this project is 2.4 GHz RF transceiver

and works on FHSS technology provides a highly secure connection, optimum responsiveness,

increased range and the ability to fly more safely. It is six channel transceiver as shown in

Fig. 3.13.

Fig. 3.13 Avionic 6 channel RF Transceiver

Page 39: Unmanned Aerial Vehicle for Surveillance

26

3.4 Software Module

Fritzing

Matlab/Simulink

Arduino IDE/ Multiwii/ X-CTU

Linux/ Python

3.4.1 Fritzing

Fritzing is an open-source hardware initiative that makes electronics accessible as a

creative material for anyone. Software community offer services in the spirit of Processing

and Arduino, fostering a creative ecosystem that allows users to document their

prototypes, share them with others, teach electronics in a classroom, and layout and

manufacture professional pcbs. This software module is used to design the circuit diagram and

interfacing of sensor with Arduino board [7].

3.4.2 Matlab/ Simulink

PID Tuner tool box is used to tune the values of PID as shown in Fig. 3.14.

Fig. 3.14 PID Tuner tool box for tuning the value of PID

Page 40: Unmanned Aerial Vehicle for Surveillance

27

3.4.3 MultiWii

Fig. 3.15 shows the MultiWii which is a general purpose software to control a multirotor RC

model. It can now use various sensors but was initially developed to support Nintendo Wii

console gyroscopes and accelerometers. Multiwii software module is used here as flight

simulator and to get the visualization and plotting of flight data. It also used to calibrate the ESC,

tuning the flight, sensor graph, video capture etc.

Fig. 3.15 Multiwii GUI Platform

Fig.3.16 Quadcopter throttle’s value of each motor

Page 41: Unmanned Aerial Vehicle for Surveillance

28

3.4.4 Arduino IDE

Arduino IDE is used for processing and controlling the on board data. PID controller is used to

perform the flight calibration on data of Gyro and accelerometer. The Arduino Development

environment contains a text editor for writing code, a message area, a text console, a toolbar with

buttons for common function, and a series of menus. It connects to the Arduino hardware to

upload program and communicate with them.

Page 42: Unmanned Aerial Vehicle for Surveillance

29

CHAPTER 4

DESIGN APPROACH AND DETAILS

4.1 Design Approach

Fig. 4.1 demonstrates the design approach which has been considered for the project. The

first and most important factor is the identification of problem which is identified as the need of

aerial surveillance. The next step is research and background which have been discussed in

section 1.3. The best solution is identified as unmanned aerial vehicle in form X shaped

quadcopter structure. After that design of the prototype have been done on several stage which

involved static thrust calculation, total weight, flight time and power consumption calculation.

Next step are also implemented and evaluated.

Fig. 4.1 Flow Diagram

Page 43: Unmanned Aerial Vehicle for Surveillance

30

4.1.1 Design of quadcopter

The design of UAV will be in structure of quadcopter as shown Fig. 4.2. The shape of

quadcopter is decide to be X shaped due to several advantage in surveillance like high degree of

stability and lifting power, best view for aerial photography. This design eliminates the need for

a yaw stabilizing rotor commonly used on helicopters.

Fig. 4.2 Quadcopter Design

4.1.2 Quadcopter Architecture

A block diagram of the quadcopter architecture is shown in Figure 4.2. Power is distributed via

power distribution board among the flight controller, sensors as well as the four ESCs. The four

ESCs drive each of the four motors. The other main component of the quadcopter subsystem is

camera and the wireless communication system. A GPS module receives data from global

orbiting satellites, interacts with the Arduino through its input/output (I/O) pins, and then the

telemetry information is sent over RF communication along with the video stream. The

communication interface and corresponding protocol of various subsystem of UAV have

mentioned in the following table.

Page 44: Unmanned Aerial Vehicle for Surveillance

31

Fig. 4.3 Quadcopter Architecture

Page 45: Unmanned Aerial Vehicle for Surveillance

32

Table 4.1 Interface protocol and communication type

Sl.No. Communication Type Protocol Description

1. ESC Control PWM The flight controller sends a pulse width modulated

signal between one millisecond and two milliseconds

to the ESC for each motor to control the movements of

the quadcopter.31

2.

Serial COM

USB 2.0,

MSP

The RASPBERRY PI and the flight controller

communicate with each other over a serial connection

in order to send telemetry data from the flight

controller to the RASPBERRY PI.

3. Motor Controls Three-

Phase

Power

The ESCs send a three phase trapezoidal wave with

varying frequencies to their respective motors to drive

them.32 The voltage ranges from 1.15 V to 1.45 V.31

4. Video Stream H.264

Video

The camera sends a raw video feed to the

RASPBERRY PI for processing and preparation to be

sent to the base station.

5. GPS Data

NEMA

GPS data is sent to the RASPBERRY PI via its digital

I/O pins. The voltage supplied to the GPS module is 5

V with a maximum current draw of about 48 mA

resulting in power consumption of 0.24 W. Transmit

and receive pins send the NMEA (National Marine

Electronics Association) 0183 data at a 115,200 baud

rate.35

6. Arduino Power DC The power distribution system on the quadcopter

provides a 5 VDC (volts direct current) power supply

to the flight controller.

8. Sensor Interface I2C

Page 46: Unmanned Aerial Vehicle for Surveillance

33

4.1.3 Mathematical model of quadcopter

The quadcopter structure is presented in Fig. 4.4 including the corresponding angular velocities,

torques and forces created by the four rotors.

Fig. 4.4 the inertial and body frames of a quadcopter

The absolute linear position of the quadcopter is defined in the inertial frame x, y and z axes with

ξ. The attitude, i.e. the angular position, is defined in the inertial frame with three Euler angles η.

Pitch angle θ determines the rotation of the quadcopter around the y-axis. Roll angle φ

determines the rotation around the x-axis and yaw angle ψ around the z-axis. Vector q contains

the linear and angular position vectors

, q . (1)

The origin of the body frame is in the center of mass of the quadcopter. In the body frame, the

linear velocities are determined by VB and the angular velocities by v

Page 47: Unmanned Aerial Vehicle for Surveillance

34

(2)

The rotation matrix from the body frame to the inertial frame is

in which Sx = sin(x) and Cx = cos(x). The rotation matrix R is orthogonal thus R−1 = RT which

is the rotation matrix from the inertial frame to the body frame. The transformation matrix for

angular velocities from the inertial frame to the bodyframe is W_, and from the body frame to

the inertial frame is W−1 _ , as shown in Fig 4.4.

in which Tx = tan(x). The matrix W_ is invertible if _ 6= (2k − 1)_/2, (k ∈ Z).The quadcopter is

assumed to have symmetric structure with the four arms aligned with the body x- and y-axes.

Thus, the inertia matrix is diagonal matrix I in which Ixx = Iyy

(5)

The angular velocity of rotor i, denoted with !i, creates force fi in the direction of the rotor axis.

The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axis

Page 48: Unmanned Aerial Vehicle for Surveillance

35

in which the lift constant is k, the drag constant is b and the inertia moment of the rotor is IM.

Usually the effect of (i) is considered small and thus it is omitted. The combined forces of rotors

create thrust T in the direction of the body z-axis. Torque B consists of the torques in the

direction of the corresponding body frame angles

in which l is the distance between the rotor and the center of mass of the quadcopter. Thus, the

roll movement is acquired by decreasing the 2nd rotor velocity and increasing the 4th rotor

velocity. Similarly, the pitch movement is acquired by decreasing the 1st rotor velocity and

increasing the 3th rotor velocity. Yaw movement is acquired by increasing the the angular

velocities of two opposite rotors and decreasing the velocities of the other two [10].

4.1.4 Wireless Transmission System

There will be a wireless transmitter mounted on quadcopter and interfaced with Arduion

board. There will also be wireless receiver interfaced to a computer that will receive the GPS and

video data. They are several wireless transmission can be exploited which work on RF

communication at 2.4 GHz which is ISM Band allotted for public application.

Telemetry is one of the brightest option for wireless communication in this situation. XBee Pro

radio module can be used as they provide long range of communication with high signal

strength. XBee is a microcontroller made by digi which uses the Zigbee protocol

Page 49: Unmanned Aerial Vehicle for Surveillance

36

(IEEE802.15.4). The other possible option for wireless communication is WiFi as it is provided

in our campus and easy to use.

4.1.5 PID Control theory and algorithm

PD controllers are nice in their simplicity and ease of implementation, but they are

often inadequate for controlling mechanical systems. Especially in the presence of noise and

disturbances, PD controllers will often lead to steady state error[3]. A PID control is a PD control

with another term added, which is proportional to the integral of the process variable. Adding an

integral term causes any remaining steady-state error to build up and enact a change, so a PID

controller should be able to track our trajectory (and stabilize the quadcopter) with a significantly

smaller steady-state error. The equations remain identical to the ones presented in the PD case,

but with an additional term in the error:

However, Fig 4.5 shows the PID controls come with their own shortcomings. One problem that

commonly occurs with a PID control is known as integral windup.

Fig. 4.5 PID Control Block Diagram

(9)

(10)

(11)

Page 50: Unmanned Aerial Vehicle for Surveillance

37

Fig. 4.6 PID Control graph

In some cases, integral wind-up can cause lengthy oscillations instead of settling. In other

cases, wind-up may actually cause the system to become unstable, instead of taking longer to

reach a steady state. If there is a large disturbance in the process variable, this large disturbance

is integrated over time, becoming a still larger control signal (due to the integral term). However,

even once the system stabilizes, the integral is still large, thus causing the controller to overshoot

its target. It may then begin a series of dieing down oscillations, become unstable, or simply take

an incredibly long time to reach a steady state. In order to avoid this, we disable the integral

function until we reach something close to the steady state. Once we are in a controllable region

near the desired steady state, we turn on the integral function, which pushes the system towards a

low steady-state error. The PID control performances are shown in Fig. 4.6.

Page 51: Unmanned Aerial Vehicle for Surveillance

38

4.2 Codes and Standards

4.2.1 Standard used in Interface of camera with board

Serial communication, transistor-transistor-level (TTL) logic signal, capture VGA, QVGA, and

QQVGA picture formats

4.2.2 Standard used in GPS Receiver

GPS modules typically put out a series of standard strings of information, under something

called the National Marine Electronics Association (NMEA) protocol.

NEMA Protocol Compatible serial ports with RS232.

NMEA-0183@9600bps (Default) at update rate of 1 second

L1 Frequency, C/A code,66 channels

4.2.3 Standard Used to interface sensors to Arduino Board (I²C)

I²C is a multi-master, multi-slave, single-ended, serial computer bus invented by Philips

Semiconductor, known today as NXP Semiconductors, used for attaching low-speed peripherals

to computer motherboards and embedded systems.

4.2.4 Standard Used in RF Transceiver (2.4 GHz FHSS technology)

Frequency-hopping spread spectrum (FHSS) is a method of transmitting radio signals by

rapidly switching a carrier among many frequency channels, using a pseudorandom sequence

known to both transmitter and receiver. It is used as a multiple access method in the frequency-

hopping code division multiple access (FH-CDMA) scheme.

4.2.5 Standard Used in wireless transmission: IEEE 802.15.4 (Zigbee protocol)

Zigbee protocol is used by RF 2.4 GHz XBee radio modules to setup the wireless

transmission system to telemeter the video and GPS data.

ZigBee is a wireless technology developed as an open global standard to address the

unique needs of low-cost, low-power wireless M2M networks.

The ZigBee standard operates on the IEEE 802.15.4 physical radio specification and

operates in unlicensed bands including 2.4 GHz, 900 MHz and 868 MHz.

Page 52: Unmanned Aerial Vehicle for Surveillance

39

4.3 Constraints, Alternatives and Tradeoffs

4.3.1 Constraints

The real time constraints involved during the flight would be external factors like air

drag, wind, birds, tower, transmission lines, wall and trees. Apart from this there are also some

legal constrains to fly the drones and quadcopters. Other constrain during the flight would be

flight time and flight range due to power restraint and communication restraint. Power

optimization is crucial in this situation. The range of flight will limited to 2 to 2.4 Km due to

wireless communication through RC controller. At the time of construction, structure of frame

should be perfect in terms of orientation, weight and size. The selection of motors and propellers

would be such that quad could maintain stable flight with proper tuning of PID.

4.3.1.1 Legal Constrains

One do not need a license to operate a UAV/Drone. Although, the FAA (Federal Aviation

Administration) has rules one needs to follow. Two of the most important rules are: 1) one

should never fly around or above people and should always keep it within sight. 2) FAA has a

complete list of safety guidelines for model aircraft that one should check before you decide to

take off. There are also restrictions on where one can and cannot fly. For example, one cannot fly

within 5 kms of any airport. The Map box provides a great map which lists all the areas which

are no fly zone areas. Also, the local Remote Control (RC) aircraft clubs may list the areas one

can and cannot use. The FAA has partnered with several industry associations to promote ‗Know

before You Fly‘, a campaign to educate the public about using unmanned aircraft safely and

responsibly. Individuals flying for hobby or recreation are strongly encouraged to follow safety

guidelines, which include: Fly below 400 feet and remain clear of surrounding obstacles

[15].

Keep the aircraft within visual line of sight at all times

Remain well clear of and do not interfere with manned aircraft operations

Don't fly within 5 miles of an airport unless you contact the airport and control tower

before flying.

Don't fly near people or stadiums

Don't fly an aircraft that weighs more than 55 lbs

Page 53: Unmanned Aerial Vehicle for Surveillance

40

Don't be careless or reckless with your unmanned aircraft – you could be fined for

endangering people or other aircraft.

4.3.1.2 Power shortage and flight duration

One of the main constrained faced during the implementation is power shortage due to higher

need of power consumption by motors and ESC. To degrade this fact, higher capacity battery is

required, but as capacity of battery increase, size & weight will also increase. We have chosen

the 2300 mah battery to operate our system. The flight time is also limited due to capacity of

battery which is 6 to 8 min.

4.3.1.3 Improper weight distribution

Improper weight distribution have occurred in the system due to small size of frame. At the time

of first flight test, throttle observed was improper which leads to unbalanced flight as shown Fig.

4.7. The result of these circumstances was tilt flight. Further increase in throttle will lead to crash

of UAV. To avoid the situation, proper weight distribution is necessary can be achieved by either

increase the frame size or multipoint to single point weight distribution technique. The first one

is easy to implement that is the reason, we decided to adopt it [5].

Fig. 4.7 Improper throttle

Page 54: Unmanned Aerial Vehicle for Surveillance

41

4.3.2 Alternatives

These are the following alternative should have consider-

For establishing the wireless communication from quadcopter to ground station, WiFi

technique can be exploited in spite of Zigbee Protocol (IEEE 802.15.4). GPS and Video

data can be transmitted through WiFi modem instead of XBee Pro Radio telemetries

which will be interfaced to Raspberry Pi.

To operating the flight of UAV, 2.4 GHz RF transceiver have used. We can use

Bluetooth module and control the flight of UAV on the android device with GUI. APM

mission planner, Multiwii, 3DR robotics provide the android app to operate UAVs.

Material of Frame have been chosen as a glass fiber. It could also be wood, aluminum

and carbon fiber as mentioned in section 3.1.1.

Flight controller can also be bought instead of making it from scratches by interfacing of

sensor to Arduino board.

4.3.3 Tradeoff

Tradeoff have explained in the following portions-

4.3.3.1 Development Cost

It is planned to design a flight controller using accessible microcontroller, sensor and other

required electronic components rather than purchasing directly a quadcopter kit.

4.3.3.2 Weight

To make system more agile, it is necessary to lesser weight that can be done choosing right

frame‘s structure, size and material. The payload carrying capacity will be sacrificed to make

system more agile in nature.

4.3.3.3 Power System

2300 mAh, LiPo battery is used which gives 5 to 6 min of flight time. Flight time can be

increased by increasing the power of battery but it will lead to more volume and mass and

unnecessarily increase weight of the system.

Page 55: Unmanned Aerial Vehicle for Surveillance

42

CHAPTER 5

SCHEDULE, TASKS AND MILESTONES

The Schedule to complete the required task, in order to achieve the aim of the project is

described in the tabular graph format in Fig. 5.1 which consist of procurement of component,

literature study, development, testing, integration, validation and operation manual preparation.

Fig. 5.1 Schedule of the project

The major milestones were faced during whole project course work are mentioned in the

following bullet points:

Optimization of power supply

Maintain the proper weight distribution.

Establishing the wireless communication

Developing and Implementing of PID control algorithm and tuning the PID values.

Transferring the video data

To achieve the above mentioned milestones few crucial tasks are need to be done which were

mentioned in the whole section 4.3.

Page 56: Unmanned Aerial Vehicle for Surveillance

43

CHAPTER 6

PROJECT DEMONSTRATION

6.1 Complete module of quadcopter

The complete setup of quadcopter have shown in Fig. 6.1 and also mentioned in section

4.1.2 where the entire component are connected as per setup explained in chapter 3. In every

integral part of the project indicated in Fig. 6.2 and in Fig 6.3, each electrical and mechanical

components of quadcopter have shown. The sponge balls are also shown which works as both

suspension and quadcopter stand as mentioned in section 3.1.2.

Fig. 6.1 Complete setup of quadcopter

There are mainly four integral parts are necessary in this project as mentioned also in the

figure in red block which are complete quadcopter with embedded electronics, Base Station GUI,

Base station telemetry receiver and 2.4 GHZ RF Transceiver. In order to fly, one have do first

binding of 2.4 GHZ RF transmitter and receiver is mentioned in Appendix A. After then

Calibration of ESCs are also necessary (is mentioned in Appendix A). Then arming of motor

Page 57: Unmanned Aerial Vehicle for Surveillance

44

should be done. Now setup is ready to fly. Now one have to go in open environment. Connect

the battery with power distribution board to power up the whole system. Switch on the 2.4 GHZ

RF Transceiver; A constant blink of 2.4 GHZ RF receiver is gone. Now, one should increase the

throttle by moving the throttle stick up. RF transmitter will send PWM signal to reviver and

ESCs will act accordingly to rotate the propellers. When throttle is enough that quadcopter can

lift up, the data of MPU 6050 will be sent to Arduino board through I2C communication and PID

control algorithm will be applied to maintain the stable flight as shown in Fig. 6.5. One should

tune the PID value properly to maintain the stable flight. These PID values can be easily

observed in GUI as shown in Fig. 6.6. The GPS and video data will sent to base station vai XBee

pro radio module.

Fig 6.2 integral part of the project mentioned individually

Page 58: Unmanned Aerial Vehicle for Surveillance

45

Fig. 6.3 Electrical and mechanical components of quadcopter

The interfacing of every integral component of embedded system module has

shown in Fig 6.5 below 2.4 GHz RF receiver is connected to Arduino via serial

communication at baud rate of 9600. XBEE telemetry is also connected to via serial

communication to Arduino board and via Zigbee protocol with other Zigbee at 2.4 GHz

RF, in API Unicast mode. GPS reciver also connected to board via serial communication

and sense data in NMEA format. MPU 6050 is connected to via i2c. Fig. 6.7, Fig. 6.8 and

Fig. 6.9 show the various use cases demonstrations.

Page 59: Unmanned Aerial Vehicle for Surveillance

46

Fig. 6.4 Integral component of embedded system module

Fig. 6.5 XBEE PRO as base station telemetry

Page 60: Unmanned Aerial Vehicle for Surveillance

47

Fig. 6.6 GUI from Mutiwii on Base Station

Fig. 6.7 Top view of quadcopter

Page 61: Unmanned Aerial Vehicle for Surveillance

48

Fig. 6.8 Side view of quadcopter

Fig. 6.9 Quadcopter as in flight

Page 62: Unmanned Aerial Vehicle for Surveillance

49

6.2 Interfacing of MUP 6050 with Arduino

MPU 6050 has been used as an IMU which consist of 3-axis accelerometer and 3-axis

gyroscope MEMS sensor as shown in Fig. 6.10a and Fig. 6.10b. In addition, it also contain

temperature sensor. It is very accurate, as it contains 16-bits analog to digital conversion

hardware for each channel. Therefor it captures the x, y, and z channel at the same time. The

sensor uses the I2C-bus to interface with the Arduino. The MPU-6050 always acts as a slave to

the Arduino with the SDA and SCL pins connected to the I2C-bus.The output representation of

accelerometer, gyro and temperature is shown in Fig. 6.11.

Fig. 6.10a Interfacing of MPU 6050 with Arduino UNO

Fig. 6.10b Interfacing of MPU6050 with Ardunio board

Page 63: Unmanned Aerial Vehicle for Surveillance

50

Fig. 6.11 data of accelerometer, gyro, temperature

6.3 Interfacing of Bluetooth with Arduino

The Bluetooth module has been used for controlling and operating the quadcopter as

mentioned in section 4.3.2. The module used here is HC05 as shown in Fig. 6.12.

Page 64: Unmanned Aerial Vehicle for Surveillance

51

Fig.6.12 interfacing of Bluetooth module

6.4 Interfacing of GPS with Arduino

GPS modules typically put out a series of standard strings of information, under the National

Marine Electronics Association (NMEA) protocol. $GPRMC strings have been used for our

project. The NMEA 0183 standard defines an electrical interface and data protocol for

communications between marine instrumentation. NMEA 0183 devices are designated as either

talkers or listeners (with some devices being both), employing an asynchronous serial interface

with the following parameters:

Baud rate: 4800

Number of data bits: 8 (bit 7 is 0)

Stop bits: 1 (or more)

Parity: none

The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines

how data are transmitted in a "sentence" from one "talker" to multiple "listeners" at a time.

Through the use of intermediate expanders, a talker can have a unidirectional conversation with a

Page 65: Unmanned Aerial Vehicle for Surveillance

52

nearly unlimited number of listeners, and using multiplexers, multiple sensors can talk to a single

computer port. Output will be in NMEA format and GPS format is shown in Fig. 6.13 and Fig.

6.14 respectively.

$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76

$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A

$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70

$GPGSV,3,2,11,02,39,223,19,13,28,070,17,26,23,252,,04,14,186,14*79

$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76

$GPRMC,092750.000,A,5321.6802,N,00630.3372,W,0.02,31.66,280511,,,A*43

$GPGGA,092751.000,5321.6802,N,00630.3371,W,1,8,1.03,61.7,M,55.3,M,,*75

$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A

$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70

$GPGSV,3,2,11,02,39,223,16,13,28,070,17,26,23,252,,04,14,186,15*77

$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76

$GPRMC,092751.000,A,5321.6802,N,00630.3371,W,0.06,31.66,280511,,,A*45

Fig. 6.13 NMEA Format

Fig. 6.14 GPS Output

Page 66: Unmanned Aerial Vehicle for Surveillance

53

6.5 Establishing communication between 2 XBees radio modules

The XBee can communicate with other XBee in two modes. One is API mode and another one is

AT mode. Here in the project API mode communication has been chosen. The communication

will be unicast communication. The XBee RF Modules interface to a host device through a logic-

level asynchronous serial port. Through its serial port, the module can communicate with any

logic and voltage compatible UART; or through a level translator to any serial device (for

example: through a RS-232 or USB interface board).

UART Data Flow

Devices that have a UART interface can connect directly to the pins of the RF module as shown

in Fig. 6.15.

Fig. 6.15 System Data Flow Diagram in a UART‐interfaced environment

Serial Data

Data enters the module UART through the DIN (pin 3) as an asynchronous serial signal. The

signal should idle high when no data is being transmitted. Each data byte consists of a start bit

(low), 8 data bits (least significant bit first) and a stop bit (high). Fig. 6.15 illustrates the serial bit

pattern of data passing through the module.

Fig 6.16 UART data packet 0x1F (decimal number ʺ31ʺ) as transmitted through the RF

module

Page 67: Unmanned Aerial Vehicle for Surveillance

54

Transparent Operation (AT Mode)

By default, XBee-PRO® RF Modules operate in Transparent Mode. When operating in this

mode, the modules act as a serial line replacement - all UART data received through the DI pin

is queued up for RF transmission. When RF data is received, the data is sent out the DO pin.

Serial-to-RF Packetization

Data is buffered in the DI buffer until one of the following causes the data to be packetized and

transmitted:

1. No serial characters are received for the amount of time determined by the RO

(Packetiza-tion Timeout) parameter. If RO = 0, packetization begins when a character is

received.

2. The maximum number of characters that will fit in an RF packet (100) is received.

3. The Command Mode Sequence (GT + CC + GT) is received. Any character buffered in

the DI buffer before the sequence is transmitted.

API Operation

API (Application Programming Interface) Operation is an alternative to the default Transparent

Operation. The frame-based API extends the level to which a host application can interact with

the networking capabilities of the module. When in API mode, all data entering and leaving the

module is contained in frames that define operations or events within the module.

Transmit Data Frames (received through the DI pin (pin 3)) include:

RF Transmit Data Frame

Command Frame (equivalent to AT commands)

Receive Data Frames (sent out the DO pin (pin 2)) include:

RF-received data frame

Command response

Event notifications such as reset, associate, disassociate, etc.

The following figures from Fig. 6.17 to Fig. 21 shows the configuration of 2 XBee,

communication AT Mode and API mode has been done in X-CTU Software environment.

Page 68: Unmanned Aerial Vehicle for Surveillance

55

Fig. 6.17 complete setup of XBee module in X-CTU software, you can see the MAC NO.and

port of device

Fig. 6.18 Configuring two XBee to communicate

Page 69: Unmanned Aerial Vehicle for Surveillance

56

Fig. 6.19 Communication in AT Mode- XBee 1

Fig. 6.20 Communication in AT Mode- XBee2

Page 70: Unmanned Aerial Vehicle for Surveillance

57

Fig. 6.21 Communication of XBee in API Mode

Page 71: Unmanned Aerial Vehicle for Surveillance

58

CHAPTER 7

MARKETING AND COST ANALYSIS

7.1 Marketing Analysis

This project has been designed for airborne campus surveillance. There is no prior art has been

implemented for this application. Our team has focused on the application and have tried to make

campus surveillance UAV commercially by providing easy design and cost effectiveness. Apart

from this the scope of market will also fall under the other civilian and military application. The

current market for military spending on UAVs is about 10.6 billion and for non-military

spending is near 6.6 billion. This equates to a total market of around 17.2 billion dollars for both

the military and non-military spending on UAVs. Our quadcopter target market also consists

primarily of military and security companies which need constant surveillance. Although

military services mostly prefer to have some UAV and drone by their own. Our quadcopter

attempts to fill a need that is not currently met by existing UAVs due to their higher cost and

complexity to operate.

The proposed UAV can be used for several applications like crop monitoring, aerial surveillance,

aerial photography and search operations. A huge amount of money can be saved by using UAV

for inspections. Wind turbines, power lines, pipelines, etc. can be inspected using a quadcopter.

The focus of the project to make aerial surveillance task easy, less expensive and more efficient.

A lot of money and manpower can be saved by performing the aerial inspection wind turbines,

power lines, pipelines etc. By adding additional sensor technology, 3D mapping of environment

can be done and it will exploit for several uses.

7.1.1 Comparative Study

Drones/UAV for surveillance and aerial photography are easily available in the market. Those

there in the market which fulfills the demands of a user for surveillance are expensive and would

easily cost somewhere around $1000 while what we have proposed falls under the costs range of

Page 72: Unmanned Aerial Vehicle for Surveillance

59

$250-$300. They are also not very handy and need trained pilot to operate. Apart from this, they

are very complex to understand and take lot of time to be a pro pilot.

7.1.1.1 DJI

Drones from DJI are very popular these days and comes with lot of feature yet they

comes under the very high cost and maintenance. DJI is an active competitor in the small UAV

market, offering four different copters between $110 and $15000. The closest which comes to

fulfilling those demands is the DJI Phantom 2 for about $1,100. Mostly, DJI Phantom series are

used for aerial photography and known as flying camera. While it does offer a flight time of 25

minutes but you will have to shell out a whopping $800 more than what we are spending on ours.

You may find a cheaper one in Air Hogs RC Helix X4 at $75 but it doesn't come close to the

number of functions our quadcopter will be performing [13].

7.1.1.2 3D Robotics

Another quadcopter, cost of $1000 in market is IRIS+ from company 3D Robotics. It has

advantage in flight time. The total flight time is 20 min for this quadcopter. IRIS+ comes with

an integrated GoPro camera mount with a vibration dampener for aerial photography and video,

but still costly.

7.1.1.3 FireBox

Firebox designs and supplies various electronic products; one of these is the Micro Drone

quadcopter for $120. The Micro Drone quadcopter is marketed towards enthusiast as a toy for

primarily indoor use. Our proposed model will respond to this competitor by focusing on the

features that Firebox failed to include, such as video capturing and GPS navigation.

7.2 Cost Analysis

The project implementation cost analysis is shown in Table 7.1.

Page 73: Unmanned Aerial Vehicle for Surveillance

60

Table 7.1 Cost analysis table

Serial No. Components Cost Per Unit Total Cost

1. Quadrotor Frame

1200 1200

2. ESC

1000 4000

3. Propellers

300 600

4. Battery 1200 1200

5. Arduino UNO 1500 1500

6. Electrical Brushless Motor 1000 4000

7. Transceiver 3100 3100

8. Telemetry

2300 4600

9. Camera 1500 1500

10. IMU Sensors 1500 1500

11. GPS Receiver 1800 1800

Total 25000

Page 74: Unmanned Aerial Vehicle for Surveillance

61

CHAPTER 8

SUMMARY

The Aerial Surveillance System is designed to monitor the real time environment like

surveillance of banks, highly crowded areas, aerial traffic and security watch etc. on a

quadcopter platform using marginal sensor input. The project consists of wireless

communication system, Camera, GPS and a quadcopter aerial platform. The quadcopter is

controlled by a 2.4 GHz RF transceiver system wirelessly. PID control technique will be

exploited to perform the flight stabilization. This project intended to design and fabricate low

cost, light weight surveillance UAV in structure of quad rotor. It is also intended to be able to

carry a payload for future developments.

Page 75: Unmanned Aerial Vehicle for Surveillance

62

REFERENCES

[1] Towards A Swarm of Agile Micro Quadrotors, Alex Kushleyev, Daniel Mellinger, Vijay

Kumar GRASP Lab, University of Pennsylvania.

[2] Design considerations of a small UAV platform carrying medium payloads, Juan Alberto

Benito, Guillermo Glez-de-Rivera, Javier Garrido Human Computer Technology Laboratory

(HCTLab) Univ. Autonoma de Madrid, Spain [email protected]

[3] Jun Li, YunTang Li (2011). ―Dynamic Analysis and PID Control for a

Quadrotor‖ 2011 International Conference on Mechatronics and Automation. [4] Atheer L. Salih, M. Moghavvemil, Haider A. F. Mohamed and Khalaf Sallom

Gaeid (2010). ―Flight PID controller design for a UAV Quadcopter.‖ Scientific

Research and Essays Vol. 5(23), pp. 3660-3667, 2010. [5] A multi-point Metropolis scheme with generic weight functions Luca Martino, Victor

Pascual Del Olmo, Jesse Read Department of Signal Theory and Communications, Universidad

Carlos III de Madrid. Avenida de la Universidad 30, 28911, Leganes, Madrid, Spain.

[6] Simple GUI Wireless Controller of Quadcopter Dirman Hanafi1 , Mongkhun Qetkeaw1 ,

Rozaimi Ghazali1 , Mohd Nor Mohd Than1 , Wahyu Mulyo Utomo2 , Rosli Omar1 1

Department of Mechatronic and Robotic Engineering, Faculty of Electrical and Electronic

Engineering, University Tun Hussein Onn Malaysia, Batu Pahat, Malaysia 2 Department of

Power Engineering, Faculty of Electrical and Electronic Engineering, University Tun Hussein

Onn Malaysia, Batu Pahat, Malaysia

[7] http://fritzing.org/home/

[8] http://arxiv.org/pdf/1112.4048.pdf

[9] https://cma.tcd.ie/misc/Surface_area_and_porosity.pdf

[10] http://sal.aalto.fi/publications/pdf-files/eluu11_public.pdf

[11] http://www.gpsinformation.org/dale/nmea.htm

[12] http://dx.doi.org/10.4236/ijcns.2013.61006

[13] http://www.dji.com/product/phantom-2

[14] http://ardrone2.parrot.com/

[15] https://www.faa.gov/uas/

Page 76: Unmanned Aerial Vehicle for Surveillance

63

APPENDIX A

Binding of RF Transceiver

Procedure:

Switch the Transmitter in pairing mode and switch the receiver in pairing mode.

Move the throttle to idle and turn the transmitter power on.

Press the ENTER for 5 second.

Press the ENTER key 5 times to select the ―BIND‖ Function.

Press the up. The screen will display the dotted line scrolling from left to right.

Binding Procedure is done.

Calibration of ESC & Programming

Calibration, in terms of ESCs, means to set the max and min speeds of the motor in

relation to the max and min width of the PWM signal sent by the Arduino. A PWM signal is

simple a square wave signal consisting of high and low (5v and 0v) signals for certain durations.

Some sample PWM waves are shown in Fig. A.1.

Fig. A.1 Duty Cycle for Calibration of ESC

The PWM signal read by the ESC is the same type as a servo signal, meaning the Servo

library from Adruino can be used to calibrate and control the ESCs. The ESC sets the speed of

Page 77: Unmanned Aerial Vehicle for Surveillance

64

the motor depending on the ratio of high to low signals. Calibration involves programming the

ESC to understand the PWM waves corresponding to the stop and maximum speeds of the

motor.

The default signal range for most servo motors and ESCs is a high signal width between 1000

and 2000 microseconds over a repetition period of 20 milliseconds (assuming a 50 Hz PWM

signal). For the quad copter, however, we want the range to be as wide as possible to allow for

greater incremental control of the motor. To this end, we calibrated the ESCs to read a signal

width from 700 to 2000 microseconds with 700 being the stop speed and 2000 being the max

speed.

First flight test for throttle

RC Radios have several outputs, one for each channel/stick/switch/knob. Each radio

output transmits a pulse at 50Hz with the width of the pulse determining where the stick is on the

RC transmitter. Typically, the pulse is between 1000us and 2000us long with a 18000us to

19000us pause before the next - so a throttle of 0 would produce a pulse of 1000us and full

throttle would be 2000us. Sadly, most radios are not this precise so we normally have to measure

the min/max pulse widths for each stick (which we'll do in a minute). Throttle test for flight is

shown in Fig. A.2.

Fig. A.2 Throttle test for flight

Page 78: Unmanned Aerial Vehicle for Surveillance

65

APPENDIX B

Code for interfacing of MPU6050 with Arduino Board

#include "I2Cdev.h"

#include "MPU6050_6Axis_MotionApps20.h"

//#include "MPU6050.h" // not necessary if using MotionApps include file

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation

// is used in I2Cdev.h

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

#include "Wire.h"

#endif

// class default I2C address is 0x68

// specific I2C addresses may be passed as a parameter here

// AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board)

// AD0 high = 0x69

MPU6050 mpu;

//MPU6050 mpu(0x69); // <-- use for AD0 high

// uncomment "OUTPUT_READABLE_QUATERNION" if you want to see the actual

// quaternion components in a [w, x, y, z] format (not best for parsing

// on a remote host such as Processing or something though)

//#define OUTPUT_READABLE_QUATERNION

Page 79: Unmanned Aerial Vehicle for Surveillance

66

// uncomment "OUTPUT_READABLE_EULER" if you want to see Euler angles

// (in degrees) calculated from the quaternions coming from the FIFO.

// Note that Euler angles suffer from gimbal lock (for more info, see

// http://en.wikipedia.org/wiki/Gimbal_lock)

//#define OUTPUT_READABLE_EULER

// uncomment "OUTPUT_READABLE_YAWPITCHROLL" if you want to see the yaw/

// pitch/roll angles (in degrees) calculated from the quaternions coming

// from the FIFO. Note this also requires gravity vector calculations.

// Also note that yaw/pitch/roll angles suffer from gimbal lock (for

// more info, see: http://en.wikipedia.org/wiki/Gimbal_lock)

#define OUTPUT_READABLE_YAWPITCHROLL

// uncomment "OUTPUT_READABLE_REALACCEL" if you want to see acceleration

// components with gravity removed. This acceleration reference frame is

// not compensated for orientation, so +X is always +X according to the

// sensor, just without the effects of gravity. If you want acceleration

// compensated for orientation, us OUTPUT_READABLE_WORLDACCEL instead.

//#define OUTPUT_READABLE_REALACCEL

// uncomment "OUTPUT_READABLE_WORLDACCEL" if you want to see acceleration

// components with gravity removed and adjusted for the world frame of

// reference (yaw is relative to initial orientation, since no magnetometer

// is present in this case). Could be quite handy in some cases.

//#define OUTPUT_READABLE_WORLDACCEL

Page 80: Unmanned Aerial Vehicle for Surveillance

67

// uncomment "OUTPUT_TEAPOT" if you want output that matches the

// format used for the InvenSense teapot demo

//#define OUTPUT_TEAPOT

#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)

bool blinkState = false;

// MPU control/status vars

bool dmpReady = false; // set true if DMP init was successful

uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU

uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)

uint16_t packetSize; // expected DMP packet size (default is 42 bytes)

uint16_t fifoCount; // count of all bytes currently in FIFO

uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars

Quaternion q; // [w, x, y, z] quaternion container

VectorInt16 aa; // [x, y, z] accel sensor measurements

VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements

VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements

VectorFloat gravity; // [x, y, z] gravity vector

float euler[3]; // [psi, theta, phi] Euler angle container

float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

Page 81: Unmanned Aerial Vehicle for Surveillance

68

// packet structure for InvenSense teapot demo

uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };

volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high

void dmpDataReady() {

mpuInterrupt = true;

}

void setup() {

// join I2C bus (I2Cdev library doesn't do this automatically)

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE

Wire.begin();

TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)

#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE

Fastwire::setup(400, true);

#endif

// initialize serial communication

// (115200 chosen because it is required for Teapot Demo output, but it's

// really up to you depending on your project)

Serial.begin(115200);

while (!Serial); // wait for Leonardo enumeration, others continue immediately

// NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio

// Pro Mini running at 3.3v, cannot handle this baud rate reliably due to

// the baud timing being too misaligned with processor ticks. You must use

Page 82: Unmanned Aerial Vehicle for Surveillance

69

// 38400 or slower in these cases, or use some kind of external separate

// crystal solution for the UART timer.

// initialize device

Serial.println(F("Initializing I2C devices..."));

mpu.initialize();

// verify connection

Serial.println(F("Testing device connections..."));

Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050

connection failed"));

// wait for ready

Serial.println(F("\nSend any character to begin DMP programming and demo: "));

while (Serial.available() && Serial.read()); // empty buffer

while (!Serial.available()); // wait for data

while (Serial.available() && Serial.read()); // empty buffer again

// load and configure the DMP

Serial.println(F("Initializing DMP..."));

devStatus = mpu.dmpInitialize();

// supply your own gyro offsets here, scaled for min sensitivity

mpu.setXGyroOffset(220);

mpu.setYGyroOffset(76);

mpu.setZGyroOffset(-85);

Page 83: Unmanned Aerial Vehicle for Surveillance

70

mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

// make sure it worked (returns 0 if so)

if (devStatus == 0) {

// turn on the DMP, now that it's ready

Serial.println(F("Enabling DMP..."));

mpu.setDMPEnabled(true);

// enable Arduino interrupt detection

Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)..."));

attachInterrupt(0, dmpDataReady, RISING);

mpuIntStatus = mpu.getIntStatus();

// set our DMP Ready flag so the main loop() function knows it's okay to use it

Serial.println(F("DMP ready! Waiting for first interrupt..."));

dmpReady = true;

// get expected DMP packet size for later comparison

packetSize = mpu.dmpGetFIFOPacketSize();

} else {

// ERROR!

// 1 = initial memory load failed

// 2 = DMP configuration updates failed

// (if it's going to break, usually the code will be 1)

Serial.print(F("DMP Initialization failed (code "));

Serial.print(devStatus);

Page 84: Unmanned Aerial Vehicle for Surveillance

71

Serial.println(F(")"))

}

// configure LED for output

pinMode(LED_PIN, OUTPUT);

}

void loop() {

// if programming failed, don't try to do anything

if (!dmpReady) return;

// wait for MPU interrupt or extra packet(s) available

while (!mpuInterrupt && fifoCount < packetSize) {

// other program behavior stuff here

// .

// .

// .

// if you are really paranoid you can frequently test in between other

// stuff to see if mpuInterrupt is true, and if so, "break;" from the

// while() loop to immediately process the MPU data

// .

// .

// .

}

// reset interrupt flag and get INT_STATUS byte

mpuInterrupt = false;

mpuIntStatus = mpu.getIntStatus();

Page 85: Unmanned Aerial Vehicle for Surveillance

72

// get current FIFO count

fifoCount = mpu.getFIFOCount();

// check for overflow (this should never happen unless our code is too inefficient)

if ((mpuIntStatus & 0x10) || fifoCount == 1024) {

// reset so we can continue cleanly

mpu.resetFIFO();

Serial.println(F("FIFO overflow!"));

// otherwise, check for DMP data ready interrupt (this should happen frequently)

} else if (mpuIntStatus & 0x02) {

// wait for correct available data length, should be a VERY short wait

while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();

// read a packet from FIFO

mpu.getFIFOBytes(fifoBuffer, packetSize);

// track FIFO count here in case there is > 1 packet available

// (this lets us immediately read more without waiting for an interrupt)

fifoCount -= packetSize;

#ifdef OUTPUT_READABLE_QUATERNION

// display quaternion values in easy matrix form: w x y z

mpu.dmpGetQuaternion(&q, fifoBuffer);

Serial.print("quat\t");

Serial.print(q.w);

Page 86: Unmanned Aerial Vehicle for Surveillance

73

Serial.print("\t");

Serial.print(q.x);

Serial.print("\t");

Serial.print(q.y);

Serial.print("\t");

Serial.println(q.z);

#endif

#ifdef OUTPUT_READABLE_EULER

// display Euler angles in degrees

mpu.dmpGetQuaternion(&q, fifoBuffer);

mpu.dmpGetEuler(euler, &q);

Serial.print("euler\t");

Serial.print(euler[0] * 180/M_PI);

Serial.print("\t");

Serial.print(euler[1] * 180/M_PI);

Serial.print("\t");

Serial.println(euler[2] * 180/M_PI);

#endif

#ifdef OUTPUT_READABLE_YAWPITCHROLL

// display Euler angles in degrees

mpu.dmpGetQuaternion(&q, fifoBuffer);

mpu.dmpGetGravity(&gravity, &q);

mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);

Serial.print("ypr\t");

Serial.print(ypr[0] * 180/M_PI);

Page 87: Unmanned Aerial Vehicle for Surveillance

74

Serial.print("\t");

Serial.print(ypr[1] * 180/M_PI);

Serial.print("\t");

Serial.println(ypr[2] * 180/M_PI);

#endif

#ifdef OUTPUT_READABLE_REALACCEL

// display real acceleration, adjusted to remove gravity

mpu.dmpGetQuaternion(&q, fifoBuffer);

mpu.dmpGetAccel(&aa, fifoBuffer);

mpu.dmpGetGravity(&gravity, &q);

mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);

Serial.print("areal\t");

Serial.print(aaReal.x);

Serial.print("\t");

Serial.print(aaReal.y);

Serial.print("\t");

Serial.println(aaReal.z);

#endif

#ifdef OUTPUT_READABLE_WORLDACCEL

// display initial world-frame acceleration, adjusted to remove gravity

// and rotated based on known orientation from quaternion

mpu.dmpGetQuaternion(&q, fifoBuffer);

mpu.dmpGetAccel(&aa, fifoBuffer);

mpu.dmpGetGravity(&gravity, &q);

mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);

Page 88: Unmanned Aerial Vehicle for Surveillance

75

mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);

Serial.print("aworld\t");

Serial.print(aaWorld.x);

Serial.print("\t");

Serial.print(aaWorld.y);

Serial.print("\t");

Serial.println(aaWorld.z);

#endif

#ifdef OUTPUT_TEAPOT

// display quaternion values in InvenSense Teapot demo format:

teapotPacket[2] = fifoBuffer[0];

teapotPacket[3] = fifoBuffer[1];

teapotPacket[4] = fifoBuffer[4];

teapotPacket[5] = fifoBuffer[5];

teapotPacket[6] = fifoBuffer[8];

teapotPacket[7] = fifoBuffer[9];

teapotPacket[8] = fifoBuffer[12];

teapotPacket[9] = fifoBuffer[13];

Serial.write(teapotPacket, 14);

teapotPacket[11]++; // packetCount, loops at 0xFF on purpose

#endif

// blink LED to indicate activity

blinkState = !blinkState;

digitalWrite(LED_PIN, blinkState);

}}

Page 89: Unmanned Aerial Vehicle for Surveillance

76

Code for interfacing of GPS with Arduino Board

#include <TinyGPS++.h>

#include <SoftwareSerial.h>

/*

This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.

It requires the use of SoftwareSerial, and assumes that you have a

4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).

*/

static const int RXPin = 4, TXPin = 3;

static const uint32_t GPSBaud = 4800;

// The TinyGPS++ object

TinyGPSPlus gps;

// The serial connection to the GPS device

SoftwareSerial ss(RXPin, TXPin);

void setup()

{

Serial.begin(115200);

ss.begin(GPSBaud);

Serial.println(F("FullExample.ino"));

Serial.println(F("An extensive example of many interesting TinyGPS++ features"));

Serial.print(F("Testing TinyGPS++ library v. "));

Serial.println(TinyGPSPlus::libraryVersion());

Page 90: Unmanned Aerial Vehicle for Surveillance

77

Serial.println(F("by Mikal Hart"));

Serial.println();

Serial.println(F("Sats HDOP Latitude Longitude Fix Date Time Date Alt Course

Speed Card Distance Course Card Chars Sentences Checksum"));

Serial.println(F(" (deg) (deg) Age Age (m) --- from GPS ---- ---- to

London ---- RX RX Fail"));

Serial.println(F("----------------------------------------------------------------------------------------------

-----------------------------------------"));

}

void loop()

{

static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

printInt(gps.satellites.value(), gps.satellites.isValid(), 5);

printInt(gps.hdop.value(), gps.hdop.isValid(), 5);

printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);

printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);

printInt(gps.location.age(), gps.location.isValid(), 5);

printDateTime(gps.date, gps.time);

printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);

printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);

printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);

printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.value()) : "*** ", 6);

unsigned long distanceKmToLondon =

Page 91: Unmanned Aerial Vehicle for Surveillance

78

(unsigned long)TinyGPSPlus::distanceBetween(

gps.location.lat(),

gps.location.lng(),

LONDON_LAT,

LONDON_LON) / 1000;

printInt(distanceKmToLondon, gps.location.isValid(), 9);

double courseToLondon =

TinyGPSPlus::courseTo(

gps.location.lat(),

gps.location.lng(),

LONDON_LAT,

LONDON_LON);

printFloat(courseToLondon, gps.location.isValid(), 7, 2);

const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);

printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);

printInt(gps.charsProcessed(), true, 6);

printInt(gps.sentencesWithFix(), true, 10);

printInt(gps.failedChecksum(), true, 9);

Serial.println();

smartDelay(1000);

Page 92: Unmanned Aerial Vehicle for Surveillance

79

if (millis() > 5000 && gps.charsProcessed() < 10)

Serial.println(F("No GPS data received: check wiring"));

}

// This custom version of delay() ensures that the gps object

// is being "fed".

static void smartDelay(unsigned long ms)

{

unsigned long start = millis();

do

{

while (ss.available())

gps.encode(ss.read());

} while (millis() - start < ms);

}

static void printFloat(float val, bool valid, int len, int prec)

{

if (!valid)

{

while (len-- > 1)

Serial.print('*');

Serial.print(' ');

}

else

Page 93: Unmanned Aerial Vehicle for Surveillance

80

{

Serial.print(val, prec);

int vi = abs((int)val);

int flen = prec + (val < 0.0 ? 2 : 1); // . and -

flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;

for (int i=flen; i<len; ++i)

Serial.print(' ');

}

smartDelay(0);

}

static void printInt(unsigned long val, bool valid, int len)

{

char sz[32] = "*****************";

if (valid)

sprintf(sz, "%ld", val);

sz[len] = 0;

for (int i=strlen(sz); i<len; ++i)

sz[i] = ' ';

if (len > 0)

sz[len-1] = ' ';

Serial.print(sz);

smartDelay(0);

}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)

Page 94: Unmanned Aerial Vehicle for Surveillance

81

{

if (!d.isValid())

{

Serial.print(F("********** "));

}

else

{

char sz[32];

sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());

Serial.print(sz);

}

if (!t.isValid())

{

Serial.print(F("******** "));

}

else

{

char sz[32];

sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());

Serial.print(sz);

}

printInt(d.age(), d.isValid(), 5);

smartDelay(0);

}

Page 95: Unmanned Aerial Vehicle for Surveillance

82

static void printStr(const char *str, int len)

{

int slen = strlen(str);

for (int i=0; i<len; ++i)

Serial.print(i<slen ? str[i] : ' ');

smartDelay(0)