You are on page 1of 37

DIGITAL PID CONTROLLER USING

MICROCONTROLLER
Nishant Mishra
02913204914
EEE

Sections
Control Systems

Types of controllers
Overview of the project
Voltage follower
The Arduino Platform
Low Pass Filter

Control Systems
A control system is a device, or set of devices, that
manages, commands, directs or regulates the
behavior of other devices or systems.
Open loop

Closed loop

Know the terms


Process variable:- It is the current status of the process
under control eg Position of a robotic arm
Set Point:- It is the desired value of a variable of the
system
Error:- It is the difference between the set point and
process variable
Controller:- A controller is a device which monitors and
physically alters the operating conditions of a given
dynamic system.

Sections
Control Systems

Types of controllers

Overview of the project


Voltage follower
The Arduino Platform
Low Pass Filter

Types of controllers

Two Position Control


Proportional plus Integral plus Derivative Control
Proportional Control
Proportional plus Integral Control
Proportional plus Derivative Control

Two position controllers

Also Known as ON-OFF or bang bang control


Inexpensive and simple
Control is quickly switched to maximum or minimum value
Eg Water heater

The Deadband

In an ON-OFF controller there is an overlap as the error


increases or decreases through zero.
This overlap causes a span of error. During this span of error,
there is no change in the controller output.

Proportional plus Integral plus Derivative


controller
A PID controller continuously
calculates an error value e(t)
as the difference between a
desired setpoint and a
measured process variable and
applies a correction based on
proportional, integral, and
derivative terms.

Proportional Control
P accounts for present values of the error. For example, if
the error is large and positive, the control output will also
be large and positive.
A proportional controller (Kp) will have the effect of
reducing the rise time and will reduce, but never
eliminate, the steady-state error.
Increasing the proportional gain also increases the
overshoot.

Effect of proportional control


Step Response

Kp

0.9
0.8

Kp=300;

0.6
To: Y(1)

s 10 s ( 20 Kp )

0.7

Amplitude

T( s )

From: U(1)

0.5
0.4

K=100

0.3
0.2

num=[Kp];

0.1
0

0.2

0.4

0.6

0.8

1.2

1.4

1.6

1.8

1.2

1.4

1.6

1.8

Time (sec.)

den=[1 10
20+Kp];

From: U(1)

1.2

To: Y(1)

Amplitude

t=0:0.01:2;

Step Response
1.4

0.8

0.6

K=300
K=300

0.4

step(num,den,t)

0.2

0.2

0.4

0.6

0.8

Time (sec.)

Proportional Derivative Control


D accounts for possible future trends of the error, based
on its current rate of change.
The stability and overshoot problems that arise when a
proportional controller is used at high gain can be
mitigated by adding a term proportional to the timederivative of the error signal.
Using a Derivative term the overshoot and settling time
can be decreased

Effect of damping
The value of the damping can
be adjusted to achieve a
critically damped response.

Integral Control
I accounts for past values of the error. For example, if the
current output is not sufficiently strong, the integral of the
error will accumulate over time, and the controller will
respond by applying a stronger action.
Proportional- Derivative control does not cure the problem
with the steady-state error. Fortunately it is possible to
eliminate this while using relatively low gain by adding an
integral term to the control function .

Effect of Integral Control


An integral control (Ki) will
have the effect of
eliminating the steadystate error, but it may
make the transient
response worse.

The Characteristics of P, I, and D controllers


RISE TIME

OVERSHOOT

SETTLING TIME

S-S ERROR

Kp

Decrease

Increase

Small Change

Decrease

Ki

Decrease

Increase

Increase

Eliminate

Kd

Small
Change

Decrease

Small
Change

Decrease

Methods for Tuning PID Controller- Manual


Method
First set Ki and Kd to zero
Increase Kp till output of loop oscillates
Kp should be set to approximately half of that value for a
"quarter amplitude decay" type response.
Increase Ki until any offset is corrected in sufficient time
for the process, however too much Ki will cause
instability.
Increase Kd if required, until the loop is acceptably quick
to reach its reference after a load disturbance.

Too much Kd will cause excessive response and


overshoot. A fast PID loop tuning usually overshoots
slightly to reach the setpoint more quickly
However, some systems cannot accept overshoot, in
which case an over-damped closed-loop system is
required, which will require a Kp setting less than half of
the Kd that was causing oscillation.

ZieglerNichols tuning method


It is performed by setting the I (integral) and D (derivative)
gains to zero.
The "P" (proportional) gain, Kp is then increased (from
zero) until it reaches the ultimate gain Ku at which the
output of the control loop has stable and consistent
oscillations.
Ku and the oscillation period Tu are used to set the P, I,
and D gains.

Control
Type

Kp

Ti

Td

0.5Ku

PI

0.45Ku Tu/1.2

PD

0.8Ku

classic
0.6Ku
PID

Tu/8

Tu/2

Tu/3

Sections
Control Systems
Types of controllers

Overview of the project


Voltage follower
The Arduino Platform
Low Pass Filter

Overview of the project

Signal
Generator

Positive
Voltage
follower

Negative
Voltage
Follower

Arduino

LPF

Output

Sections
Control Systems
Types of controllers
Overview of the project

Voltage follower
The Arduino Platform
Low Pass Filter

Voltage follower
A voltage follower (also called a unity-gain amplifier, a
buffer amplifier, and an isolation amplifier) is a op-amp
circuit which has a voltage gain of 1.
This means that the op amp does not provide any
amplification to the signal. The output voltage is the same
as the input voltage. Thus, for example, if 5V goes into
the op amp as input, 5V comes out as output. A voltage
follower acts as a buffer, providing no amplification or
attenuation to the signal.

Voltage follower: Positive buffer


The gain of a non inverting
op amp is given by:
Vo/Vin= 1+ (R2/R1)
When R2 tends to 0 and
R1 is infinite, the gain is 1

Negative Buffer
The gain of an inverting
op amp is given by
Vo/Vin = -R2/R1
The gain when R2 = R1
is -1
This configuration is
called a negative buffer

Sections

Control Systems
Types of controllers
Overview of the project
Voltage follower

The Arduino Platform


Low Pass Filter

The Arduino platform


A microcontroller is a small computer (SoC) on a single integrated circuit
containing a processor core, memory, and programmable input/output
peripherals.

The Arduino UNO


Arduino Uno is a 5V 8-bit
16 MHz AVR
microcontroller board
based on the
ATmega328P. It has 14
digital input/output pins (of
which 6 can be used as
PWM outputs)6 analog
inputs, a 16 MHz quartz
crystal, a USB connection,
a power jack, an ICSP
header and a reset button.

Pulse width Modulation


PWM is a modulation
technique used to encode
a message into a pulsing
signal.Digital control is
used to create a square
wave, a signal switched
between on and off. This
on-off pattern can simulate
voltages in between on
and off.

Algorithm
previous_error = 0
integral = 0
start:
error = setpoint - measured_value
integral = integral + error*dt
derivative = (error - previous_error)/dt
output = Kp*error + Ki*integral + Kd*derivative
previous_error = error
wait(dt)
goto start

Code in arduino IDE

Sections

Control Systems
Types of controllers
Overview of the project
Weins bridge oscillator
Voltage follower
The Arduino Platform

Low Pass Filter

Analog output using LPF


The idea behind realizing Digtal to
Analog output from the PWM signal
is to analog low-pass filter the PWM
output to remove most of the high
frequency components, thereby
leaving only the low frequency (D.C.)
components. The bandwidth of the
low-pass filter will essentially
determine the bandwidth of the
Digtal to Analog analog frequency

Second order LPF


The implementation for a
second order passive low
pass filter is simply
cascading two first order
filters in series. We create
two first order filters, each
with an f3dB of 23.4 Hz
For this example, we
chose 6.8 F for CF and
computed RF to be 1k
(standard 1% value)

Thank You

You might also like