THE AUTOMATED PIC MICROCONTROLLER BASED TEMPERATURE CONTROL OF FAN SPEED DESIGN
Nur Khairunnisa Binti Muhammad Alwy
“I hereby declared that I have read through this report and found that it has comply the partial fulfillment for awarding the degree of Bachelor of Electrical Engineering
(Control, Instrumentation and Automation)”
Signature : ………
Supervisor‟s Name : ……….
THE AUTOMATED PIC MICROCONTROLLER BASED TEMPERATURE CONTROL OF FAN SPEED DESIGN
NUR KHAIRUNNISA BINTI MUHAMMAD ALWY
A report submitted in partial fulfillment of requirements for the degree of Bachelor in Electrical Engineering (Control, Instrumentation And
Automation)
Faculty Of Electrical Engineering
UNIVERSITI TEKNIKAL MALAYSIA MELAKA
I hereby declared that this report entitle “The Automated PIC Microcontroller Based Temperature Control Of Fan Speed Design” is the result of my own research except as cited in the reference. The report has not been accepted for
any degree and is not concurrently submitted in candidature of any other degree.
Signature : ………
Name : ……….
“To dear mum and dad,
ACKNOWLEDGEMENT
Alhamdulilah, praise be to Allah, for enabling me to complete this PIC Microcontroller control for home automation system project and report for my “Projek Sarjana Muda”.
I would like to express my profound gratitude to my Final Year Project (FYP) supervisor, Mr. Hyreil Anuar Bin Hj Kasdirin for his invaluable support, guidance, supervision and useful suggestions throughout this report. His contribution, moral support and continuous encouragement enabled me to complete my report successfully.
I am indebted to my friends for their aid, ideas and advice and others who helped me in completing this project directly or indirectly.
ABSTRACT
ABSTRAK
TABLE OF CONTENTS
CHAPTER TITLE PAGE
DECLARATION iii
DEDICATION iv
ACKNOWLEDGEMENT v
ABSTRACT vi
TABLE OF CONTENTS viii
LIST OF TABLE xi
LIST OF FIGURE xii
LIST OF ABBREVIATIONS xv
LIST OF APPENDICES xvii
1 INTRODUCTION
1.1 Background 1
1.2 Problem Statement 2
1.3 Objectives 3
1.4 Scope Of Project 3
1.5 Organization 4
2 LITERATURE REVIEW 5
2.1 Preface 5
2.3 Types of Speed Variable 6 2.3.1 Wall-Mounted Control 6
2.3.2 Pulled-Chain 8
2.3.3 Remote Controlled 8
2.3.4 Hand-clapped Control 10
2.4 Type of Controller 12
2.4.1 Microprocessor 12
2.4.2 Microcontroller 14
2.4.3 Microchip PIC16F876A 16 2.5 LM35DZ Temperature Sensor 18
2.6 Subsumtion 20
3 METHODOLOGY 21
3.1 Preface 21
3.2 Project Flowchart 22
3.3 Practice of Project 23
3.4 System Development 25
3.4.1 Hardware Development 26 3.4.2 Software Development 30 3.4.3 Firmware Development 33
3.5 Project Operation 33
3.6 Subsumtion 35
4 RESULT AND ANALYSIS 36
4.1 Preface 36
4.1 Project Analysis 37
4.2 Hardware Analysis 38
4.2.1 12V and 5V Power Supply
Circuit 40
Circuit 58 4.2.5 Motor (Fan) Drive Circuit 62 4.2.6 Interface PIC16F876A With
LCD (216 Characters) 69
4.3 Software Analysis 74
4.3.1 PIC Basic Programming 75
4.3.2 ADC Programming 76
4.3.3 Threshold for ADC Input 80 4.3.4 Multiple Thresholds for
ADC Input 82
4.3.5 LCD Output Display 86
4.4 Firmware Analysis 87
4.4.1 Serial Interface 87
4.5 Subsumtion 88
5 CONCLUSION AND
RECOMMENDATION 88
5.1 Conclusion 88
5.2 Recommendation 88
REFERENCE 93
LIST OF TABLE
NO TITLE PAGE
4.1 The output waveforms for power
supply circuit. 40
4.2 The capacitor selection for crystal
operation. 47
4.3 The RC oscillator component selection
50
4.4 The VOUT result from the experiment.
55
4.5 The measured value of output
voltage of LM35DZ. 57
4.6 The voltage supply to motor. 65
4.7 The motor operation. 66
4.8 The operation of H-Bridge. 68
LIST OF FIGURE
NO TITLE PAGE
2.1 Wall-mounted control of ceiling fan 7
2.2 Pulled-chain of ceiling fan 8
2.3 Remote control of ceiling fan 9
2.4 The schematic diagram of (a) Transmitter and (b) Receiver for Infra-red remote control [27].
10
2.5 Hand-clapped control of ceiling fan 11 2.6 Microcomputer Architecture [2]. 13 2.7 Components of a typical full-featured
microcontroller 15
2.8 The pin diagram of PIC16F873 microcontroller
16
2.9 (a) Appearance and (b) Symbol of LM35DZ.
18
3.1 The Automated PIC based Temperature Control of Fan Speed Design and Construction
22
3.2 The block diagram for PIC microcontroller
based fan. 25
3.3 The flow chart for hardware work process. 26 3.4 Illustration of automatic PIC based
process.
4.1 The schematic diagram of the
microcontroller based fan temperature control system.
38
4.2 Block diagram of the microcontroller based
fan temperature control system. 39 4.3 The 5V and 12V power supply circuit. 40 4.4 Output voltage from 5V power supply
circuit.
42
4.5 Output voltage from 12V power supply circuit.
43
4.6 The power supply block diagram. 43 4.7 The basic circuitry for Microchip
PIC16F876A microcontroller. 45
4.8 Crystal operation as clock oscillator. 47
4.9 The RC mode circuitry. 49
4.10 The reset circuit with external reset button. 51 4.11 The simple Reset circuit by using the Power
on Reset. 52
4.12 The temperature sensor (LM35) interface
with PIC16F876A. 53
4.13 Full-Range Centigrade Temperature Sensor. 54 4.14 The Temperature vs. Output Voltage Graph. 55 4.15 The schematic diagram of temperature
sensor (LM35) circuit. 56
4.16 The VOUT reading at room temperature. 56 4.17 The oscillating temperature sensor display. 57 4.18 The basic external drive circuit. 58 4.19 The operation of external equipment drives
circuit. 59
4.20 The transistor switch (a) cut-off open switch
4.21 The external drive circuit using optocoupler. 61 4.22 The motor drive circuit used in the
microcontroller based fan temperature
control system. 62
4.23 The simplified motor drive circuit. 63 4.24 Fan is operating at lower speed in Speed 1. 64 4.25 Fan is operating in Speed 2. 64 4.26 Fan is operating in Speed 3. 65 4.27 The connection of motor and relay. 66 4.28 The basic structure of an H-bridge. 67 4.29 The pin connection of L293B H-Bridge
Motor Driver. 68
4.30 The circuit diagram of LCD display. 69 4.31 LED as speed output display. 72 4.32 The 7 segment as output display for speed
and room temperature reading. 73 4.33 The flow chart of the overall software for
the microcontroller based fan temperature
control system. 74
4.34 The simulation to test the ADC programming.
77
4.35 The flow chart for ADC programming. 77 4.36 The threshold for ADC input circuit
construct in PROTEUS 7. 80
4.37 The flowchart of combination of ADC with
LED output indicator. 81
4.38 The multiple thresholds for ADC input. 82 4.39 The flow chart for multiple output
indicators.
83
4.40 The actual requirement for the
microcontroller based fan temperature control system.
85
PIC16F876A.
5.1 The microcontroller based fan temperature
control system. 90
5.2 The more sophisticated microcontroller
LIST OF ABBREVIATIONS
UTeM - Universiti Teknikal Malaysia Melaka FYP - Final Year Project
PIC - Peripheral Interface Controller PWM - Pulse Width Modulation CCP - Capture/ Compare/ PWM AC - Alternate Current
DC - Direct Current IR - Infra-Red
VLSI - Very-Large-Scale-Integration CPU - Central Processor Unit I/O - Input/Output
IC - Integrated Circuit
RAM - Random Access Memory ROM - Read Only Memory A/D - Analog-To-Digital D/A - Digital-To Analog
EPROM - Erasable Programmable Read-Only Memory
EEPROM - Electrically Erasable Programmable Read Only Memory MCU - Microcontroller
EMF - Electromagnetic Field NC - Normally Close NO - Normally Open VB - Visual Basic TX - Transmit Data RX - Received Data RC - Resistor/capacitor XT - ceramic resonator
HS - High speed crystal or ceramic resonator LP - Low power crystal
POR - Power On Reset RS - Register Selection
EN - Enable
R/W - Read write
LIST OF APPENDICES
NO TITLE PAGE
A PIC16F876A Configuration 95
B Project Gantt Chart 97
C ADC Programming 99
D Threshold for ADC Input Programming 100 E Multiple Threshold for ADC Input
Programming 101
F The CCS C language programming Automated PIC Microcontroller Based
Temperature Control Of Fan Speed Design 102 G The Hardware for the Automated PIC
Microcontroller Based Temperature
CHAPTER 1
INTRODUCTION
1.1 Background
Since a fan creates its cooling effect by speeding, thus, the most important part of a fan is its speed controller. Electric fan come in a different ways of operating method, that is depend on the manufactures and style. The conventional fans are operated by pull-chain control or capacitor-stepped wall control. In contemporary day nowadays, a luxurious feature offered on many modern ceiling fans that speed is controlled by the hand-held wireless remote control. These types of fan are typically has three or five of speed control. Most ceiling fans sold in recent years have switch for turned the fan on and off operation together with adjust the speed at which the blades rotate.
This invention relates to the field of devices for moving air in enclosed spaces. More particularly it relates to an automatic PIC controlled fan. The PIC microcontroller based ceiling fan is automatically switching the speed of fan rotating according to the environment temperature changes. This project is as further step for developing a smart home technology by fulfilling the requirement of technologies “tomorrow will be more advanced than today”.
1.2 Problem Statement
Modern electronics has provided the consumer with the ability to remotely control a variety of household appliances. However, there has not yet been exploited with automatic control of ventilation devices, or more particularly to the control of fan‟s speed.
In operation to control speed a fan, it is often necessary to physically adjust the fan in order to increase the degree of ventilation provided, or substantially change the direction of air flow. The ability to automatically change the speed of fan via changes of surroundings temperature would allow the user to feel comfort without physically to change the speed of fan.
device is very suitable to be used in extensive area, hospital and children‟s room.
PIC microcontroller based ceiling fan is as further step to improve the technology of a fan. This new invention will satisfy a person needs to make life easier and better. All the mundane household chores are done without having to think about those works.
1.3 Objectives
The aim of this project is to design a home automation system that is ceiling fan based on the advanced technology without only using choke.
The main objectives are:
To design and develop a hardware and software of PIC microcontroller based ceiling fan
To determine how PIC microcontroller based ceiling fan is useful to all user
To identify the problem during use a PIC microcontroller based ceiling fan
To analyse the output of the PIC microcontroller based ceiling fan
1.4 Scope Of Project
The emphasis is on the design, construction, development and analysis for one of automation system that can be implemented at our home. Besides that, the PIC microcontroller is also introduced in this report. The other aspect such as maintenance and marketing will not be covered in this report.
1.5 Organization
This report is a progress report as the project “The Automated PIC Microcontroller Based Temperature Control of Fan Speed Design” is a one year project. Hence, this report basically reports and documents the process and tasks accomplished through out FYP 1 and 2.
The organisation of this report is as follows: First, Chapter 1 describes the background, problem statement objective and scope of the project. Second, Chapter 2 presents the literature review for this project, analyse the information about the article that related to the project design and discusses the advantages and disadvantages of automatic PIC based temperature control of speed for a ceiling fan. Next, Chapter 3 explains about methodology of the project; it includes of material, project block diagram, flowchart and procedure of automatic PIC based temperature control of speed for a ceiling fan.
CHAPTER 2
LITERATURE REVIEW
2.1 Preface
This chapter suppose explain the studies on paper or journal which made by persons or those similar projects that has been undertaken by one company. In this case there are no related journals and papers, thus, the literature review that has been is based on the operation that related on the speed variable for the conventional ceiling fan.
Apart from that, this chapter also contains study and information on involved main components theory in implementing this project. This study is conducted would be to ensure this project can be implemented smoothly and orderly.
2.2 Temperature-Rated Electric Fan