Professional Documents
Culture Documents
1. _________________ _____/____/_____
2. _________________ _____/____/_____
3. _________________ _____/____/_____
4. _________________ _____/____/_____
ACKNOWLEDGMENT
We have great pleasure to convey our gratitude to DEPARTMENT OF ELECTRICAL AND
COMPUTER ENGINEERING for permitting us to do this final project. We express our
profound sense of gratitude to our internal guide ASH P for his valuable Guidance. Last but not
the least our special thanks to our friends for their support and constant Encouragement during
the project work.
Table of content
CHAPTER 1 ........................................................................................................1
INTRODUCTION1
1.1 Background ......................................................................................................................................... 1
1.2 Statement of problem .......................................................................................................................... 1
1.3 Objective ............................................................................................................................................. 1
1.3.1 General objective ......................................................................................................................... 1
1.3.2 Specific objectives ....................................................................................................................... 2
1.4 Significance of the study ..................................................................................................................... 2
1.5 Scope and limitation of the study........................................................................................................ 2
1.5.1 Project Scopes .............................................................................................................................. 2
1.5.2 Limitations of the study ............................................................................................................... 2
1.6 Methodologies..................................................................................................................................... 3
1.6.1 Source of data .............................................................................................................................. 3
1.6.2 Data collection instruments .......................................................................................................... 3
1.7 Application area .................................................................................................................................. 4
1.7.1 Thesis Outline .............................................................................................................................. 4
CHAPTER 3 ......................................................................................................13
CHAPTER 4 ......................................................................................................26
CHAPTER 5 ......................................................................................................33
REFERENCES..................................................................................................34
APPENDIX ........................................................................................................35
CODE .................................................................................................................35
LIST OF FIGURE
Figure2.3.1: Variable width pulse train ........................................................................................7
Figure2.5.1:transformer ...............................................................................................................14
Figure 2.6.1: Full Wave Rectifier (Bridge Rectifier) and Wave Form........................................14
Figure 2.7.1: Capacitor charging and discharging.......................................................................15
LIST OF TABLES
Table3.3.4.1: LCD pin connection description ......................................................................27
LIST OF ACRONYMS
ABSTRACT
Temperature control is a process to maintain the temperature at certain level. This process is
commonly used in all area of the world. Recently in globalization era, this process become
important element because there are many applications in daily life involves this process
especially server room and green house. Server room works continuously in 24 hours every day.
During the process, server room needs to be monitored frequently in order to ensure its
functional and efficiency especially on temperature. It is important to study the level of
temperature recommended in server room. This matter must be considered to make sure no
disturbance occur in server room due to unstable temperature. Automatic temperature control
referred as the best method in any application by controlling the temperature automatically. This
method shows significant improvement in temperature control as the process is functioning
without needed support from the human to control all the process. In addition, this finding makes
human works become easy and system that automatically controlled and function will be
developed.
The output from the Microcontroller is a PWM digital output; there by connected to a transistor
to control the Fan speed. Simply it turns the motor on and off to saturate the calculated duty
cycle.
CHAPTER 1
INTRODUCTION
1.1Background
Nowadays, in globalization era there are always the invention of the new technologies features
every year. Automatic temperature control system become the most popular features which
rapidly gaining its popularity due to its importance to certain applications. This system utilizes in
a room that lack of air conditioning system such as in server room and green house. The system
is designed that is supposed to monitor the temperature inside a server room. In server room, the
temperature is always high and unstable and human will not able to control the temperature
manually. The automatic system required to control the temperature within the server room is
measured by using a temperature sensor. When the current temperature is below the lower limit
of the desired if it is in the first upper limit 25°C to 40°C, the server room is cooled using a
fan.When the current temperature is within the desired range, no control action is needed. The
current temperature of the room must be continuously displayed on the LCD. In addition the
controller should use LEDs to indicate the current state of temperature in the server room. [5]
1.3 Objective
1.3.1 General objective
The mainobjective of our project is to design and implement an automated temperature control
system for the server room.
1. Temperature sensor monitoring the recent value of temperature within the range
b. There are no guarantee that the information sent via SMS will get to its destination on time
1.6 Methodologies
We use different methods for doing our final thesis project. These are:-
Different websites
Websites
The Internet: when gathering information on control system, the internet played a very
important role. This is because one can get the latest and up to date information on almost
anything at all on the network. I was able to get almost all the relevant information needed on the
internet. Surfing the internet for this topic gave me data on things like the origin of
microprocessor, microcontrollers and how they have improved our technology and our lives over
the years.
Libraries: information on this topic was also gotten in different kinds of books on different
topics. Some of the kinds of books which we used in our research were books on electronics,
magazines on the latest kind of technologies. Etc.
System Analysis
Analysis involves a detailed study of the current system, leading to specifications of a new
system. Analysis is a detailed study of various operations performed by a system and their
relationships within and outside the system. This is the total analysis given to all the data
obtained during the cause of this project design. The reason for this analysis is to have the best
possible design or the close adaptive designed principle for achieving my own project. These
analyses have been done to ascertain correct and best design. This system analysis was employed
in selecting the best design module and in calculating the component for the system. Because of
the nature of country we are in, system analysis will help in order to engage the available
component in our design.
Server room
Research lab
Green house
CHAPTER TWO
LITERATURE REVIEW
modern way of fault notification on fan operation based on the modem application through
phone number of concerned person to do so.
𝑇𝑜𝑛
𝐷= ; 𝑇 = 𝑇𝑜𝑛 + 𝑇𝑜𝑓𝑓 ............................................................... (2.1)
𝑇
PWM is a mechanism for generating an output signal that repeats periods between logic high and
low. We can control the duration of the high and low signal in accordance with what we
want.Duty cycle is the percentage of high signal period and the period of the signal and this
percentage will be directly proportional to the average voltage generated.
The ratio Ton/Tis called the duty cycle of the square wave pulses. The effective DC voltage
supplied to the load is controlled by adjusting the duty cycle. On a PIC micro controller, PWM
output is possible on digital I/O pins 3, 5, 6, 9, 10 and 11. On these pins the analog Write
function is used to set the duty cycle of a PWM pulse train that operates at approximately 500
Hz. Thus, with a frequency fc = 500 Hz, the period is T = 1/fc ~2ms. As with conventional
HARAMAYA UNIVERSITY ELECTRICAL AND COMPUTER ENGINEERING 2016 Page 7
AUTOMATIC TEMPERATURE MEASUREMENT &CONTROL SYSTEM FOR SERVER ROOM
digital I/O, the pin Mode function must be called first to configure the digital pin for output. The
digital output voltage of a micro controller is either 0 V or 5 V. Thus, in Equation (1), Vs = 5 V.
The PWM output level with the analog Write is an 8-bit value that corresponds to an effective
voltage range of 0 to 5 V. The special pins on the on micro controller like pin3.5, 6,9,10 and 11
are for the PWM operation. Equation (2.3) depicts the relationships between the PWM output
parameters. Thus,
Therefore,
2.4 RESISTORS
A resistor is a two terminal electronic component which produces a voltage across its terminals
that is proportional to the electric current through it in accordance with Ohm’s law:
𝑽 = 𝑰𝑹
Resistors are elements of electrical network and electronic circuits and are ubiquitous in most
electronic equipment. Practical resistors can be made with various compounds and films as well
as resistance wires (wire made of high resistivity alloy, such as nickel-chrome).
The primary characteristics of a resistor are the resistance, the tolerance, the maximum working
voltage and the power rating. The ohm (symbol: Ω) is the SIunit of electrical resistance, named
after George Smith Ohm.
2.5 Transformer
The transformer is a device used for reducing or increasing the voltage of an electric power
supply, usually to apply a particular piece of equipment to be used. Transformers work only with
AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase
voltage, step-down transformers reduce voltage. Most power supplies use step-down
transformers to reduce the dangerously high mains voltage (220V in Nigeria) to a safer low
voltage. The input coil is called the primary and the output coil is called the secondary. There is
HARAMAYA UNIVERSITY ELECTRICAL AND COMPUTER ENGINEERING 2016 Page 8
AUTOMATIC TEMPERATURE MEASUREMENT &CONTROL SYSTEM FOR SERVER ROOM
no electrical connection between the two coils; instead they are linked by an alternating magnetic
field created in the soft-iron core of the transformer. The two lines in the middle of the circuit
symbol represent the core. Transformers waste very little power so the power out is (almost)
equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the
number of turns on each coil, called the turn ratio determines the ratio of the voltages. A step-
down transformer has a large number of turns on its primary (input) coil which is connected to
the high voltage mains supply, and a small number of turns on its secondary (output) coil to give
a low outputvoltage.
Figure2.5.1Trannsformer
2.6 Rectifier
There are several ways of connecting diodes to make a rectifier (convert AC to DC). The bridge
rectifier is the most important and it produces full-wave varying DC. A full-wave rectifier can
also be made from just two diodes if a center-tap transformer is used, but this method is rarely
used now that diodes are cheaper. A single diode can be used as a rectifier but it only uses the
positive (+) parts of the AC wave to produce half-wave varying DC. A bridge rectifier can be
made using four individual diodes, but it is also available in special packages containing the four
diodes required. It is called a full-wave rectifier because it uses the entire AC wave (both
positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses
0.7V when conducting and there are always two diodes conducting, as shown in the diagram
below. Bridge rectifiers are rated by the maximum current they can pass and the maximum
reverse voltage they can withstand
Figure 2.6.1 Full Wave Rectifier (Bridge Rectifier) and Wave Form.
2.9 Transistors:
The transistor is one of the fundamental building blocks of modern electronic devices, and is
ubiquitous in modern electronic systems. Following its release in the early 1950s the transistor
revolutionized the field of electronics and paved way for smaller and cheaper radios, calculators
and computers amongst other thing. A transistor is a semiconductor device used to amplify and
switch electronic signals. It is made of a solid piece of semiconductor material with at least three
terminals for connection to an external circuit. Avoltage or current applied to one pair of the
transistor’s terminals, changes the current flowing through another pair of terminals. Since the
controlled(output) power can be much more than the controlling (input) power, the transistor
provides amplification of a signal. Today, some transistors are packed individually but many
more are found embedded in integrated circuit. [4]
The two types of transistors have slight differences in how they are used in a circuit. A bi-polar
transistor has terminals labeledbase, collector and emitter. A small current at the base terminal
(i.e. flowing from the base to the emitter) can control or switch a much larger current between
the collector and emitter terminals. For a field effect transistor (FET), the terminals are labeled
gate, source and drain; a voltage at the gate can control current between source and drain.
Principle of Operation
Transistors are commonly used as electronic switches for both high power applications including
switched mode power supplies and low power applications such as logic gates. In grounded
emitter transistor circuit, as the voltage rises, the base and collector current rises exponentially
and the collector voltage drops because of the collector load resistor. For the transistor to act as a
switch, the values of the input voltage can be chosen such that the output is completely on (at
saturation) or completely off. This type of operation is common in digital circuits where only
“on” and “off” values are relevant.
When the switch is closed, current flows through the resistor to the base of the transistor. The
transistor then allows current to flow from the +9v to the 0v and the lamp comes on. The
transistor has to receive a voltage at its base for the lamp to light up. The presence of the resistor
is to protect the transistor as they can be damaged easily by very high voltage/current.
CHAPTER 3
METHODOLOGY AND SYSTEM DESIGN
3.1 METHODOLOGY
Initial approach to project designing and execution is to gather enough information in order to
help speed up the operation once the actual work commences. Methodology is the study of how
to perform scientific research. It is the part of that is used to find out what type of data is
maintained, what fact to find and look for, how to find them and how to record them for usage.
the value set in tempMax the fan will be at its maximum spinning velocity and the LCD will
display FANS: 100% even though the temperature might increase above tempMax. But after
some negotiation of temperature increased set the variable gab which is the difference between
current reading temperature and the maximum set temperature. Then we some if() functions to
check is greater than 2 units of temperature, the red LED lights giving warning that the current
reading is exceeds maximum temp and the system assume that the fan is not properly operating
in this temperature region for the purpose of some fault occurred on fan.
KEYPA
LCD
D
PIC
DISPLAY
18F45K22
LED
The basic blocks of the System include the following blocks; Temperature Sensing circuit, PIC
microcontroller, LED, LCD Display, Fan, and keypad. The temperature Sensor detects the
HARAMAYA UNIVERSITY ELECTRICAL AND COMPUTER ENGINEERING 2016 Page 15
AUTOMATIC TEMPERATURE MEASUREMENT &CONTROL SYSTEM FOR SERVER ROOM
temperature of the environment. The temperature sensor consists of an LM35 IC. It has the
measuring range of -55°C to 150 °C. The temperature sensor is connected to an analogue input
of microcontroller. The LCD module is also connected to the analogue or digital input-output of
the microcontroller. The LCD module displays the current temperature. The LCD display used is
a 16x2 Alphanumeric Display. The microcontroller generates PWM signal according to the
temperature. The speed of the fan and fan heater are controlled by the ON time of the PWM
generated. With increasing ON time, the speed of the fan increases while the fan heater is
inverse, thus controlling the temperature of the system.
Transformer
Rectifier
Capacitor
This module is basically designed to achieve regulated power supply 12V for fan motor and 5V
for other components that we have used in our thesis. It mainly consists of a transformer which is
used to step down the AC voltage, IN4007 diodes used to form a full wave bridge rectifier to
convert AC to DC, capacitor used as a filter circuit, 7812 and 7805 voltage regulators IC’s that
are used to obtain 12V and 5V respectively at the output of the regulators. In most of our
electronic products we need a power supply for converting mains AC voltage to a regulated DC
voltage. For making a power supply designing, each and every component is essential to be
considered. Starting with very basic things of choosing of components are:-
230V AC is converted into 12V AC using a step-down transformer. 12V output of step down
transformer is an RMS value and its peak value is given by the product of square root of two
with RMS value, which is approximately 17V.This is a simple approach to obtain a 12V and
5VDC power supply using a single circuit. The circuit uses two ICs 7812(IC1) and 7805 (IC2)
forobtaining the required voltages. The AC mains voltage will be stepped down by the
transformer,rectified by bridge and filtered by capacitor C1 to obtain a steady DC level .The IC1
regulatesthis voltage to obtain a steady 12V DC. The output of the IC1 will be regulated by the
IC2 toobtain a steady 5V DC at its output. In this way both 12V and 5V DC are obtained. Such a
circuits very useful in cases when we need twoDC voltages for the operation of a circuit.
As we require a 12V or 5V we need LM7805/12 Voltage regulator ICs are characterized by:-
Input voltage range 7V~ 35V for IC2 while 14.5V~40V with respect to temperature forIC1.
Output voltage range 𝑉𝑚𝑎𝑥 = 5.2𝑣, 𝑉𝑚𝑖𝑛 = 4.8𝑣for IC2 while for IC1is from11.5𝑣 𝑡𝑜 12.5𝑣
Typical capacitance values range from about 1 pF (10−12 F) to about 1 mF (10−3 F).Datasheet
of7812 prescribes to use a 0.01μF capacitor at the output side to avoid transient changes in the
voltages due to changes in load and a 0.33μF at the input side of regulator to avoid ripples.
3.3.2 Microcontroller
microprocessor requires additional chips to provide these functions. The microcontroller acts like
the brain of the control systems available in the system. The microcontroller chip that has been
selected for the purpose of controlling the control systems is PIC18F45K22 manufactured by
Microchip. This chip is selected based on several reasons. [10] The PIC18F45K22 is a low
power, high-performance microcontroller. The device is manufactured bymicrochip’s high-
density non-volatile memory technology. The on-chip Flash allows the program memory to
bereprogrammed in-system or by a conventional non-volatile memory programmer. The microchip
PIC18F45K22 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to
many embedded control application.
central processing unit - ranging from small and simple 8-bit processors to sophisticated 32- or
64-bit processors
Clock generator - often an oscillator for a quartz timing crystal, resonator or RCcircuit
High performance
device is used with single power supplies. As the LM35 draws only 60 µA from the supply, it
has very low self-heating of less than 0.1°C in still air. The LM35 is rated to operate over a
−55°C to +150°C temperature range. Its output is linear and each degree Celsius is equal to
10mv.e.g like150 ° C = 1500mV and -40 ° C =-400mV.LM35 does not need for external
trimming to give accuracies of ±1⁄4 at room temperature and ±3/4℃overa full −55 to +150°C
temperature range. It can be easily useable for single supplies of power and it has also comfort level at
minus supplies. Values that the LM35sensor returns are 10mV/°C degree. This means that first we have
to multiply it with 100 to reach 1 °C. So, if we need to set a specific temperature, we use this: [2]
100
𝑐𝑒𝑙𝑠𝑖𝑢𝑠 = 𝑝𝑜𝑤𝑒𝑟 𝑠𝑢𝑝𝑝𝑙𝑦 𝑣𝑜𝑙𝑡𝑎𝑔𝑒 ∗ 𝑖𝑛𝑝𝑢𝑡 𝑓𝑟𝑜𝑚 𝑠𝑒𝑛𝑠𝑜𝑟 ∗
210
Applications of LM35
LM35 is applicable in many ways like other temperature sensors. Its temperature
will be 0.01°C of the surface temperature. It has assumed that air temperature and
surface is approximately equal. If the air temperature is lower or higher than the
surface temperature it will be die in between the air temperature and surface
temperature. To solve this problem it is held at that temperature at which surface
satisfies their interest. The simplest way to minimize this issue it cover up with
wires and make it possible that wires are all at same temperature as surface then
LM35 die’s temperature will not be affected by air temperature. Temperature
sensor LM35 does not need for any additional circuit. Due to its low output
impedance, its output and its linear calibration it ispossible that it will install easily
and integrated in a control circuit. Due to low supply of current it has an effect of
very low self-heating.
Advantages of LM35
output voltage than thermocouples and does not require that output voltage is
amplified.
The screens of LCD are limited to text and are generally used in laser printers, copiers and fax
machines and in networking equipment such as data storage and in routers. The screens are in
small number of configuration, mostly16x2, 20x2 and 20x4. With a standard use of16 pins
interface generally using pins on 0.1 inch / 2.54mm centers. Those LCD they do not have
backlights used 14pins, basically two pins used for to power the lights. The LCD defines two
modes of interfacing one for4 bits and other one is 8 bits. By using the 4 bit mode is complex,
but it reduces the number of active connections that we needed. In 8 bit mode instruction set are
designed to allow switching without requiring the lower four data pins. If it is in4 bit mode,
character and control data is transferred as pairs of 4 bit "nibbles" on the upper data pins, D4-D
i. VSS, VDD and VEE: -While VDD and VSS provide +5V and ground respectively, VEE is
used for controlling LCD contrast.
ii. RS (Register Select): -There are two very important registers inside the LCD. The RS pin is
used for their selection as follows. If RS=0, the instruction command code register is selected,
allowing the user to send a command such as clear display, cursor at home, etc. if RS=1, the data
register is selected, allowing the user to send data to be displayed on the LCD.
iii. R/W (read/write): R/W input allows the user to write information to the LCD or read
information from it.
iv. E (enable): -The LCD to latch information presented to its data pins uses the enable pin.
When data is supplied to data pins, a high–to-low pulse must be applied to this pin in order for
the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450 ns
wide.
v. D0 – D7: -The 8–bit data pins, DO– D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers. To display letters and numbers, we send ASCII codes
for the letters A–Z, a-z numbers 0-9 to these pins while making RS=1.There are also instruction
command codes that can be sent to the LCD to clear the display or force the cursor to home
position or blink the instruction command codes.
3.3.7 KEYPAD
Keypad is connected to PORTB. The‘* ‘key of the keypad is used to clear the value entered
during the temperature setup and the ‘# ‘key is used to ENTER (save) the setting. The heater and
the fan are controlled using transistors and relays connected to pins RD0 and RD1 of the
microcontroller respectively. [1]
CHAPTER 4
RESULTS AND DISCUSSION
ALGORITHM
3. Clear LCD.
7.2. Switch OFF FAN and control its speed using PWM generation
LCD (16× 2)
LED (2.2V,10mA)
Transistor (2N2222)
Resistors (200Ω,330Ω)
Diode (1N4007)
Proteus
MicroC PRO
Software Design
In this part will show the steps and procedures we followed to develop the programs for the
systems that we are going to develop.
Programming process
The MikroC PRO for PIC is a powerful, feature-rich development tool for PIC microcontrollers.
It is designed to provide the programmer with the easiest possible solution to developing
applications for embedded systems, without compromising performance or control.
PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used in a wide
variety of applications, and C, prized for its efficiency, is the natural choice for developing
embedded systems. MikroC PRO for PIC provides a successful match featuring highly advanced
IDE, ANSI compliant compiler, broad set of hardware libraries, comprehensive documentation,
and plenty of ready-to-run examples.MikroC is a full-featured ANSI C compiler for 5 different
microcontroller architectures. It is the best solution for developing code for your favorite
microcontroller. It features intuitive IDE, powerful compiler with advanced SSA optimizations,
lots of hardware and software libraries, and additional tools that will help you in your work. Each
compiler comes with comprehensive Help file and lots of ready-to-use examples designed to get
you started in no time. [6]
An algorithm has to be developed to make the microcontroller to read the input and respond
accordingly. Therefore, the algorithm is established and represented by a flowchart. These
flowcharts are then translated into C language and compiled using MikroC Pro C IDE and
compiler.We have three cases in our Circuit diagram to obtain:
Case1: when temp (current reading temperature) is greater than the set value (a)
Case3: when temp (current reading temperature) is less than the set value(c)
CHAPTER 5
CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion
At the end of our project, we deduce that it is realized to maintain the temperature of a given
server room in certain region by incorporating the fan speed with respect to temperature sensor.
The temperature sensed was mapped to equivalent speed through the ADC (analogue to digital
converter) in the software designed. In that case if every fault occurred on the fan, there will be
notifications about that error for the authorized person. The temperature values andcorresponding
speed of fan is expected to be displayed on the LCD continuously. The system developed was
successfully automatic to control the temperature in server room in such it uses the PWM
algorithm, in what there is no need of human intervention. The system can also be used for not
only server room by initializing the temperature minimum and temperature maximum allowed
for that purpose. Therefore, besides the world global warming and unexpected and expected
rising of temperature around the world is being series trouble, we can use the system developed
here for other application like home automation and in medical case.
This project can be achieved its objectives and provides solution in the form a system that can
monitor temperature of a given room if it is implemented.
5.2 Recommendations
Adding updated technologies like GPRS to feature of the system it can be developed for
ONLINE maintenance and gives related functions. Increasing a number of fan in the given room
will reliable the durability of the fans life with proper utilization and cooling activities in
efficient and effective way. We recommend the user to have a multiple number of fans with
respect to area of that room to keep the life expectance of the devices and for effective and
efficient application to be for utilized. One can improve the system not only for hot area but also
for cold area where the temperature may be below the minimum set value by considering heater
to be used in the system instead of fan.
REFERENCES
[1] A.K .SAWHNEY “A course in electrical and electronic measurements and
Instrumentation, 4thed”
[2] Texas Instruments. LM35 Precision Centigrade Temperature Sensors. USA: Texas
Instruments; 2013.
[4] Comus Europe Ltd. Datasheet of 7805 and 7812. U.K: Comus Europe Ltd; 2009.
[5] Vetelino J. and Raghu A. Introduction to Sensors. USA: CRC Press; 2011
System with Gsm Modem” IOSR Journal of Electrical and Electronics Engineering, vol.
1, no. 6, (2012).
[7] John B. Peatman, “Design with PIC Microcontrollers”,2nd Edition, Pearson Education,
2005.
APPENDIX
CODE
*Project name: Automatic Temperature Control
*/
charKeypadPort at PORTB;
sbitLCD_RS_Direction at TRISD4_bit;
sbitLCD_EN_Direction at TRISD5_bit;
#define ENTER 15
#define CLEAR 13
#define ON 1
#define OFF 0
void main () {
unsignedint temp;
intmV,TempMin;
Lcd_Out(1,4, "Automatic");
FAN = OFF;
START:
TempMax = 0;
TempMin = 0;
while(1)
do
while(!kp);
if ( kp == ENTER)break;
Lcd_Chr_Cp(kp + '0');
TempMax=(10*TempMax) + kp;
inTemp = Ltrim(Txt);
kp=0;
while(kp!= ENTER)
do
while(!kp);
//program loop
while(1) {
Txt[4] = 0;
Lcd_Out(2,7,Txt);
Lcd_Out(2,1, "Temp");
inTemp = Ltrim(Txt);
Lcd_Out(1,11, inTemp);
if (TempMin<TempMax)
FAN = ON;
LED = OFF;
if (TempMin==TempMax)
FAN = ON;
LED = OFF;
if(TempMin>TempMax)
FAN = OFF;
LED = ON;