0% found this document useful (0 votes)
41 views1 page

Implementation of PID Controller by Microcontroller of PIC (18 Series) and Controlling The Height of Liquid in Sources

This document discusses the implementation of a PID controller using a PIC microcontroller to control the height of liquid in industrial applications. It details the mathematical foundation of PID control, the use of PWM for motor control, and the importance of selecting appropriate PID parameters for effective system performance. The paper also highlights practical applications of the PID controller in industries, particularly in managing liquid levels in oil tanks.

Uploaded by

Trushank Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Implementation of PID Controller by Microcontroller of PIC (18 Series) and Controlling The Height of Liquid in Sources

This document discusses the implementation of a PID controller using a PIC microcontroller to control the height of liquid in industrial applications. It details the mathematical foundation of PID control, the use of PWM for motor control, and the importance of selecting appropriate PID parameters for effective system performance. The paper also highlights practical applications of the PID controller in industries, particularly in managing liquid levels in oil tanks.

Uploaded by

Trushank Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Citation: Maghsadhagh A (2016) Implementation of PID Controller by Microcontroller of PIC (18 Series) and Controlling the Height of Liquid in

botics &

Advances in Robotics
Ro A Sources. Adv Robot Autom 5: 156. doi: 10.4172/2168-9695.1000156
n
Maghsadhagh, Adv Robot Autom 2016, 5:3

ut
Advances
DOI: 10.4172/2168-9695.1000156

oma n
& Automation
tio
ISSN: 2168-9695 Page 2 of 4
Research Article Open Access
• I accounts for past values of the error. For example, if the Which can be converted to:
current output is not sufficiently strong, error will accumulate
Implementation of PID Controller by Microcontroller of PIC (18 Series) over time, and the controller will respond by applying a
u[k]= u[k − 1] + K1 ∗ u[k] + K 2 ∗ u[k − 1] + K 3 ∗ u[k − 2]

and Controlling the Height of Liquid in Sources stronger action. Now a digital output must be transferred to an analog output, to be
understandable for the pomp.
• D accounts for possible future values of the error, based on its
Ardavan Maghsadhagh*
current rate of change. Some applications can be controlled by Pulse Width Modulation (PWM)
Istanbul Technical University, Master, Faculty of Electrical Engineering, İstanbul, Turkey
PI in the absence of D factor or PD in the absence of I factor
(Figure 2). DC motors were the first type widely used, since they could be
Abstract powered from existing direct-current lighting power distribution
To approach to the factors of PID we can use Ziegler-Nichols systems. A DC motor's speed can be controlled over a wide range, using
This paper presents a comprehensive analysis of PID controller and implementation of PID by the microcontroller method which is a heuristic method of tuning a PID controller. It either a variable supply voltage or by changing the strength of current
of PIC and the use of PWM in the DC controlling processes. First of all we use the PID controller to control a is performed by setting I (integral) and D (derivative) gains to zero. in its field windings [2,3].
continuous process by using reasonable factors (P, I, D) in PID and PIC (18f452) will help us during this period of The "P" gain, Kp is then increased (from zero) until it reaches the
time and after that producing an adequate PWM signal for the use of our pomp to take the motor under our control. ultimate gain Ku, at which the output of the control loop has stable V Ra
ù= + T
We have to use an appropriate IC such as L298 which is a motor driver. rm
K eφ ( K eφ )2
and consistent oscillations. Ku and the oscillation period Tu are used
to set the P, I, and D gains depending on the type of controller used: As it can be seen from the equal, DC motors speed can be controlled
Keywords: Microcontroller; PID; Microchip technology; PIC de(t ) (Table 1). by three parameter: voltage (V), flux (𝜙), resistance of motor (Ra).
= Kpe(t) + K i ∫ 0t e(t)dt + K d
*u(t)
Introduction dt Discrete-time PID algorithm In the past one of the most common ways for controlling DC
Where Kp, Ki, Kd, all non-negative, denote the coefficients for the motors is using a kind of variable resistance. This kind of control have
These days many people are aware of the importance of controlling proportional, integral, and derivative terms, respectively (sometimes The PID mathematical equation must be transferred to digital
equation which will be understandable for the PIC. It can be changed been used in old sewing machines (Figure 3).
process in our factories and housekeeping. One of the most important denoted P, I, and D). In this model:
factors that are vital for motors and pumps in factories, is the times with a good approximation like the below equation, for digital But it is not an economical way to control a DC motor because of
• P accounts for present values of the error. For example, if the implementation, we are more interested in a Z-transform of (*): its energy losses. So engineers had to find out a new controlling method
the motors are in stand by mood and the operator wants to turn on error is large and positive, the control output will also be large
them. This can cause a huge current in the rotors even eight times  Ki  [4,5].
and positive. U(z) = K p + + K d (1 − z −1 )  E (z)
more than functional current. By being aware about this huge current,  1 − z −1  First of all, engineers introduced Duty Cycle term. A duty cycle is
we have to be avoided about turning off motors. Now we can use a the percentage of one period in which a signal or system is active. Duty
By rearranging once again:
common controller like PID that can reduce the damages impressively. cycle is commonly expressed as a percentage or a ratio. A period is the
But determining reasonable factors for PID is very vital for the system  ( K p + K i + K d ) + ( − K p − 2 K d ) z −1 + K d z −2  time it takes for a signal to complete an on-and-off cycle. As a formula,
which is designed to be able to control a continuous system that will be U(z) =   E (z)
 1 − z −1  a duty cycle may be expressed as:
interrupted by one or more output valves. PW
K1 = K p + K i + K d = D × 100
After designing a probable software, we have to find a capable T
hardware such as motor driver, microcontroller and what it needs to K2 =
− K p − 2K d where D is the duty cycle, PW is the pulse width, and T is the total
run properly. PIC is a family of microcontrollers made by Microchip period of the signal. Thus, a 60% duty cycle means the signal is on 60%
K3 = K d of the time but off 40% of the time. So the motor can be controlled
Technology, derived from the PIC1650 originally developed by General
Instrument's Microelectronics Division. The name PIC initially referred It can be written: precisely with high output (Figure 4).
to Peripheral Interface Controller. The first parts of the family were
U ( z ) − z −1U ( z ) = K1 + K 2 z −1 + K 3z −2  E ( z )
available in 1976; by 2013 the company had shipped more than twelve
billion individual parts, used in a wide variety of embedded systems.
In 2000, Microchip introduced the PIC18 architecture. Unlike the 17
series, it has proven to be very popular, with a large number of device
variants presently in manufacture. In contrast to earlier devices, which
were more often than not programmed in assembly, C has become the
predominant development language. Because of this popularity this
type of PICs is chosen (Figure 1).
As a bridge to the real world from assembly world, a driver is Figure 1: Type of PICs. Figure 3: Voltage -ωm Plot.
needed, which transfers the programs and orders from microcontroller
to the pomp input. PWM helps us to control the pomp continuously
and properly [1]. *Corresponding author: Ardavan Maghsadhagh, Istanbul Technical University,
Master, Faculty of Electrical Engineering, İstanbul, Turkey, Tel: 902122853030;
PID Controller in Mathematical Format E-mail: [email protected]

A proportional integral derivative controller is a control loop Received September 27, 2016; Accepted November 01, 2016; Published
Figure 2: PID Conduct.
November 04, 2016
feedback mechanism commonly used in industrial control systems.
A PID controller continuously calculates an error value e(t) as the Citation: Maghsadhagh A (2016) Implementation of PID Controller by
Microcontroller of PIC (18 Series) and Controlling the Height of Liquid in Sources. Control Type Kp Ki Kd
difference between a desired set point and a measured process variable. Adv Robot Autom 5: 156. doi: 10.4172/2168-9695.1000156
P 0.5Ku - -
The controller attempts to minimize the error over time by adjustment
Copyright: © 2016 Maghsadhagh A. This is an open-access article distributed PI 0.45Ku 1.2Kp/Tu -
of a control variable u(t) such as the position of a control valve, a
under the terms of the Creative Commons Attribution License, which permits PID 0.6 Ku 2Kp/Tu 8Kp/Tu
damper, or the power supplied to a heating element, to a new value unrestricted use, distribution, and reproduction in any medium, provided the Figure 4: Resistance - ωm Plot.
determined by a weighted sum: original author and source are credited. Table 1: Ziegler–Nichols method.

Adv Robot Autom, an open access journal Volume 5 • Issue 3 • 1000156 Adv Robot Autom, an open access journal Volume 5 • Issue 3 • 1000156
ISSN: 2168-9695 ISSN: 2168-9695

Citation: Maghsadhagh A (2016) Implementation of PID Controller by Microcontroller of PIC (18 Series) and Controlling the Height of Liquid in Citation: Maghsadhagh A (2016) Implementation of PID Controller by Microcontroller of PIC (18 Series) and Controlling the Height of Liquid in
Sources. Adv Robot Autom 5: 156. doi: 10.4172/2168-9695.1000156 Sources. Adv Robot Autom 5: 156. doi: 10.4172/2168-9695.1000156

Page 3 of 4 Page 4 of 4

A technique to take analog output from digital input in various Height Sensor programming software is recommended to whom does not know C
systems. language very well (Figure 10).
Strain gage sensors are one the most popular sensors which are
The pulse can be produced by many methods such as hardware used in industrial applications (Figure 8). Practical Industrial Application of PID Controller
techniques (ICs like 555 timer IC) or software methods.
A strain gauge (or strain gage) is a device used to measure strain In industrial country, particularly in oily oil-rich countries,
Since our microcontrollers do not have the acceptable power to on an object. The gauge is attached to the object by a suitable adhesive, engineers implement PID controller by PICs or PLCs to control the
run a motor, a driver is needed to make the analog output capable to such as cyanoacrylate. As the object is deformed, the foil is deformed, height of oil in tanks. Controlling the height of petroleum liquid in
operational (Figure 5). causing its electrical resistance to change. This resistance change, tanks of refineries is one of the most important factors of safety in oil
usually measured using a Wheatstone bridge, is related to the strain by industry.
Driver the quantity known as the gauge factor (Figure 9).
As it has been said, many practical controllers had been used
The pulse which is on the microcontroller port is not able to run So VG will be changed by the changing of R2 and a resistance factor for many years to control turbulences in various systems, but PID
a motor such as a pomp. So a motor driver such as L298 is needed will be a voltage factor and understandable for the microcontroller. controller has been very successful until today either in industrial
(Figure 6). applications or nonindustrial (Figure 11).
It is very important that a low pass filter (such as a capacitance) is
The L298 is an integrated monolithic circuit in a 15-lead Multiwatt vital for the output of the sensor since there are various kinds of noises Conclusion
and PowerSO20 packages. It is a high voltage, high current dual full- in Lab.
bridge driver designed to accept standard TTL logic levels and drive Figure 10: Proteus Schematic of Project.
In this paper, implementation of PID controller, which has been
inductive loads such as relays, solenoids, DC and stepping motors. Two Programming one the most popular controller, is discussed. Implementing by PIC
enable inputs are provided to enable or disable the device independently microcontroller, one of the high-wrought microcontrollers that is
One of the most important parts of the project is programming
of the input signals. The emitters of the lower transistors of each bridge used in factories and industrial places commonly. First of all, a digital
process which can be done by C language. On the other hand, Flowcode
equal of PID is needed to be understandable for the microcontroller.
are connected together and the corresponding external terminal can be
The digital output will not be fit for the analog world and PWM is
used for the connection of an external sensing resistor. An additional
designed to control the pomp properly. After all every project needs
supply input is provided so that the logic works at a lower voltage some sensors to make the brain of the project (microcontroller) be
(Figure 7). aware about interrupts. Using sensors in the right bridge is another
It can run two motors (50V, 2A) in the same time or its outputs can vital point.
be used to activate one motor with high current whose form is used in References
this project. 1. Katsuhiko Ogata: Linear Control.

2. Varodom Toochinda (2011) Digital PID Controllers.

3. Peterchev AV, Sanders R (2006) Digital Pulse-Width Modulation Control in


Power Electronic Circuits: Theory and Applications.

4. Microchip Technology, PIC18f452 catalog.


Figure 11: An Industrial Schematic of PID controller In Tanks.
Figure 7: Electronic Circuit of L298. 5. Sengolrajan T, Shanthi B (2016) Comparative Analysis of Trapezoidal PWM
Strategies for three phase Trinary Source nine Level Inverter In: Journal of
Electrical Engineering.

Figure 5: Duty Cycle Process.

Figure 8: Strain Gauge schematic.

Figure 6: L298 a Similar Motor Driver. Figure 9: Wheatstone Bridge.

Adv Robot Autom, an open access journal Volume 5 • Issue 3 • 1000156 Adv Robot Autom, an open access journal Volume 5 • Issue 3 • 1000156
ISSN: 2168-9695 ISSN: 2168-9695

You might also like