Indian J. Phys. 84 (1) 71-79 (2010)
An embedded design for monitoring and controlling temperature A Goswami1*, T Bezboruah2 and K C Sarma1
1
Department of Instrumentation and USIC, Gauhati University, Guwahati-781 014, Assam, India 2 Department of Electronics and Communication Technology, Gauhati University, Guwahati-781 014, Assam, India E-mail :
[email protected] Received 26 June 2008, accepted 11 September 2009
Abstract : Each and every part of human life is somehow linked with the embedded products. Embedded systems are product of hardware and software co design. It is becoming an integral part of engineering design process for efficient analysis of data acquisition. Data acquisition implies the gathering of information about a system or process. It is the process of collecting data in an automated way from analog and digital sources of measurement, such as sensors and devices under test. The present paper describes the design of an embedded system for the control of temperature and light intensity in a single system using sensors, microcontroller and Liquid Crystal Display (LCD). It describes the controlling action incorporated in the hardware to control any device connected when specific conditions are met. Keywords : Embedded system, analog to digital converter, data logger, offline analysis. PACS No.
: 07.05.Hd
1. Introduction It is very much essential in industrial as well as experimental setup to monitor and control temperature continuously. The efficient solution for this problem is to develop a data logger. Earlier development of data logger had been done through manual measurements from analog instruments, such as thermometers and manometers. Unfortunately data logger of this type can’t fulfill the current requirements in terms of timing and accuracy. Since 1990, further development in data logging took place as people begin to create PC-based data logging systems [1,2]. In later stages of development it has been found that microcontrollers (integration of microprocessors and certain peripherals including memory) are more reliable as well as efficient [3]. Use of *Corresponding Author
© 2010 IACS
%
A Goswami, T Bezboruah and K C Sarma
microcontrollers in embedded design has not only been increased but brought a revolutionary change. At the same time competitive pressures require manufacturers to expand their product functionality and provide differentiation while maintaining or reducing the cost. Monitoring and controlling physical parameters like temperature, pressure, humidity etc. using microcontrollers are very much effective in industrial and research oriented requirements. As a parameter, nature of temperature is ever-changing. It is exposed to huge array of stimuli from its environment. Though temperature can be monitored through variety of sensors, one should adhere maximum cares in selecting sensors due to different levels of complexity associated with the calibration process. If calibration is not implemented properly output of the embedded system may vary from actual temperature measured through standard instruments. The purpose of the present work is to explore the possibility of continuously monitoring temperature. The system is also equipped with necessary hardware to initiate control action for temperature as soon as temperature reaches higher than set value. The system developed enables it’s user to set the value of temperature as required and set transfer rate of data through RS-232. Necessary Keypad in the form of push-buttons is provided for setting desired temperature and transfer time. For the purpose of storing and some intelligent analysis of data, the system is connected to PC through RS-232. This setup can be effectively used in industries for single control end. 2. Motivation The purpose of the proposed work is its low cost and industrial demand. Such a design can effectively decrease the number of computers used in an industry, such as food processing, green house or a packing industry and thus in turn can save power which is the main feature of this work. 3. Experimental setup The block diagram of the experiment is shown in Figure 1. The hardware and software description of the embedded system for monitoring and controlling temperature are described below :
3.1. Hardware description : The whole circuit of the experiment can be divided into following sections :
(i) Power supply section : The regulated power supply section is design and fabricated with full wave rectifier using voltage regulator 7805 which provides a constant voltage of 5 V to the circuit. (ii) Analog to digital conversion section : Since we have to sense analog parameters i.e. temperature and light, hence we have to use any analog to digital converter (ADC).
An embedded design for monitoring and controlling temperature
%!
SERIAL DATA TRANSFER FOR OFFLINE ANALYSIS
ADC0809
TRANSDUCER
AT 89S52 C
LCD HARDWARE CONTROL
KEY-PAD
Figure 1. Block diagram of the experimetal setup.
We have opted for ADC 0809 as it has 8 channels and is microprocessor compatible ADC which is easily available [4]. It will convert the analog signal of the transducer to digital value with respect to the reference voltage which in our case is 2.5 V. This reference voltage is obtained using TL431, which is a programmable shunt voltage reference with output voltage range of 2.5 V to 36 V and works like zener diode [5]. For the conversion, ADC requires a reference frequency which is supplied from IC555 in the form of astable oscillator. Sensor used for temperature measurement is LM 35 which is calibrated in °C and is linear in +10 mV/°C scale factor with 0.5°C accuracy [6]. The calibration curve of the sensor is shown in Figure 2.
Figure 2. Voltage vs. temperature calibration curve.
(iii) Controller section : The analog value is converted to digital value by ADC and is picked up by the microcontroller AT89S52 which is a low-power, high-performance Complementary Metal Oxide Silicon (CMOS) 8-bit microcomputer with 8 KB of Flash programmable and erasable read only memory (EPROM) [7]. (iv) Display section : Since it is essential to display the data received from the microcontroller, a liquid crystal display 44780 LCD is used which is a 2×16 line display [8,9].
%"
A Goswami, T Bezboruah and K C Sarma
(iv) Temperature control section : This section consists of a relay to control hardware to start cooling for maintaining temperature as set by the user and a buzzer to notify the change [10,11]. (v) Hardware controlling : Simple push buttons are used to set temperature and give the time of data transfer to the PC. A 12 V relay is used to control an LED at the set temperature. The schematic diagram of the system is shown in Figure 3. The whole system that we are fabricating for the experiment on a single board is shown in Figure 4.
Figure 3. Embdeded control hardware circuit – schematic diagram.
3.2. Software description : Software development for the present work consists of two main modules. One being the online monitoring and controlling, and the other being offline analysis based on data stored in computer. Present article limits its work on first module keeping second module for future development. Software is developed in both C and Assembly language. Algorithm for online monitoring and controlling of temperature is given below : (i) First step is to initialize keys, Interrupt vectors panel and LCD (ii) Define port P3 of
microcontroller
ATMEL 89S52 as output port
(iii) Get data through ADC0809 from two different channels of Temperature and Light Intensity continuously after a fixed interval (iv) Value obtained from different channels converted to appropriate form of display
An embedded design for monitoring and controlling temperature
%#
Figure 4. Photograph of the fabricated system.
(v) Display the appropriate values of Temperature and Light Intensity in LCD panel in Round Robin pattern (vi) Start hardware devices to act if sense temperature is higher than temperature
set
(vii) New value of Temperature can be set using four keys as follows : (a) Press first key for once to display existing high value of set temperature (TH) and press the key twice to display existing low value of set temperature (TL) and blink cursor at unit position (b) Second key for increment in unit position (c) Third key for shifting one position left at a time (d) Fourth key for setting new temperature value replacing previous one (viii) New value of transfer rate of data to RS-232 is set using keypad as follows : (a) Press first key thrice for displaying existing value of transfer rate set and blank cursor at unit position (b) Second key for increment in unit position (c) Third key for shifting one position left at a time (d) Fourth key for setting new transfer rate of data to RS-232
%$
A Goswami, T Bezboruah and K C Sarma
(ix) Return to step 3 The Flowchart for monitoring and controlling temperature is given in Figure 5.
Figure 5. Flow chart.
An embedded design for monitoring and controlling temperature
%%
4. Results and conclusion In the present system, the temperature measurement and light intensity from the ADC channels are taken. The performances of the channels are distinguished on the basis of its accuracy. The accuracy indicates how closely the sensor can measure the actual or real world parameter value. The more accurate a sensor is, better it will perform. To achieve this, calibration is done with a standard digital thermometer. Since LM35 is a linear device so calibration process yields good result (for each degree rise, 10 mV is the rise). Then temperature displayed in LCD is compared with the standard temperature from digital thermometer at an interval of 1hour and results are shown in Table 1. Table 1. Comparison of temperature displayed in LCD with standard temperature from digital thermometer. Time (hr:min)
Displayed temp. (°C)
Thermometer temp. (°C)
6:00 am
21.0
21.21
7:00 am
21.6
21.54
8:00 am
21.7
21.73 21.98
9:00 am
21.9
10:00 am
22.2
22.28
11:00 am
22.5
22.44
12:00 noon
23.1
23.22
1:00 pm
23.5
23.58
2:00 pm
23.8
23.88
3:00 pm
24.3
24.32
4:00 pm
23.7
23.76
5:00 pm
23.4
23.36
6:00 pm
22.9
22.86
Due to single decimal calibration in the microcontroller the results are correct up to one decimal only. The on/off condition of the relay is set by making a loop of two values as high temperature limit (TH = TSET) and low temperature limit (TL = TSENSE). By setting the set condition in a hysteresis or loop form around the ambient temperature, it greatly reduces the fluctuation of the device around a single set temperature. Here we write the software to the controller as to switch on the device at TH and switch off the device at TL. Again when TH is reached, device is re- switched on. As an example we set the temperature range as TL = 23 °C and TH = 24 °C and observed results are given in Table 2. We performed experiments to verify the correctness of the set value and performance of the external hardware accordingly. The ON/OFF condition of Table 2 is shown graphically in Figure 6. The rate of data transfer through RS-232 is controlled through the keypad, and
%&
A Goswami, T Bezboruah and K C Sarma Table 2. Observed results when set the temperature range as TL = 23 °C and TH = 24 °C. Set value of temperature (°C)
TL = 23 °C
Led status
Time (hr:min)
ON
3:00 pm
OFF
6:00 pm
TH = 24 °C
Figure 6. ON/OFF condition of hardware at set values.
whatever be the time that declared as the gap, to PC is accurately achieved. For example, if as 2 hr, i.e. at a gap of 2 hr, the temperature to PC. With different values of set value for experiment and it works properly.
at which the data should be transferred we have set the time for data transfer value at that instant will be transferred transfer time, we have performed the
The system can be further enhanced by developing necessary software for offline anlysis.The data stored on PC will enable the system to make historical and intelligent analysis to make efficient decision. Acknowledgment Authors are grateful to the staff of “TICO Institute of Embedded Learning”, New Delhi for providing technical support and time to time advice during the work. References [1]
A Goswami, T Bezboruah and K C Sarma Proc. of the International conference on emerging technologies and applications in engineering, technology and science during 13th -14th January, Rajkot, India 1 pp105 (2008)
[2]
www.ni.com/dataloggers – A Review of PC-Based Data Logging and Recording Techniques
[3]
Muhammad Ali Mazidi and Janice Gillispe Mazidi The 8051 microcontroller and embedded systems (India, Pearson education ltd.) (2007)
[4]
National Semiconductor Corporation, ADC 0809 data sheet, 8-bit Microprocessor compatible A/D converters with 8-channel multiplexer, National Semiconductor data book, October updates (2002)
[5]
S T Microelectronics data book, March, publication http://www.st.com (2002)
[6]
National Semiconductor Corporation, LM35 datasheet, precision centigrade temperature sensors, Atmel data book, November (2000) update
An embedded design for monitoring and controlling temperature [7]
%'
Atmel corporation, AT89S52 data sheet, 8-bit microcontroller with 8k bytes flash, Atmel Data book (2000) update
[8]
http://en.wikipedia.org/wiki/Liquid_crystal_display
[9]
Introduction to LCD programming tutorial by Craig Steiner Copyright 1997-2005 by Vault Information Services LLC (http://8052.com/tutlcd.phtml)
[10]
H S Kalsi Electronic instrumentation (New Delhi) Tata McGraw-Hill Ltd. (1999)
[11]
http://en.wikipedia.org/wiki/temperature-measurement