Saturday, August 30, 2014

LM35 Simple Thermometer Circuit with LCD - 16F818

Thermometer
Thermometer

In modern world, analog equipment and device are converting in to digital format. To do this mostly used sensors. There are many cool sensors available now days, ranging from IR distance sensor modules, accelerometers, humidity sensors, temperature sensors etc. but many of these sensors are analog in nature. That means they give a voltage output that varies directly (and linearly) with the sensed quantity. For example in LM35 temperature sensor, the output voltage is 10mV per degree centigrade. That means if output is 300mV then the temperature is 30 degrees. Or else, if the temperature changed one degree then its output voltage varied by 10mv.

In this post, I show you how to build temperature sensor (Thermometer) circuit easily. It uses the PIC 16F818 micro-controller, LM35 temperature sensor and a 16x2 LCD.

LM35 Temperature Sensor Schematic Diagram
Schematic Diagram

LM35

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ' Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of 1/4°C at room temperature and 3/4°C over a full -55 to +150°C temperature range. It can be used with single power supplies, or with plus and minus supplies.

Features
  • Calibrated directly in Celsius (Centigrade)
  • Linear + 10.0 mV/°C scale factor
  • 0.5'C accuracy guarantee-able (at +25°C)
  • Rated for full -55° to +150°C range
  • Operates from 4 to 30 volts

Operation


The LM35 outputs an analog voltage proportional to the temperature. This analog voltage then read by the PIC and processed to display the corresponding temperature value on the LCD. The PIC ADC module does the analog to digital conversion. The PIC MCU’s ADC gives us the value between 0-1023 for input voltage of 0 to 5v. So if the reading is 0 then input is 0v, if reading is 1023 then input is 5v.In the code, I have used the mikroC library function for ADC.

The temperature range for this circuit is 0°C to 150°C.
You can download project files form below and it used MikroC

/************************************************************************

    LM35 Temperature Sensor
    Copyright (C) 2015 Scorpionz

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

  >> Email: scorpionzblog@gmail.com
    >> Web  : scopionz.blogspot.com

************************************************************************/

char temp;

void main()
{
OSCCON= 0x70; // 8MHz internal osc
ADCON0=1;
ADCON1=0b10001110;
TRISA = 0x01; // AN0 input
TRISB = 0x00;
PORTA = 0;
PORTB = 0;

Lcd_Init(&PORTB);

Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
Delay_ms(10);

Lcd_Out(1, 3, ".:SCORPIONZ:.");
Delay_ms(1000);
Lcd_Out(2, 2, "Temp is 000.0ßC");

while(1) {

temp = Adc_Read(0)/2.048;

Lcd_Chr(2, 10, ((temp/100)%10 +48));
Lcd_Chr(2, 11, ((temp/10)%10  +48));
Lcd_Chr(2, 12, ( temp%10      +48));
Delay_ms(100);
}
}


Posted By :

Please Note: All contents provided on this blog are for non-commercial purposes only.
Any question..? Feel Free to Ask!

Drop your Comments below. Please report broken links to here
  1. This comment has been removed by a blog administrator.

    ReplyDelete

 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger