Digital Thermometer


Also called temperature indicator. This temperature measuring project has a veriety of range from  -55 to +125 degree centigrade indicating on four common anode seven segment display module. The project measures an accurate temperature value point to point.

DigitalThermometer

                    The main sensing part of the project is the semiconductor DS1820.It is based on one wire protocol device manufactured by Dallas semiconductor comes in different resolution such as DS18S20(9-bit resolution), DS18B20(12-bit resolution) etc.A microcontroller(AT89C2051) controls whole circuit function like receiving the serial data from DS1820 and converting the value for displaying the seven segment module.


DS18204x7 Segment displayAT89C2051

12MHz crystalBC547    Resistors     33pF Ceramic capacitor


The program is written as follows :


 

   Project : DS18x20 Temperature indicator on 4x7-Segment display
   Writer : Sameer Gupta
   Date : July 2012
   MCU : AT89C2051, XL : 12MHz */
 
 sbit OW_Bit at P3_7_bit;     // OneWire pinout
 sbit dgt_4 at P3.B0; // Control pins for the seven segments
 sbit dgt_3 at P3.B1;
 sbit dgt_2 at P3.B2;
 sbit dgt_1 at P3.B3;
 unsigned char SG=0;
 int Digit1,Digit2,Digit3,Digit4;
 char number[]={0x03,0x9F,0x25,0x0D,0x99,0x49,0x41,0x1F,0x01,0x09,0xFD};
 char Decimal[]={0x02,0x9E,0x24,0x0C,0x98,0x48,0x40,0x1E,0x00,0x08};
 
void MUX() org IVT_ADDR_ET0 // multiplexing using Timer0 overflow interrupt
{
    TL0=0x36; // load LSB & MSB values
    TH0=0xf6;
    P1=0xFF;
    dgt_1 = dgt_3 = dgt_2 = dgt_4 = 0;
    SG++;
    SG=SG%4;
    switch(SG){
        case 0: P1=number[Digit1];
                dgt_1 = 1;
                break;
        case 1: P1=Decimal[Digit2];
                dgt_2 = 1;
                break;
        case 2: P1=number[Digit3];
                dgt_3 = 1;
                break;
        case 3: P1=number[Digit4];
                dgt_4 = 1;
                break;
    }
}
 
const unsigned short TEMP_RESOLUTION = 12; //Replace ’12’ with ‘9’ if you are using DS18S20
 
unsigned temp;
void Display_Temperature(unsigned int temp2write) {
  const unsigned short RES_SHIFT = TEMP_RESOLUTION - 8;
  char temp_whole;
  unsigned int temp_fraction;
 
  // check if temperature is negative
  if (temp2write & 0x8000) {
    Digit4 = 10;   //Show negative sign
    temp2write = ~temp2write + 1;
  }
 
  // extract temp_whole
  temp_whole = temp2write >> RES_SHIFT ;
 
  // convert temp_whole to characters
  if (temp_whole/100)
     Digit4 = temp_whole/100;
  else
     Digit4 = 0;
 
  Digit3 = (temp_whole/10)%10;             // Extract tens digit
  Digit2 =  temp_whole%10;                 // Extract ones digit
 
  // extract temp_fraction and convert it to unsigned int
  temp_fraction  = temp2write << (4-RES_SHIFT);
  temp_fraction &= 0x000F;
  temp_fraction *= 625;
  // convert temp_fraction to characters
  Digit1 =  temp_fraction/1000;         // Extract thousands digit
}
 
void main() {
  TMOD=0x01;        // Intialize Timer 0
  TL0=0x36;         // Load Timer 0 for 2.5mS delay for multiplexing
  TH0=0xF6;
  IE=0x82;          // Here EA=1 & ET0=1
  TR0_bit=1;        // Start timer0
  //--- main loop starts here
  do {
    //--- perform temperature reading
    Ow_Reset();                                  // Onewire reset signal
    Ow_Write(0xCC);                              // Issue command SKIP_ROM
    Ow_Write(0x44);                              // Issue command CONVERT_T
    Delay_us(120);
    Ow_Reset();
    Ow_Write(0xCC);                              // Issue command SKIP_ROM
    Ow_Write(0xBE);                              // READING_SCRATCHPAD
    temp =  Ow_Read();
    temp = (Ow_Read() << 8) + temp;
    Display_Temperature(temp);
    Delay_ms(500);
  } while (1);
}      //End

Download the code.


 TempHigh

TempNormal

TempLow

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Add comment

Security code
Refresh

Comments  

bodhesh
#32 bodhesh 2015-10-07 09:23
very much helpful for our house
bodhesh
#31 bodhesh 2015-10-07 09:21
very much heipful for me
your web rocks

Thanks
Online Classifieds
#30 Online Classifieds 2014-10-14 19:07
We are a group of volunteers and opening a new scheme in our community.
Your web site offered us with valuable information to work on. You've
done a formidable job and our whole community will be thankful to you.
- Post Free Classifieds Ads - UsaBestAds.com
SG
#29 SG 2014-10-03 02:14
@Nick,
The compiler used is "MikroC pro for 8051".
Nick
#28 Nick 2014-09-18 08:17
Hi, nice project. Which compiler you used for this project ? Can you suggest programmer for AT89c2051 ? Thanks !
Roberta
#27 Roberta 2014-08-01 00:29
Its such as you learn my mind! You appear to know a lot approximately this,
such as you wrote the ebook in it or something. I believe that you just could do with a few percent
to power the message house a bit, but other than that, that
is great blog. An excellent read. I will definitely be back.
SG
#26 SG 2014-07-31 06:26
@Elijah, In future you'ill be able to subscribe the site newsletter also.
Benedict
#25 Benedict 2014-07-31 02:38
Your way of telling everything in this piece of writing is
really fastidious, every one can without difficulty understand it, Thanks a
lot.
Elijah
#24 Elijah 2014-07-30 19:42
I'll right away grab your rss feed as I can not
to find your email subscription link or newsletter service.

Do you have any? Kindly permit me know in order that I may
subscribe. Thanks.
123Total.biz
#23 123Total.biz 2014-07-30 19:14
Cе poste est remplі de conseils
Amount:


1.png8.png9.png5.png8.png5.png
Visitors Today67
Visitors Yesterday112

  • Your IP Address : 172.16.210.168

1
Online

SG Templetes by Sameer Gupta