Professional Documents
Culture Documents
Many metals, semiconductors, and ceramics change their electrical resistance with
temperature in a known reproducible manner. This change in resistance results in a
change of current or voltage, so it can be measured and then displayed in an analog to
digital fashion. This is the basis for digital thermometer. Digital thermometers are a
quick, simple and effective way of obtaining temperature information.
Digital thermometers are quickly replacing traditional mercury thermometers mercury
thermometers were used in the same way as by heating the liquid mercury in the tip
would cause it to expand into the tube of the thermometer, thus fluctuating according
to temperature and stopping at a point on the scale. For clinical use to prevent
contamination between patients in 1990s digital thermometers began replacing
traditional thermometers in medicine due to safety concerns.
ACKNOWLEDGEMENT
We would like to acknowledge and extend our heartfelt gratitude to the persons who
have made possible the completion of our project. Without their timely help, the
project could not have been a success, our supervisor Madam Uzma Raheem, for her
vital encouragement and support. Madam Shafia Tabbassum our cosupervisor, for
her understanding and assistance. Prof.Dr.M.A.Haleem, Chairman, Department of
Biomedical Department for the help and inspiration he extended. Sir Zeeshan project
incharge for the constant reminders and much needed motivation. All Biomedical
department faculty members and Staff Sir Asif Memon, for assisting in the collection
of the topics for the chapters.
Most especially we gratefully acknowledge to our family for their encouragement and
financial support, and above all to God, who made all things possible.
ABSTRACT
A digital thermometer is designed and built utilizing a temperature sensor LM35 and
distributed control system circuit. Temperature was recorded in the range 97F
to100F, 37C with an accuracy of 0.01. Numeric and graphical data were displayed
on a PC using a program written in Visual Basic. The project is based on Human
Machine Interface (HMI) equipment which provides a control and visualisation
interface between a human and a process; machine, application or appliance. HMIs
allow us to control, monitor, diagnose and manage our application.
The report
CERTIFICATE
This is to certify that:
2005-BM-132
2005-BM-113
2005-BM-123
2005-BM-130
Are student of Biomedical Engineering Department batch 2005 and have completed
their final year project assign to them.
Prof.Dr.M.A.Haleem
Chairman
Biomedical Engineering Department
CERTIFICATE
This is to certify that:
2005-BM-132
2005-BM-113
2005-BM-123
2005-BM-130
Are student of Biomedical Engineering Department batch 2005 and have completed
their final year project assign to them.
Engr.Uzma Raheem
Project Advisor
Lecturer
Dept. of Biomedical Engineering
Engr.Shafia Tabbasum
Project Advisor
Lecturer
Dept. of Biomedical Engineering
Table of Contents
Chapter # 1
Theory
1.1
Introduction
1.2
General Description
1.2.1
Thermometer
1.2.2
Sensor
1.2.3
Analog-To-Digital Converter
1.2.4
Microcontroller
1.2.5
1.3
Serial Interfacing
1.3.1
1.3.2
System Components
1.3.3
Computer
1.3.4
Physical Link
1.3.5
Programming
10
1.3.6
Languages
10
1.4
10
1.5
11
1.5.1
Elements
11
1.5.2
11
Chapter # 2
Technical Data
12
2.1
Block Diagram
12
2.2
Components List
13
2.2.1
LM35
13
2.2.2
ADC0804
13
2.2.3
Microcontroller 89C51
13
2.2.4
14
2.3
Circuit Description
14
2.3.1
Power Supply
14
2.3.2
14
2.3.3
Analog Unit
15
2.3.4
Display Unit
15
2.5
Programmme
15
2.6
24
2.6.1
24
Vital Statistics
Chapter # 3
References
Project Management
25
Chapter # 1
Theory
1.
Theory
1.1
Introduction
1.2
General Description
1.2.1
Thermometer
Chapter # 1
Theory
Alcohol thermometer
Galileo thermometer
Infrared thermometer
Mercury-in-glass thermometer
Pill thermometer
Resistance thermometer
Reversing thermometer
Thermistor
Thermocouple
1.2.2
Sensor
Chapter # 1
Theory
Electromagnetic
Chemical
Mechanical
Optical Radiations
Ionising Radiations
Acoustics
Temperature Sensor
Big differences exist between different temperature sensor or temperature
measurement device types. Using one perspective, they can be simply
classified into two groups, contact and non-contact. The two links below take
you to descriptive pages on each type with a breakdown by more specific,
detailed types under that simple, first breakout.
There are also vendors of each sensor type, some vendors sell more than one
type and some sell nearly all types, but not always all brands. There are
differences between brands and the differences are most evident among those
device types for which there are few if any recognized standards. Start your
search either for a specific temperature measurement device type or go to the
vendor page index and you can access the vendors of specific types from
there.
Both contact and non-contact sensors require some assumptions and
inferences in use to measure temperature. Many, many well-known uses of
Sir Syed University of Engineering & Technology
Chapter # 1
Theory
these sensors are very straightforward and few, if any, assumptions are
required. Other uses require some careful analysis to determine the controlling
aspects of influencing factors that can make the apparent temperature quite
different from the indicated temperature
1.2.3
Analog-To-Digital Converter
Chapter # 1
Theory
Chapter # 1
Theory
Applications
AD converters are used virtually everywhere where an analog signal has to be
processed, stored, or transported in digital form. Fast video ADCs are used, for
example, in TV tuner cards. Slow on-chip 8, 10, 12, or 16 bit ADCs are
common in microcontrollers. Very fast ADCs are needed in digital
oscilloscopes, and are crucial for new applications like software defined radio.
1.2.4
Microcontroller
A microcontroller (also MCU or C) is a functional computer system-on-achip. It contains a processor core, memory, and programmable input/output
peripherals. Microcontrollers include an integrated CPU, memory (a small
amount of RAM, program memory, or both) and peripherals capable of input
and output. Microcontrollers are used in automatically controlled products and
devices, such as automobile engine control systems, remote controls, office
machines, appliances, power tools, and toys. By reducing the size, cost, and
power consumption compared to a design using a separate microprocessor,
memory, and input/output devices, microcontrollers make it economical to
electronically control many more processes.
Programs
Microcontroller programs must fit in the available on-chip program memory,
since it would be costly to provide a system with external, expandable,
memory. Compilers and assembly language are used to turn high-level
language programs into a compact machine code for storage in the
microcontroller's memory. Depending on the device, the program memory
may be permanent, read-only memory that can only be programmed at the
factory, or program memory may be field-alterable flash or erasable read-only
memory.
Other Microcontroller Features
Since embedded processors are usually used to control devices, they
sometimes need to accept input from the device they are controlling. This is
the purpose of the analog to digital converter. Since processors are built to
interpret and process digital data, i.e. 1s and 0s, they won't be able to do
Sir Syed University of Engineering & Technology
Chapter # 1
Theory
anything with the analog signals that may be being sent to it by a device. So
the analog to digital converter is used to convert the incoming data into a form
that the processor can recognize. There is also a digital to analog converter
that allows the processor to send data to the device it is controlling.
In addition to the converters, many embedded microprocessors include a
variety of timers as well. One of the most common types of timers is the
Programmable Interval Timer, or PIT for short. A PIT just counts down from
some value to zero. Once it reaches zero, it sends an interrupt to the processor
indicating that it has finished counting. This is useful for devices such as
thermostats, which periodically test the temperature around them to see if they
need to turn the air conditioner on, the heater on, etc.
Types of Microcontrollers
ARM
AVR
V850
PowerPC ISE
AT-MEGA 16
1.2.5
Chapter # 1
Theory
Dot pitch: The distance between the centers of two adjacent pixels. The
smaller the dot pitch size, the less granularity is present, resulting in a
sharper image. Dot pitch may be the same both vertically and horizontally,
or different (less common).
Viewable size: The size of an LCD panel measured on the diagonal (more
specifically known as active display area).
Color support: How many types of colors are supported (coll., more
specifically known as color gamut).
Brightness: The amount of light emitted from the display (coll., more
specifically known as luminance).
Contrast ratio: The ratio of the intensity of the brightest bright to the
darkest dark.
Input ports (e.g., DVI, VGA, LVDS, DisplayPort, or even S-Video and
HDMI).
1.3
Serial Interfacing
A serial port is a computer interface that transmits data one bit at a time. In common
use, the term serial port refers to ports that use a particular asynchronous protocol.
These ports include the RS-232 ports on PCs and many serial ports in embedded
systems. Most serial ports are bidirectional: they can both send and receive data.
Transmitting one bit at a time might seem inefficient but has advantages, including the
ability to use inexpensive cables and small connectors.
Chapter # 1
Theory
Serial ports are ideal for many communications between embedded systems or
between embedded systems and PCs. Serial ports can also be a good choice when you
need very long cables or a basic network among PCs, embedded systems or a
combination. Some systems include a serial port that is hidden from users but
available to technicians for debugging and diagnostics.
1.3.1
1.3.2
System Components
Communicating via serial ports requires three things: computers with serial
ports, a cable or wireless interface that provides a physical link between the
ports, and programming to manage the communications.
1.3.3
Computer
1.3.4
Physical Link
The physical link between computers consists of the wires or other medium
that carries information from one computer to another and the connectors and
other components that interface the medium to the computers.
RS-232 links can use just about any cable type and require one line per signal
plus a common ground line. RS-485 networks typically use twisted-pair cables
with a pair for each differential signal. Other options for serial
communications include fiber-optic cable, which encodes data as the presence
or absence of light, and wireless technologies, which enable sending data as
electromagnetic (radio) or infrared signals through the air. Computers
Chapter # 1
Theory
Programming
Languages
The programming for a serial interface can use any language, and the language
doesnt have to be the same on every computer. The only requirement is that
all of the computers must agree on a format. Microcontroller programs might
access UART registers directly or use library functions or other higher-level
methods to set communications parameters and exchange data. PC
applications typically use higher-level functions to access ports.
1.4
10
Chapter # 1
Theory
A HMI represents the front end of a machine, the visible window into
the
process.
Good HMI aesthetics and ergonomy are often key selling features for machines.
1.5
Elements
A DCS typically uses custom designed processors as controllers and uses both
proprietary interconnections and protocols for communication. Input & output
modules form component parts of the DCS. The processor receives
information from input modules and sends information to output modules. The
input modules receive information from input instruments in the process and
transmit instructions to the output. Computer buses or electrical buses connect
the processor and modules through multiplexers/demultiplexers. Buses also
connect the distributed controllers with the central controller and finally to the
Human-Machine Interface (HMI) or control consoles
1.5.2
11
Chapter # 1
Schedulability analysis
Theory
12
Chapter # 2
Technical Data
2.
Technical Data
2.1
Block Diagram
SENSOR
LM35
A/D
UNIT
MCU
ATMEL
80C51
SENSOR
LM35
LCD
A/D
UNIT
MCU
ATMEL
80C51
LCD
SENSOR
LM35
A/D
UNIT
MCU
ATMEL
80C51
LCD
COMPUTER
PC
12
Chapter # 2
2.2
Technical Data
Components List
2.2.1
LM35
ADC0804
Microcontroller 89C51
13
Chapter # 2
Technical Data
2.2.4
2.3
Circuit Description
Our digital thermometer consists of four units, Power Supply, Main Control Unit,
Analog Unit and Digital or Display Unit.
2.3.1
Power Supply
5 V
31
19
100 R
1
L C D D is p l a y
5K6
5 V
10 uF
2
30 pF x 2
1 1 .0 9 5 M H z
18
9
8K2
12
13
14
15
1
2
3
4
5
6
7
8
U 2
E A /V P
X1
X2
R ESET
IN T 0
IN T 1
T0
T1
P
P
P
P
P
P
P
P
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
P
P
P
P
P
P
P
P
0 .0
0 .1
0 .2
0 .3
0 .4
0 .5
0 .6
0 .7
P
P
P
P
P
P
P
P
2 .0
2 .1
2 .2
2 .3
2 .4
2 .5
2 .6
2 .7
R D
W R
PSEN
A L E /P
TXD
R XD
39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28
17
16
29
30
11
10
8051
5 V
10 uF
13
8
11
10
1
3
4
5
2
6
U 4
R 1 IN
R 2 IN
T 1 IN
T 2 IN
C
C
C
C
V
V
+
12+
2+
-
R 1O U T
R 2O U T
T1O U T
T2O U T
12
9
14
7
5
9
4
8
3
7
2
6
1
P1
C O N N EC TO R D B9
M A X232
14
Chapter # 2
2.3.3
Technical Data
Analog Unit
An 8 bit ADC is used which convert the data receive from temperature sensor
connected to pin 6 of ADC, a 10 k resistor and 150 pf capacitor is used to
generate clock pulse and a 10 k variable resister is required to set the
reference.
The sequence of conversion of data is as follows:
1. CS ( pin 1) is applied to activate the ic
2. WR (pin 3) is applied to get the analog value
3. INT (pin 5) gives the indication that the indication is complete.
4. RD ( pin 2) signal is applied to get the digital converted value
5 V
U 3
10 K
1
9
4
10 K
19
7
150 pF
AG N D
VR EF
C LK
C LKR
V IV I+
IN T R
W R
R D
C S
D
D
D
D
D
D
D
D
B
B
B
B
B
B
B
B
7
6
5
4
3
2
1
0
5
3
2
1
11
12
13
14
15
16
17
18
AD C 0804
T e m p e r a tu r e
S encer
2.3.4
Display Unit
The last section consists of LCD Module and output to PC. Signals are sent to
the LCD for the display of temperature in degree centigrade and degree
ferenheit.This can also be seen through PC by implementation of the signals to
MAX232, which is connected to Serial Connector RS232.This RS232 is then
connected to the printer port of the computer, so that parameter like
temperature could be seen on the PC.
2.5
Programmme
#include <reg51.h>
#include <math.h>
#define ADDRESS 'B'
15
Chapter # 2
Technical Data
sfr
ldata
= 0x80;
sfr
adc
= 0x90;
sbit
adccs =P3^0;
sbit
adcrd =P3^1;
sbit
adcwr =P3^2;
sbit
adcint =P3^3;
sbit
relay
sbit
rs
= P2^7;
sbit
rw
= P2^6;
sbit
en
= P2^5;
sbit
check = P1^0;
=P3^7;
16
Chapter # 2
Technical Data
rs = 1;
rw = 0;
en = 1;
MSDelay(1);
en = 0;
MSDelay(10);
return;
}
void ClearScreen(void)
{
lcdcmd(0x01); }
void Intilize(void)
{
lcdcmd(0x38);
lcdcmd(0x0E);
lcdcmd(0x06);
ClearScreen();
}
void Location(unsigned char Row,unsigned char Col)
{
unsigned char DispLoc = 0x80;
if(Row == 2)
DispLoc = 0xc0;
DispLoc = DispLoc+Col;
lcdcmd(DispLoc);
}
LCDString(char str[])
{
int x = 0;
while(str[x] != '$' )
{
lcddata(str[x]);
x++;
Sir Syed University of Engineering & Technology
17
Chapter # 2
Technical Data
}
}
int
RoundOff(float
x)
{
float
r;
float
d;
r = ceil (x);
d = x-(r-1);
if (d>0.5)
return((int)r);
r--;
return((int)r);
}
void PrintChar (unsigned char PChar)
{
float
r,r2;
float
PCharL = PChar;
ValString[3] = '$';
r = PCharL/10;
r2 = ceil(r);
if (r2 != r)
r2--;
r = (r-r2)*10;
r = RoundOff(r);
ValString[2] = ((char)r)+48;
if (r2>9)
{
r = r2/10;
r2 = ceil(r);
if(r2 != r)
Sir Syed University of Engineering & Technology
18
Chapter # 2
Technical Data
r2--;
r = (r-r2)*10;
r = RoundOff(r);
ValString[0] = ((char)r2)+48;
r2 = r;
}
ValString[1] = ((char)r2)+48;
LCDString(ValString);
}
ValPint = PInt;
float
RoundPint;
float
DecPint;
float
r;
RoundPint = ceil(ValPint);
if (RoundPint > ValPint)
RoundPint--;
DecPint = (ValPint-RoundPint)*10;
DecPint = RoundOff(DecPint);
ValString[4] = ((char)DecPint)+48;
ValPint = RoundPint;
DecPint = RoundPint/10;
RoundPint = ceil(DecPint);
if(RoundPint > DecPint)
RoundPint--;
DecPint = (DecPint-RoundPint)*10;
DecPint = RoundOff(DecPint);
ValString[2]= ((char)DecPint)+48;
Sir Syed University of Engineering & Technology
19
Chapter # 2
Technical Data
ValPint = (ValPint-DecPint)/10;
if (ValPint > 9)
{
RoundPint = ValPint / 10;
DecPint = ceil(RoundPint);
if (DecPint > RoundPint)
DecPint--;
RoundPint = (RoundPint-DecPint)*10;
ValPint = RoundPint;
ValString[0]= ((char)DecPint)+48;
}
ValString[1]= ((char)RoundPint)+48;
LCDString(ValString);
}
unsigned char GetADC()
{
unsigned char AdcData;
adc = 0x0ff;
adccs = 0;
MSDelay(10);
adcwr = 0;
MSDelay(10);
adcwr = 1;
MSDelay(5);
adcrd = 0;
MSDelay(10);
AdcData = adc;
adcrd = 1;
adccs = 1;
return(AdcData);
}
unsigned int C2F(unsigned char DC)
Sir Syed University of Engineering & Technology
20
Chapter # 2
Technical Data
{
return (135.8);
}
void
IntilizeTimer(void)
{
TMOD
TH1
= 0x20;
= -3;
SCON = 0x50;
TR1
= 1;
}
void
= 0;
}
unsigned char Receive(void)
{
unsigned char Rec = '%';
while (RI == 1)
{
Rec = SBUF;
RI = 0;
}
return (Rec);
}
void
Unit,Ten;
float
Hund = 0;
float
x=
float
x2;
AsciiData;
21
Chapter # 2
Technical Data
x = x / 10;
x2 = ceil(x);
if (x2 > x)
x2--;
x = ((x- x2)*10);
Unit = ceil(x);
if(Unit > x)
Unit--;
Unit = Unit;
x=
AsciiData;
x2 = (x - Unit)/10;
if (x2 > 9)
{
Ten = x2;
//Temp
x = x2 / 10;
x2 = ceil(x);
if(x2 > x)
x2--;
Hund = x2;
x2 = (x -x2)*10;
}
Ten = x2;
Transmit(((char)Hund)+48);
MSDelay(10);
Transmit(((char)Ten)+48);
MSDelay(10);
Transmit(((char)Unit)+48);
MSDelay(10);
Transmit('$');
MSDelay(10);
}
void main(void)
{
Sir Syed University of Engineering & Technology
22
Chapter # 2
char
Technical Data
loop = 0;
deg_f = 0;
//
TransmitAscii(155);
Intilize();
IntilizeTimer();
relay = 0;
Location(1,2);
LCDString("Deg C$");
Location(2,2);
LCDString("Deg F$");
while(loop == 0)
{
Location(1,8);
deg_c = GetADC();
Instruction = Receive();
if (Instruction != '%')
{
switch (Instruction)
{
case 'Q':
relay = 0;
break;
case 'q':
relay = 0;
break;
case ADDRESS:
23
Chapter # 2
Technical Data
relay = 1;
Transmit('$');
break;
case 'd':
TransmitAscii(deg_c);
break;
}
}
PrintChar(deg_c);
//
Location(2,2);
//
PrintInteger(deg_f);
//
deg_c++;
//
//
deg_c = GetADC();
//
deg_f = C2F(deg_c);
}
}
2.6
Vital Statistics
24
Chapter # 3
3.
Project Management
Project Management
April
As soon as project was selected, an extensive research was being done covering all
the aspects of the project. Internet was the primary source to gather information about
working principle and components used in digital thermometer.
May & June
It is also necessary to study and collect data about distributed control system (DCS)
on which basically our project works, study and selection of suitable microcontroller
was the next task to be done.
July & August
Purchasing of components was the next step, which is a long and tedious job with
multiple visits to Electronic market during the period of our semester break. Finally
we selected MCS 89C51 as our controller, several small practical were performed on
it to check its performance.
September
Interfacing of MCS51 with ADC and LCD was the next task to be performed by us,
which is not the easy job because firstly experiment with ADC had to be done then the
interfacing and then test codes for ADC was performed. Same procedure was applied
for LCD, after experiment with LCD module interfacing was done and then test codes
for LCD module.
October
To complete the analog part Designing and fabrication of PCBs was done by taking
help with our supervisors Madam Uzma and Madam Shafia. Fabrication of PCBs
required much time in the mean while we acquire knowledge about RS 232 port and
Max232 port for serial communication.
25
Chapter # 3
Project Management
November
Assembling of components was done on PCBs so that analog part should be
completed before final semester exams. Programming of C language for
microcontroller was the major step done in this month.
December
Digital part was the next step so test codes for serial communication via
HyperTerminal for LCD and also for PC interfacing for that we require VB
programming. We have faced many problems in interfacing with PC because when
we interface 3 of our modules with computer and on giving 0 1 logic we are getting
noise instead of any result, this actually happens because we do not know the
tristate. After studying the tristate we came to know that the basic logic behind it is
that PC first calls all the modules then it interfaces with one module at a time and the
other two stay at rest , but this is happening so quickly that we are getting all the three
results at the same time.
After the successful testing of project by achieving temperature in Centigrade and in
Fahrenheit on both LCD and on PC, we work on the last step of our project which is
finalizing of our project report and preparing for poster presentation.
26
References
Websites
1.
www.linuxfocus.org/English/February2005/article365.shtml -
2.
www.beyondlogic.org/serial/serial.htm -
3.
www.arcelect.com/rs232.html -
4.
www.datasheetcatalog.com/datasheets_pdf/L/M/3/5/LM35.shtml -
5.
dcs.upc.edu/
6.
www.schneider-electric.co.uk/electricity.nsf/automation-control/hmi-humanmachine-interfaces-
Books
1.
Lakeview.Research.Serial.Port.Complete.2nd.Edition.Dec.2007