Microcontroller Based Temperature Measurement and Controlling
Microcontroller Based Temperature Measurement and Controlling
Microcontroller Based Temperature Measurement and Controlling
TEMPERATURE MEASUREMENT
AND CONTROLLING”
SUBMITTED BY: -
MANISH PHOGAT
ROLL NO: - 07-ECE-158
GURGAON INSTITUTE OF
TECHNOLOGY & MANGEMENT
ACKNOWLEDGEMENT
INDEX
1. PROFILE OF THE COMPANY.
2. PROJECT INTRODUCTION.
3. PROJECT METHODOLOGY
3.1 HARDWARE DESCRIPTION
3.1.1 8051 microcontroller
3.1.2 Temperature
sensor DS1620
3.1.3 Brushless DC fan
3.1.4 LCD
3.1.5 Voltage Regulator
3.1.6 Power Supply
3.1.7 PCB
3.1.8 Capacitor
3.1.9 Resistor
3.1.10
3.2 SOFTWARE DESCRIPTION
3.3 HOW IT WORKS?
4.FUTURE PROSPECTS
5.CONCLUSION
6.BIBLIOGRAPHY
3.PROJECT METHODOLOGY
Pin
configuration
of µC
P89v51RD2+
It is a 40 pin DIP configuration which
operates on 5V.
Supports 12-clock (default) or 6-clock
mode selection via software or ISP.
• Pin 9: connected to Reset
• Pin 18,19: connected to crystal
(to provide the required
frequency to work on).
• Pin 29: PSEN ,it is a read strobe
to external program memory.
• Pin 30: ALE, It enables the
address latch for port 0
• Pin 31: EA (when low, enables
code to be fetched from external
memory).
• Pin no. 1 to 8: Port 1.
• Pin no. 10 to 17: Port 3.
• Pin no. 21 to 28: Port 2.
• Pin no. 32 to 39: Port 0.
PIN DESCRIPTION
OSCILLATOR CHARACTERISTICS
XTAL1 and XTAL2 are the input and
output, respectively,of an inverting
amplifier which can be configured for
use as an on-chip oscillator.To drive the
device from an external clock
source,XTAL1 should be driven, while
XTAL2 is left unconnected.
3.1.2 IC-DS1620
The DS1620 Digital Thermometer and
Thermostat provides 9-bit temperature
readings which indicate the
temperature of the device. With three
thermal alarm outputs, the DS1620 can
also act as a thermostat. THIGH is
driven high if the DS1620's temperature
exceeds a user defined temperature TH.
TLOW is driven high if the DS1620's
temperature falls below a user defined
temperature TL.
Pin Description :-
CONFIGURATION/STATUS
REGISTER:
where
DONE = Conversion Done Bit.
1=conversion complete, 0=conversion in
progress. The power-up/POR state is a 1.
THF = Temperature High Flag. This bit
will be set to 1 when the temperature is
greater than or equal to the value of TH.
It will remain 1 until reset by writing 0
into this location or by removing power
from the device. This feature provides a
method of determining if the DS1620 has
ever been subjected to temperatures
above TH while power has been applied.
The power-up/POR state is a 0.
TLF = Temperature Low Flag. This bit
will be set to 1 when the temperature is
less than or equal to the value of TL. It
will remain 1 until reset by writing 0 into
this location or by removing power from
the device. This feature provides a
method of determining if the DS1620 has
ever been subjected to temperatures
below TL while power has been applied.
The power-up/POR state is a 0.
NVB = Nonvolatile Memory Busy Flag.
1=write to an E2 memory cell in
progress. 0=nonvolatile
memory is not busy. A copy to E2 may
take up to 10 ms. The power-up/POR
state is a 0.
CPU = CPU Use Bit. If CPU=0, the
CLK/ CONV pin acts as a conversion
start control, when RST is low. If CPU is
1, the DS1620 will be used with a CPU
communicating to it over the 3–wire port,
and the operation of the CLK/CONV pin
is as a normal clock in concert with DQ
and RST . This bit is stored in
nonvolatile E2 memory, capable of at
least 50,000 writes. The DS1620 is
shipped with CPU=0.
1SHOT = One–Shot Mode. If 1SHOT is
1, the DS1620 will perform one
temperature conversion upon reception
of the Start Convert T protocol. If
1SHOT is 0, the DS1620 will
continuously perform temperature
conversion. This bit is stored in
nonvolatile E2 memory, capable of at
least 50,000 writes. The DS1620 is
shipped with 1SHOT=0.
3.1.3 Brushless DC Fan
Vss : GRND
Vcc : Power supply
RS : RS=0 to select command
register
RS=1 to select data register
R/W : R/W = 0 for write, R/W = 1
for read
E : Enable
3.1.6.Power Supply
3.1.9 Resistance
COLOURS CODE
Black 0
Brown 1
Red 2
Orange 3
Yellow 4
Green 5
Blue 6
Violet 7
Grey 8
White 9
#include <REG51F.H>
#include <REG51F.H>
#include<stdio.h>
sbit dq=P0^0;
sbit clk=P0^1;
sbit rst=P0^2;
sbit tcom=P0^3;
sbit fan=P0^5;
void init_ds1620();
//------------------------------------------------
---------------------------
code disp_lut[] =
{'0','1','2','3','4','5','6','7','8','9'};
void lcd_init();
void pulse();
sbit RS=P1^1;
sbit RW=P1^2;
sbit E=P1^3;
sbit D4=P1^4;
sbit D5=P1^5;
sbit D6=P1^6;
sbit D7=P1^7;
//------------------------------------------------
-----------------------------
void main()
{
tcom=0;
lcd_init();
init_ds1620();
while(1)
rst=1;
wt_ds1620(0xee);
rst=0;
delay_ms(2);
delay_ms(2);
rst=1;
wt_ds1620(0xaa);
temp2=rd_ds1620();
rst=0;
process(temp2);
if(temp2>temp)
fan=1;
cmd_wr(0x80);
delay_ms(5);
data_wr('F');
delay_ms(5);
data_wr('A');
delay_ms(5);
data_wr('N');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr('I');
delay_ms(5);
data_wr('S');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr('O');
delay_ms(5);
data_wr('N');
delay_ms(5);
data_wr(' ');
delay_ms(5);
cmd_wr(0xc0);
delay_ms(5);
data_wr('T');
delay_ms(5);
data_wr('e');
delay_ms(5);
data_wr('m');
delay_ms(5);
data_wr('p');
delay_ms(5);
data_wr('=');
delay_ms(5);
data_wr('=');
delay_ms(5);
data_wr('>');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr(ds3);
delay_ms(5);
data_wr(ds2);
delay_ms(5);
data_wr(ds1);
delay_ms(5);
else
{ fan=0 ;
cmd_wr(0x80);
delay_ms(5);
data_wr('F');
delay_ms(5);
data_wr('A');
delay_ms(5);
data_wr('N');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr('I');
delay_ms(5);
data_wr('S');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr('O');
delay_ms(5);
data_wr('F');
delay_ms(5);
data_wr('F');
delay_ms(5);
cmd_wr(0xc0);
delay_ms(5);
data_wr('T');
delay_ms(5);
data_wr('e');
delay_ms(5);
data_wr('m');
delay_ms(5);
data_wr('p');
delay_ms(5);
data_wr('=');
delay_ms(5);
data_wr('=');
delay_ms(5);
data_wr('>');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr(' ');
delay_ms(5);
data_wr(ds3);
delay_ms(5);
data_wr(ds2);
delay_ms(5);
data_wr(ds1);
delay_ms(5);
void init_ds1620()
rst = 1;
wt_ds1620(0x0c); //writing
permission to the control register
rst = 0;
delay_ms(2);
delay_ms(2);
rst=1;
delay_ms(2);
delay_ms(2);
rst=1;
wt_ds1620(0xa1);
temp=rd_ds1620();
rst=0;
delay_ms(2);
delay_ms(2);
rst=1;
rst=0;
delay_ms(2);
delay_ms(2);
rst=1;
wt_ds1620(0xa2);
temp1=rd_ds1620();
rst=0;
//------------------------------------------
clk=0;
dq = (a & b); /*
Send bit to 1620 */
clk=1;
b=(b<<1); /* Setup
to send next bit */
}
return;
clk=0;
dq = (a & b); /*
Send bit to 1620 */
clk=1;
b=(b<<1); /* Setup
to send next bit */
return;
}
dq=1;
for(j=0;j<10;j++)
{
clk = 0;
if(dq)
k |= b;
clk = 1;
b = (b<<1);
return k;
}
unsigned char read_temp()
return 0;
void lcd_init()
delay_ms(15);
cmd_wr0(0x30);
delay_ms(5);
cmd_wr0(0x30);
delay_ms(5);
cmd_wr0(0x30);
delay_ms(5);
cmd_wr0(0x20);
delay_ms(5);
cmd_wr(0x14);
delay_ms(5);
cmd_wr(0x28);
delay_ms(5);
cmd_wr(0x06);
delay_ms(5);
cmd_wr(0x0c);
delay_ms(5);
cmd_wr(0x80);
delay_ms(5);
cmd_wr(0x01);
delay_ms(5);
{
RS=RW=0;
map(value);
pulse();
cmd_wr0(value);
value=value<<4;
cmd_wr0(value);
}
void map(unsigned char value)
P1=((P1&0x0F)|(value&0xF0));
void pulse()
E=1;
delay_ms(1);
E=0;
RS=1;
RW=0;
map(value);
pulse();
value=value<<4;
map(value);
pulse();
unsigned int i, j;
}
void process(unsigned char value)
value=value/2;
ds1=disp_lut[value%10];
ds2=disp_lut[(value/10)%10];
ds3=disp_lut[value/100];
}
WORKING:
5.CONCLUSION
No matter where we look in the modern
world, the evidence of the embedded
revolution is starting to creep into every
aspect of modern life. From microchip
devices that can be implanted into the
skin to futuristic software solutions for
handheld units, embedded technology
and the results of embedded technology
have started to transform the form and
shape of the technological society
forever.
BIBLIOGRAPHY
• 8051 Microcontroller and embedded
systems : Muhammad Ali Mazidi,
Janice Gillispie Mazidi & Rolin D.
McKinlay
• Google
• www.howstuffworks.com
• www.alldatasheets.com
• www.dalsemi.com