Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

DESGIN OF ADPATIVE PID CONTROLLER FOR QUADCOPTER UAV

18LV72 PROJECT WORK


PHASE II

PRITHIV L
(19MV32)

Dissertation submitted in partial fulfillment of the requirements for the degree of

MASTER OF ENGINEERING

Branch: ELECTRONICS AND COMMUNICATION ENGINEERING

Specialization: VLSI DESIGN


of Anna University

June 2021

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


PSG COLLEGE OF TECHNOLOGY
(Autonomous Institution)
COIMBATORE – 641 004
PSG COLLEGE OF TECHNOLOGY
(Autonomous Institution)

COIMBATORE - 641 004

DESIGN OF ADAPTIVE PID CONTROLLER FOR QUADCOPTER


UAV

Bonafide record of work done by

PRITHIV L
(19MV32)

Dissertation submitted in partial fulfilment of the requirements for the degree of

MASTER OF ENGINEERING

Branch: ELECTRONICS AND COMMUNICATION ENGINEERING


Specialization: VLSI DESIGN

of Anna University

June 2021

------------------ -------------
Mr.K.R.RADHAKRISHNAN Dr. V. KRISHNAVENI
Faculty Guide Head of the Department

Certified that the candidate was examined in the viva-voice examination held on……21.06.2021….

……………………. ..……………………
(Internal Examiner) (External Examiner)
ACKNOWLEDGEMENT

ACKNOWLEDGEMENT
I would like to extend my sincere thanks to Dr.K.PRAKASAN, Principal In-Charge, PSG
College of Technology, for his kind patronage.

I am indebted to Dr.V.KRISHNAVENI, Professor and Head In-Charge, Department of


Electronics and Communication Engineering, for her continued support and motivation.

My sincere thanks to the program coordinator, Dr.P.SARAVANAN, Associate Professor,


Department of Electronics and Communication Engineering for providing me constant support
and reviewing the progress.

I would like to express my deepest gratitude to my class tutor, Mrs.A.UMA, Assistant


Professor (Sel.Gr.), Department of Electronics and Communication Engineering, for her
constant motivation, direction and guidance throughout the course of my project work.

My sincere thanks to my guide, Mr.K.R.RADHAKRISHNAN, Assistant Professor (Sr.Gr),


Department of Electronics and Communication Engineering, my Project Guide whose valuable
guidance and continuous encouragement throughout the course made it possible to complete
this dissertation work well.

I extend my thanks to all the teaching and non-teaching staff members of Department
of Electronics and Communication Engineering and my student colleagues for their continuous
support at every stage for the completion of this project.

Last but not the least I thank the Almighty and my family members who have been a
great moral support to me.

i
Synopsis

SYNOPSIS

PID (Proportional Integral Derivative) in arial drone control used to read the real-
time values of gyro sensor the rotational speed of the motor is varied to retain the altitude
and angular displacement based on the control inputs. It basically reduces the error rate
of the closed loop system. The PID has three variables that can be tuned. P is Proportional
which reduces the present error rate, I is Integral reduces past error rate and D is derivative
predicts the future errors and reduces it.
In current scenario Based on the occurrence of errors in the operational
environment of the drone the PID should be tuned manually which takes time to implement
it. To make the PID auto tunable based on the operational environment the PID is designed
with inbuilt adaptive control unit for controlling the variables of the PID. And there are
adaptive filters used for same purpose. But the step response of the filter is too low. To
implement this design MATLAB Simulink is used to design and compare its response to
other available models. C code is generated from the MATLAB Simulink and it was used
in the Vits HLS to generate RTL Code. Furthermore, Vivado HLx is used to find the power
consumption, critical operating frequency and total number of resources used when
implemented in the FPGA.
The observation from the analysis is that the proposed PID provided better step
response and lower peak over shoot than the adaptive filters and existing PID controllers
respectively. The Proposed PID provides sensitivity up to 38.1 V/ms whereas the existing
PID and adaptive filter provides up to 9.6 V/ms and 6.4 V/ms respectively for reference
voltage of 24V. the proposed system consumes 143 mW and the power consumption of
the adaptive filter and existing PID is 164mW and 165mW respectively. The operating
frequency of proposed system is 28.571 MHz, 41.667 for adaptive filter and 28.571 MHz
for existing PID. From this comparison of results, it is concluded that the proposed system
has higher sensitivity with 13% lower power consumption.

ii
Contents

CONTENTS

CHAPTER Page No.

Acknowledgement ……………………………………………..….…………………...(i)
Synopsis………………….………………………………………………..…………….(ii)
List of Figures ………………………………………………...………………………..(v)
List of Tables ……………………………………………………………………………(vii)
1. INTRODUCTION…………………………………………………………..............1
1.1. PID of quadcopter/drone 1
1.2. Loop time 2
1.3. PID parameters 2
1.3.1. P Gain 2
1.3.2. I Gain 3
1.3.3. D Gain 3
1.4. Tuning effect of each parameter in UAV 3
1.4.1. P on Roll, Pitch and Yaw 3
1.4.2. D on Roll and Pitch 3
1.4.3. I on Roll, Pitch and Yaw 3
1.5. Yaw performance other than PID parameters 4
2. LITERATURE SURVEY…………………..………………………………………..5
3. DESIGN OF DRONE FLIGHT CONTROLLER………………………………….10
3.1. PID 10
3.1.1. Advantages 11
3.1.2. Disadvantages 11
3.2. Adaptive Filter 11
3.2.1. Advantages 12
3.2.2. Disadvantages 12
3.3. Proposed Design 12
4. IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE.……...14
4.1. Simulation Results 14
4.1.1. Adaptive filter 14
4.1.2. PID 15
Contents

4.1.3. Proposed Design 16


4.2. Synthesis Results 18
4.2.1. Adaptive filter 18
4.2.2. PID 18
4.2.3. Proposed Design 19
4.3. Implementation Results 20
4.3.1. Adaptive filter 20
4.3.2. PID 20
4.3.3. Proposed Design 21
4.4. Implementation Procedure 23
4.4.1. Simulink Design and Implementation 23
4.4.2. VITS HLS 25
4.4.3. Vivado HLx 27
5. RESULTS AND DISCUSSIONS…………………………………………………..31
5.1. Synthesis Result 31
5.1.1. PID architecture 31
5.1.2. Adaptive controller Architecture 31
5.1.3. Proposed Architecture 31
5.2. Comparison of Results 32
5.2.1. Sensitivity 32
5.2.2. Resource Utilization 32
5.2.3. Frequency 33
5.2.4. Power 33
6. CONCLUSION………………..…………………………………….……….……. 34

BIBLIOGRAPHY ..…………………………………………………………….………… 35
List of Figures

LIST OF FIGURES

Figure No. Title Page No.

1.1 General Block Diagram PID 1

2.1 Parameters that effect steady state errors 5

2.2 Block diagram of TRMS 6

2.3 Simulink model of LMS filter algorithm 7

3.1 Schematic of PID 10

3.2 Table for response variation based on the parameter 11


increase

3.3 Schematic of general block diagram of Adaptive Filter 11

3.4 Schematic of Proposed System 13

4.1 Step Response of Adaptive Filter 14

4.2 Step Response of Adaptive Filter for Varying Reference 15

4.3 Step Response of PID 16

4.4 Step Response of PID for Varying Reference 16

4.5 Step Response of Proposed PID 17

4.6 Step Response of Proposed PID for Varying Reference 17

4.7 Synthesized Design of Adaptive filter 18

4.8 Synthesized Design PID Controller 19

4.9 Synthesized Design of Proposed PID 19

4.10 Timing and clock summary 20

v
List of Figures

4.11 Power Summary 20

4.12 Design Runs 20

4.13 Timing and clock summary 21

4.14 Power Summary 21

4.15 Design Runs 21

4.16 Timing and clock summary 22

4.17 Power Summary 22

4.18 Design Runs 22

4.19 Simulink Untitled Window 23

4.20 Simulink Library Window 23

4.21 Configuration Parameter for Simulink Code Generator 24

4.22 Code generation Report for Simulink Code Generator 25

4.23 Command to Get RTL Code from C code 26

4.24 Vivado Platform 27

4.25 ADD/ Creating the Verilog File 28

4.26 Providing Input/Output pins 28

4.27 Editing of Verilog Code 29

4.28 Synthesis of RTL Schematic 29

4.29 Implementation Results 30

5.1 Comparison of sensitivity for each structure 32

5.2 Comparison of resources utilized for each structure 32

5.3 Comparison of critical path frequency for each structure 33

vi
List of Figures

5.4 Comparison of power consumption for each structure 33

vii
List of Figures

LIST OF TABLES

Table No. Title Page No.

2.1 Parameter of the parrot 8

5.1 Synthesis Result of PID architecture 31

5.2 Synthesis Result of Adaptive controller Structure 31

5.3 Synthesis Result of Proposed PID Structure 31

vii
INTRODUCTION Chapter 1

CHAPTER 1

INTRODUCTION

PID (Proportional Integral Derivative) in arial drone control used to read the real-time
values of gyro sensor the rotational speed of the motor is varied to retain the altitude and
angular displacement based on the control inputs. It basically reduces the error rate of the
closed loop system. The PID has three variables that can be tuned. P is Proportional which
reduces the present error rate, I is Integral reduces past error rate and D is derivative predicts
the future errors and reduces it. Based on the occurrence of errors in the operational
environment of the drone the PID should be tuned manually which takes time to implement it.

Fig 1.1 General Block Diagram of PID

1.1 PID OF QUADCOPTER/DRONE


The need for PID in a drone is to correct the error, derived from the measured value
read from the gyro sensor and the desired set point given by the user to control the rotational
speed of the motor. The minimization of errors can be controlled by adjusting the control
variables in every loop.

1
INTRODUCTION Chapter 1

1.2 LOOP TIME


There are two different scenario that determines the loop time of the controller they
are Gyro sampling rate and FC loop time which means frequency of with the reading is taken
from the Gyro sensor and the frequency of which PID loop uses the data from the Gyro. The
representation of FC Loop time is determined by either time taken for the controller to
completer the loop or frequency at which the loop is ran. These interchangeable criteria decide
the speed of operation in the PID controller.
The requirement for having the FC loop time higher is to reduce the latency and there
are other criteria that can effect the delay other than the PID loops. They are as follows:
• Gyro sensor delay:
It is caused by the built-in low pass filter and limited sampling rate.
• FC PID loop time
• ESC Protocol:
Time taken for the data to reach ESC from the FC.
• How often the ESC updates the motor speed.
• Motor reaction time.
• Latency caused by the cameras and displays
• Radio communication delays
The benefit of having a faster loop time and gyro sampling rate gives higher response
time of the system. But there are some risks having higher than needed. Like the vibration of
the drone’s frame got from the motors of the drone. These vibrations can provide high
frequency noise which are higher than the Nyquist Frequency of the system. This may cause
some distortion and some random movements in the UAV.

1.3 PID PARAMETERS


1.3.1 P Gain
• Determined by the hardness flight controller work or correct the error to acquire
the desired flight path.
• It is like controlling the sensitivity and responsiveness setting.
• Higher the P gain sharper the control and if the P gain is lower then the softer
the controls.
• If the P gain is too high then UAV becomes vary sensitive and tends to cause
high overshoots.

2
INTRODUCTION Chapter 1

• If the P gain is too low then the UAV becomes sloppy and does not respond
quick enough.
1.3.2 I gain
• This is determined for the drone to hot the altitude against the external forces
such as wind and off centred motors.
• This can be concluded as the stiffness of the UAV.
• I gain improves throttle dips.
1.3.3 D gain
• Used as a damper and reduces the over correction and overshoot.
• Counteracts P gain and counteracts the oscillations provided by P gain.
1.4 TUNING EFFECT OF EACH PARAMETERS IN UAV
Tuning of the drone’s PID cannot be done randomly. Because each of the parameters
of the PID effect different response provided by the drone. The response of the drone is based
on the three variables controlled by parameters of PID. They are P, I and D gain. There is an
order to tune the response variables of a PID. Initially roll then pitch and finally Yaw. This
tuning of a quadcopter may take few minutes or hours or days to get it perfectly.
1.4.1 P on Roll, pitch and Yaw
• If P is low the drone starts to wobble. And when high there will be fast
oscillations.
• Too high of P gain can result in high vibration in the frame.
• Yaw is the response time for a drone to stop. Yaw P gain won’t provide much
vibration as on roll P gain and pitch P gain.
1.4.2 D on Roll and Pitch
• Rising of D gain helps in reduction of oscillation while descending of the drone.
• Excessive D gain provides oscillations to the drone in the opposite direction
and makes the motors to get hotter.
1.4.3 I on Roll, pitch and Yaw
• If there is a noise while maintaining the altitude then increase I on pitch gain.
and this also helps at keeping the same angle when moved front or back.
• If the drone does not hold the angle during the left or right movement then
change I on Roll gain. The I gain should be high enough, if excessively done
then the it may result in stiff and there may even provide oscillations.

3
INTRODUCTION Chapter 1

1.5 YAW PERFORMANCE OTHER THAN PID PARAMETERS


Apart from PID parameters other things can improve or effect yaw performance. They
are as follows:
• Using heavier propellers which generates more counter torque and improve
cost efficiency.
• Increase RPM of the motor or increase the battery capacity.
• Yaw can be destabilized by the accelerating of the motor is faster than the
deceleration.
• Reduction of motor distance in the frame is also another parameter effects the
yaw of the drone.

4
LITERATURE SURVEY CHAPTER 2

CHAPTER 2

LITERATURE SURVEY

Literature survey consists of various Drone controller architectures to reduce the area,
time and power consumption of the design.

2.1 DYNAMIC MODELLING AND ALTITUDE CONTROL OF PARROT


ROLLING SPIDER USING LQR [1]
One of the most favourable quadcopter around the world is parrot rolling spider mini
drone which are used in academics and experimentation. In this paper mathematical modeling
of kinematics and dynamics are derived and discussed. This design uses the linear feedback
circuits for stabilizing the system and comparative analysis of the altitude control. This is done
using the Proportional Integral Derivative (PID) and Linear Quadratic Regulator (LQR) control
techniques. The design is constructed using Matlab/Simulink software for verification of
response and program the system. This software also helps to obtain the parameters of the
system. The highly nonlinear plant model is linearized around equilibrium points and a linear
feedback controller is employed for stabilizing the system.

Fig 2.1- Parameters that effect steady state errors

5
LITERATURE SURVEY CHAPTER 2

2.2 CONTROL OF TWIN ROTOR MIMO SYSTEM USING 1- DEGREE-


OF-FREEDOM (DOF) PID, 2-DEGREE-OF-FREEDOM (2DOF) PID AND
FRACTIONAL ORDER PID CONTROLLER (FOPID) [2]
Control design of a TRMS system resembling helicopter is very complicated task.
Since it is highly non-liner system, which makes the controller design for TRMS system very
complex problem. Two rotors are connected to TRMS system. Where the one is the main
rotor and other is tail rotor. The tail rotor is connected to the main rotor with beam for counter
balance.Two degrees of freedom (2DOF) PID controller and FOPID controller model of TRMS
involving horizontal and vertical plane has been obtained for controller design. 2-DOF PID
and FOPID controller both have been discussed in this paper. With the Simulation results
obtained for vertical and horizontal plane, factional order PID controller has been found to be
better than 2-DOF controller. The results of all the simulation work has been performed on the
MATLAB/Simulink environment.

Fig 2.2 - Blodk diagram of TRMS

2.3 COMPARATIVE PERFORMANCE ANALYSIS OF LMS AND NLMS


ON ECG SIGNAL BY USING TMS 320C6713 DSK KIT [3]
Adaptive filtering constitutes one of the core technologies in the field of digital signal
processing and finds numerous applications in the areas of science and technology viz. echo
cancellation, channel equalization, adaptive noise cancellation, adaptive beam-forming,
biomedical signal processing etc. Noise of ECG signal will minimize by using two algorithms
that is LMS and NLMS on TMS320C6713 DSK kit. A Simulink model is designed to generate

6
LITERATURE SURVEY CHAPTER 2

auto C code for the DSP processor. The output results are analyzed using Digital Storage
Oscilloscope (DSO) in terms of filtered signal. The results have also been compared with the
LMS algorithm to prove the superiority of NLMS algorithm.

Fig 2.3 - Simulink model for LMS filter algorithm

2.4 THE PARROT UAV CONTROLLED BY PID CONTROLLERS [4]


The paper presents the process of modelling and designing control laws for four-rotor
type of the Parrot UAV. The state space model is obtained by using several phenomena like
gyroscopic effects for rigid bodies, propellers and rotors. The obtained model has been used
to design PID control laws for roll, pitch, yaw angle and altitude, respectively. The numerical
simulations of the closed loop model are shown that system in satisfy way stabilize flight of
the quadro-rotor in all considered directions.
Autonomous Unmanned Air Vehicle (UAV) are increasingly popular platforms, due to
their use in military applications, traffic surveillance, environment exploration, structure
inspections, mapping and aerial cinematography. For these applications, the ability of quadro-
rotor to take off and land vertically, to perform hover flight as well as their agility, make them
ideal vehicles.
Four rotors helicopters have several basic advantages over manned systems including
increased manoeuvrability, low cost, reduced radar signatures. Vertical take-off and landing
type UAV’s exhibit further advantages in the manoeuvrability features. Such vehicles require
little human intervention from take-off to landing. This helicopter is one of the most complex
flying system that exist. This is partly due to the number of physical effects (aerodynamics
effects, gravity, gyroscopic, friction and inertial counter torques) acting on the system
(Derafaetal., 2007; Kimon, 2007). Helicopters and quadro-rotors are dynamically unstable and
therefore suitable control methods are needed to stabilize them. In order to be able to optimize
the operation of the control loop in terms of stability, precision and reaction time, it is essential

7
LITERATURE SURVEY CHAPTER 2

to know the dynamic behaviour of the process which can be established by a representative
mathematical model.
Table 2.1 Parameters of the Parrot
Parameter Meaning
Mass (including the support)
Distance between rotor and
center of mass
Max angular speed of the rotor –
in runner -14.5 V
Ratio of angular speed propeller
to rotor
Diameter x stroke of propeller

2.4 AN AUTOMOTIVE APPLICATION OF REAL-TIME ADAPTIVE


WIENER FILTER FOR NON-STATIONARY NOISE CANCELLATION IN
A CAR ENVIRONMENT [5].
Wiener filter is one of the most fundamental noise-reduction approaches among
numerous techniques. The speech recognition in an in-vehicle environment needs a non-
stationary noise cancellation to eliminate the background noise. However, few efforts have
been reported to show the effectiveness of Wiener filter. Not much has been evaluated how
the Wiener filter really works for reducing the non-stationary noise in real-time. In this paper,
a real-time adaptive Wiener filter with two microphones is implemented to reduce noisy
speech when noise signals and desired speech are incoming simultaneously. Furthermore, in
order to build a real-time noise canceller, this paper also gives an analysis of different matrix
sizes of the Wiener filter so as to enable the possibility of real-time implementation. The
performance of the proposed design is measured by as much as 20dB noise reduction, and
the proposed adaptive Wiener matrix update speed achieves a 28.6 ms/frame, with a matrix
size of 200.
Automatic speech recognition (ASR) systems have been widely used in in-vehicle
environment applications, such as navigation systems control, cabin control, and stereo
systems control. Nevertheless, most of those products not eligible for in-vehicle applications
as they are typically assumed to operate in a silent environment. Three microphones
beamforming was used to detect the desired and undesired periods of speech by defining a
geometrical “active zone”. With three microphones the word boundary detector can retrieve

8
LITERATURE SURVEY CHAPTER 2

the desired speech embedded with noise from a variety of noisy backgrounds. The VAD
(Voice Activity Detection) algorithm is an effective speech detecting method that performs to
an average of 80% success rate. However, the VAD does not work well if an unwanted speech
(noise) is incoming at the same time as desired speech. For a real-time environment in an in-
vehicle environment, noise sources are non-stationary because they come from all directions.
The previous works are conventionally implemented by using industrial control software such
as LabVIEW which can verify our design rapidly due to its powerful mathematical libraries and
the capability of real-time simulation.
However, the exact computational efficiency cannot be explored. It is also unable to
evaluate the performance and throughput of the designs. On the other hand, noise reduction
is a very challenging and complex problem due to its highly complexity and heavily
dependence of specific context and applications. Hence, this paper presents a real-time
adaptive Wiener filter for non-Stationary noise cancellation. It can efficiently evaluate the
performance and cost of the individual components of noise reduction
2.5 ANALYSIS AND COMPARISON OF RLS ADAPTIVE FILTER IN
SIGNAL DE-NOISING [6]
In the field of digital signal processing only adaptive filter can deal with some random
signal noise or the time-varying signal. The adaptive filter can track the changes of the signal
and noise so as to realize optimal filtering. This paper introduces the structure and principle
of adaptive filters. Recursive Least Square (RLS) Algorithm, presents the implementation of
simulation in the software simulator of a 32-order adaptive filter which is designed in MATLAB
environment. The emulation result shows that the 32-order adaptive filter can remove the
noise very well.
Traditional filter works well only when the signal and noise overlap in the given
frequency band, once the signal and noise overlap in the whole frequency band, and its
features cannot be predicted, Recursive Least Square (RLS) adaptive algorithm filter has
incomparable superiority of traditional methods. RLS adaptive filter uses the time average and
solves linear adaptive filtering by means of batch method. In this work, we studied RLS
adaptive algorithm filter and found that RLS algorithm converge very fast on the model, solve
the problem of slow delay, big error caused by slow convergence of Least Mean Square
(LMS), and it was widely used in practice.

9
DESIGN OF POLAR ENCODER/DECODER CHAPTER 3

CHAPTER 3

DESIGN OF DRONE FLIGHT CONTROLLERS


3.1 PID
The schematic of PID is shown in the Fig 4. It is a controller system that correct its
present and future errors based on the past response with reference with the input signal
provided by the user based on the gain which are preset for a given environmental conditions.
This cannot be varied or changed suddenly. The rise time and settling time of the PID is higher
but its peak over shoot is higher. This results in a lateral movement initially.

Fig 3.1 - Schematic of PID


The eq (2) is the derived equation of PID where Error e[n] is based on the reference
and current response is given as

𝑒[𝑛] = 𝑟[𝑛] − 𝑦[𝑛 − 1]…………(1)

The equation of PID controller is given as:

𝑢[𝑛] = 𝐾𝑝 𝑒[𝑛] + 𝐾𝑖 𝐷−𝜆 𝑒[𝑛] + 𝐾𝑑 𝐷𝜇 𝑒[𝑛]………(2)

Where Kp, Ki, Kd are gain values of the P, I, D respectively

10
DESIGN OF POLAR ENCODER/DECODER CHAPTER 3

Fig 3.2 – Table For Response Variation Based On The Parameter Increase.

3.1.1 Advantages
• Easy to stabilize
• Faster response than just P controller.
• No steady state errors.
3.1.2 Disadvantages
• Can amplify high frequency noises.
• Narrower range stability.
3.2 ADAPTIVE FILTER
The schematic of Adaptive filter is shown in fig 5. It is a filter that can automatically
adjust the its coefficients based on the environmental changes. But the only problem in the
adaptive filter’s usage in a drone is that its rise and settling time are lower when compared to
PID controller.

Fig 3.3 - Schematic of general block diagram Adaptive Filter


The input reference signal is given as

𝑟
𝑋[𝑛] = [𝑥[𝑛], 𝑥[𝑛 − 1, … , 𝑥[𝑛 + 1]] ……(3)

11
DESIGN OF POLAR ENCODER/DECODER CHAPTER 3

Output error sample is given as

𝑒[𝑛] = 𝑑[𝑛] − 𝑤[𝑛] ∗ 𝑥[𝑛]……….(4)

Filter coefficient updating equation is given as

𝑤[𝑛 + 1] = (1 − 𝜇𝛼 )𝑤[𝑛] + 𝜇 𝑒[𝑛]𝑋[𝑛]………(5)

X[n] in eq (3) is the input reference signal. And w[n] and d[n] in eq (4) are filter
coefficient and noisy signal. Α and µ in eq (5) are error coefficients parameters which varies
from 0 to 1.

3.2.1 Advantages
• Many well documented implementations (LMS, RLS, Kalman filters)
• Are optimal in that they minimize the mean squared estimation error
• Often can be computed in real-time
3.2.2 Disadvantages
• Provide point estimates
• Mean-squared error isn’t always relevant
To improve the problems that is discussed in the above system the follow design is
proposed.
3.3 PROPOSED DESIGN
In this fig 6 shows the proposed schematic of the PID controller. To reduce the peak
overshoot and improve or speedup the response time of the controller system, both PID and
adaptive filter is introduced in a single system. In the proposed system the PID is provides the
response for the reference provided by the user. The adaptive controller takeover when there
is a change in the control environment unless the PID is tuned again by the tuning module
provided inside the PID. Once the PID is tuned the control is reverted back to the PID
controller.

12
DESIGN OF POLAR ENCODER/DECODER CHAPTER 3

Fig 3.4 - Schematic of Proposed System

u[n] = u1[n − 1] + [Kp + Ki + Kd]e[n] + [Kp + 2Kd]e[n − 1] + [Kd]e[n − 2]………………(6)

The above eq (6) shows the integrated equation of both PID and adaptive filter. This
equation shows the complexity of the design is higher than the existing systems.
The above discussed system are designed using Simulink which is used do generate
the c/c++ code. Which are ran in Vits HLS to generate the RTL design. And then the RTL
design is implemented using Vivado HLx for the analysis of power consumption, Resource
utilization and critical path frequency.

13
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

CHAPTER 4
IMPLEMENTATION OF DRONE CONTROLLER
ARCHITECHTURE

The controller structures discussed in the previous chapter are implemented using
Verilog language in Vivado platform and the procedure of implementation are explained in
detail in this chapter.

4.1 SIMULATION RESULTS

4.1.1 Adaptive Filter

The following fig 4.1 shows the simulation output waveform of Adaptive filter. From the
waveform it can be analyzed and resulted as the adaptive provides a smooth transition for the
provided reference and also it also takes time to get settled to its optimal point.

Fig 4.1 Step Response of Adaptive Filter

14
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

The Fig 4.2 shows the response of an Adaptive filter for a variable reference. From
this it is proven that even before the response wave gets settle the reference value is changed.
So, this design has steady rise time with smooth transition rate. But slow settling time.

Fig 4.2 Step Response of Adaptive Filter for varying reference

4.1.2 PID

The fig 4.3 shows the step response of PID simulated in the Simulink software. From
the waveform it can me concluded that the PID have a very good rise time and its settling time
is faster than the adaptive filters. But there is a glitch at the rising edge of the wave. This make
the drone moves will be wavey.

15
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.3 Step Response of PID

The fig 4.4 shows the response of a PID for a varying reference. It is concluded that
PID has good rise time and better settling time than adaptive filter but due to the glitch at the
rising edge of the wave. This unwanted glitch does not allow the PID response to settle for
short time responses.

Fig 4.4 Step Response of PID for varying reference

4.1.3 Proposed PID

The fig 4.5 shows the step response of the Proposed PID where the waveform looks
almost ideal to the reference given to the design and settling time is also faster than the
adaptive filter and existing PID.

16
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.5 Step Response of Proposed PID

The below show fig 4.6 show the response of the proposed PID for a varying reference
voltage.

Fig 4.6 Step Response of Proposed PID for varying reference

17
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

4.2 SYNTHESIS RESULTS

4.2.1 Adaptive filter

The adaptive filter design has been designed using Simulink which is used do generate
the c/c++ code. Which are ran in Vits HLS to generate the RTL design. And then the RTL
design is implemented using Vivado HLx. It consumes 164 mW with utilization of 499 LUTs,
90 and 18 DSPs. Its operating frequency is 41.667MHz. In fig 4.7 shows the synthesised
design of adaptive filter.

Fig 4.7 Synthesized Design Adaptive Filter

4.2.2 PID

The PID controller design has been designed using Simulink which is used do
generate the c/c++ code. Which are ran in Vits HLS to generate the RTL design. And then the
RTL design is implemented using Vivado HLx. It consumes 165 mW with utilization of 1013
LUTs, 128 and 27 DSPs. Its operating frequency is 28.571 MHz. In fig 4.8 shows the
synthesised design of adaptive filter.

18
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.8 Synthesized Design PID controller

4.2.3 Proposed PID

The proposed PID controller design has been designed using Structural RTL language
in Vivado HLx platform. Its blocks were designed using above discussed design codes as
reference and has sub blocks like 64-bit floating-point adder, subtractor and multiplier. It
consumes 143 mW with utilization of 1526 LUTs, 64 and 27 DSPs. Its operating frequency is
28.571 MHz. In fig 4.9 shows the synthesised design of adaptive filter.

Fig 4.9 Synthesized Design of proposed PID

19
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

4.3 IMPLEMENTATION RESULTS

4.3.1 Adaptive Filter

The fig 4.10 shows the clock summary of the adaptive filter. It was derivative from
implementation of constraint file added to the vivado design project.

Fig 4.10 Timing and clock summary

The fig 4.11 shows the power summary of the adaptive filter after finalizing the
operational frequency of design using the STA analysis. That is after getting the near zero
positive slack.

Fig 4.11 Power summary

The Fig 4.12 shows the design runs of the adaptive filter which has the information of
number of LUTs, FFs and DSP block are used to implement the design.

Fig 4.12 Design runs

4.3.2 PID

The fig 4.13 shows the clock summary of the PID. It was derivative from
implementation of constraint file added to the vivado design project.

20
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.13 Timing and clock summary

The fig 4.14 shows the power summary of the PID after finalizing the operational
frequency of design using the STA analysis. That is after getting the near zero positive slack.

Fig 4.14 Power summary

The Fig 4.15 shows the design runs of the PID which has the information of number
of LUTs, FFs and DSP block are used to implement the design.

Fig 4.15 Design runs

4.3.3 Proposed PID

The fig 4.16 shows the clock summary of the Proposed PID. It was derivative from
implementation of constraint file added to the vivado design project.

21
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.16 Timing and clock summary

The fig 4.17 shows the power summary of the Proposed PID after finalizing the
operational frequency of design using the STA analysis. That is after getting the near zero
positive slack.

Fig 4.17 Power summary

The Fig 4.18 shows the design runs of the Proposed PID which has the information of
number of LUTs, FFs and DSP block are used to implement the design.

Fig 4.18 Design runs

22
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

4.4 IMPLEMENTATION PROCEDURE

4.4.1 Simulink design and implementation

• Open MATLAB and type “Simulink” in the command window or click on the
Simulink icon on the task bar. The Fig 4.19 shows the Simulink Window after
doing the above process.

Fig 4.19 Simulink untitled window

• To get the component to be connected for the design open the library. And the
Library used for our implementation is HLD Coder. The Fig 4.20 shows the
screenshot of Simulink Library.

Fig 4.20 Simulink Library Window

23
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

• Place all the components by selecting and right clicking the needed component
and select place in the project
• Connect the components in the required design and provide the parameter for
the project components.
• Then Click on Run to get the waveform or the response of the design in the
scope.
• Open Simulink coder app and configure as shown in the fig 4.21

Fig 4.21 Configuration parameter for Simulink Coder generator

• Then click on OK to generate the C code. The summary report will be opened
in a new window as shown in the Fig 4.22.

24
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.22 Code Generation Report for Simulink Coder generator

4.4.2 Vits HLS

• Open HLS and create project and add all the C code files generated by
Simulink Code generator.
• Run the following command in the command prompt of the Vits HLS as shown
in Fig 4.22 to generate the RTL file.

25
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.23 Commands to get RTL code from C code

26
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

4.4.3 Vivado HLx

• Open the vivado HLx


• Click on the create project to open the new project wizard
• Click on next
• Provide project name and location for the project to be stored
• Select the RTL project
• Select the part using the part number
• Click on finish to complete the wizard
• The system will initialize the project

Fig 4.24 Vivado platform

• Now click on the + on the top of the sources window which is highlighted in the
above figure
• Select the add or create design source and click next
• Click on create file to create the .v file to write the program
• Give the name for the .v file

27
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

Fig 4.25 Add/ creating the verilog file

• After giving the name click on finish


• The input and output variables can be given her or can be given after

Fig 4.26 Providing input/output pins

• Click on ok and yes

28
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

• The .v file will be added in the design source and double click on the name to open
the coding window

Fig 4.27 Editing of Verilog Code

• To view the RTL design click on the open elaborate design


• The RTL block will open and to view the full diagram click on the + on the block.

Fig 4.28 Synthesised RTL Schematic

29
IMPLEMENTATION OF DRONE CONTROLLER ARCHITECHTURE CHAPTER 4

• Now next step is run synthesis to get the number of FF, LUTs and other utilities
• Then run the implementation to get the power and timing analysis
• Click on the open implementation to see the results

Fig 4.29 Implementation Results

• To dump the code in the FPGA click on generate bitstream

30
RESULTS AND ANALYSIS CHAPTER 5

CHAPTER 5

RESULTS AND ANALYSIS

Implementation results of each Drone flight controller structure are given and compared
with each other in this chapter. All the implementation are done in Xilinx vivado software on
Artix 7 board as the base platform

5.1 SYNTHESIS RESULTS


5.1.1 PID Architecture
Table 5.1 Synthesis Result of PID Architecture
AREA UTILISATION LUT : 1013
FF : 128
DSP:27
POWER 165 mW
CONSUMPTION

5.1.2 Adaptive Controller Architecture


Table 5.2 Synthesis Result of Adaptive Controller Structure
AREA UTILISATION LUT : 499
DSP : 18
FF: 90
POWER 164 mW
CONSUMPTION

5.1.3 Proposed PID Architecture


Table 5.3 Synthesis Result of Proposed PID Structure
AREA UTILISATION LUT : 1526
DSP : 27
FF: 64
POWER 143 mW
CONSUMPTION

31
RESULTS AND ANALYSIS CHAPTER 5

5.2 COMPARISION OF RESULT


5.2.1 Sensitivity
Fig 5.1 explains about the sensitivity of different designs of controller that is used in a
UAV is designed using Simulink for functionality verification. As shown in the figure the
proposed design has higher sensitivity. The sensitivity is calculated by, Sensitivity = Settling
Voltage/ Settling time

Sensitivity (mV/s)
50

40

30

20

10

0
PID NLMS Proposed
Sensitivity (mV/s) 9.6 6.4 38.1

Fig 5.1 Comparison of sensitivity for Each Structure


5.2.2 Resource Utilization
To get the sensitivity higher for better performance the proposed design has both the
adaptive filter and a PID. But the flip flops consumed are the lowest in the proposed design
than the existing systems and the DSP blocks are equal to the existing PID system where it
should be higher than the sum of both adaptive filter and existing PID system. In Fig 5.2 shows
the number of LUTs, DSPs and Flip Flops consumed or utilized for implemented designs.

Resource Utilization
1500

150

15
LUTs FFs DSPs

Adaptive Filter PID Proposed design

Fig 5.2 Comparison of resource utilized for Each Structure

32
RESULTS AND ANALYSIS CHAPTER 5

5.2.3 Frequency
Even though proposed design is larger and consumes higher resource than the other
the frequency of operation remains the same as the existing PID filter. This is because the
proposed design has a PID block. So the critical path remains the same in both systems. Fig
5.3 represents the critical path frequency for different designs.

FREQUENCY (MHZ)

41.667

28.571

28.571
ADAPTIVE PID PROPOSED
FILTER DESIGN

Fig 5.3 Comparison of critical path frequency for each structure


5.2.2 Power
As discussed before the proposed design consumes higher resources the Flip Flops
and DSP blocks consumes higher power than LUTs. As the Flip Flop consumption is lower
than the preexisting design and DSP blocks are same as the PID system, the power
consumption of the proposed system is 13% lower in power consumption. Fig 5.4 provides
the power consumption of implemented designs

Power (W)

0.164 0.165

0.143

Adaptive Filter PID Proposed design

Fig 5.4 Comparison of Power Consumption for Each Structure

33
CONCLUSION Chapter 6

CHAPTER 6

CONCLUSION
To deal with the peak overshoot in PID and low response time in adaptive contollers
this designed system is proposed. In comparison of the proposed system with the PID and
LLMS adaptive system, the proposed system has better response time and good settling time
than the other designs compared. Even though the proposed system has higher resource
utilization than the other systems, the power consumption is 13% lower than the other designs
and operating frequency remains same as the existing PID filter. From this comparison it can
be concluded that the proposed system has better performance than the existing designed
systems. And so it can be concluded that the system is better replacement of the existing
controller designs.
The observation from the analysis is that the proposed PID provided better step
response and lower peak over shoot than the adaptive filters and existing PID controllers
respectively. The Proposed PID provides sensitivity up to 38.1 V/ms whereas the existing PID
and adaptive filter provides up to 9.6 V/ms and 6.4 V/ms respectively for reference voltage of
24V. the proposed system consumes 143 mW and the power consumption of the adaptive
filter and existing PID is 164mW and 165mW respectively. The operating frequency of
proposed system is 28.571 MHz, 41.667 for adaptive filter and 28.571 MHz for existing PID.
From this comparison of results, it is concluded that the proposed system has higher
sensitivity with 13% lower power consumption.

34
BIBLIOGRAPHY

BIBLIOGRAPHY
1. Ashis C K, Rahul Sharma K “Dynamic Modelling and Altitude Control of Parrot Rolling
Spider using LQR”, 2019 2nd International Conference on Intelligent Computing,
Instrumentation and Control Technologies (ICICICT).

2. Seema Chaudhary and Awadhesh Kumar “Control of Twin Rotor MIMO System Using
1- Degree-of-Freedom (DOF) PID, 2-Degree-of-Freedom (2DOF) PID and Fractional
order PID Controller (FOPID)”, Proceedings of the Third International Conference on
Electronics Communication and Aerospace Technology [ICECA 2019] IEEE
Conference Record # 45616; IEEE Xplore ISBN: 978-1-7281-0167-5

3. Chaitanya M Patil and R A Deshpande “Comparitive Performance Analysis of LMS and


NLMS on ECG Signal by using TMS 320C6713 DSK kit”International Journal of
Computer Applications (0975 – 8887) Volume 111 – No 12, February 2015
4. Andrzej Koszewnik “The Parrot UAV Controlled by PID Controllers”, acta mechanica et
automatica, vol.8 no.2 (2014), DOI 10.2478/ama-2014-0011
5. Yen-Hsiang Chen, Shanq-Jang Ruan, Tom Qi. “An Automotive Application Of Real-
time Adaptive Wiener Filter For Non-stationary Noise Cancellation In A Car
Environment.” 978-1-4673-2193-8/12/$31.00 ©2012 IEEE
6. GuoQuan Xing, YuXia Zhang, “Analysis and comparison of RLS Adaptive Filter in
Signal De-noising”, 978-1-4244-8165-1/11/$26.00 ©2011 IEEE

7. Software/Hardware Implementation of an Adaptive Noise Cancellation System, Dr.


Wagdy H Mahmoud, University of the District of Columbia Dr. Nian Zhang, University
of the District of Columbia,2013
8. GuoQuan Xing and YuXia Zhang. “Analysis and Comparison of RLS Adaptive Filter in
Signal De-noising”, 978-1-4244-8165-1/11©2011 IEEE.
9. M. Bahoura, H. Ezzaidi, “FPGA-implementation of a sequential adaptive noise
canceller using Xilinx System Generator,” Proceedings of the 2009 International
Conference on Microelectronics (ICM), pp. 213-216, 2009.
10. The LMS Algorithm with Delayed Coefficient Adaptation , Proceedings of the IEEE
Transactions On Acoustics. Speech. And Signal Processing. Vol 37. No 9. September
1989
11. S. Haykin, Adaptive Filter Theory, Prentice Hall, Upper Saddle River, NJ, 2002.

35
BIBLIOGRAPHY

12. Douglas, S.C., “Fast exact filtered-X LMS and LMS algorithms for multichannel active
noise control, “Proceedings of IEEE International Conference on Acoustics, Speech,
and Signal Processing, 1997. ICASSP-97., Vol. 1, pp. 399-402, 1997.

13. Jing Dai; Yanmei Wang, “NLMS Adaptive Algorithm Implement Based on FPGA,”
Proceedings of the 3rd International Conference on Intelligent Networks and Intelligent
Systems (ICINIS), pp. 422- 425, 2010.

36
PUBLICATION

PUBLICATION
1. Prithiv L, Radhakrishnan K R, “Design of Adaptive PID controller for quadcopter UAV”, One
day Online Workshop on Micro Nano Electronics and Communication Systems
(MECS’21),PSG College of Technology,Coimbatore.

37
Department of Electronics & Communication Engineering
PSG College of Technology, Coimbatore – 641004

ONE DAY VIRTUAL CONFERENCE ON


MICRO NANO ELECTRONICS & COMMUNICATION SYSTEMS
MECS 2021
E- CERTIFICATE

This is to certify that Dr./Mr./Ms.PRITHIV L (19MV32),M.E VLSI Design, Department of Electronics


and Communication Engineering, PSG College of Technology has presented a paper titled “DESIGN
OF ADAPTIVE PID FILTER FOR QUADCOPTER UAV ” in the one day virtual conference on
“Micro Nano Electronics & Communication Systems” (MECS’ 2021) organized by the Department
of Electronics and Communication Engineering, PSG College of Technology, Coimbatore on 8 th May
2021.

Dr. V. K. Manoharan Dr. V. Krishnaveni


Conference Secretary Convener

You might also like