TEMPERATURE CONTROL APPLICATIONS BY MEANS OF A PIC16F877 MICROCONTROLLER



Similar documents
Microcontroller-based experiments for a control systems course in electrical engineering technology

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

PC BASED PID TEMPERATURE CONTROLLER

HITACHI INVERTER SJ/L100/300 SERIES PID CONTROL USERS GUIDE

Interfacing Analog to Digital Data Converters

Conversion Between Analog and Digital Signals

Bi-directional Power System for Laptop Computers

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

Real time MATLAB Interface for speed control of Induction motor drive using dspic 30F4011

Design and Construction of Microcontroller Based Charge Controller for Photovoltaic Application

Programmable Single-/Dual-/Triple- Tone Gong SAE 800

XC series BD board for special functions. Operate Manual

Room Temperature based Fan Speed Control System using Pulse Width Modulation Technique

Microcontroller to Sensor Interfacing Techniques

Use and Application of Output Limiting Amplifiers (HFA1115, HFA1130, HFA1135)

Experiment 8 : Pulse Width Modulation

Introduction to SMPS Control Techniques

Analog-to-Digital Converters

Digital to Analog Converter. Raghu Tumati

How to Turn an AC Induction Motor Into a DC Motor (A Matter of Perspective) Steve Bowling Application Segments Engineer Microchip Technology, Inc.

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

Frequency Response of Filters

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

Switch Mode Power Supply Topologies

An Introduction to MPLAB Integrated Development Environment

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Micro-Step Driving for Stepper Motors: A Case Study

How to Read a Datasheet

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Tamura Closed Loop Hall Effect Current Sensors

HIGH VOLTAGE POWER SUPPLY FOR ELECTRO-OPTICS APPLICATIONS

Controlling a Dot Matrix LED Display with a Microcontroller

DM74121 One-Shot with Clear and Complementary Outputs

Lecture 18: Common Emitter Amplifier. Maximum Efficiency of Class A Amplifiers. Transformer Coupled Loads.

Interfacing To Alphanumeric Displays

Digital to Analog and Analog to Digital Conversion

PowerAmp Design. PowerAmp Design PAD135 COMPACT HIGH VOLATGE OP AMP

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University

Basic DC Motor Circuits

Developments in Point of Load Regulation

Constructing a precision SWR meter and antenna analyzer. Mike Brink HNF, Design Technologist.

FUZZY Based PID Controller for Speed Control of D.C. Motor Using LabVIEW

Implementation of Fuzzy and PID Controller to Water Level System using LabView

TS555. Low-power single CMOS timer. Description. Features. The TS555 is a single CMOS timer with very low consumption:

PID Control. Proportional Integral Derivative (PID) Control. Matrix Multimedia 2011 MX009 - PID Control. by Ben Rowland, April 2011

Op-Amp Simulation EE/CS 5720/6720. Read Chapter 5 in Johns & Martin before you begin this assignment.

Microcontroller Code Example Explanation and Words of Wisdom For Senior Design

Programming Logic controllers

Features. Applications

Pulse Width Modulation

Tutorial for MPLAB Starter Kit for PIC18F

A 5 Degree Feedback Control Robotic Arm (Haptic Arm)

Speed Control Methods of Various Types of Speed Control Motors. Kazuya SHIRAHATA

21. PID controller SYSTEM ACTUATOR. Figure 1: A crude example for a regulation

IMPLEMENTATION OF FUZZY EXPERT COOLING SYSTEM FOR CORE2DUO MICROPROCESSORS AND MAINBOARDS. Computer Education, Konya, 42075, Turkey

KA7500C. SMPS Controller. Features. Description. Internal Block Diagram.

Current Loop Tuning Procedure. Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) General Procedure AN-015

Harmonics and Noise in Photovoltaic (PV) Inverter and the Mitigation Strategies

Tire pressure monitoring

Chapter 6: From Digital-to-Analog and Back Again

Lab 7: Operational Amplifiers Part I

A PC-BASED TIME INTERVAL COUNTER WITH 200 PS RESOLUTION

AMZ-FX Guitar effects. (2007) Mosfet Body Diodes. Accessed 22/12/09.

Design and Construction of Variable DC Source for Laboratory Using Solar Energy

HT46R14A Single Phase AC Induction Motor Frequency Converter Application

MICROCONTROLLER BASED SMART HOME WITH SECURITY USING GSM TECHNOLOGY

Self-Balancing Robot Project Proposal Abstract. Strategy. Physical Construction. Spencer Burdette March 9, 2007

Bipolar Transistor Amplifiers

LM118/LM218/LM318 Operational Amplifiers

Transistor Characteristics and Single Transistor Amplifier Sept. 8, 1997

Current and Temperature Ratings

24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales FEATURES S8550 VFB. Analog Supply Regulator. Input MUX. 24-bit Σ ADC. PGA Gain = 32, 64, 128

E&I MAINTENANCE ENTRY TEST ENABLING OBJECTIVES. DESCRIBE hazards and precautions taken to avoid injury in the workplace.

Frequency Converter Fv

Introduction to Electronic Signals

Measuring Temperature withthermistors a Tutorial David Potter

Model AD558J AD558K AD558S 1 AD558T 1 Min Typ Max Min Typ Max Min Typ Max Min Typ Max Units

Transistor Amplifiers

APPLICATION NOTE ULTRASONIC CERAMIC TRANSDUCERS

Electronics 5: Arduino, PWM, Mosfetts and Motors

LED board datasheet EB

A PIC16F628 controlled FLL (Frequency Locked Loop) VFO for HF

Series AMLDL-Z Up to 1000mA LED Driver

Basic Pulse Width Modulation

SMART DRUNKEN DRIVER DETECTION AND SPEED MONITORING SYSTEM FOR VEHICLES

Web Site: Forums: forums.parallax.com Sales: Technical:

How to measure absolute pressure using piezoresistive sensing elements

International Journal of Electronics and Computer Science Engineering 1588

"Charging Lithium-Ion Batteries: Not All Charging Systems Are Created Equal"

Cornerstone Electronics Technology and Robotics I Week 15 Voltage Comparators Tutorial

DM Segment Decoder/Driver/Latch with Constant Current Source Outputs

USER MANUAL ESP. Enhanced Steering Performance. R-Net

Accurate Measurement of the Mains Electricity Frequency

ARRL Morse Code Oscillator, How It Works By: Mark Spencer, WA8SME

Considerations When Specifying a DC Power Supply

EFC Frequency converters

Microcontroller for Variable Speed BLDC Fan Control System. T.C. Lun System Engineer, Freescale Semiconductor, Inc.

# 2. Selecting and Using Thermistors for Temperature Control

Transcription:

TEMPERATURE CONTROL APPLICATIONS BY MEANS OF A PIC16F877 MICROCONTROLLER Serhat YILMAZ, Burak TOMBALOGLU, Kursat KARABULUTLU, Yener GUMUS, Hasan DiNCER serhaty72@yahoo.com, buraktombaloglu@hotmail.com, bkb7883@hotmail.com, yenergumus@hotmail.com, hdincer@kou.edu.tr University of Kocaeli, Electronics and Communications Research and Application Center-EHSAM, Veziroglu Kampusu 41040, Kocaeli/Turkey Key words: PID control,,fuzzy control, PIC16F877 ABSTRACT In this study, temperature of a closed environment is kept constant by a PIC16F877. The microcontroller holds the fuzzy control process or PID control process, individually. The temperature data is acquired from LM 35 temperature sensor and the control output determines speed of a 220V AC fan by means of a PWM and a triac triggering circuits. The heat control system will be used to cool a highly sensitive measurement device. Refer to the results, performances of these two control methods are compared. I. INTRODUCTION A glass container, dimensions of which is 20*20*30 cm is aimed to be cooled by PID and fuzzy control methods. The container is heated by a resistance and heat of the inner environment is increased depending on the outer environment. The microcontroller acquires the temperature data and its control output adjusts the cooling rate of the fan in order to decrease heat of the inner environment down to the outer conditions. The control system will be used to eliminate the self-heating effect of the resistors of a measurement device which increases uncertainties in the measurement. Fuzzy and PID control methods obtain a highly stable temperature in the container. Programming of PID and fuzzy control algorithms are prepared in PIC assembler codes. Figure.1- Block Diagram of the Control System INPUT LAYER II. THE HEAT CONTROL SYSTEM The system is composed of a 300W heater resistance, a temperature sensor, a measurement amplifier, a controller, a digital/analog converter, a pulse width modulator, a triac triggering circuit and a 220V AC fan. Figure.2- Heat Sensor and Measurement Amplifier [11] The input layer contains a LM35 temperature sensor and a measurement amplifier. LM35 produces 10mV per 0 C [13]. Therefore 35 0 C is represented by 350 mv. As shown in figure.2;

e2 9 = 1+ = 10 e1 1 e2 e 4 e3, 5 = e 6 5 (1) = (2) Refer to Eq.1, e 2 will be 3,5V. If adjustable set value e 3 is set to 2.5V, then output e 0 will be 5 5 e0 = e5 1 + e4 = 6e 5 5e 4= 5e 2 5e 3 = 5( e2 e3) = 5V (3) 1 1 MICROCONTROLLER SECTION The processed digital data which is received from port C of the microcontroller is reconverted to analog data by a 8 bit ladder 2-2R DAC circuit as shown in figure.4. [7] OUTPUT LAYER This section is consist of a PWM, a fan driver and an LCD driver. Pulse Width Modulation Circuit: DAC output is input modulation data of the PWM circuit and is required to determine speed or rotation interval time of the cooling fan. Figure3. Crystal and Voltage Supply Connections The amplifier output e 0 is read by analog input (RA0) and converted to digital data by A/D converter of the microcontroller.[8] Figure5. Pulse Width Modulator Charges and discharges of C 1 creates a sawtooth signal. The 2 nd voltage comparator LM339 is used to compare sawtooth and input signals. [12] While amplitude of input signal is greater than the sawtooth's amplitude, the comparator output produces +V CC. [14] Circuit of The Fan Driver PWM output is applied to an optocoupler which drives BD177 NPN transistor. The transistor supplies sufficient current to trigger the triac BT138 which adjusts the fan's speed refer to pulse wide of the trigerring signal. Figure4. 2-2R Ladder Scheme The converted data is processed by the PID control or the fuzzy control programs. Figure.6- Triac Trigerring Circuit

LCD Heat Display Unit: An LCD driver circuit is set to monitor temperature in the glass container. [10] Figure.9- Structure of the Realized PID Controller Figure.7- Circuit of the LCD Driver II. CONTROL METHODS The controllers allow to fix the heat of the system by means of adjusting the fan s cooling rate. STAGES OF DIGITAL PID CONTROLLER DESIGN The use of digital controllers are increasing gradually in the last decades. Developments in the electronics and microprocessor technology brings out the need for discrete approximation to PID controllers. Block diagram of a closed loop digital controller is shown below. [1] STAGES OF FUZZY CONTROLLER DESIGN The heat of the system is sensed by a sensor and compared with the set value. The error between the actual and set value is called to be set/actual offset. This offset determines the main fuzzy linguistic rules of the system. They are as follows: If the offset is large, then cool the system, more If the offset is very small, then don t change the cooler, much Fuzzy logic processing runs under these rules and the rules related to the rate of change of the set/actual offset. This allows us very smooth adjustment of cooling rate. Input data of the offset is calculated by means of taking relative heat difference of actual heat to the set value as shown below. E= (Actual Heat of the System)-(Set Value) (5) Input data for rate of change of offset ( E), is the difference between the last value of E, (E n ) and the previous value of E, (E n-1 ): E= (E n ) - (E n-1 ) ) (6) Figure.8- Block Diagram of a Closed Loop Digital Controller Control signal of the PID controller for each sampling interval (T) is determined as; Kd Ki.T P1 = P0 + (e1 e2).kp+ (e1 2.e2 + e3). + (e1 + e2). (4) T 2 where; Kp, K d and K i are coefficients of proportional, integral and derivative elements, respectively. P0 is the the control signal of the previous sampling, e 1 is the current error, e 2 is error of previous sampling and e 3 is the error of the sampling before previous sampling. [4] And the PID algorithm which is used in the microcontroller is obtained by using approximate trapezoidal iteration and derivative, as shown in figure.9 ; The figures shown below represent condition and conclusion membership functions. Condition membership functions represent offset (E) 1,00 ZR PS PM PB Figure 10. Membership Functions for E 1,00 NB NM NS ZR PS PM Figure.11 Membership Functions for Offset Change of Heat

and rate of offset change in heat ( E). Conclusion membership function represents adjustment of the fan s speed. 1.00 ZERO SLOW MEDIUM FAST Flowchart of the control program is shown in figure.14; BEGIN Introduce PIC16F877 XT OSC,WDT OFF PWRTE = ON ENTER Constants Figure.12- Membership Functions of the Variable That Adjusts the Fan s Speed Rules are created by organizing our information and past experiences about a system, with expressions which is being used in daily life. In organizing these expressions a way may be followed such as below: Table.1 Organising the Rules Error About Zero Big Very Big (Heat =Set Value) (Heat > Set Value) (Heat >> Set Value) Change of Error ZR PS PM PB Heat is Decreasing NB ZERO ZERO SLOW MEDIUM NM ZERO SLOW SLOW MEDIUM NS ZERO SLOW MEDIUM MEDIUM No Change ZR ZERO SLOW MEDIUM FAST PS SLOW SLOW MEDIUM FAST PM SLOW MEDIUM MEDIUM FAST Heat is Decreasing PB SLOW MEDIUM FAST FAST PORTC : Output PORTA bit.0 :Input RA0 : Analog Input Jump to Bank 0 e(t-2) = 0 e(t-1) = 0 e(t) = 0 CALL Delay CALL GETAD Result of A/D Conversion = y y = 0? e(t) e(t-1) = Error Write 0 to PORTC III. CONTROL PROGRAM The control program is written in assembler codes and converted to hexadecimal codes by the MPLAB software. Hex codes are transferred to the PIC by a programmer that we ve formed according to the scheme below[9]; Fuzzy or PID Control Process Write y to PORTC Figure14. Program Algorithm IV. EXPERIMENTAL RESULTS While temperature of the outer environment is 30 0 C, the container is heated during 18 minutes and then heat of inner environment is measured as 39 0 C. Graph of heating versus time for the container is shown in figure.15. Using a 12 bit analog I/O card, the results are converted to graphs in computer environment by means of pascal programming language. Figure13. PIC Programmer Figure15. Graph of System s Heating

RESULT OF PID CONTROL After the heating process of 18 minutes, PID controller is started. PID coefficients are selected as; Kp=0.1, Kd=0.2, Ki=0.01 Figure.16-PID Control Result As shown in the figure, against the heater resistance, the temperature is decreased linearly until 31 0 C. Then, oscillations are occured. RESULT OF FUZZY CONTROL Settling time of the fuzzy controller was faster than the PID controller. Overshoots and undershoots were relatively small. V. CONCLUSION A container is aimed to be cooled by PID and fuzzy control methods. In the both methods, system is cooled linearly until a certain degree which is above the heat of outer environment. Oscillations after this temperature is sourced by rolling-off the motor speed. Cooling rate is reduced relative to the reduction in the error and could not remove the heated air away sufficiently. That s why, temperature is occasionally increases and reduces. In order to set the temperature under the heat of the outer environment, a cooler, such as peltier cooling elements can be used instead of the fan. These elements can reduce the temperature under negative degrees. This will also reduce the settling time. REFERENCES 1. M.K Sarýoglu, Otomatik Kontrol (I) ITU, 1991. 2. I.Yuksel, Otomatik Kontrol Sistem Dinamigi ve Denetim Sistemleri, UU, 1995. 3. M.N. Özdas, A.T. Dinibutun, A. Kuzucu, Otomatik Kontrol Temelleri, ITU Makine Fakültesi Otomatik Kontrol Birimi, 1988. 4. N. Kuo, C. Benjamin, Digital Control Systems, Saunders College Publishing, 1992 5. J. Zeigler, N.B Nichols, Optimum Settings Of Automatic Controllers, Trans, Asme, pp: 64, 759-768, 1942 6. O. Altýnbasak, Mikrodenetleyiciler ve PIC Programlama, Altas Basým Yayým Dagitim, 2000. 7. PIC Microcontroller Uygulama Devreleri, Bilesim Yayýncýlýk, 2000. 8. Microchip Data Sheets, PIC16F87X28/40-Pin 8-Bit CMOS Flash Microcontrollers, www.microchip.com 9. Flash PIC Programmer, www.rotgradpsi.de/mc/index.html 10. Digital Panel Meter Design Application Note (An023), Intersil Corporation, 1999. 11. LM324 Operational Amplifier Datasheet, Fairchild Semiconductor Corporation, 2001, www.fairchildsemi.com 12. LM339 Comparator Datasheet, Fairchild Semiconductor Corporation, 2001, www.fairchildsemi.com 13. LM35 Precision Centigrate Temperature Sensors, National Semiconductor Corp., December 1994 14. 4QD TEC Pulse Width Modulators, www.4qd.co.uk Figure17. Fuzzy Control Result