Author Topic: LM35: resistance is futile  (Read 3094 times)

0 Members and 1 Guest are viewing this topic.

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 552
  • Country: gb
LM35: resistance is futile
« on: November 02, 2018, 03:52:36 pm »
In my LM35 temp sensor project I have the LM35 connected to the input of a PIC16F1829. It seems to work ok-ish.

However, I notice that some schematics with the LM35 have a 1k resistor between the LM35 and the PIC input or a 1k resistor grounding the LM35 output with the PIC input between the resistor and the LM35.

Both these variations seem to make the measurement, slightly, more accurate but I cannot figure out why!

Can anyone help please?

Cheers.
You can release yourself but the only way to go is down!
RJD
 

Offline JackJones

  • Regular Contributor
  • *
  • Posts: 229
  • Country: fi
Re: LM35: resistance is futile
« Reply #1 on: November 02, 2018, 04:10:41 pm »
It could be connected to a negative supply, allowing it to measure negative temperatures. Or if it's just to ground, it's possibly for capacitive loads or noise decoupling. There is a section about this in the datasheet on page 14: http://www.ti.com/lit/ds/symlink/lm35.pdf

Edit: Could you give a link to an example of a schematic like you described? I tried looking for one but couldn't quite find one like you described.
« Last Edit: November 02, 2018, 04:19:44 pm by JackJones »
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: LM35: resistance is futile
« Reply #2 on: November 02, 2018, 05:14:34 pm »
In my LM35 temp sensor project I have the LM35 connected to the input of a PIC16F1829. It seems to work ok-ish.

However, I notice that some schematics with the LM35 have a 1k resistor between the LM35 and the PIC input or a 1k resistor grounding the LM35 output with the PIC input between the resistor and the LM35.

Both these variations seem to make the measurement, slightly, more accurate but I cannot figure out why!


+ PerranOak

The LM35 is an accurate but very low power device. And, as a result, it is a bit fussy about what it is connected to. To keep the LM35 happy you need to connect it to low noise power lines and connect a 1uf 100nF (correction) or larger low ESR capacitor directly across the LM35 supply and 0V pins pins. Also, the LM35 cannot tolerate much capacitance on it's output. So best to connect a resistor, with short leads directly to the LM35 output pin. You can then connect the free end of the resistor to your MCU. This is most likely the resistor that you have seen on other circuits.

You should also ensure that the LM35 is not exposed to any magnetic fields. In addition, the LM35 should be shielded from heat, cold or draughts: apart from the temperature you are measuring, of course. :)

There is a pretty good write-up in the TI application report: http://www.ti.com/lit/ds/symlink/lm35.pdf

The thing to remember is that you are dealing with small millivolt signals. :)
« Last Edit: November 05, 2018, 05:57:03 pm by spec »
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: LM35: resistance is futile
« Reply #3 on: November 02, 2018, 05:25:47 pm »
This simple sensor is also part of Nokia 3310 cell phone .: :-DD

https://malagas.wordpress.com/2011/06/03/pic18f2520-lcd-nokia/


it is now using another microcontroller (PIC18F1320) and it is inside the nokia 3310 case :P

[ Edit] Old pictures of make up and final layout. I believe i put a zener diode between the power lines for the LM35D to stabilize it amd prevent spikes.
« Last Edit: November 02, 2018, 05:54:34 pm by malagas_on_fire »
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline brybot

  • Contributor
  • Posts: 20
  • Country: us
Re: LM35: resistance is futile
« Reply #4 on: November 02, 2018, 05:33:00 pm »
Adding to spec's commentary, your ADC is essentially a capacitive load, albeit small. It may be causing some instabilities that are dampened with the extra resistor.

As an experiement, you could try adding an op-amp buffer to the output to see if that stabilizes your readings. Depending on your application, you could even use the op-amp to increase your ADC resolution.

Looking forward to seeing your circuit!
 

Offline t1d

  • Super Contributor
  • ***
  • Posts: 1255
  • Country: us
Re: LM35: resistance is futile
« Reply #5 on: November 02, 2018, 05:47:20 pm »
For additional study, regarding interfacing MCUs, look up "Pull Up" and "Pull Down" resistors.
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: LM35: resistance is futile
« Reply #6 on: November 02, 2018, 06:13:33 pm »
This simple sensor is also part of Nokia 3310 cell phone .: :-DD

https://malagas.wordpress.com/2011/06/03/pic18f2520-lcd-nokia/


it is now using another microcontroller (PIC18F1320) and it is inside the nokia 3310 case :P

[ Edit] Old pictures of make up and final layout. I believe i put a zener diode between the power lines for the LM35D to stabilize it amd prevent spikes.

And fresh pictures of actual status. It still works on an original 5V charger.

[Edit ] The PIC used was a PIC18F2520 and it was ported from the original code which used a PIC18F1320, in order to have SPI or I2C to communicate with RTC. Its been a while.. sorry.
« Last Edit: November 02, 2018, 09:12:18 pm by malagas_on_fire »
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 552
  • Country: gb
Re: LM35: resistance is futile
« Reply #7 on: November 05, 2018, 03:41:38 pm »
Thanks JackJones it is to ground. Yes, I see what you mean about p14 – I had skipped that as I thought it refered only to using it at the end of a long cable. I fitst saw the resistor at:

https://www.best-microcontroller-projects.com/eeprom.html

Cheers spec. By "low ESR" cap what do you mean exactly? What would a low ESR be considered to be? Is there a particular type of cap that typically gives a low ESR or is it a case of parameter searching with a supplier?

malagas_on_fire interesting appication!

brybot thank you for that, I do like to experiment. If I can get my finger out I should be able to knock-up a schematic soonest!

t1d ah I though these were just for switches and the like, thanks.
You can release yourself but the only way to go is down!
RJD
 

Offline JackJones

  • Regular Contributor
  • *
  • Posts: 229
  • Country: fi
Re: LM35: resistance is futile
« Reply #8 on: November 05, 2018, 03:57:52 pm »
Looks like the resistor in your example is just a current limiting resistor to protect the input. The input also shares a pin with one of the programming pins, so it also offers some buffering/isolation between the programming pins and the sensor.

I'm not sure what value is considered low ESR, never really thought about it, but ceramic caps are a good example of those.
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: LM35: resistance is futile
« Reply #9 on: November 05, 2018, 05:44:42 pm »

By "low ESR" cap what do you mean exactly? What would a low ESR be considered to be? Is there a particular type of cap that typically gives a low ESR or is it a case of parameter searching with a supplier?

ESR stands for Equivalent Series Resistance, in case you didn't know. Low ESR capacitors are good for high frequency decoupling and other high frequency applications. There are two common types of low ESR capacitors that are practical: ceramic X7R dielectric and polypropylene dielectric.

100nF ceramic X7R is commonly used for decoupling digital circuits, but they can be used for analogue circuits provided they are not for low distortion applications, like HiFi. Ceramic would be fine for your temperature sensor application (corrected my original post: 100nF will be sufficient).

Polypropylene are the dog's nuts, but they have always been relatively large and expensive compared to ceramic. Although, there are some reasonably priced, compact polypropylene capacitors available now.
« Last Edit: November 05, 2018, 05:58:39 pm by spec »
 
The following users thanked this post: PerranOak

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: LM35: resistance is futile
« Reply #10 on: November 05, 2018, 09:54:31 pm »
Hi i'm here to correct my previous assumption of my invention about the zener diode which is in fact a regular 1n4148 diode to protect the sensor from back EMF .

Follow the recomendation about the capacitor which is also present in my sensor. I'll add a humidity sensor later.
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 552
  • Country: gb
Re: LM35: resistance is futile
« Reply #11 on: November 07, 2018, 03:50:41 pm »
Cheers spec.

So I could use a 100nF X7R both on the LM35 and to decouple the microcontroller itself?
You can release yourself but the only way to go is down!
RJD
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: LM35: resistance is futile
« Reply #12 on: November 07, 2018, 05:31:44 pm »
Yeah two near the power rails on the uC and the lm35 . If you have some random readings or glitches put the addional diode 1n4148 in reverse between positve and negative rails in between uC and lm35, near to the lm35
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: LM35: resistance is futile
« Reply #13 on: November 12, 2018, 04:36:03 pm »
Cheers spec.

So I could use a 100nF X7R both on the LM35 and to decouple the microcontroller itself?
No probs :)

Yes, 100nf X7R is the 'standard' decoupling capacitor, but as David Hess pointed out, some three-terminal voltage regulators tend to be unstable with low ESR capacitors on their outputs, the LM337 for example.

But, if you want the real deal go for polypropylene (PP).  They used to be large and hellish expensive but with the latest technology they are quite small and reasonably priced. For analogue circuits, apart from really cost sensitive applications, I  tend to specify PP now: lower noise, lower distortion, no aging to speak of, stable capacitance with  changes in DC voltage and temperature...

I have a couple with cornflakes and milk every morning for breakfast ;D
« Last Edit: November 12, 2018, 08:02:56 pm by spec »
 
The following users thanked this post: PerranOak

Offline PerranOakTopic starter

  • Frequent Contributor
  • **
  • Posts: 552
  • Country: gb
Re: LM35: resistance is futile
« Reply #14 on: November 12, 2018, 06:24:20 pm »
Cheers mate.

I shall sprinkle some on my toast!
You can release yourself but the only way to go is down!
RJD
 

Offline spec

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: england
  • MALE
Re: LM35: resistance is futile
« Reply #15 on: November 12, 2018, 08:01:08 pm »
 ;D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf