Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

temperature sensor LM35

Status
Not open for further replies.
what is the output range given at the output of lm 358 after amplication .
at normal temperature what will be the output voltage.
reply as soon as possible

The opa has a Gain of '5', so with a LM35 giving 10mV/Cdeg you should be able to work out the output voltage
for any temperature from +2C to +100Cdeg easily.

eg: at 20Cdeg, the LM35 gives 20 * 0.01 = 0.2V which after the opa *5 = 1volt
 
Last edited:
where to connect the output of lm 35 to positive of lm 358 or negative of lm 358.whether it is 4k ohm or 4.7 k ohm.
reply as soon as possible.
 
where to connect the output of lm 35 to positive of lm 358 or negative of lm 358.whether it is 4k ohm or 4.7 k ohm.
reply as soon as possible.

The output of the LM35 goes to pin 3 [non inverting input]

Use a 1.0K in place of the 100K.

Do you follow OK.?
 
hello,
When you read the ADC and multiply by 2 it will always give an even number.
example: 10 * 2 = 20 , 11 * 2 =22

So the LCD will display 20Cdeg 22degC .....

Use a reference voltage of +2.5 when setting for an 8 bit adc conversion.

Please use English.

olá!,
Quando você lê o ADC e o multiplica por 2 dará sempre um número uniforme.
exemplo: 10 * 2 = 20, 11 * 2 =22 Assim o LCD indicará 20Cdeg 22degC .....

Use uma tensão da referência de +2.5 ao ajustar-se para uma conversão de 8 bocados ADC.

Use por favor o inglês.

**broken link removed**
 
Last edited:
Ericgibbs,

First I want to thank them!

The voltage reference you refer to is the LM35? The PIC because I could not change the input of the ADC!

I put a trimpot between 1k to GND and +5 with the 330R resistors on each side and
the output voltage on pin I measured central 2.6 Volts (2.5V with the levels were slightly above normal)
and used this voltage on pin VS + of LM35 and worked perfect!

If you are so right, the problem is solved!

Thank you again and send a big hug to all of Brazil!

Cabral
 
Hi, I'm currently working on a project which required me to compare the temperature of one area with the temperature of the other area.

I started doing this by comparing T1 and T2. If the result of T1 subtract by T2 is equal or greater than 20, then a buzzer will be activated. Below are the PICBasic code:

DEFINE osc 20

Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1

define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50

adct1 var word
temp1 var word
adct2 var word
temp2 var word

TRISA = %11111111
ADCON1 = 0
TRISB = %00000000

Start:

ADCIN 0, adct1
temp1 = (adct1*5)/10
adcin 1, adct2
temp2 = (adct2*5)/10

Lcdout $fe, 1
Lcdout "T1 = ", dec temp1,"deg C"
lcdout $fe, $c0
lcdout "T2 = ", dec temp2,"deg C"

if temp2 - temp1 >= 20 then
sound PORTB.7,[100,10,50,10]
endif

goto start

LCD is able to show the result, but the buzzer is activated all the way no matter the result of T2 minus T1 is equal or greater than 20. I think there is something wrong with my code, but I cant figure it out where is it. Anyone can help?

I am using PIC16F877 and LM35DZ as temperature sensor.

Thanks in advance. :)
 
hi,
Code:
if temp2 - temp1 >= 20 then
sound PORTB.7,[100,10,50,10]
endif

If during sampling and comparing the condition is met, the 'sound' will be set for ever.!

You need to call silence if the condition is not met.
try an 'else' statement
 
Now I tried to start from the beginning by showing the temperature reading of LM35DZ on the LCD. Here's the code:

DEFINE osc 20

Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1

define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50

lmtemp var word
temp var word

TRISA = %11111111
ADCON1 = 0

Start:

ADCIN 0, lmtemp
temp = (lmtemp*5)/10
Lcdout $fe, 1
Lcdout "Temp = ", dec temp,"C"

pause 100

goto start

The results of the LCD is wrong, with the reading of temperature "417C".

The output of LM35DZ is direct input to AN0, when I measured the output voltage of LM35DZ, it is 4.06V. I decided to remove the output of LM35DZ from PIC and measure the output voltage again, which is the correct now, 0.28V (28 deg C).

I was told by my friend that it shouldn't be a problem cos he used that before. But I just recalled that he used reference voltage for that. Is that relation between that? What should I do to get the correct reading?

Thanks ericgibbs for the last reply :)
 
hi,

The results of the LCD is wrong, with the reading of temperature "417C".

The output of LM35DZ is direct input to AN0, when I measured the output voltage of LM35DZ, it is 4.06V. I decided to remove the output of LM35DZ from PIC and measure the output voltage again, which is the correct now, 0.28V (28 deg C).

This suggests that you have got pin AN0 set as an output, check the adc configuration bits.
 
hi,
Which Basic are you using.?

ADCON1 = 0x06
TRISA = 0xcf ''%11111111
TRISE = 0x00
 
Which Basic? PIC Basic PRO I guess.

After that I set ADCON1 = %10000010, I still get the same result, which is wrong. And I just noticed that I dun get the result in decimal point as well.

Hmm... :(
 
Which Basic? PIC Basic PRO I guess.

After that I set ADCON1 = %10000010, I still get the same result, which is wrong. And I just noticed that I dun get the result in decimal point as well.

Hmm... :(

hi,
Your Basic is not compatible with my Basic Sim.:)

I'll try to get a free download of PIC Basic Pro.

As a test, disconnect the LM35 from the PIC adc input and measure the voltage on the adc pins.... I assume that you are not using any pullup resistors, post what you measure.

EDIT:
Please confirm the Basic you are using.
 
Last edited:
Hi,

I got 4.94V when I measured the voltage on the adc pins, all the portA pins are 4.94V. I am using a programmer board where there is a 220 Ohm resistor in each of the I/O pin, is that consider a pullup?

I'm using MicroCode Studio Plus with compiler version PICBASIC PRO 2.47.
 
Hi,

I got 4.94V when I measured the voltage on the adc pins, all the portA pins are 4.94V. I am using a programmer board where there is a 220 Ohm resistor in each of the I/O pin, is that consider a pullup?

I'm using MicroCode Studio Plus with compiler version PICBASIC PRO 2.47.

hi,
Thats a pullup, a 220R will pull the output of the LM35 high.!
Remove that 220R and try again.

For some reason I cannot get the Lite version of PICPRO to compile your program.:confused:

I will look again, but Im 99% sure that the 220R on the adc pin your problem.
 
woo, I've tried to connect the output of LM35 to pin AN0 bypassing the 220 Ohm, I'm still getting the same result. So disappointed as I thought it is easy to use LM35. Anyway, may be I'll build the circuit of PIC on bread board and try again. :(
 
woo, I've tried to connect the output of LM35 to pin AN0 bypassing the 220 Ohm, I'm still getting the same result. So disappointed as I thought it is easy to use LM35. Anyway, may be I'll build the circuit of PIC on bread board and try again. :(

The LM35 is very easy to use, many DIY circuits have been made OK.

Did you re-measure the adc input pin voltage after you had removed the 220R.?

Also check that the LM35 still works OK when not connected to the adc, just in case the 220R voltage has damaged it.
 
Just measured, I got the same results 4.94V on all the adc pins. And the LM35's working fine, showing 0.27V.

Probably I'll build it in bread board and test again.

Thanks for ur patient guidance ericgibbs. Appreciate that. ;)

By the way, do you have any suggestion of ADC's IC if I want to use an ADC module with PIC instead of an PIC with built in ADC. I am doing my final year project which I only use a PIC and few LM35DZ without any circuit. I don't think I can score any mark from here. So I'm thinking of using a PIC with external ADC module and perhaps a keypad to lock/unlock the system.
 
Just measured, I got the same results 4.94V on all the adc pins. And the LM35's working fine, showing 0.27V.

Probably I'll build it in bread board and test again.

Thanks for ur patient guidance ericgibbs. Appreciate that. ;)

By the way, do you have any suggestion of ADC's IC if I want to use an ADC module with PIC instead of an PIC with built in ADC. I am doing my final year project which I only use a PIC and few LM35DZ without any circuit. I don't think I can score any mark from here. So I'm thinking of using a PIC with external ADC module and perhaps a keypad to lock/unlock the system.

hi,
I use the quad MCP3204 12 bit adc ic. [ also a 8 channel ver MCP3208]

Get the datasheet.:)
 
Yes, I got the results desired with a simple PIC circuit on breadboard. As you mentioned, pull-up resistor problem :)

Now I'll proceed to the next step XD

Thanks ericgibbs
 
Good morning,

I was reading about the LM35 and saw that it does not work under the terminal 4V + Vs therefore believe
that the configuration that I mentioned above, putting the LM35 + Vs to 2.5 volts should not be correct!

The friend advised me Ericgibbs: "Use of a reference voltage of +2.5 to adjust itself to a conversion
ADC, 8 bit "

I ask: How? I change the hardware or software? and how to change?

I appreciate any help!

Cabral
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top