You are on page 1of 53

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Belgavi: 590018

A Project report on
WIRELESS REMOTE CONTROLLED UTILITY DRONE
Submitted in partial fulfillment of the requirement for the award of degree of
BACHELOR OF ENGINEERING in
ELECTRONICS AND COMMUNICATIONS
Submitted by:
Ashwin Bhat (1PI13EC021)
Gururaj Joshi (1PI13EC035)
Nirmal Hegde (1PI13EC062)
UNDER THE GUIDANCE OF
Internal Guide:
Rajeshwari B
Associate Professor
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Jan - May 2017


P.E.S. INSTITUTE OF TECHNOLOGY
(An Autonomous Institute under VTU, Belgaum)
BENGALURU - 560085
DECLARATION

We hereby declare that the project report entitled “Wireless Remote Controlled
Utility Drone” is the bonafide record of the project carried out at P.E.S. Institute
of Technology in partial fulfillment of the requirements for the award of degree
Bachelor of Engineering in Electronics and Communication Engineering of
Visvesvaraya Technological University, Belgaum during the academic year
2017. We further declare that the project report is not submitted to any other
universities in fulfillment of the requirements for the award of any degree.

Ashwin Bhat (1PI13EC021)


Gururaj Joshi (1PI13EC035)
Nirmal Hegde (1PI13EC062)
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
Belgavi 590018

PES Institute of Technology


(An Autonomous Institute under VTU, Belgaum)
Bengaluru-560085

CERTIFICATE
This is to certify the project entitled Wireless Remote Controlled Utility Drone is a bonafide
work carried out by Ashwin Bhat, Gururaj Joshi and Nirmal Hegde bearing University seat
numbers 1PI13EC021, 1PI13EC035 and 1PI13EC062 respectively in partial fulfillment for the
award of Bachelor of Engineering in Electronics and Communication of the Visvesvaraya
Technological University, Belgaum during the academic year 2016-2017. It is certified that all
correction/suggestions indicated for internal assessment have been incorporated in the report
deposited in the department library. The project report has been approved as it satisfies the
academic requirements with respect to the project work prescribed for the said degree.

Head of Department: Principal: Guide:


Dr. Chandar T S Dr. K S Sridhar Prof. Rajeshwari B
Dept. of ECE. PESIT Dept. of ECE
PESIT Bengaluru-560085 PESIT
Bengaluru – 560085 Bengaluru – 560085

Name of the Examiner Signature with Date

1.

2.
ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any
task would be incomplete, without the mention of people who made it possible,
whose constant guidance and encouragement crown all the efforts with success.

Our most sincere and grateful acknowledgement to the P.E.S Institute of


Technology for providing us with the opportunity to pursue our degree and thus
helping us shape our career.

We would like to sincerely thank our project guide, Professor Rajeshwari B of


the department of Electronics and Communication Engineering for her continuous
valuable guidance, advice and persistent encouragement throughout the project.

We would like to sincerely thank Dr. T.S. Chandar, Head of the Department
Electronics and Communication for his encouragement and support throughout
the project.

We are thankful to Dr. Sridhar K.S. Principal of PES institute of Technology,


Bengaluru for his encouragement and support in our endeavor.

We would like to thank the project coordinators Prof. Purushotham U and


Prof.Sumanth Sakkara along with all the technical and non technical staff of the
department of ECE for their support and encouragement.

Last but not the least we wish to thank our family and friends for all their love,
support and encouragement.
Contents Page Number

ABSTRACT 1
CHAPTER 1: The WiReCUD 2
1.1 Introduction 2
1.2 Problem statement 3
1.3 Project Constraints 3
1.4 Project Assumptions 3
CHAPTER 2: Literature survey and references 4
CHAPTER 3: Building the quadcopter 6
3.1 Anatomy of the quadcopter 6
3.1.1 The Frame 6
3.1.2 Brushless DC motors 7
3.1.3 The Battery 8
3.1.4 Propellers 9
3.1.5 Electronic Speed Controller 10
3.1.6 Flight Controller 11
3.1.7 Transmitter and receiver 12
3.1.8 The Camera 14
CHAPTER 4: Calculations 15
4.1 Calculation of model weight 15
4.2 Calculation of required ESC rating 15
4.3 Choosing the propeller size 16
4.4 Choosing the right battery 16
CHAPTER 5: Design and essential operations 17
5.1 Block Diagram 17
5.2 Binding Procedure 18
5.3 Flight Controller Operations 18
5.3.1 ESC calibration 19
5.3.2 Motor Layout 19
5.3.3 Accelerometer calibration 19
5.3.4 PI settings 20
5.4 Arming and disarming procedure 20
CHAPTER 6: Quadcopter Dynamics 21
6.1 The science behind flying a quadcopter 21
6.1.1 The three principal aircraft axes 21
6.2 Quadcopter dynamics 22
CHAPTER 7: Applications 25
7.1 Aerial Photography and Videography 25
7.1.1 Photos captured 26
7.1.2 Snapshots of videos 27
7.2 Inventory management using color codes 28
7.2.1 Deciphering the color code 29
7.2.2 Color Code Database 29
7.2.3 Output 33
7.2.4 Analysis of results 35
CHAPTER 8: Potential Applications 36
8.1 Leaf disease detection using feature extraction 36
8.2 FPV racing and VR experience 37
CHAPTER 9: Conclusion 38
CHAPTER 10: Quadcopter maintenance 39
APPENDIX 40
LIST OF FIGURES
Figure Description Page
No. Number
3.1 Q450 Frame 7
3.2 Avionic C2830 KV850 BLDC motors 8
3.3 2200mah 35C LiPo Battery 9
3.4 10*4.5 Propellers 10
3.5 30A ESC 11
3.6 KK 2.1.5 Flight Controller 12
3.7 FlySky FS-I6 Transmitter and Receiver 13
3.8 GoPro Camera 14
5.1 Block diagram of the WiReCUD 17
5.2 KK 2.1.5 Settings 20
6.1 The 3 principal aircraft axes 21
6.2 The two frames of reference 22
6.3 Basic configuration of a X quadcopter 23
6.4 Motor configuration for hovering 24
6.5 Motor configuration for turning clockwise and counter 24
clockwise respectively.
6.6 Motor configurations for moving forward, backward, 24
left and right respectively.
7.1 Image sample 1 26
7.2 Image sample 2 26
7.3 Video Snapshot 1 27
7.4 Video Snapshot 2 27
7.5 Color code database 30,31,32
7.6 Example input 1 33
7.7 Example output 1 33
7.8 Example input 2 34
7.9 Example output 2 34
8.1 Steps involved in leaf disease detection 36
9.1 The Final Product 38
ABSTRACT

Quadcopters, since their invention in 1922 have been used in a variety of


applications, thus playing a pivotal role in the automation of various tasks. These
tasks range from simple video streaming to the recent home delivery services by
online retailers and taxi services in the near future.

Wireless Remote Controlled Utility Drone (WiReCUD) is one such quadcopter


which seamlessly does a range of applications such as live streaming of videos,
aerial photography, videography and inventory management. The premise for these
applications are based on the fact that the quadcopter and the mounted camera is
remote controlled.

The images captured from the WiReCUD is used for inventory management.
Inventory management is done on the principle of color coding of items. Each
product in an inventory is assigned a unique color code that is a combination of the
primary colors which can be read, analyzed and sorted using the quadcopter
camera.

Dept. of ECE Jan - May 2017 Page 1


CHAPTER 1: THE WiReCUD

1.1 Introduction
Drones belong to a class of aerial vehicles called "Unmanned Aerial Vehicles" (UAVs). These
vehicles can take to the air without pilots. A quadcopter, also called a quadrotor
helicopter or quadrotor, is a multirotor automobile that is lifted and propelled by four rotors.
Quadcopters are classified as rotorcraft, as opposed to fixed-wing aircraft, because their lift is
generated by a set of rotors (vertically oriented propellers).

Quadcopters generally use two pairs of identical fixed pitched propellers; two clockwise (CW)
and two counterclockwise (CCW). These use independent variation of the speed of each rotor to
achieve control. By changing the speed of each rotor it is possible to specifically generate a
desired total thrust; to locate the centre of thrust both laterally and longitudinally; and to create a
desired total torque, or turning force.

The movement and control of a quadcopter is governed by three aircraft principal axes, namely
the pitch axis, roll axis and the yaw axis. These axes move with the vehicle and rotate relative to
the Earth along with the craft. By varying the pitch axis, the quadcopter moves forwards or
backwards. While varying the roll axis, the quadcopter moves sideways and upon varying the
yaw axis, the quadcopter responds by turning clockwise or anticlockwise in a plane.

Quadcopters find applications in many relevant facets of today's science and technology scene.
Their applications range from simple recreational fun to the more complex applications of
surveillance, traffic monitoring, mineral mapping, resource location, inventory management and
they can also play a vital role in search and rescue operations.

Dept. of ECE Jan - May 2017 Page 2


Wireless Remote Controlled Utility Drone (WiReCUD)

1.2 Problem Statement


To design a multirotor system, specifically the quadcopter, for the purpose of sustained and
stable flight while capable of performing the following functions.

 Aerial photography: Live streaming of videos and capturing photos and videos.

 Inventory management: Using color coding of products.

1.3 Project Constraints


There are a few constraints that limit the full functionality of this project. Some of them are:

 The quadcopter is best suited to fly on a bright, sunny day.

 The quadcopter cannot fly in the rain and is advised against flying in strong winds.

 The quadcopter is monitored by line of sight only.

1.4 Project Assumptions


There are a few assumptions made to ensure the best outcome of the application. They are:

 Standardization: Each box/container contains a specified amount of the product.

 Order: The boxes are always arranged in the right order (The top side always faces up).

Dept. of ECE Jan - May 2017 Page 3


CHAPTER 2: LITERATURE SURVEY AND REFERENCES

[1] Mathematical Modeling of Hexacopter-Artale, Milazzo, Ricciardello:


Among the multicopter layout typology, the four rotors, also called quadrotor, have been widely
chosen by many researchers as a very promising vehicle for indoor/outdoor navigation.
Multidisciplinary concepts are necessary because this type of rotorcraft attempts to achieve
stable hovering and precise flight by balancing the forces produced by the four rotors.
Nowadays, the design of multicopter with more than four rotors, i.e. hexacopter and octocopter,
is developing thanks to the possibility of managing one or more engine failures and to increase
the total payload. In this paper a hexacopter is considered whose six-rotors are located on
vertices of a hexagon and are equidistant from the center of gravity; moreover, the propulsion
system consists of three pairs of counter-rotating fixed-pitch blades. The aircraft dynamic
behavior is here presented by the mathematical model, by considering all its external and internal
influences. Assuming the hexacopter as a rigid body, the differential equations describing its
dynamic behavior can be derived from the Newton-Euler equations, leading to equivalent
mathematical models. Euler angle parameterization of three-dimensional rotations contains
singular points in the coordinate space that can cause failure of both dynamical models and
control. These singularities are not present if the three-dimensional rotations are parameterized in
terms of quaternions.

[2] Visual Tracking and Control of a Quadcopter -Markus, Zhang, Kolja, Martin:
The control of quadcopter during autonomous flights relies on knowledge of variables like
position, velocity and orientation, which can be partly calculated using information provided by
on-board inertial sensors. However, the drift of inertial sensors leads to errors during time-
discrete integration, making a steadily accurate estimation of the absolute pose nearly
impossible. The 6 DOF of the quadrotor are controlled by four inputs (roll, pitch, yaw, thrust) by
varying the lift forces and the balance of reaction torques through changing the rotating speed of
the rotors. Two pairs of rotors are spinning clockwise and counterclockwise respectively, so that
the sum of their reaction torques is zero during hovering. Unlike normal helicopters, the
propellers of the quadcopter applied in this work have fixed pitch angles. This minimalistic
hardware design (no rotor linkages etc) makes the quadcopter robust such that it can survive
crashes during experiments without getting seriously damaged.

Dept. of ECE Jan - May 2017 Page 4


Wireless Remote Controlled Utility Drone (WiReCUD)

[3] Estimation and Control for an Open-Source Quadcopter-Inkyu Sa, Peter Corke:
The MikroKopter comprises four brushless-DC motors each with its own speed controller. These
communicate via I2C bus to the central flight controller board. The flight control board version
2.1 is based on an Atmega 1284 processor running at 20MHz which implements the state
estimator, control loops, decodes the pulse stream from the radio control receiver, and also
receives commands over a serial data port and transmits status information. The flight control
board holds a triaxial MEMS accelerometer and gyroscope, and a barometric pressure sensor. A
magnetic compass can be fitted but we do not use one. Multi-channel input from a Futaba
handset is read via a digital input pin. For safety the handset must be active to enable the
quadrotor to fly. The flight controller has a serial port which can be used to receive commands or
transmit status information. This is connected to a Zigbee module which allows commands and
status to be communicated wirelessly. The flight controller communicates with a simple packet
protocol over a serial port running at 57600 baud. The packets have a header and a 2-byte
checksum (not CRC16). The ExternControl packet (11 bytes) provides the same inputs to the
flight controller as it receives from the radiocontrol receiver and is a convenient way to allow
control from a computer (or the MikroKopter Navi board which adds GPS waypointing
capability). Roll and pitch values in this packet are 8-bit signed integers that represent desired
roll and pitch values in degrees. The DebugOut packet (66 bytes) provides important state
information from the flight controller such as raw sensor values (inertial sensor values, radio-
control receiver values), estimated state values (attitude, height) and current motor demand
values. The values are all integers. From code analysis and simple static measurements of
acceleration values as a function of vehicle inclination we have determined that attitude is given
in units of deg/10 and accelerations are in units of g/611. The accelerations AccRoll and
AccNick1 are respectively −y¨ and ¨x in the body frame.

Dept. of ECE Jan - May 2017 Page 5


CHAPTER 3: BUILDING THE QUADCOPTER

3.1 Anatomy of the quadcopter

A good quadcopter is designed and built with good parts. Here are the list of
components used to design the WiReCUD.

3.1.1 The Frame:

Any good machine starts off with the right structure. The frame used for the WiReCUD is called
the Q450 frame. A few features of the frame are as follows:

 The main frame is made of high quality glass fiber.


 The arms are reinforced and made of durable polyamide nylon.
 Integrated PCB connections for direct electrical connections.
 Colored arms for pilot reference and orientation.
 Large mounting tabs on the main frame bottom plate for easy mounting of peripheral
devices.
 Pre- threaded brass sleeves for all the frame bolts.

Technical Specifications:

 Width: 450mm.
 Height: 55mm.
 Weight: 270g (without electronics).
 Motor mount bolt holes: 16/19mm.

The presence of an integrated PCB plate eliminates the need for a power distribution board, thus
reducing the overall weight of the drone. Assembly is extremely easy due to the pre-threaded
brass sleeves for all the frame bolts eliminating the need for lock nuts.

Dept. of ECE Jan-May 2017 Page 6


Wireless Remote Controlled Utility Drone (WiReCUD)

Fig. 3.1 Q450 Frame

3.1.2 Brushless DC Motors:

Brushless DC Motors (aka BLDC motors) are synchronous motors powered by DC electricity
via an inverter or switching power supply which produces an AC or bi-directional electric
current to drive each phase of the motor via a closed loop controller. In this context, alternating
current does not imply but does include a sinusoidal waveform, with minimal restriction on
waveform; it must be periodic, and its frequency will determine motor rpm, and the waveform
does affect how smooth the generated torque is as well as the motor's efficiency at transforming
electrical to mechanical energy.

The BLDC motors used in the WiReCUD are Avionic C2830 KV850 quad brushless motors.

Technical Specifications:

 No Load Voltage: 10V.


 No load RPM: 850 RPM/V.
 Motor shaft diameter: 3mm.
 Maximum continuous current: 15A.
 Maximum efficiency: 96%.

Dept. of ECE Jan-May 2017 Page 7


Wireless Remote Controlled Utility Drone (WiReCUD)
 No load Current: 0.6A.
 Maximum current: 18A.
 Resistance: 146m Ohm.
 Weight: 57g.
 Maximum Power: 240W.
 Maximum thrust: 750g.
 Motor diameter: 28mm.
 Motor height: 30mm.

Fig. 3.2 Avionic C2830 KV850 BLDC motors

Number of units used: 04.

3.1.3 The Battery:

A lithium polymer battery aka LiPo battery is a rechargeable battery of lithium ion technology
using a polymer electrolyte instead of the more common liquid electrolyte. High conductivity
semisolid polymers form the electrolytes and they are generally used in quadcopters on account
of their high efficiency and variable discharge rates.

Dept. of ECE Jan-May 2017 Page 8


Wireless Remote Controlled Utility Drone (WiReCUD)
The battery used in the WiReCUD is a 3 cell 2200mah, 35C LiPo battery. This specification of
battery was chosen in order to achieve the maximum flight time while not overpowering the ESC
and motor systems.

Technical Specifications:

 Weight: 177g.
 Battery rating: 2200mah.
 Number of cells: 3.
 Cell voltage: 3.7V.
 Maximum battery voltage: 12V.
 Discharge rate: 35C.
 Maximum working temperature: 36 degree Celsius.
 Time to charge: 2.5 hours.

Fig. 3.3 2200mah 35C LiPo Battery

3.1.4 Propellers:

Propellers are fans that transmit power by converting rotational motion into thrust. A pressure
difference is produced between the forward and rear surfaces of the airfoil shaped blade and air
is accelerated behind the blade. A pair of clockwise and anticlockwise propellers are used to

Dept. of ECE Jan-May 2017 Page 9


Wireless Remote Controlled Utility Drone (WiReCUD)
generate the thrust required to lift the quadcopter. Opposite arms use the same propellers and
adjacent arms use opposite propellers. The propellers are made of durable plastic.

Technical Specifications:

 Dimensions: 10x4.5 inches.

Fig 3.4 10*4.5 Propellers

Number of units used: 04.

3.1.5 Electronic Speed Controller:

Electronic Speed Controller (ESC) is an electronic circuit with the purpose to vary an electronic
motor's speed. It controls the RPM value of the BLDC motor. In order to make all four motors
rotate at the same speed, we need to calibrate our ESCs. Calibration of ESCs ensures each ESC
outputs the same and correct minimum and maximum power to the motors, thus ensuring equal
RPM of each motor. The ESCs used in the WiReCUD have the following specifications.

Technical Specifications:

 ESC Current: 30A.


 Operating voltage range: 8.4V to 16.8V.
 Input signal: PWM signal.
Dept. of ECE Jan-May 2017 Page 10
Wireless Remote Controlled Utility Drone (WiReCUD)
 BEC type: Linear mode.
 BEC output voltage, current: 5V, 0.5A.
 Weight: 28g.
 Dimensions (L*B*H): 36mm*25.5mm*1.6mm.
 Firmware: BLHeli.

Fig. 3.5 30A ESC

Number of units used: 04.

3.1.6 Flight Controller:

The flight controller (FC) is the brain of the quadcopter. It is a circuit board that takes the sensors
data and user commands, and controls the motor in order to keep the quadcopter in the air. The
FC has basic sensors such as gyroscopes and accelerometers and acts as a hub for peripheral
devices such as GPS, LEDs, alarms, etc.

The FC employed by the WiReCUD is the KK 2.1.5. The KK 2.1.5 comes with an on board
control and display system that helps in easy calibration and tuning of settings.

Technical Specifications:

 Size: 50.5mm*50.5mm*12mm.

Dept. of ECE Jan-May 2017 Page 11


Wireless Remote Controlled Utility Drone (WiReCUD)
 Weight: 21g (Including the buzzer).
 IC: Atmega644 PA.
 Gyro/Acc: 6050MPU InvenSense Inc.
 Auto-level: Yes.
 Input Voltage: 4.8 to 6V.
 AVR Interface: Standard 6 pin.
 Signal from Receiver: 1520us (5 channels).
 Firmware Version: 1.6 (Comes with Quadcopter X and + configurations pre-installed).

Fig. 3.6 KK 2.1.5 Flight Controller

3.1.7 Transmitter and Receiver:

Transmitter is an electronic device that accepts user input in terms of throttle, three axes of flying
and other predefined functions, and generates a radio frequency alternating current. When a
connected antenna is excited by this alternating current, the antenna emits radio waves. The
receiver which is mounted on the drone receives these radio waves and translates it for the flight

Dept. of ECE Jan-May 2017 Page 12


Wireless Remote Controlled Utility Drone (WiReCUD)
controller which actuates a response from the motor or peripheral devices. The transmitter and
receiver used in the WiReCUD is the FlySky FS-I6.

Technical Specifications

 Number of Channels: 6.
 RF Range: 2.4 to 2.48 GHz.
 Bandwidth: 500KHz
 Antenna Length: 26mm*2 (Dual Antenna).
 Weight: 392g.
 Batteries: 6V, 1.5AA*4.
 Size: 174*89*190 mm.
 Channel Order: Aileron Ch1; Elevator Ch2; Throttle Ch3; Rudder Ch4; Channels 5 and 6
are user defined.

Fig. 3.7 FlySky FS-I6 Transmitter and Receiver

Dept. of ECE Jan-May 2017 Page 13


Wireless Remote Controlled Utility Drone (WiReCUD)
3.1.8 The Camera:

The camera is a peripheral device that is capable of capturing photos and videos.

The camera mounted on the WiReCUD is a sports action camera called the GoPro. The GoPro is
capable of capturing high resolution images and recording full HD videos for extended durations
of time. The specifications of this camera is as follows.

Technical Specifications:

 Image resolution: 4000x3000 pixels (12MP).


 Video resolution: 1920x1080 pixels (1080p at 60fps).
 Widescreen Video Capture.
 CMOS Optical Sensor.
 WiFi interface for live streaming with range up to 180m.
 32GB of memory.
 Weight: 260g.

Fig. 3.8 GoPro camera

Dept. of ECE Jan - May 2017 Page 14


CHAPTER 4: CALCULATIONS

A lot of measurements and precise calculations are involved in building a


quadcopter. Here are the critical calculations involved for stable flight.

Critical Calculations

4.1 Calculation of Model Weight.

Maximum thrust generated by each motor: 750g (Given in motor specification sheet).

Therefore, total thrust generated = 750*4 =3000g.

For efficient lift off, Model Weight = 0.5*Total Thrust = 1500g.

Maximum permitted model weight = 1700g.

4.2 Calculation of required ESC rating.

Maximum current in the motor: 18A (Given in the motor specification sheet).

The optimum ESC rating lies between 1.2*Max Current and 1.5*Max Current.

Therefore, . I < Optimum ESC Rating < 1.5*Max I


1.2*Max

21.6 < ESC Rating < 27.

Ideal ESC Rating = 25A and above.

ESCs used: 30A ESCs.

Dept. of ECE Jan - May 2017 Page 15


Wireless Remote Controlled Utility Drone (WiReCUD)

4.3 Choosing the propeller size.

450mm quads generally use 8/9/10 inch propellers as they provide the just right amount of thrust.

Propellers used: 10*4.5 inch propellers.

4.4 Choosing the right battery.

Maximum current in each motor: 18A (Given in the motor specification sheet).

Therefore, total maximum current in the drone = 18*4 = 72A.

Ampere hour rating of the battery (A): 2200 mah.

A*C = Total current

Where C is the discharge rate of the battery.

Therefore, discharge rate of the battery (C) = 72/2.2 = 32.72.

Optimum C rating = 35C.

C rating of the battery used: 35.

Based on these calculations and equipment, the estimated flying time is found to be 6 minutes.
But, adhering to the 80% rule*, gives us the practical flying time of 5 minutes.

*80% rule implies that the battery level is never dropped to less than 20% of its maximum
charge as it could permanently damage the battery.
Dept. of ECE Jan - May 2017 Page 16
CHAPTER 5: DESIGN AND ESSENTIAL OPERATIONS

A good design plays a great role in the functionality of a device. The WiReCUD is
designed for easy control, optimization and efficiency.

5.1 Block Diagram:

Fig. 5.1 Block diagram of the WiReCUD

The ends of the ESCs are soldered on to the main frame base plate. Since the frame has an
integrated Power Distribution Board (PDB), it effectively connects the positives of all the ESCs
together while grounding the negatives. A T-Connector is soldered on to the main frame base
plate for the battery connection. Hot glue is put over the solder joints to insulate the connections
and prevent short circuiting. The arms of the quadcopter are then screwed on to the main frame
base plate. The battery straps are then stuck on to the main frame base plate. Then, the main
frame top plate is screwed on. BLDC motors are mounted in the proper place. The ESCs are
fastened to the arms of the quadcopter using zip ties. The KK 2.1.5 flight controller is mounted

Dept. of ECE Jan - May 2017 Page 17


Wireless Remote Controlled Utility Drone (WiReCUD)
on the top of the main frame top plate. The ESC leads are connected to the flight controller in the
appropriate slots. The receiver is mounted on a convenient spot on the main frame. Its antennas
are arranged suitably for optimum reception of transmitted signal. The channel inputs of the
receiver are also connected to the flight controller in the appropriate slots. A buzzer is attached to
the flight controller in order to indicate low voltage/battery. The direction of rotation of the
motors are checked before attaching the propellers. To change the direction of rotation of the
motor, simply interchange any two ESC-motor connections.

In order to ensure that the given receiver only responds to the given transmitter, we
need to 'bind' the transmitter and receiver.

5.2 Binding Procedure:

 Install the batteries in the transmitter and turn it off.


 Connect the binding jumper/key to the battery port of the receiver.
 Connect the battery of the receiver to any channel power supply. The red LED will blink
indicating that it is in binding mode.
 Press and hold the bind key of the transmitter and turn it on.
 The binding procedure is finished when the red LED on the receiver flashes more slowly
than before. Pull out the binding wire and the red indicator stays on.
 Disconnect the receiver battery.
 Turn off the transmitter and then back on.
 Connect all the servos to the receiver and then connect its battery.
 Check if all servos are working as expected.

Upon finishing the binding procedure, the receiver signal information is displayed on the
transmitter screen.

5.3 Flight controller operations:

The KK 2.1.5 flight controller is the brain of the WiReCUD. It has a myriad of sensors which
need to be calibrated. Here are the most important operations that must be performed in order to
get the best stabilization during flight.

Dept. of ECE Jan - May 2017 Page 18


Wireless Remote Controlled Utility Drone (WiReCUD)
5.3.1 ESC calibration:

ESC calibration is an essential part any quadrotor flight. It helps set the limits of maximum and
minimum current outputs by each ESC into the motor. This helps in each motor rotating at the
same rate. The procedure for ESC calibration varies for different flight controllers. The
procedure for the KK 2.1.5 flight controller is as follows.

 Remove all propellers and disconnect the battery.


 On the transmitter, push the throttle stick to the maximum limit.
 Press and hold buttons 1 and 4 on the flight controller.
 While pressing the aforementioned buttons, connect the battery.
 Wait until you hear a few beeps.
 Now, immediately bring the throttle stick to zero.
 Wait until you hear a few beeps.
 Release buttons 1 and 4.

5.3.2 Motor layout:

The motors must rotate in the direction specified by the flight controller. In order to check the
order and rotation of the motors, we need to perform the following steps.

 When the quadcopter is in 'SAFE' mode, go to the menu by pressing button 4.


 Scroll down by pressing button 3 until you reach 'Load Motor Layout'.
 Scroll down again until you reach 'Quadcopter X' configuration and load it.
 Check the motor orientation as displayed on the screen and connect the motors in the
appropriate manner.

5.3.3 Accelerometer calibration:

This helps in stabilization and self leveling of the quadcopter. The procedure involved is:

 When the quadcopter is in 'SAFE' mode, go to the menu by pressing button 4.


 Scroll down by pressing button 3 until you reach 'ACC Calibration'.
 Once selected, place the quadcopter on a level surface and press 'Continue' (Button 4).
 Once the timer counts down, the accelerometers are calibrated.

Dept. of ECE Jan - May 2017 Page 19


Wireless Remote Controlled Utility Drone (WiReCUD)
5.3.4 PI Settings:

 When in 'SAFE' mode, go to the menu by pressing button 4.


 Select 'PI Editor' by pressing button 4.
 Choose the axis of your choice by pressing button 4.
 Press buttons 2 or 3 to access either of P/I Gain values or limits.
 For high speed racing, slightly higher values of P and I are recommended while for free
style flight, slightly lower value of P and I are recommended.

5.4 Arming and disarming the quadcopter:

The user must reserve the right to arm or disarm the quadcopter at will without having to
plug/unplug the batteries. This is achieved by assigning certain actions to arming or disarming
the quadcopter.

 By default, 'yaw right' (Left stick right) arms the quadcopter.


 By default, 'yaw left' (Left stick left) disarms the quadcopter.

Please note that a quadcopter can be armed or disarmed only when the throttle stick is at zero.

Fig. 5.2 KK 2.1.5 Settings

Dept. of ECE Jan - May 2017 Page 20


CHAPTER 6: QUADCOPTER DYNAMICS

6.1 The science behind flying a quadcopter

A quadcopter is governed by the same principal axes as an airplane. Thus, we can study aircraft
axes and apply them for multirotors without loss of generality.

6.1.1 The three principal aircraft axes.

A quadcopter much like an airplane, is governed by three predominant axes which grants it
stability and flight. The three fundamental airplane axes are: The vertical axis (Yaw); The lateral
axis (Pitch) and the Longitudinal axis (Roll).

The 'Yaw' axis runs from the bottom of the plane to the top of the plane and in a quadcopter, it
helps in rotating clockwise or anticlockwise while in plane. The 'Pitch' axis runs from the right
wing to the left wing and in a quadcopter, helps in moving forwards or backwards. The 'Roll'
axis runs from the nose of the plane to the tail of the plane and in a quadcopter, helps it in
moving sideways.

The three fundamental axes and their effects on an airborne system can be illustrated as follows:

Fig. 5.1 The 3 principal aircraft axes

Dept. of ECE Jan - May 2017 Page 21


Wireless Remote Controlled Utility Drone (WiReCUD)

6.2 Quadcopter Dynamics

Quadcopter control is a fundamentally difficult and interesting problem. With six degrees of
freedom (three translational and three rotational) and only four independent inputs, quadcopters
are severely underactuated. In order to achieve six degrees of freedom, translational and
rotational motion are coupled. The resulting dynamics are highly nonlinear, especially after
accounting for the complicated aerodynamic effects. Finally, unlike ground vehicles,
quadcopters have very little friction to prevent their motion, so they must provide their own
damping to in order to stop moving and remain stable. Together, these factors create a very
interesting control problem.

Quadcopter dynamics can be derived by understanding the two frames in which the quadcopter
operates. The inertial frame is defined by the ground, with gravity pointing in the negative z
direction. The body frame is defined by the orientation of the quadcopter, with the rotor axes
pointing in the positive z direction and the arms pointing in the x and y direction.

Fig. 6.2 The two frames of reference

Dept. of ECE Jan - May 2017 Page 22


Wireless Remote Controlled Utility Drone (WiReCUD)
In order to properly model the dynamics of the system, we need an understanding of the
physical properties that govern it. We will begin with a description of the motors being used
for our quadcopter. All motors on the quadcopter are identical, so we can analyze a single one
without loss of generality. Note that adjacent propellers, however, are oriented opposite each
other; if a propeller is spinning “clockwise”, then the two adjacent ones will be spinning
“counter-clockwise”, so that torques are balanced if all propellers are spinning at the same rate.

Fig. 6.3 Basic configuration of a X quadcopter

Each rotor produces both a thrust and torque about its center of rotation, as well as a drag
force opposite to the vehicle's direction of flight. If all rotors are spinning at the same angular
velocity, with rotors one and three rotating clockwise and rotors two and four counterclockwise,
the net aerodynamic torque, and hence the angular acceleration about the yaw axis, is exactly
zero, which mean there is no need for a tail rotor as on conventional helicopters. Yaw is induced
by mismatching the balance in aerodynamic torques (i.e., by offsetting the cumulative thrust
commands between the counter-rotating blade pairs).

Since there are four independent inputs to a quadcopter, there are four different ways in which a
quadcopter can move viz. up/down (defined by the throttle stick), forwards/backwards (defined
by the pitch stick), sideways (defined by the roll stick) and rotate clockwise/counter clockwise
while hovering (defined by the yaw stick).

The configuration of the motors for each of these inputs are illustrated below.

Dept. of ECE Jan - May 2017 Page 23


Wireless Remote Controlled Utility Drone (WiReCUD)
Throttle: A quadcopter hovers or adjusts its altitude by applying equal thrust to all four motors.

Fig. 6.4 Motor configuration for hovering

Yaw: A quadcopter adjusts its yaw by applying more thrust to motors rotating in one direction.

Fig. 6.5 Motor configuration for turning clockwise and counter clockwise respectively.

Pitch and Roll: A quadcopter adjusts its pitch or roll by applying more thrust to one motor and
less thrust to its diametrically opposite motor.

Fig 6.6 Motor configurations for moving forward, backward, left and right respectively.

The flight controller detects changes in user input and configures the motors accordingly.

Dept. of ECE Jan - May 2017 Page 24


CHAPTER 7: APPLICATIONS

A drone is deemed meritable when it accomplishes a specific task. The WiReCUD


being a multipurpose utility drone is capable of performing several tasks.

For the purpose of this project, the applications that are demonstrated are:
 Aerial photography and videography.
 Inventory management using color coding of products.

7.1 AERIAL PHOTOGRAPHY AND VIDEOGRAPHY:

The WiReCUD is equipped with a high definition (HD) sports action camera viz. the GoPro. The
GoPro is capable of live streaming video, recording full HD videos for hours together and also
capturing single images or a burst of images in high resolution. This enables the WiReCUD to
take breathtaking photos and videos of areas inaccessible by man.

The GoPro is mounted on to the WiReCUD by means of an camera mount with a very strong
adhesive base. The mount is stuck on the main frame top plate and the angle of the camera is
adjusted according to user needs.

The GoPro camera is remotely controlled by a proprietary mobile application called "Capture"
available on Android platform and developed by GoPro. The camera is linked to the mobile
phone via WiFi and data is transmitted to the phone via WiFi. The "Capture" app allows the user
to view live streaming of video on his/her mobile device, capture images and record videos.

The resolution of the images taken by the camera is 4000x3000 pixels for a 12MP wide image.
The videos are shot in 1080p at 60fps with a resolution of 1920x1080. The range of WiFi can
extend up to 600 feet which is around 182 metres.

A few samples of the images taken by the WiReCUD is enclosed in this document.

Dept. of ECE Jan - May 2017 Page 25


Wireless Remote Controlled Utility Drone (WiReCUD)
7.1.1 Photos taken by the WiReCUD.

Fig. 7.1 A still during sunset

Fig. 7.2 A still in the sunset that captures a bird flying by

Dept. of ECE Jan - May 2017 Page 26


Wireless Remote Controlled Utility Drone (WiReCUD)
7.1.2 Screenshots of videos taken by the WiReCUD

Fig. 7.3 A general snapshot

Fig. 7.4 A snapshot depicting a cricket practice session

Dept. of ECE Jan - May 2017 Page 27


Wireless Remote Controlled Utility Drone (WiReCUD)
Sec: 7.2
INVENTORY MANAGEMENT USING COLOR CODING OF PRODUCTS:

Inventory management is the supervision of non-capitalized assets (inventory) and stock items.

A component of supply chain management, inventory management supervises the flow of goods
from manufacturers to warehouses and from these facilities to point of sale. A key function of
inventory management is to keep a detailed record of each new or returned product as it enters or
leaves a warehouse or point of sale.

Every business has to undergo the tedious and mundane aspect of inventory management in
order to keep business profitable. More often than not, a lot of businesses employ manpower for
this trivial yet crucial operation. This leads to decreased efficiency of labour, time and introduces
an opportunity for errors.

In order to mitigate these problems, the WiReCUD can play a pivotal role in this new scheme of
inventory management.

In this scheme, each product in the product catalogue comes with a unique 'color code'. Each
color code is a combination of the three primary colors viz. Red, Green and Blue arranged in a
2x2 matrix. One of the boxes in the matrix is always 'white' at any given time. This gives a total
of up to 108 unique possible combinations.

This method of inventory management is best suited for small businesses and traders who deal
with a limited number of products. Likely consumers of this application can be grocery traders,
farmers, small retailers etc.

The brilliance of this application lies in the fact that this method is user defined. Any group of
related users can assign a non universal color code for a product (Unlike bar codes, which is a
universal product code). Universal Product Codes (UPCs) are paid services that require an
annual service fee. This inhibits small traders from utilizing the benefits of automated inventory

Dept. of ECE Jan - May 2017 Page 28


Wireless Remote Controlled Utility Drone (WiReCUD)
management. All one needs to process color coded products is a computer (To store and view
inventory) and a camera (This is where the WiReCUD steps in).

Also, this system is non-specific, i.e. color codes need not always have to be a 2x2 matrix. They
can be changed according to user needs into an array, rectangular matrices etc. Thus, this scheme
can be scaled to accommodate more than 2000 different products.

7.2.1 DECIPHERING THE COLOR CODE


The process of decoding a color code are as follows:
 Load the image containing the color code to the program.
 Extract the red, green and blue components of the image.
 Use a median filter to remove noise.
 Remove objects of pixel size smaller than a particular threshold.
 Find the coordinates of the centroid of red, green and blue.
 Compare the relative positions of the centroid of red, green and blue.
 Categorize the item and load the next color code for processing.

It is prudent to observe that it is not necessary that these color codes be printed and stuck onto a
box. Pens, markers or crayons can be used just as effectively to generate color codes.

The limitation/drawback of this system however is that it cannot be implemented in the absence
of light. Also, since the WiReCUD makes a video recording of all the color codes, human
intervention is required to extract the color codes from various parts of the video.

The platform used to implement this application is MATLAB and the sample code is provided in
the appendix section of this document on page 42.

7.2.2 Color code database: The database of all possible color codes in ascending order are
displayed below in Fig. 6.5. Thus, the color code in the first row and first column represents item
1 while the color code in the second row, second column represents item 6 and so on until the
color code in 36th row and 4th column represents item 108.

Dept. of ECE Jan - May 2017 Page 29


Wireless Remote Controlled Utility Drone (WiReCUD)

Dept. of ECE Jan - May 2017 Page 30


Wireless Remote Controlled Utility Drone (WiReCUD)

Dept. of ECE Jan - May 2017 Page 31


Wireless Remote Controlled Utility Drone (WiReCUD)

Dept. of ECE Jan - May 2017 Page 32


Wireless Remote Controlled Utility Drone (WiReCUD)
7.2.3 Output:
For the following 'ideal' input color codes,

Code for item 1 Code for item 4 Code for item 10

Code for item 36 Code for item 39 Code for item 84

Fig. 7.6 Example input 1


The output is:

Fig. 7.7 Example Output 1


This program, in addition to processing an ideal color code, also works equally well with a
practical color code.

Dept. of ECE Jan - May 2017 Page 33


Wireless Remote Controlled Utility Drone (WiReCUD)
For the following 'practical' color code:

Code for item 10 Code for item 11 Code for item 20

Code for item 20


Code for item 2
Code for item 1

Fig. 7.8 Example input 2


The output is:

Fig. 7.9 Example output 2

Dept. of ECE Jan - May 2017 Page 34


Wireless Remote Controlled Utility Drone (WiReCUD)
7.2.4 Analysis of results.
In the first example taken above, we considered 'ideal' color codes which have ideal
characteristics such as high color saturation, equal x & y coordinates and perfect orientation or
zero tilt. These factors are highly favorable and pose no problems during color and coordinate
detection.
For the purpose of demonstration, we have chosen six different and random ideal color codes
from the given color code database. The result is that each color code has been identified and the
item/product corresponding to that color code has been added to the inventory list. The total
stock of items in the inventory and the transaction cost is computed.
Color Code Chosen Item added to inventory Total Number Cost of item
Code 1 Item 1 1 42
Code 4 Item 4 1 79
Code 10 Item 10 1 19
Code 36 Item 36 1 24
Code 39 Item 39 1 34
Code 84 Item 84 1 84

Total Cost: 282

In the second example taken above, we have considered 'practical' color codes which suffer
imperfections such as low color saturation, improper orientation leading to varying values of x &
y coordinates. This makes comparison of relative positions quite difficult. In order to solve this
problem, error correcting measures are implemented.
For the purpose of demonstration, we have chosen six color codes, five being different and one
being a copy of another color code. The result is that each color code is identified irrespective of
the nature of imperfection and the corresponding item/product is added to the inventory list. The
total stock of items in the inventory and the transaction cost is computed.
Color Code Chosen Item added to inventory Total Number Cost of item
Code 1 Item 1 1 42
Code 2 Item 2 1 53
Code 10 Item 10 1 19
Code 11 Item 11 1 53
Code 20 Item 20 2 02

Total Cost: 171

Dept. of ECE Jan - May 2017 Page 35


CHAPTER 8: POTENTIAL APPLICATIONS

The WiReCUD has the potential to perform several other applications. Here are
some of the applications that are feasible using this drone but are not demonstrated
as a part of the final year project.

8.1 LEAF DISEASE DETECTION USING FEATURE EXTRACTION:

The basic premise of this application is that certain leaf diseases have specific characteristics and
leave marks which are unique in their own sense on certain leaves. A sample photo of the
diseased leaf is taken and pre processed in order to remove noise and enhance the quality of the
image. A smoothening filter is used to smoothen the image (Enhance contrast etc.). The image is
later segmented, each segment containing parts of the image that are similar. This gives us a fair
idea about the severity of disease spread across various parts of the leaf. Segmentation can be
done using various methods such as K-means clustering, boundary and spot detection algorithm
etc. One of the segments of the image consisting of the region of interest is chosen to be
analyzed. The infected leaf shows the symptoms of the disease by changing the color of the leaf.
Hence the greenness of the leaf can be used for the detection of infected portion of the leaf.
Feature extraction plays a major role for the identification of diseased regions of the leaf.

Fig. 8.1 Steps involved in leaf disease detection

Dept. of ECE Jan - May 2017 Page 36


Wireless Remote Controlled Utility Drone (WiReCUD)
The impact of this application is far too great to be neglected. This application could provide as a
low cost alternative for farmers and gardeners alike to identify diseases and seek support online
than compared to consulting an arborist to do the exact same job. Thus, diseases like bacterial
blight, anthracnose, cercospora leaf spots, alternaria alternata etc. can be easily identified.

The limitation of this application is that the characteristics of the diseases should be remarkably
different to give accurate results. Thus the aforementioned diseases which have radically
different characteristics can be identified and classified with accuracy. Also, this requires a huge
database of sample leaves of each disease to accurately perform feature extraction.

8.2 FPV RACING AND VR EXPERIENCE:

First Person View (FPV) racing is an exciting new sport that combines high tech drones and high
speed racing. For this purpose, a FPV camera is mounted onto a drone and is coupled to a FPV
goggle. What the drone pilots see while they are flying are the low latency analog video from
FPV cameras. The experience offered by FPV cameras is two dimensional (2D).

Virtual Reality (VR) experience is similar to FPV experience except from the fact that it offers a
three dimensional (3D) experience. A VR camera is mounted on a drone and a VR headset is
used to enjoy the virtual experience of flying in the air. VR experiences are generally limited to
slow flying drones as opposed to FPV experiences which are generally used in high speed racing.

Besides these, drones open up a world of other interesting applications that include real time
traffic management, real time surveillance in security operations, situation assessment in case of
calamities, mineral mapping using remote exploration, pesticide/medicine spraying, apiary
management etc.

Dept. of ECE Jan - May 2017 Page 37


CHAPTER 9: CONCLUSION

For the purpose of the final year project, we have successfully designed a multi utility drone
which is capable of capturing images, recording videos and also helps perform inventory
management. The details of the project and their applications are summarized in this report.

In conclusion, we began with a generic introduction to quadcopter technology and introduced the
problem statement under consideration and the necessary assumptions and constraints of the
project. We delved into the anatomy of the quadcopter and understood the specifications of each
component that makes the WiReCUD. We later learnt the necessary calculations required while
choosing the right components. We looked into some key procedures required for proper
stabilization of the drone. We understood the dynamics which dictate the laws of quadcopter
control and flight.

We later demonstrated the applications namely, 'Aerial photography and videography' and
'Inventory management using color coding of products'. From the results of these applications,
we can infer that the WiReCUD can play an indispensable role in alleviating human effort and in
some cases, help automate certain processes thus making tasks more efficient. Lastly, we listed a
few possible applications that can be accomplished using the WiReCUD.

After months of persistent hard work and development, we have the following final product.

Fig. 9.1 The final product (WiReCUD)

Dept. of ECE Jan - May 2017 Page 38


CHAPTER 10: QUADCOPTER MAINTENANCE

The WiReCUD is built for durability and ruggedness, but prolonged abuse can lead to permanent
damages. In such cases, it is prudent to find replacement parts as soon as possible. A few
common cases for which parts get damaged are listed below and their corresponding replacement
or repair tips are also given.

 Crash landings and rough handling can lead to deterioration of the quadcopter arm
structure, leading to cracks/fractures and eventually breakages. It is highly recommended
a spare arm be utilized instead of repairing the existing one.

 The bullet connectors connected to the motor ends often come off quite easily. It is
advised to check the connections before flight lest it come off during flight. In case a
bullet connector does come off, the connection can be re-established by soldering the
ends of the motor to the bullet connector.

 The balance plug of a battery (Charging Pin) is often let loose during quadcopter flight
and is often damaged by propellers spinning at high speeds. In such cases, it is advised to
tape the ends of a spare balance plug than to solder them as the extreme heat from the
soldering iron can short the charging pins, thereby ruining the battery later on.

 It is never recommended that the quadcopter be flown over wet grass as little amounts of
water is sufficient to short the connections on the flight controller, thereby damaging the
board and in some cases, cause fire.

 Propellers are extremely vulnerable and break very often. Thus, it is recommended that
the quadcopter be flown on soft surfaces such as grass.

Warning

Multirotors are extremely dangerous and must be operated under strict supervision of
experienced personnel. Quadcopters must always be disarmed while not in use and the battery
disconnected. Any accidental exposure to propellers must be met with immediate first aid.

Dept. of ECE Jan - May 2017 Page 39


APPENDIX
References:
1. V.Artale, C.L.R Milazzo and A. Ricciardello.
Mathematical Modeling of Hexacopter: Kore University of Enna Faculty of Engineering and
Architecture Cittadella Universitaria- 94100 - Enna, Italy.

2. J. Verbeke, D. Hulens, H. Ramon, T. Goedemé and J. De Schutter. The Design and


Construction of a High Endurance Hexacopter suited for Narrow Corridors Modeling and
control of a hexa-copter: Brno University of Technology, Czech Republic , IEEE May 2012.

3. Inkyu Sa, Peter Corke System identification, estimation and control for a cost effective
open-source quadcopter, Queensland University of Technology, Australia, IEEE, 28 June, 2012.

4. Markus Achtelik, Tianguang Zhang, Kolja Kuhnlenz ,Visual tracking and control of a
quadcopter using a stereo camera systems and inertial sensors :, Institute of Automatic Control
Engineering (LSR), Technische Universität München, D-80290 Munich, Germany. IEEE
Germany.

5. Andrea Giorgetti; Matteo Lucchi; Marco Chiani; Moe Z. Win IEEE Transactions on
Aerospace and Electronic Systems, 2011

6. I. S. Kryvokhatko; V. V. Sukhov 2013 IEEE 2nd International Conference Actual Problems


of Unmanned Air Vehicles Developments Proceedings (APUAVD), 2013

7. N. Goddemeier, K. Daniel, and C. Wietfeld, “Role-based connectivity management with


realistic air-to-ground channels for cooperative UAVs,” IEEE J. Sel. Areas Commun., vol. 30,
no. 5, pp. 951–963, Jun. 2012.

Dept. of ECE Jan - May 2017 Page 40


Wireless Remote Controlled Utility Drone (WiReCUD)
Online resources:

1. http://andrew.gibiansky.com/blog/physics/quadcopter-dynamics/

2. https://www.youtube.com/watch?v=FXYCK_Q-
82I&list=PLjtPmfQ3Of5_fLdnEsOu5COWW-tfGzxRn

3. https://www.youtube.com/watch?v=eSCvCAC7Q-c

4. http://multicopter.forestblue.nl/multicopter_basics.html

5. https://oscarliang.com/build-a-quadcopter-beginners-tutorial-1/

6. https://myfirstdrone.com/build-your-first-quad/

7. http://quadcopterguru.com/diy-quadcopter-guide/

8. https://myfirstdrone.com/tutorials/how-to-fly-a-quadcopter/how-to-hover-a-quadcopter/

Data sheets:

1. Motor data sheet: http://www.rcbazaar.com/product.aspx?productid=1905

2. ESC data sheet: http://www.sarkanyellato.hu/wp-content/uploads/2011/10/RC-Timer-


10.18.30.40A-ESC-Instruction.pdf

3. Flight controller data sheet: https://hobbyking.com/media/file/825710515X1372583X25.pdf

Dept. of ECE Jan - May 2017 Page 41


Wireless Remote Controlled Utility Drone (WiReCUD)

Sample code for 'Inventory management using color coding of products'.


clear all; close all; clc;
tr=100; Cost=0; pix=3000;
redcoeff=0.1;grecoeff=0.05;bluecoeff=0.1;
for j = 1:108
Num_item(j) = 0;
end
%Cost of items database
Cost_item001 = 42 ;Cost_item002 = 53 ;Cost_item003 = 45 ;Cost_item004 = 79
;Cost_item005 = 48 ;Cost_item006 = 25 ;Cost_item007 = 38 ;Cost_item008 = 16
;Cost_item009 = 07 ;Cost_item010 = 19 ;
Cost_item011 = 53 ;Cost_item012 = 46 ;Cost_item013 = 12 ;Cost_item014 = 46
;Cost_item015 = 40 ;Cost_item016 = 68 ;Cost_item017 = 46 ;Cost_item018 = 76
;Cost_item019 = 37 ;Cost_item020 = 02 ;
Cost_item021 = 76 ;Cost_item022 = 98 ;Cost_item023 = 23 ;Cost_item024 = 26
;Cost_item025 = 32 ;Cost_item026 = 01 ;Cost_item027 = 35 ;Cost_item028 = 38
;Cost_item029 = 03 ;Cost_item030 = 64 ;
Cost_item031 = 58 ;Cost_item032 = 14 ;Cost_item033 = 65 ;Cost_item034 = 06
;Cost_item035 = 64 ;Cost_item036 = 24 ;Cost_item037 = 23 ;Cost_item038 = 61
;Cost_item039 = 34 ;Cost_item040 = 29 ;
Cost_item041 = 34 ;Cost_item042 = 69 ;Cost_item043 = 78 ;Cost_item044 = 08
;Cost_item045 = 91 ;Cost_item046 = 24 ;Cost_item047 = 79 ;Cost_item048 = 37
;Cost_item049 = 09 ;Cost_item050 = 27 ;
Cost_item051 = 78 ;Cost_item052 = 27 ;Cost_item053 = 09 ;Cost_item054 = 03
;Cost_item055 = 64 ;Cost_item056 = 32 ;Cost_item057 = 60 ;Cost_item058 = 49
;Cost_item059 = 46 ;Cost_item060 = 18 ;
Cost_item061 = 89 ;Cost_item062 = 75 ;Cost_item063 = 79 ;Cost_item064 = 19
;Cost_item065 = 50 ;Cost_item066 = 97 ;Cost_item067 = 64 ;Cost_item068 = 83
;Cost_item069 = 37 ;Cost_item070 = 32 ;
Cost_item071 = 30 ;Cost_item072 = 12 ;Cost_item073 = 65 ;Cost_item074 = 36
;Cost_item075 = 84 ;Cost_item076 = 28 ;Cost_item077 = 80 ;Cost_item078 = 21
;Cost_item079 = 64 ;Cost_item080 = 39 ;
Cost_item081 = 20 ;Cost_item082 = 57 ;Cost_item083 = 32 ;Cost_item084 = 84
;Cost_item085 = 34 ;Cost_item086 = 65 ;Cost_item087 = 21 ;Cost_item088 = 64
;Cost_item089 = 52 ;Cost_item090 = 69 ;
Cost_item091 = 85 ;Cost_item092 = 26 ;Cost_item093 = 89 ;Cost_item094 = 56
;Cost_item095 = 31 ;Cost_item096 = 20 ;Cost_item097 = 63 ;Cost_item098 = 87
;Cost_item099 = 61 ;Cost_item100 = 68 ;
Cost_item101 = 38 ;Cost_item102 = 36 ;Cost_item103 = 46 ;Cost_item104 = 64
;Cost_item105 = 78 ;Cost_item106 = 60 ;Cost_item107 = 15 ;Cost_item108 = 62 ;

%Load images continuously


for k = 1:*Number of color codes*
jpgFileName = strcat('*Filename*', num2str(k), '.*extension*');
if exist(jpgFileName, 'file')
data = imread(jpgFileName);
else
fprintf('File %s does not exist.\n', jpgFileName);
data = imread ('black.jpg');

Dept. of ECE Jan - May 2017 Page 42


Wireless Remote Controlled Utility Drone (WiReCUD)
end
%Initialise all co-ordinates to zero
Xred=[0,0,0];Xgre=[0,0,0];Xblue=[0,0,0];
Yred=[0,0,0];Ygre=[0,0,0];Yblue=[0,0,0];
%The Red Part
diff_imred = imsubtract(data(:,:,1), rgb2gray(data));
%Use a median filter to filter out noise
diff_imred = medfilt2(diff_imred, [3 3]);
diff_imred = im2bw(diff_imred,redcoeff);
diff_imred = bwareaopen(diff_imred,pix);
bwred = bwlabel(diff_imred, 8);
statsred = regionprops(bwred, 'BoundingBox', 'Centroid');
% Display the image
imshow(data)
hold on
for object = 1:length(statsred)
bbred = statsred(object).BoundingBox;
bcred = statsred(object).Centroid;
Xred(object)=round(bcred(1)); Yred(object)=round(bcred(2));
rectangle('Position',bbred,'EdgeColor','r','LineWidth',2)
plot(bcred(1),bcred(2), '-m+')
a=text(bcred(1)+15,bcred(2), strcat('X: ', num2str(round(bcred(1))), ' Y: ',
num2str(round(bcred(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color',
'black');
end
hold off

%The Green Part


diff_imgre = imsubtract(data(:,:,2), rgb2gray(data));
%Use a median filter to filter out noise
diff_imgre = medfilt2(diff_imgre, [3 3]);
diff_imgre = im2bw(diff_imgre,grecoeff);
diff_imgre = bwareaopen(diff_imgre,pix);
bwgre = bwlabel(diff_imgre, 8);
statsgre = regionprops(bwgre, 'BoundingBox', 'Centroid');
hold on
for object = 1:length(statsgre)
bbgre = statsgre(object).BoundingBox;
bcgre = statsgre(object).Centroid;
Xgre(object)=round(bcgre(1)); Ygre(object)=round(bcgre(2));
rectangle('Position',bbgre,'EdgeColor','r','LineWidth',2)
plot(bcgre(1),bcgre(2), '-m+')
a=text(bcgre(1)+15,bcgre(2), strcat('X: ', num2str(round(bcgre(1))), ' Y: ',
num2str(round(bcgre(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color',
'black');
end
hold off

%The Blue Part


diff_imblue = imsubtract(data(:,:,3), rgb2gray(data));

Dept. of ECE Jan - May 2017 Page 43


Wireless Remote Controlled Utility Drone (WiReCUD)
%Use a median filter to filter out noise
diff_imblue = medfilt2(diff_imblue, [3 3]);
diff_imblue = im2bw(diff_imblue,bluecoeff);
diff_imblue = bwareaopen(diff_imblue,pix);
bwblue = bwlabel(diff_imblue, 8);
statsblue = regionprops(bwblue, 'BoundingBox', 'Centroid');
hold on
for object = 1:length(statsblue)
bbblue = statsblue(object).BoundingBox;
bcblue = statsblue(object).Centroid;
Xblue(object)=round(bcblue(1)); Yblue(object)=round(bcblue(2));
rectangle('Position',bbblue,'EdgeColor','r','LineWidth',2)
plot(bcblue(1),bcblue(2), '-m+')
a=text(bcblue(1)+15,bcblue(2), strcat('X: ', num2str(round(bcblue(1))), ' Y:
', num2str(round(bcblue(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color',
'black');
end
hold off

%Inventory management
if
(~(Yred(1)<Yblue(1))&&(Xblue(1)>Xgre(1))&&~Xblue(2)&&~Xgre(2)&&abs(Xred(1)-
Xgre(1)<tr)&&(Xred(1)<Xblue(1))&&abs(Yred(1)-Yblue(1)<tr)&&(Yred(1)<Ygre(1)))
disp('A box of item 1 has entered the warehouse');
Num_item(1)=Num_item(1)+1; Cost = Cost+Cost_item001;
elseif
(~(Yred(1)<Ygre(1))&&(Xgre(1)>Xblue(1))&&~Xblue(2)&&~Xgre(2)&&abs(Xred(1)-
Xblue(1)<tr)&&(Xred(1)<Xgre(1))&&abs(Yred(1)-Ygre(1)<tr)&&(Yred(1)<Yblue(1)))
disp('A box of item 2 has entered the warehouse');
Num_item(2)=Num_item(2)+1; Cost = Cost+Cost_item002;
elseif (~(Yred(1)<Yred(2))&&(Xred(2)>Xgre(1))&&abs(Xred(1)-
Xgre(1)<tr)&&(Xred(1)<Xred(2))&&abs(Yred(1)-Yred(2)<tr)&&(Yred(1)<Ygre(1)))
disp('A box of item 3 has entered the warehouse');
Num_item(3)=Num_item(3)+1; Cost = Cost+Cost_item003;
elseif (~(Yred(1)<Ygre(1))&&(Xgre(1)>Xred(2))&&abs(Xred(1)-
Xred(2)<tr)&&(Xred(1)<Xgre(1))&&abs(Yred(1)-Ygre(1)<tr)&&(Yred(1)<Yred(2)))
disp('A box of item 4 has entered the warehouse');
Num_item(4)=Num_item(4)+1; Cost = Cost+Cost_item004;
elseif (~(Yred(1)<Yred(2))&&(Xred(2)>Xblue(1))&&abs(Xred(1)-
Xblue(1)<tr)&&(Xred(1)<Xred(2))&&abs(Yred(1)-Yred(2)<tr)&&(Yred(1)<Yblue(1)))
disp('A box of item 5 has entered the warehouse');
Num_item(5)=Num_item(5)+1; Cost = Cost+Cost_item005;
elseif (~(Yred(1)<Yblue(1))&&(Xblue(1)>Xred(2))&&abs(Xred(1)-
Xred(2)<tr)&&(Xred(1)<Xblue(1))&&abs(Yred(1)-Yblue(1)<tr)&&(Yred(1)<Yred(2)))
disp('A box of item 6 has entered the warehouse');
Num_item(6)=Num_item(6)+1; Cost = Cost+Cost_item006;
elseif
(~(Yred(1)<Ygre(2))&&~Xgre(3)&&~Xblue(1)&&~Yblue(1)&&~Xblue(2)&&~Yblue(2)&&ab
s(Xred(1)-Xgre(1)<tr)&&(Xred(1)<Xgre(2))&&abs(Yred(1)-
Ygre(2)<tr)&&(Yred(1)<Ygre(1)))
disp('A box of item 7 has entered the warehouse');

Dept. of ECE Jan - May 2017 Page 44


Wireless Remote Controlled Utility Drone (WiReCUD)
Num_item(7)=Num_item(7)+1; Cost = Cost+Cost_item007;
elseif (~(Yred(1)<Yblue(2))&&~Xgre(1)&&~Xblue(3)&&abs(Xred(1)-
Xblue(1)<tr)&&(Xred(1)<Xblue(2))&&abs(Yred(1)-
Yblue(2)<tr)&&(Yred(1)<Yblue(1)))
disp('A box of item 8 has entered the warehouse');
Num_item(8)=Num_item(8)+1; Cost = Cost+Cost_item008;
elseif (~(Yred(1)<Yred(3))&&abs(Xred(1)-
Xred(2)<tr)&&(Xred(1)<Xred(3))&&abs(Yred(1)-Yred(3)<tr)&&(Yred(1)<Yred(2)))
disp('A box of item 9 has entered the warehouse');
Num_item(9)=Num_item(9)+1; Cost = Cost+Cost_item009;
elseif
(~(Ygre(1)<Yred(1))&&(Xred(1)>Xblue(1))&&~Xred(2)&&~Xblue(2)&&abs(Xgre(1)-
Xblue(1)<tr)&&(Xgre(1)<Xred(1))&&abs(Ygre(1)-Yred(1)<tr)&&(Ygre(1)<Yblue(1)))
disp('A box of item 10 has entered the warehouse');
Num_item(10)=Num_item(10)+1; Cost = Cost+Cost_item010;

.
. And so on, up
to 108 test cases
.
.
.
elseif (abs(Yblue(1)-
Ygre(2)<tr)&&(Xblue(1)<Xgre(2))&&(Ygre(1)<Ygre(2))&&abs(Xgre(1)-Xgre(2)<tr))
disp('A box of item 107 has entered the warehouse');
Num_item(107)=Num_item(107)+1;Cost = Cost+Cost_item107;
elseif (abs(Yblue(1)-
Yblue(3)<tr)&&(Xblue(1)<Xblue(3))&&(Yblue(2)<Yblue(3))&&abs(Xblue(2)-
Xblue(3)<tr))
disp('A box of item 108 has entered the warehouse');
Num_item(108)=Num_item(108)+1; Cost = Cost+Cost_item108;
else disp('Skipping this iteration');
end
end

%Display the inventory


disp('Here is the final inventory list')
for j=1:108
if (Num_item(j)>0)
fprintf('The total number of item %d is %d\n',j,Num_item(j));
end
end
%Display the cost of items moved
fprintf('The cost of transaction is %d\n',Cost);

Dept. of ECE Jan - May 2017 Page 45


INDIVIDUAL CONTRIBUTIONS
Ashwin Bhat (1PI13EC021) has contributed greatly to the realization of this
particular project. His contributions range from creative suggestions for alleviating
practical limitations to testing and identifying errors in proofs of concept. He also
came up with suitable values for the PID settings.

Gururaj Joshi (1PI13EC035) has played an essential role in the completion of this
project. His contributions spread from procurement of various components to
piloting the quadcopter. He has played a very important role in the design and
construction of the WiReCUD. It is safe to say that without his perseverance,
determination and resourcefulness, this project would not be finished on time.

Nirmal Hegde (1PI13EC062) has played a vital role in building and developing the
WiReCUD. His contribution range from procuring components to piloting the
quadcopter to documenting results and creating reports. He also is the progenitor of
the application 'Inventory management using color coding of products'. It is safe to
say that without his contributions, this project would have a very hard time coming
into fruition.

Dept. of ECE Jan - May 2017 Page 46

You might also like