LM35: resistance is futile - Page 1
Forum section: electronics / beginners

author: PerranOak
author_rank: Frequent Contributor
timestamp: November 02, 2018, 03:52:36 pm
content: 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.

author: JackJones
author_rank: Regular Contributor
timestamp: November 02, 2018, 04:10:41 pm
content: 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.pdfEdit: 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.

author: spec
author_rank: Frequent Contributor
timestamp: November 02, 2018, 05:14:34 pm
content: Quote from: PerranOak on November 02, 2018, 03:52:36 pm+ PerranOakThe 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 a1uf100nF (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.pdfThe thing to remember is that you are dealing with small millivolt signals.

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: November 02, 2018, 05:25:47 pm
content: This simple sensor is also part of Nokia 3310 cell phone .: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[ 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.

author: brybot
author_rank: Contributor
timestamp: November 02, 2018, 05:33:00 pm
content: 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!

author: t1d
author_rank: Super Contributor
timestamp: November 02, 2018, 05:47:20 pm
content: For additional study, regarding interfacing MCUs, look up "Pull Up" and "Pull Down" resistors.

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: November 02, 2018, 06:13:33 pm
content: Quote from: malagas_on_fire on November 02, 2018, 05:25:47 pmAnd 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.

author: PerranOak
author_rank: Frequent Contributor
timestamp: November 05, 2018, 03:41:38 pm
content: 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.htmlCheers 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.

author: JackJones
author_rank: Regular Contributor
timestamp: November 05, 2018, 03:57:52 pm
content: 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.

author: spec
author_rank: Frequent Contributor
timestamp: November 05, 2018, 05:44:42 pm
content: Quote from: PerranOak on November 05, 2018, 03:41:38 pmESR 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.

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: November 05, 2018, 09:54:31 pm
content: 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.

author: PerranOak
author_rank: Frequent Contributor
timestamp: November 07, 2018, 03:50:41 pm
content: Cheers spec.So I could use a 100nF X7R both on the LM35 and to decouple the microcontroller itself?

author: malagas_on_fire
author_rank: Frequent Contributor
timestamp: November 07, 2018, 05:31:44 pm
content: 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

author: spec
author_rank: Frequent Contributor
timestamp: November 12, 2018, 04:36:03 pm
content: Quote from: PerranOak on November 07, 2018, 03:50:41 pmNo probsYes, 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

author: PerranOak
author_rank: Frequent Contributor
timestamp: November 12, 2018, 06:24:20 pm
content: Cheers mate.I shall sprinkle some on my toast!