Skip to main content

LM35

Interfacing LM35 Temperature Sensor with PIC Microcontroller.


The are many cool sensors available now a days, ranging from IR distance sensor modules, accelerometers, humidity sensors, temperature sensors and many many more(gas sensors, alcohol sensor, motion sensors, touch screens). Many of these 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. In this tutorial we will learn how to interface LM35 temperature sensor with PIC18F4520 microcontroller and display its output on the LCD module.
First I recommend you to go and read the following tutorial as they are the base of this small project.
After reading the ADC tutorial given above you will note the the PIC MCU’s ADC gives us the value between 0-1023 for input voltage of 0 to 5v provided it is configured exactly as in the above tutorial. So if the reading is 0 then input is 0v, if reading is 1023 then input is 5v. So in general form if the adc read out is valthen voltage is.
unsigned int val;
val=ADCRead(0); //Read Channel 0
voltage= ((val)/1023.0)*5;
The above formula give voltage in Volts, to get Voltage in mili Volts (mV) we must multiply it with 1000, so
voltage=((val)/1023.0)*5*1000); //Voltage is in mV
since 10mV = 1 degree, to get temperature we must divide it by 10, so
t=((val)/1023.0)*5*100); //t is in degree centigrade
simplifying further we get
t=((val/1023.0)*500);
t=(val*0.48876);
we round off this value, so
t=round(val*0.48876);
remember round() is a standard c library function



Comments

Popular posts from this blog

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search ABSTRACT: In this paper, With advances in geo-positioning technologies and geo-location services, there are a rapidly growing amount of spatiotextual objects collected in many applications such as location based services and social networks, in which an object is described by its spatial location and a set of keywords (terms). Consequently, the study of spatial keyword search which explores both location and textual description of the objects has attracted great attention from the commercial organizations and research communities. In the paper, we study two fundamental problems in the spatial keyword queries: top k spatial keyword search (TOPK-SK), and batch top k spatial keyword search (BTOPK-SK). Given a set of spatio-textual objects, a query location and a set of query keywords, the TOPK-SK retrieves the closest k objects each of which contains all keywords in the query. BTOPK-SK is the batch processing of sets...

A simple and reliable touch sensitive security system CODING

#include <REGX51.H> #include "lcd.c" #define MAX_DELAY() delay(65000) sbit Vibra_Sense=P3^1; sbit Buz=P1^0; void intro() {  lcd_init();  lcd_str("Touch Sensitive ",0x80);  lcd_str("Security System ",0xc0);  MAX_DELAY();MAX_DELAY();  lcd_clr();  }  void main()  { unsigned int i = 0, j= 0; intro();    while(1)    { lcd_str("Security Syst On",0x80); lcd_str("No Vibra Detectd",0xc0); Buz = 1; if(Vibra_Sense == 1) { while(Vibra_Sense == 1) delay(1000); } else { while(Vibra_Sense == 0) delay(1000); } Buz = 0; lcd_str("Vibraton Detectd",0xc0);delay(65000); while(1);    }  }

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud Abstract                                                                                                                                                      ...