 Open Access
 Total Downloads : 2243
 Authors : V. P. Kodgirwar, Vivek Kumar, Sushant Sawant, Manish Shegokar
 Paper ID : IJERTV3IS041539
 Volume & Issue : Volume 03, Issue 04 (April 2014)
 Published (First Online): 25042014
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
Design of Control System for Quadcopter using Complementary Filter and PID Controller
International Journal of Engineering Research & Technology (IJERT)
ISSN: 22780181
Vol. 3 Issue 4, April – 2014

Kodgirwar Professor, EnTC, Modern College Of Engineering,
Pune, India,
Vivek Kumar Student, EnTC, Modern College Of Engineering,
Pune, India,
Manish Shegokar Student, EnTC, Modern College Of Engineering,
Pune, India,
SushantSawant Student, EnTC, Modern College Of Engineering,
Pune, India,
Abstract:This paper presents about the design of control system of Quadcopter. In this paper we have shown the implementation of control system in software. Control System of Quadcopter consists of two main parts: Complimentary filter and PID block. Complimentary filter act as feedbacks block and provide the angle along x axis and y axis of Quadcopter. We have also shown the need of complimentary filter instead of using just accelerometer and gyroscope directly for finding out the angle along x and y axis using graph plot. PID Controller block calculates the error in angle along x and y axis to give the output signal which reduces the error. We have shown the significance of three constant parameters of PID Controller. All the results of this paper are tested on actual Quadcopter and also plotted in the form of graph using Matlab and Processing software.
Keywords: System Design, Complimentary Filter, Sensor integration, filter design, PID controller.

INTRODUCTION
Quadcopter is basically a rotorcraft which uses four fixed rotors to lift and propel itself. Quadcopter uses four fixed pitched propellers out of which two rotors rotate in clockwise and other two in anticlockwise direction.
Initially the Quadcopter developed was not stable due to the various factors. Some of the major factors are non availability of small and powerful electrical motors, ESC (Electronic speed controller) for controlling the electrical motor. The sensors like gyroscope and accelerometer were mechanical and difficult to interface with electronics. Similarly high speed and small size processors and microcontrollers were also not available to process PID Algorithm for balancing Quadcopter. But now a day due to rapid growth and advancement in the field of VLSI (Very large Scale Integration), MEMS (Micro Electromechanical System) and power electronics have reduced the size of microcontrollers, sensors and improved its performance. Recently BLDC (Brushless DC) Motors are developed which has high power to weight ratio and requires very less maintenance. The brushless motors are multiphased, normally 3 phases, so direct supply of DC power will not turn
the motors on. It requires Electronic Speed Controllers (ESC) which generates three high frequency signals with different but controllable phases continually to keep the motor turning. Due to these advancements it becomes easy to write the algorithm in the microprocessor and controlling the speed of all four rotors to achieve stable flight. The ESC is a BLDC motor controller board that has a battery input and a three phase output for the motor. Each ESC is controlled independently by PWM (Pulse Width Modulated) signal [8].

SYSTEM DESIGN
Our system includes basically three parts: Input, PID Section and output section. Throttle signal isgiven to microcontroller which is converted into PWM Signal and given to ESC which in turn increases the speed of motor. X and Y are set pointangle along X axis and Y axis. Present angle is given by complimentary filter using which offset is calculated and given to PID Controller. PID produces the output signal in the form of PWM signal which is added or subtracted from PWM signal of throttle to maintain set point [2].
Fig. 1. System Design

SENSOR INTEGRATION
To determine the position of Quadcopter we have used IMU (Inertial Measurement Unit) MPU6050 sensor which gives us the value along xaxisaxis and zaxis. IMU consist of three axes of gyroscope and three axes of accelerometer. MPU6050 contains 16bit ADCs for digitizing the output of Accelerometer and gyroscope. It has dedicated I2C bus for transferring data from MPU6050 to microcontroller. I2C works at 400 kHz. Data can also be transferred using SPI at 1MHz [1].
Accelerometer: It measures magnitude of gravity that is force/mass. It can be used as inclinometer of Quadcopter. If Quadcopter lifts to the upward direction then accelerometer x reads negative. If Quadcopter lifts to the downward direction then accelerometerreadnegative value.
Therefore, small angle (sin (theta)) allows gravity reading to be proportional to up to +/60 degrees.But only just an accelerometer cant use as sensor for Quadcopter because it cant tell difference between short term transitional acceleration versus stationary incline changes [8]. We have shown the performance of accelerometer in figure 3.
Gyroscope: It measures speed of rotation. It reads 0 when stationary and reads positive or negative while spinning.But it drifts badly from initial condition due to vibrations of motors of Quadcopter. Therefore only gyroscope cannot be used forfeedback in Quadcopter [8]. We have shown the performance of Gyroscope in figure 4.

FILTER DESIGN
As we know accelerometer reads for static angles that is fast changes are ignored and gyroscope is used for changing angles that is slow changes are ignored. For removing these problems there are two filters: Complementary filter and Kalman filter. In that case Kalman filter is theoretically ideal filter for combining noisy sensors to get accurate estimates. AsComplementary filters are easy to code wecan use it to fix noise, drift and horizontal acceleration dependency [4].

COMPLEMENTARY FILTER
Fig.2. Complementary filter
Integrator:The purpose of integrator is to take the sum of finite number of samples of gyroscope taken at constant interval.
It can be implemented in the given way: Angle + = gyro*dt
LowPass Filter: The purpose of the lowpass filter is to only consider longterm changes and ignore shortterm fluctuations.angle = (0.98)*angle + (0.02)*x_acc;
In the above equation the second term i.e. 0.02*x_acc acts as the low pass filter.
HighPass Filter:The purpose of high pass filter is to allow shortduration signals to pass through while filtering out signals that are steady over time. It used to cancel out drift in Quadcopter.
Sample Period:It is the amount of time that passes between each program loop. If the sample rate is 100 Hz, the sample period is 0.01 sec. In the equation of complimentary filter it is denoted by dt [25].
Final Equation of Complimentary filter we used is:
Angle_X= 0.93*(Angle_X+ (gyro_Xrate*dt)) +0.07*(Acc_X)
For our Quadcopter experimental result is as shown in Figure3, figure 4 and figure 5.
It is the response of accelerometer, gyroscope and complementary at 180 degree [34].
TableI Experimental readings of complementary filter
Angle
Output of accelerometer X
Output of gyroscope X (roll)
Output of complementary angle X (roll)
30
34.43
21.62
30.32
60
62.52
325
60.80
90
93.10
324
90.32
120
115
52.97
120.92
160/p>
163.66
674
160.87
Table II Experimental readings of complementary filter
Angle
Output of accelerometer Y
Output of gyroscope Y (pitch)
Output of complementary angle Y (pitch)
30
32.41
118.92
30.60
60
62.52
140.23
60.50
90
92.30
270.32
90.60
120
123.2
294.31
120.75
160
153.35
319.45
150.5
Fig. 3.Response of accelerometer
Fig. 4.Response of gyroscope
Fig. 5.Response of complementary filter

PID CONTROLLER
Feedback control system is a mechanism that collects and uses information for measurements.There are two types of control system, they are as follows open loop control system and closed loop control system. In open loop control system compute the data from the system based on set conditions. They are used where the operating conditions are stable. On the other hand closed loop control system uses the feedback to change the output of the system. They have ability to adapt the changing conditions. They can make the unstable process stable.PID controller is the control loop feedback system used in control system on large scale. PID controller calculates an "error" value as the difference between a measuredprocess variable and a desired set point. The controller attempts to minimize the error in outputs by adjusting the process control inputs.
Fig.6.PID controller
The PID stands for Proportional, Integral and Derivative controller. It has three constant parameters as proportional, integral, derivative. P depends on the present error, I on the accumulation of past errors, and D is a prediction of future errors, based on current rate of change. A proportional controller ( ) will have the effect of reducing the rise time and will reduce but never eliminate the steadystate error. The proportional component depends only on the difference between the set point and the process variable. This difference is referred to as the Error term. The proportional gain ( ) determines the ratio of output response to the error signal. An integral control ( ) will have the effect of eliminating the steadystate error for a constant or step input, but it may make the transient response slower. The integral component sums the error term over time. The result is that even a small error term will cause the integral component to increase slowly. The integral response will continually increase over time unless the error is zero, so the effect is to drive the SteadyState error to zero. A derivative control ( ) will have the effect of increasing the stability of the system, reducing the overshoot, and improving the transient response Increasing the derivative time (Td) parameter will cause the control system to react more strongly to changes in the error term and will increase the speed of the overall control system response [7].
The proportional term is given by: = * e (t)
0
The integral term is given by: =
The derivative term is given by: = e(t)
So for achieving stable flight of Quadcopter we have to find the suitable values of Kp, Ki and Kd.Each of these coefficients has different effects on Quadcopter flight.
Proportional Gain coefficient:Kp coefficient of PID Controller is responsible for sensitivity and reactivity for angular change. The higher the coefficient, the higher the Quadcopter seems more sensitive and reactive to angular change. If it is too low, the Quadcopter will appear sluggish and will be harder to keep steady. Quadcopter starts tooscillate with a high frequency when Proportional gain is too high [7].
Integral Gain coefficient: Ki coefficient can increase the precision of the angular position. For example when the Quadcopter is disturbed and its angle changes 20 degrees, in theory it remembers how much the angle has changed and will return 20 degrees. Without this term, the opposition does not last as long. However, when the Ki value gets too high theQuadcopter begin to have slow reaction and a decrease effect of the Proportional gain as consequence, it will also start to oscillate like having high P gain, but with a lower frequency[7].
Derivative Gain coefficient: Kdcoefficient allows the Quadcopter to reach more quickly the desired attitude. It decrease control action fast when the error is decreasing fast. In practice it will increase the reaction speed and in certain cases an increase the effect of the P gains. D gain makes the Quadcopter more sensitive, which means if Quadcopter oscillates, this parameter will increase the oscillations [7].
Final Values of Kp, Ki and Kdused in Quadcopter:
Table III Experimental readings of Kp, Ki and Kd
Kp
Ki
Kd
1.34
0.86
1.23
Figure 7 and 8 shows the PID graph for pitch and roll of Quadcopter. In the graph green line shows the set point of PID. Red line shows the offset in input and blue line shows the output of PID which is PWM signal [58].
Fig. 7.Response of pitch
Fig. 8.Response of roll

CONCLUSION

In this paper we have presented the design of control system for Quadcopter consideringsoftware implementation. We have obtained the result as the output of Complementary filter by measuring the input from accelerometer and gyroscope. The response of PID controller is acceptable. From the calculations of angle we get the values and the graphs.
REFERENCES

Visual track system applied in quadrotor aerial robot
JieTong Zou, YuChiungTsengNational Formosa University, Yunlin County, 632, [email protected]

Igor Gaponov, Anastasia Razinkova,Quadcopter Design and Implementation as aMultidisciplinary Engineering Course 97814673 24182/12. IEEE International Conference on Teaching, Assessment, and Learning for Engineering (TALE) 2012

Stephen P. Tseng, WenLung Li, ChihYang Sheng, JiaWei Hsu, Chin Sheng Chen Motion and Attitude Estimation Using Inertial Measurements with Complementary Filter Institute of Mechatronic Engineering National Taipei University of Technology Taipei, Taiwan, ROC.

HikanJohanssonandTapioSarami A class if complementary IIR filters Signal Processing Laboratory, Tampere University of TechnologyP.O. Box 553 FIN33101 Tampere, Finland.

Tuning of Complementary filter attitude estimator using precise model for multicopter by RadekBarÃ¡nek, Doctoral Degree Programme , FEEC BUT

http://en.wikipedia.org/wiki/PID_controller

NI Tutorial PID Theory explained white paper3782 http://www.ni.com/whitepaper/3782en

Position Control of a Manipulator Using PID Control Algorithm Based on ATmega8535 MicrocontrollerbyThiang, HandryKhoswanto, Edwin Pangaldus from Electrical Engineering Department, Petra Christian University ICA2009ISBN 9789798861055