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.

LM35 & TL431 as a precision temperature sensor on a PIC

Status
Not open for further replies.

blueroomelectronics

Well-Known Member
I wanted to use a LM34 or LM35 directly connected to an analog input pin on a PIC (a 16F917 if you must know) and use a TL431 (2.5V reference) on VREF+ (RA3)

I'll test it when I get an LM34 on the Firefly but if anyone has any experience they'd like to share or opinions I'd like to hear them.
 
I have used both the LM34 and the LM35. Never used one with an external voltage refrence before. Usually either just hook the device directly to the ADC pin or run it through an opamp to up the voltage sensativity.

good luck,
kingpin094
 
hi bill,
I have used the LM35 and LM135 with a PIC16F877 and a +2.50 Vref device.

Worked ok, its at lowest recommended Vref of +2.5V. You must leave at least 2.5V between the -Vref and +Vref.

As you can see from the LM35 datasheet the Vout/degC is only 10mV/Cdeg.

So over the basic +0C to +100C its only 100*.01= 1V which with a Vref of +5V gives an ADC value of (1/5) *1023 = #205

The Vref +2.5V increases the ADC slope, so you get an ADC value of #410, so the resolution around 0.25Cdeg.

If your required temperature is 0 to 100C, then I have found its better to have a non-invert opa *5,
leave the Vref [internal] at +5v and you get a resolution of around 0.1Cdeg.

The advantage of the LM35 is that is Centigrade and the LM135 is Kelvin.

Hope this is useful.
 
Last edited:
ericgibbs said:
hi bill,
I have used the LM35 and LM135 with a PIC16F877 and a +2.50 Vref device.

Worked ok, its at lowest recommended Vref of +2.5V. You must leave at least 2.5V between the -Vref and +Vref.

As you can see from the LM35 datasheet the Vout/degC is only 10mV/Cdeg.

So over the basic +0C to +100C its only 100*.01= 1V which with a Vref of +5V gives an ADC value of (1/5) *1023 = #205

The Vref +2.5V increases the ADC slope, so you get an ADC value of #410, so the resolution around 0.25Cdeg.

If your required temperature is 0 to 100C, then I have found its better to have a non-invert opa *5,
leave the Vref [internal] at +5v and you get a resolution of around 0.1Cdeg.

The advantage of the LM35 is that is Centigrade and the LM135 is Kelvin.

Hope this is useful.

So far all the suggestions are helpful. It's for a home thermostat so I hope nobody needs 100c. Just an average range that a typical home might see.
 
Have you considered a DS18B20 1-wire sensor? It does the conversion for you and needs no voltage reference. I've noticed spikes with the LM35's, but not with the 1-wire. Here's a graph of my fridge freezer going through it's normal cycles. Sensor D is the 1-wire, the others are LM35's.

**broken link removed**

Mike
 
Last edited:
hi mike,
I have never noticed any 'spikes' when I've been logging temperature using the LM series. Tested them from -50Cdeg thru +150Cdeg.

Is that just one sensor or have you seen it on others, whats the nature of the spike??, is it the LM or the PIC's ADC.
 
02:20:30 is the time when somebody opened and prepared himself/herself an incredible sandwich, isn't it?

I can see it took some time to bring the temperature to normal. Sandwich WAS big :)

Maionaise or mustard?
 
atferrari said:
02:20:30 is the time when somebody opened and prepared himself/herself an incredible sandwich, isn't it?

Actually, that's the normal cycling of the fridge without being opened. The big spike is the defrost cycle. It took me by surprise too when I saw the data. Refrigerators with auto-defrost bring the temperature above freezing and vent the moisture to prevent buildup.

Mike
 
Well for simplicities sake a SPI sensor will most likely be used. The PIC16F917 has a hardware I2C and SPI but they use the same I/O pins as the UART and I need the UART hardware more. SPI is easy to bit bash.
An LM74 (or any of the excellent MAXIM DS16xx chips) looks like the choice.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top