LM35 temperature sensor, acrylic container, Personal Computer Integrated Circuit Programmable Integrated Circuit, fuzzy control, temperature data, Acrylic plate, temperature, control system, circuit board, Fan control circuit, probability theory, set membership, function block, empirical knowledge, microcontroller, fuzzy logic, electronic engineering, programming, manufacturing process, Degree of Truth, mathematical model, hardware construction, fuzzy set theory
DEVELOPMENT OF fuzzy logic
TEMPERATURE MICROCONTROLLER MUHAMMAD FARHAN BIN ABDUL LATIP This report is submitted in partial fulfillment of the requirement for the award of Bachelor of Electronic Engineering (Computer Engineering) With Honours Faculty of Electronic and Computer Engineering Universiti Teknikal Malaysia Melaka April 2010
UNIVERSTI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BORANG PENGESAHAN STATUS LAPORAN PROJEK SARJANA MUDA II
Tajuk Projek Sesi Pengajian
: Development of Fuzzy Logic Temperature Microcontroller : 2009/2010
Saya MUHAMMAD FARHAN BIN ABDUL LATIP mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut: 1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka. 2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja. 3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi pengajian tinggi. 4. Sila tandakan ( ) :
*(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972) **(Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)
__________________________ (TANDATANGAN PENULIS)
___________________________________ (COP DAN TANDATANGAN PENYELIA)
"I hereby declare that this report is the result of my own work except for quotes as cited in the references."
Signature Author Date
: ...................................................... : ...................................................... : ......................................................
"I hereby declare that I have read this report and in my opinion this report is sufficient in terms of the scope and quality for the award of Bachelor of Electronic Engineering (Computer Engineering) With Honours."
Supervisors Name : ......................................................
v ACKNOWLEDGEMENT Firstly, I would like to praise to Allah S.W.T. for making my job run smooth and success. Next I wish to credit to Mrs. Sharatul Izah Binti Samsudin as my supervisor. My thanks is expended to my beloved family especially to my father, Mr. Abdul Latip Bin Ismail and my mother, Mrs. Hindun Bte Ali for their support. Besides, very grateful to all staff at Universiti Teknikal Malaysia Melaka for guidance and commitment. I really appreciate all efforts and ideas.
vi ABSTRACT In this study, temperature of a closed environment is kept constant by a PIC16F877A. An acrylic container, dimension of 20*20*30 cm is aimed to be cooled by fuzzy logic methods. The microcontroller holds the fuzzy control process. The temperature data is acquired from LM35DZ temperature sensor and the control output determines speed of a 12V fan by means of Pulse Width Modulator (PWM). The heat control system
will be used to cool a highly sensitive
measurement device. 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 decreasing heat of the inner environment down to the outer conditions. The control system will be used to eliminate the self heating effect of resistors of a measurement device which increases uncertainties in the measurement.
vii ABSTRAK Dalam kajian ini, suhu persekitaran tertutup dikawal oleh PIC16F877A. Sebuah bekas akrilik berdimensi 20*20*30 cm bertujuan untuk disejukkan menggunakan kaedah logik fuzzy. Mikropengawal ini mempunyai proses kawalan fuzzy. Data suhu diperolehi daripada pengesan suhu LM35DZ dan keluaran kawalan menentukan kelajuan kipas 12V dengan menggunakan pemodulat lebar denyut (PWM). Sistem kawalan kepanasan akan digunakan untuk menyejukkan peranti pengukur yang sangat sensitif. Bekas dipanaskan oleh kerintangan dan suhu pada persekiran di dalam bekas meningkat bergantung pada persekitaran di luar bekas. Mikropengawal memerlukan data suhu, dan keluaran kawalannya akan mengubah kadar penyejukan daripada kipas untuk menurunkan suhu persekitaran di dalam bekas sama seperti suhu persekitaran di luar bekas. Sistem kawalan ini akan digunakan untuk menghilangkan kesan pemanasan diri daripada perintang pada peranti pengukur dimana ianya akan meningkatkan ketidak pastian dalam pengukuran.
TABLE OF CONTENT
DECLARATION CONFIRMATION ACKNOWLEDGEMENT ABSTRACT TABLE OF CONTENT LIST OF TABLES LIST OF FIGURES List of Abbreviations
1.1 Objectives of Project 1.2 Projects Scope of Works
PAGE iii iv v vi viii xii xiii xvi 2 3
2.1 Fuzzy Logic Essentials
2.2.1 Benefits of fuzzy Logic
2.2.2 degree of truth
2.2.3 Fuzzy Sets
2.2.4 Fuzzy Logic
2.2.5 Fuzzy Connective
2.2.6 Fuzzy AND Operator
2.2.7 Fuzzy OR Operator
2.2.8 Fuzzy NOT Operator
2.2.9 Fuzzy Rules
2.2.10 Takagi-Sugeno Fuzzy Systems
2.2 Fuzzy Control
2.2.1 Direct Fuzzy Control
2.2.2 Supervised Fuzzy Controller
2.2.3 Smart Switching Control
2.3 LM35DZ Temperature Sensor
2.4 Microcontroller 2.5 C programming language
2.5.1 Design 2.5.2 Characteristics 2.6 PIC16F877A Microcontroller
x 18 19 19 20 21
3.1 Research and Survey Results
3.2 Hardware Design
3.3 software development
3.4 Integration between Hardware and Software
4.1 Temperature Sensor Microcontroller Circuit Testing33
4.2 Construction Hardware of Temperature Sensor
4.3 Development Software of Temperature Sensor
CONCLUSION AND RECOMMENDATION
APPENDIX Basic C Language Programming for Testing Purpose Fuzzy Control C Language for Real Purpose
xii LIST OF TABLES
Comparison of characteristics between PIC16F87XA
Comparison of device features between 16F87XA
Circuits operation based on input temperature
PAGE 23 23 45
xiii LIST OF FIGURES
Type of membership functions
Feedback control system with direct fuzzy controller
Nonlinear, fuzzy-rule-based supervisor of a PID controller 15
Smart switching between conventional controllers,
LM35DZ temperature sensor
Flowchart or work methodology
Direct Fuzzy Control
Circuit diagram using Proteus software
Circuit during testing mode
Coding for LCD
Coding for sensor
Value on sensor
Value on LCD
Circuit construction using protoboard for testing mode 35
Testing the functionality of LM35 temperature sensor 36
Value of temperature displayed on LCD
Circuit during testing mode
Prefabricated PIC circuit board
Prefabricated LCD circuit board
Fan mounts at container
Fan control circuit
Chloroform as joining material
Configuration of input-output port
xv 44 46 47 48
xvi LIST OF ABBREVIATIONS
OTP ROM -
One-time Programmable Read Only Memory
Algorithmic Language Personal Computer integrated circuit
Programmable Integrated Circuit Pulse Width Modulator Proportional Integral Derivative Fuzzy Logic Control Degree of Fulfillment Analog to Digital Liquid Crystal Display integrated development
Environment Direct Current
Reduce Instruction Set Computer Random Access Memory Electrically Erasable Programmable Read-Only Memory Brown-Out Reset Complementary Metal Oxide Semiconductor Omniscient Code Generation Parts Per Million
1 CHAPTER 1 INTRODUCTION Nowadays, a technology becomes an essential in our life. Without technology, humans tasks are functionless especially in communication and learning process
. human activities
are mostly including PC, hand phone, internet, television and others. Some of it will produce heat when used it. The heat capable to damage the inner components of the product that is sensitive to heat such as IC, transistor and capacitor. Sometimes when the heat is too high, it will reduce the work effectiveness of the device used. As a result, this project is proposed. This temperature microcontroller can be implemented to the room or gadget in reducing surroundings temperature thus prevent the heat sensitive components from damage indirectly.
2 In this project, temperature of a closed environment is kept constant by a PIC16F877A. The microcontroller holds the fuzzy control process. The temperature data is acquired from LM35 temperature sensor and the control output determines speed of 220V AC fan by means of PWM and a triac triggering circuits. The heat control system will be used to cool a highly sensitive measurement devise. This project consists of four parts which is the heat control system, output layer, control method, and control program . An acrylic container is aimed to be cooled by a Fuzzy control method. 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 condition. The control system will be used to eliminate the self-heating effect of the resistors of the measurement device which increases uncertainties in the measurement. 1.1 Objectives of Project 1. To develop programming code of fuzzy logic temperature control
system. 2. To design the hardware that have been required for fuzzy logic temperature microcontroller using PIC 16F877A. 3. To implement the programming to the output device. 4. To integrate software and hardware and make it well function.
3 1.2 Project's Scope of Work This project will focus primarily on the several concepts of programming and electronic engineering such as calibration and function of the sensor, programming and microcontroller for the operation of the system besides in setting the quantity of measurement which will be corresponding to the temperature. For programming, it is totally focuings in coding a PIC 16F877A. In addition, hardware and software will be integrated and will be tested the functionality. 1.3 Organization The organization of this report is as follow: Chapter 1 Introduction It is about an introduction of the project, objectives, and scope of works. Chapter 2 Literature review It is mainly explain the concept of the project in details. It is also include the review of several projects that have been made by researchers from other university. With this, we are able to compare and differentiate our project with others especially related to the control approach in developing the temperature microcontroller. Chapter 3 Methodology It is included with block diagram and the system overview.
4 Chapter 4 Results It will cover all the result of testing, hardware construction and software development for this project. Chapter 5 Conclusions and recommendations It concludes the overall project that has been done for this semester and recommend for future upgrade.
5 CHAPTER 2 LITERATURE REVIEW Lots of research by reading the journal, article from the internet and also books in order to give some illustration on how the fuzzy logic application works with the microprocessor. Fuzzy logic is a form of multi-valued logic derived from fuzzy set theory
to deal with reasoning that is approximate rather than precise . In contrast with binary sets having binary logic, also known as crisp logic, the fuzzy logic variables may have a membership value of not only 0 or 1. Just as in fuzzy set theory with fuzzy logic the set membership values can range between 0 and 1, in fuzzy logic the degree of truth of a statement can range between 0 and 1 and is not constrained to the two truth value
s, true (1) and false (0), as in classic propositional logic.
6 2.1 Fuzzy Logic Essentials 2.1.1 Benefits of Fuzzy Logic Fuzzy logic is a technique that attempts to systematically and mathematically emulate human reasoning and decision-making. Fuzzy logic allows engineers to exploit their empirical knowledge
and heuristics represented in the "if/then" rules and transfer it to a function block. Fuzzy logic thus provides engineers with a clear and intuitive way to implement control systems
, decision-making and diagnostic system
s in various branches of industry . Fuzzy logic algorithms can be used for advanced applications in industrial automation such as: Intelligent control system Fuzzy control solutions are especially useful for complex systems
where standard means such as PID control fails. Fuzzy logic can be an advantage in cases where an explicit analytical-process model is not available or is too complex. Another advantage of fuzzy logic is that it can be easily combined with conventional controllers and substantially enhance their functionality. For example, fuzzy rules interpolate between a series of locally linear controllers and schedule gains of a PID controller based on changing operating conditions. So fuzzy rules do not have to necessarily replace conventional control methods
, but rather extend their capabilities. Process diagnostics, fault detection If an analytical process model is not available or is too complex to be run in realtime, empirical knowledge can be used to classify process conditions and early detect faults.
7 Decision-making and Expert System
s Fuzzy rules can emulate an experienced human operator in real time, for example select appropriate ingredients, components or machines according to specific situations in the manufacturing process. 2.1.2 Degree of Truth Both degrees of truth and probabilities range between 0 and 1 and hence may seem similar at first. However, they are distinct conceptually; truth represents membership in vaguely defined sets, not likelihood of some event or condition as in Probability Theory
. For example, let a 100 ml glass contain 30 ml of water. Then we may consider two concepts: Empty and Full. The meaning of each of them can be represented by a certain fuzzy set. Then one might define the glass as being 0.7 empty and 0.3 full. Note that the concept of emptiness would be subjective and thus would depend on the observer or designer. Another designer might equally well design a set membership function where the glass would be considered full for all values down to 50 ml. It is essential to realize that fuzzy logic uses truth degrees as a mathematical model
of the vagueness phenomenon while probability is a mathematical model of randomness. A probabilistic setting would first define a scalar variable for the fullness of the glass, and second, Conditional distribution
s describing the probability that someone would call the glass full given a specific fullness level. This model, however, has no sense without accepting occurrence of some event, for example that after a few minutes, the glass will be half empty. Note that the conditioning can be achieved by having a specific observer that randomly selects the label for the glass, a distribution over deterministic observers, or both. Consequently, probability has nothing in common with fuzziness, these are simply different concepts which superficially seem similar because of using the same interval of real numbers [0, 1].