LM35 Testing

Status
Not open for further replies.

koolguy

Active Member
Hello,
I have LM35 how to test it i have doubt it is damage, how to test it with multi meter??
https://embedded-lab.com/blog/?p=4867
according to this the i have used Vcc 6V so, output is 0.005V it changes in between, why?
**broken link removed**
 
Last edited:
hi,
Have you read the datasheet.?
E
 

Attachments

  • LM35.pdf
    299.6 KB · Views: 278
Try this, post what you measure.
 

Attachments

  • AAesp01.gif
    7.1 KB · Views: 274
You just set it up as shown in that link. Pos and Neg to any voltage 4.5 to 9v DC and the middle leg to your Volt meter red lead on the 2v DC range and the black lead to the voltage negative.

Have just done that on my LM35 and the meter reads 0.236v which = 23.6deg C. The display is stable, but if you have the bare sensor in a cool draught it may just move up and down.

If you still get 0.005v then supsect its connected wrong or damaged.
 
Remember that the 'DP' and the 'DT' packages have different pinouts!!!
 
Hello,
I have LM35 how to test it i have doubt it is damage, how to test it with multi meter??
https://embedded-lab.com/blog/?p=4867
according to this the i have used Vcc 6V so, output is 0.005V it changes in between, why?
**broken link removed**


Agree with the LM35s pinout shown in the Embedded link.

To me the pantech link you now show has pin1 and 3 the wrong way around for a t092 device.
 
It is showing .009V

If you have connected it up as that Embedded link or Erics picture then you should be getting a sensible reading, as you are not , can only concluded the sensors duff, you need to get a new one.
( just reversing the + and - connections for a split second are enough to blow them)

There is a chance it is working fine, if you are testing it in a freezer where the temp is 0c ..
 
Hello,
I have changed the LM35 please tell how to convert it to *C
the ADC is working fine at 5V reference. left justified
lm35 is giving 10mV/*C
so, there is 10 bit ADC 2^10=1023bits
5/1023= 4.8mV

so, how to convert in *C

#include <htc.h>

__CONFIG( BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000


void main()
{
TRISB=0X00;
PORTB=0X00;
TRISA = 0xff ;
ADCON1=0b00000000;
ADCON0=0b10000001;//000 = channel 0, (RA0/AN0)
ADIF=0;
ADIE=1;
PEIE=1;
while(1){
__delay_us(10);
GO_DONE=1;
__delay_us(10);

PORTB=ADRESH;
PORTB=0X00;
__delay_ms(200);
PORTB=0Xff;
__delay_ms(200);

}
}
 
hi,
One option is to amplify the LM35 output, to give 5v as an input to the PIC.
The working range is +2C thru 150C.
I usually scale the amp to give 4.88v out at 100C, this gives a ADC count of 1000 for 100C, so a +/-0.1C resolution.
The maths are easier for this scaling.
 
You are better off referencing the ADC to its minimum possible ( I'm sure that its 2.2v) That way you can get the best resolution.. But

degrees C = (ADCin * 5v / 1024) * 100 ....
 
degrees C = (ADCin * 500 / 1024) will give you what you want!
How to get this equation need to understand.

C:
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
unsigned char digits[] = {  0b00010000,0b01111101,0b00100010,0b00101000,0b01001101,0b10001000,

0b10000000, 0b00111101,0X00,0b00001000};

void main(){
TRISD=0X00;   
TRISB=0X00;
PORTB=0X00;
TRISA = 0xff ;
ADCON1=0b00000000;
ADCON0=0b10000001;//000 = channel 0, (RA0/AN0)
ADIF=0;
    ADIE=1;
    PEIE=1;
while(1){
    __delay_us(10);
GO_DONE=1;
    __delay_us(10);

unsigned char x=0;

x=ADRESH;
PORTD = 8;
x=x%10;
PORTB=digits[x];
__delay_ms(5);
PORTB=0X00;
x=ADRESH;
PORTD = 4;
x=(x/10)%10;
PORTB=digits[x];
__delay_ms(5);
PORTB=0X00;
x=ADRESH;
PORTD = 2;
x=x/100;
PORTB=digits[x];
__delay_ms(5);
PORTB=0X00;
x=ADRESL;
x=x%10;
PORTD = 1;
PORTB=digits[ADRESL];    // just for test on display working or not
__delay_ms(5);
PORTB=0X00;
       
    }
}
 
Left justification??? It is easier in right justification..

11111111 11xxxxxx.. all this needs shifting 6 bits.. This is mainly for 8 bit compatibility..
xxxxxx11 11111111.. Here you can just read into a 16 bit number...

Justification is usually in ADCON1, bit 7..

C:
unsigned int result;

result = (( unsigned int) ADRESH << 2) + (ADRESL >>6); // Left!

result = (unsigned int) ADRESH << 8  + ADRESL;  //Right!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…