Quad Copter
Quad Copter
Abstract
The goal of this project was to design the quadcopter flying robot control from
Radio frequency and Wi-Fi technology. The purpose of this system was to
save time and reduce the extra cost unless necessary instead of using the
actual vehicle in the filming, surveillance research and rescue missions by
military and law enforcement agencies, etc. Moreover, this project was
intended to know about the calibration and balancing the quadcopter flying
robot control from the microprocessor. Quadcopter is able to control from a
computer in Surveillance WI-Fi communication port forwarding feature via the
internet.
Contents
Abstract
Table Contents
Acknowledgements
1. Introduction............................................................................................................................ 2
2. Arduino Nano ........................................................................................................................ 4
3. Brushless DC Motors (1300kv) .......................................................................................... 5
4. Electronic Speed Controller (ESC) .................................................................................... 7
5. ESC Features ....................................................................................................................... 7
6. ESC Calibrating .................................................................................................................... 8
7. Motor test result .................................................................................................................. 10
8. Frame/ measurement (x525 Quad frame) ...................................................................... 11
9. Accelerometer and Gyroscope ......................................................................................... 12
10. Gyro or M.E.M.S............................................................................................................. 12
11. Magnetometer................................................................................................................. 13
12. Theory of Roll/ Pitch & Yaw .......................................................................................... 14
13. Stabilization System ...................................................................................................... 15
14. Propellers ........................................................................................................................ 17
15. Balancing the Propeller ................................................................................................. 18
16. Ultrasonic Distance Sensors (HC-SR04).................................................................... 19
17. Altitude Hold.................................................................................................................... 22
19. Wi-Fi and Radio Control System Tx/ Rx ..................................................................... 23
20. RC Transmitter ............................................................................................................... 26
21. Power System (Li-po battery) ....................................................................................... 26
22. Designed the hardware and Software Choice ........................................................... 28
23. PID Theory ...................................................................................................................... 29
24. Reducing the vibration ................................................................................................... 30
25. Testing Experience Results and Calculations ........................................................... 31
26. Costs ................................................................................................................................ 34
27. Project Management Planning ..................................................................................... 34
28. Conclusions .................................................................................................................... 35
29. ENCE PROJECT SPECIFICATION FORM ............................................................... 36
30. Suggestions for further work ........................................................................................ 37
31. References and Bibliography ....................................................................................... 37
32. Appendices ..................................................................................................................... 39
1|P a g e
QUADCOPTER PROJECT
Acknowledgements
Firstly, I would like to thank to my family who inspired and fully supported me
for financial and advance the education of engineering.
I also want to thank to my Real-time lecturer Martin Giles from second year
who gave me the motivation and the knowledge of microprocessor. My final
year individual project depends on the knowledge of what Martin Giles has
taught us during the second year. I had enough education to do this
quadcopter project thus I decided to do it.
Thanks to all the staff members and lecturer of University of Westminster and
Computer System Engineering Department that made to get us the
graduation year for their effort.
1. Introduction
2|P a g e
QUADCOPTER PROJECT
Nowadays people use the quadcopter for video filming, research platform,
Military and law enforcement, etc. Instead of using the actual helicopter. It
is a lot of saving money, no fuel cost, reduce the carbon dioxide into the
atmosphere (air pollution) and speed and efficiency. People use it for sky shot
video filming or very high location shot and crowded people in the event
instead of using filming crane. Quadcopter are used for surveillance research
and rescue missions by military and law enforcement agencies. The largest
use of quadcopters in the USA has been in the field of aerial imagery as
taking record video or photo of nature.
This project aims for young people who is learning the computer, electronic
science, to understand about the microprocessor, using different between
WIFI wireless signal and Radio signal and who try to build low cost
quadcopter. This project has been combined with the economic components
and efficient quadcopter. It is based on the theory but more practical than
theory. Most of the flying devices are based on the theory, then actual
balance, calibrate and level depending on the hardware.
There are many types of quadcopters
3|P a g e
QUADCOPTER PROJECT
2. Arduino Nano
My own source code of C program plus multiwii flight control code combined
together and uploaded into Arduino nano to control the whole quadcopter
system. My own source code is created for an altitude hold feature, auto
landing system and WIFI control system. Multiwii flight control code was used
for main PID control.
4|P a g e
QUADCOPTER PROJECT
This is the main part of the quadcopter project. Firstly, find out what type of
motor will be required and how many amperes or how many kv of motor will
be needed. There are two types of motors, brushed motor and brushless
motor. Brushed motor runs on direct current (DC). The speed of the motor
depends largely on the voltage supplied. Brushless motor runs on alternating
current (AC). The speed of the motor depends largely on the rate at which the
alternating current is switched.
Coin A Magnet
Coin B
Coin C
A brushless Motor will generally have three sets of wiring, there are red wire,
black wire and yellow wire. All the wires are connected to Electronic Speed
5|P a g e
QUADCOPTER PROJECT
Control (ESC). The Red wire goes to Vcc+ of ESC, Black go to GND of ESC
and Yellow is the middle coin of the motor which connect to the middle wire of
ESC. Red and black wire depending on the direction of the motor turning
direction see (Table.3.1). This brushless RCX07-013 model is support
maximum 19A current, 275W maximum power, Rotation speed 1300kv
(RPM/v) and 930g maximum pull per motor. The equation of the requires
RPM below.
6|P a g e
QUADCOPTER PROJECT
Signal
+5v
+12V + ESC
GND
20A Brushless
motor
-
GND
5. ESC Features
5.2 Brake
This brake feature just stops turning the motor when the throttle is zero from
Radio control or Wi-Fi control.
7|P a g e
QUADCOPTER PROJECT
6. ESC Calibrating
8|P a g e
QUADCOPTER PROJECT
9|P a g e
QUADCOPTER PROJECT
This is result of motor performance below after ESC and motor calibration.
10 | P a g e
QUADCOPTER PROJECT
11 | P a g e
QUADCOPTER PROJECT
When we think the gyro we usually think about a big heavy spinning object
like bicycle wheel as long as they keep spinning one in axis fast enough they
do not want to fall over. This is the same example can be also apply other
moving structure not just spinning object. For example, fly insect is flipping
wing keep up and down with the same speed so this insect can correct their
body balance.
Also the single electronic gyro uses the same basic principle. There is a micro
coin vibrator back and forward with the piezoelectric current when the gyro
changes the angle the micro coin will keep vibrating up and down in the same
direction. This thing pushes pressure on the piezoelectric components which
12 | P a g e
QUADCOPTER PROJECT
11. Magnetometer
The accelerometer can sense only roll and pitch rotation, which cannot sense
the yaw rotation. However, gyroscope can sense the yaw rotation, but it
cannot point the direction of the magnetic field and direction. In this case
quadcopter used the magnetometer to measure the yaw rotation.
Magnetometer measures the direction of the magnetic field which way is
North, South, East and West. Therefore quadcopter can follow the waypoint
of pilot seat. This is an additional feature for the quadcopter. Especially, if the
quadcopter used the GPS device, magnetometer must be installed, the pole
locations are used as a reference together with the Yaw angular velocity from
the gyroscope to calculate a stable of Yaw angle.
13 | P a g e
QUADCOPTER PROJECT
Roll is tilting left and right, which is controlled from increasing speed of left
and right motors.
Pitch is moving the nose up and down which has controlled the same way as
a roll, but it uses different motors increasing speed of front and back motors.
Yaw is turning clockwise and anticlockwise controlled by turning speed of
regular rotation motor.
Gyro sends the degree of rotation data to the microprocessor so how does
the quadcopter reacting. Quadcopter has 4 controllable degrees of Roll,
Pitch, Yaw (x, y, z axis) and Altitude. Roll is Ailerons, pitch is Elevator, yaw is
Rudder and acceleration is called throttling in term of flight.
14 | P a g e
QUADCOPTER PROJECT
The idea is simple, if the quad is falling to the right then speed up the right
motor and slow the left one with the same amount and vice versa. Also, if the
quad is falling down from the nose, then speed up the front motor and slow
down the rear motor. Each degree can be controllable by the speed of thrusts
of each motor. If all four rotors apply equal thrust the quadcopter will stay in
the same direction. Gyro sensors are calculated to get the correct position for
those three x, y, z degrees. To maintain the balance of the body the
quadcopter must be continuously taking measurements from the gyro
sensors. Those measurements of the speed of the motor are made the
quadcopters body level.
There is the Roll and pitch theory calculation below. Always motor is running
between minimum 1100 and maximum 2000. For example, if the nose of the
quadcopter wants to lift M1 and M2 motors need to speed up and the M3 and
M4 motors will decrease the same speed. So M = M + RX (Elevator)/ 2 for
example current motor M value is motor 1200. Current RX (Elevator) value is
same as motor value, but when transmitter raises up from TX the value will
be increased e.g.: 1250 then we need the actual value therefore divided by 2.
The current motor speed is 1225 so 25 raise up the speed.
Pitch Control
M1 = M1 + Receiver (Elevator) /2
M2 = M2 + Receiver (Elevator) /2
M3 = M3 - Receiver (Elevator) /2
M4 = M4 - Receiver (Elevator) /2
15 | P a g e
QUADCOPTER PROJECT
Roll Control
M1 = M1 + Receiver (Aileron)/2
M4 = M2 + Receiver (Aileron) /2
M2 = M3 - Receiver (Aileron) /2
M3 = M4 - Receiver (Aileron) /2
Gain amount
M1 = M1 + PitchAmount * PitchGain
M4 = M4 - PitchAmount * PitchGain
M2 = M2 + RollAmount * RollGain
M3 = M3 - RollAmount * RollGain
This is the basic rule that should be found in all quadcopter programs. The
main difference between the different firmware approaches is how to
calculate PitchAmount and RollAmount. This can simply be read from a Gyro
sensor and multiply it by a constant factor to adjust the range, or we can use
PID approach or even Kalman filter and combine Gyro with Acc sensors to
get the exact degree.
The Gain factor is used to determine the sensitivity. Other checks such as
trimming are common in quadcopter code.
16 | P a g e
QUADCOPTER PROJECT
14. Propellers
17 | P a g e
QUADCOPTER PROJECT
Two propellers rotate in the opposite directions to the other two motors to
avoid the body twisting. The propeller is rotating in each centering which
having opposite tilting, all of the propeller will provide lifting thrust without
twist in the same direction. This makes it possible for the quadcopter to
stable. The larger diameter of propeller can generate more thrust, it also
requires more power. The larger diameter of propeller can lift more weight but
less RPM so no stable. When using the heights RPM motors needs the
smaller or middle size propeller. Smaller propeller with highest RPM motor
makes extra stable of quadcopter but it has only limited thrust to lift the
weight.
This is the most important part of the quadcopter project. Balancing is the
essential of stabilization. If propellers are not balanced find out the heavier
side using with balancer. There are two ways of balancing the propeller, using
the wire which means put some small wire, tape on the lighter side to balance
the propeller. Or using the sandpaper to rub on the heavy part of the
18 | P a g e
QUADCOPTER PROJECT
19 | P a g e
QUADCOPTER PROJECT
Wall
20 | P a g e
QUADCOPTER PROJECT
100cm 100cm
Adjustable distance
from user
Arduino Ultrasonic
Pin 7 Echo
Pin 8 Trig
GND GND
5V Vcc
Arduino connected to computer USB port to load the program. After upload
the program Arduino will start to run automatically then pressed the Serial
Monitor under the Tools to read the value of the distance from the sensor. So
now decide the distance from the object what maximum distance will require
in the project and set the value in the program. The theory to find the distance
in centimeters below
21 | P a g e
QUADCOPTER PROJECT
The Echo Pin cycle is used to determine the distance of the nearest object by
bouncing ultrasonic sound waves off of it. If you change the value of
maximumRange that adjust the maximum range of the distance. For
example, if you use a value of 100 mean is 100cm after the distance
calculation. See the Sensor test Program
The same feature with the other 4 side ultrasonic sensors are measured to
the object neat to the quadcopter. When the user is switched on to side
altitude hold the quad will memorize the distance of the object from every side
and auto stabilizing. Those features help a lot when we are flying in the
narrow area without hitting any objects. Anytime a user can switch off the
altitude hold switch for the manual control.
Autopilot feature is more safe and stable. This feature does auto takeoff and
auto landing. The auto takeoff function is communication between ground
sensor and motor's speed. If the user enables to auto takeoff, all the sensor
will get their value distance from the objects. Then throttle will raise up by
22 | P a g e
QUADCOPTER PROJECT
program gently until quadcopter is floating up in the air. In this case, the user
can set the value for the height limit. For example, if the user sets the value of
100cm the quad will stay in the 100cm height after auto takeoff and wait for
the user control.
The auto landing system is aimed for a professional landing without hitting to
the ground. The controller can more concentrate on the other stabilization
with auto landing system. Also more battery efficiency of using the auto pilot
system when the quad landing.
The most popular system is called the WI-Fi wireless communication. WI-Fi
wireless communications and radio communications are slightly different
features. WI-Fi network communication uses radio frequency. Communication
across a wireless network is two-way radio frequency communication. A
computer or mobile phone or tablets wireless adapter translates the data into
a radio signal and transmits it to the router. Then the router receives the data
and decodes it. WI-Fi system able to connect internet through wireless or
Ethernet cable connection. The same process also works with the router
receives the information from the internet, translating it into a radio signal and
sending to computer or mobile or tablets wireless adapters.
WI-Fi and Radio signal are the same frequency. This quadcopter project
using the 2.4 GHz WI-Fi and Radio Signal. User can able to control from both
transmitters. Nano wireless router sit in the center of the quadcopter which is
connected to Arduino network shield via RJ-45 network cable. Nano Router
will generate 2.4 GHz wireless signal and all the same feature as normal
router. It's able to configure the SSID and password from PC.
23 | P a g e
QUADCOPTER PROJECT
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
24 | P a g e
QUADCOPTER PROJECT
client.println("<TITLE>Q U A D C O P T E R</TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1>-- WIFI Q U A D C O P T E R --</H1>");
client.println("<hr />");
client.println("<br />");
client.println("<br />");
// movement
client.println("<a href=\"/?start\"\"> Start </a>");
client.println("<br />");
client.println("<a href=\"/?up\"\"> UP </a>");
client.println("<br />");
client.println("<a href=\"/?landing\"\"> Landing </a>");
client.println("<br />");
client.println("<a href=\"/?stop\"\"> STOP </a>");
client.println("<br />");
client.println("</BODY>");
client.println("</HTML>");
//stopping client
client.stop();
Radio transmitter is one way signal, easy to use and only one controller
transmitter device can connect. Controller using the radio signal are not able
to access the internet access so that only limited distance.
25 | P a g e
QUADCOPTER PROJECT
20. RC Transmitter
As for the power source of the quadcopter, the reason behind to choose the
li-po battery because it is light. NiMh is cheaper than li-po but a lot heavier. Li-
po is more performance and long lasted ampere life. Equation below to
calculate the flight time. Battery capacity is depends on the overall ampere
draw of the quadcopter (eg: how much power usage of the motors and how
much overall weight of the quadcopter). For example
26 | P a g e
QUADCOPTER PROJECT
Advantages
This is Heavy Duty Series 60C Li-poly packs deliver full capacity. It is high
performance for x525 size quadcopter. Heavy duty 12AWG leads deliver the
power through the pre-installed XT60 plug for maximum efficiencies and
minimum resistance. Heavy Duty li-poly cells are hand selected at the factory
and matched by internal resistance to give the most consistent and best
performing battery. Li-po provides the minimum 2200mAh capacity and 11.1
voltage 3 Cells. 60C of constant discharge and light weight 198g.
Disadvantages
Li-po batteries are so dangerous if careless. The only important thing is over
charged or electric shocked when it is happen li-po will get fire easily. Li-po
will need the low battery alarm because if it is used until less than 6 voltage or
over discharged battery will completely damage. It will not be allow to charge
again.
The battery 11.1 volts directly connected to ESC then ESC provided 5 volt to
flight controller microprocessor board. This is the theory of a flight time theory
it is depends on the capacity of the li-po batteries and balancing of the device.
I choose a 11.1 volt 20C 2200mAh li-po battery. The average amp draw of my
quadcopter should be 18 amps maximum for full throttle. This will give me a
flight time of 7 to 10 minutes.
27 | P a g e
QUADCOPTER PROJECT
Flight control circuit board was simply designed the minimum weight of nano
arduino and micro 10dof GY-87 gyro sensor solder on universal PCB. One
important thing was PCB needed to break the connection between pins of
arduino see in Appendices A. All the components needs to measure the
weight individually to calculate the total of quadcopter weight.
According to the table.22.3 is showing the total weight of the all components
1378g. The target weight was 2000g and maximum weight of the 4 brushless
28 | P a g e
QUADCOPTER PROJECT
Proportional
Proportional is the first loop and it focuses on correcting the present errors in
the stabilization system. For example: quadcopter is running well and
hovering in the air. If there any outside force cause as wind or user change
the angle from transmitter the quadcopter will tilt to one direction. The gyro
will sense this degree change and it will measure how many degree was
changed and tell to microprocessor the output pulse for motor in opposite
direction of tilt.
Proportional (P) loop intend to return the quadcopter back to initial position
but in reality quadcopter is overshoot to opposite direction of tilt. The
quadcopter will keep changing back and forth between two directions. This
problem will happen when Proportional (P) working alone. Integral (I) loop
can fix this problem. See Appendices C for PID flowchart.
Integral
Integral is the second loop and it focuses on correcting the past errors in the
stabilization system. Integral (I) will measure changing of angle as
Proportional (P) but it will also measure how long the tilt lasted for. So Integral
(I) loop is the kind of delay between beginning of measurements and
29 | P a g e
QUADCOPTER PROJECT
quadcopter return back to initial position.The overshoot error will occur after
Proportional (P) measurement, Integral will correct the overshoot error and
help stabilize the quadcopter.
Derivative
Derivative (D) focuses on predicting future errors of quadcopter stabilization.
This measurement is the same type of measurements as the Integral (I)
measurement. Derivative (D) is calculated the when is the next overshoot will
occur so that (D) loop make ready to fix the next overshoot error. See
Appendices B for PID flowchart.
Mostly vibration come from the propeller and propeller head. Even if the
propeller was balanced there is minor vibration left when the motor spinning
with high speed. Those vibration needs to reduce to get stable quadcopter.
There is two type of reducing the vibration of propeller, changing the new
propeller head or using rubber band prop instead of using prop head see
(fig.24.1). Rubber band prop is more safety for propeller damage when the
quadcopter crash and less vibration effect. If less vibration of quadcopter is
less drifting and more stabilize.
30 | P a g e
QUADCOPTER PROJECT
31 | P a g e
QUADCOPTER PROJECT
32 | P a g e
QUADCOPTER PROJECT
Quadcopter was slowed response because I gain was too high in PID
setting
Quadcopter was not stable which was jumped up and down because
too big propeller and high pitch which is 10x5
33 | P a g e
QUADCOPTER PROJECT
26. Costs
The project was managed to the economy cost depends on the university
project allowance. Most of the device was bought from amazon and eBay.
The cost will be changed depend on the type of project and currency
different.
Total 129.44
Table.26.1. Maximum Component costs
Project planning is the main part of the whole project before the project
starting. Everything need to be managed and organised to complete the
project on time. Project management is directly link to the overall project cost
and time. Anything get the wrong order of any component or damaging during
the test that will be delayed and waste the time.
34 | P a g e
QUADCOPTER PROJECT
Motors & x x x
ESC
Wireless Ctrl x x x
Stabilization x x x x
Sensor x x x x x x
Programming x x x x x x x x
Propeller x x
Reports x x x x
PID setting x x
28. Conclusions
The outcome of this project was greater than what expected because the
quadcopter was managed the extra stabilized the balanced. It also got
chance to modify the altitude hold and magnitude hold by using barometer
and magnetometer. In the objective of quadcopters theory, there is still a
minor drifting issue when the quadcopter hover although there should not be
drifting issue if PID setting and right propellers were used in designed project.
It is needed to fix the frame after been crashed.
There is need to upgrade 4000mAh the li-po battery ampere to get more flight
time. Wi-Fi controller GUI was not completed. Currently, html webserver was
able to control instead of complete Wi-Fi control program. It might successful
the program and modify to Xbee Technology instead of using the nano router
when I got more time and extra budget.
35 | P a g e
QUADCOPTER PROJECT
Supervisor(s):
PRIMARY GOALS
1.
SECONDARY GOAL
1.
RESOURCES NEEDED
36 | P a g e
QUADCOPTER PROJECT
http://robots.dacloughb.com/project-2/esc-calibration-programming/
37 | P a g e
QUADCOPTER PROJECT
38 | P a g e
QUADCOPTER PROJECT
32. Appendices
Appendices A
39 | P a g e
QUADCOPTER PROJECT
40 | P a g e
QUADCOPTER PROJECT
41 | P a g e
QUADCOPTER PROJECT
Appendices B
Appendices C
42 | P a g e