# LM35 - reading garbage.

**URL:** <https://forum.arduino.cc/t/lm35-reading-garbage/457012>\
**Category:** Sensors\
**Created:** [May 6, 2017, 5:16pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012 "2017-05-06T17:16:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 6, 2017, 5:16pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/1 "2017-05-06T17:16:27Z")

</div>

Hi,  
I'm trying to get ambient temperature from LM35 with DUE but instead of some real temperatures I'm just reading some random values/noise. First, if you want to tell me to use google, do not do it, I tryed every available relevant tutorial and forum post. Nothing helped.  
I connected 5 of them, to pins A0-A4 and read directly the values with analogRead() and average of 10  
readings were:

```cpp
A0: 452, A1: 776, A2: 871, A3: 511, A4: 421

```

converted with formula:

```cpp
temp = (analogRead(pin) / 1024.0) * 3.3 * 100

```

and resulting temperatures were something between 135 to 280 °C ... that cannot be right.  
It's connected in same way as in this schema [https://fredim.files.wordpress.com/2012/06/fetch-php.gif](https://fredim.files.wordpress.com/2012/06/fetch-php.gif)  
Arduino is powered via USB.

Is there someging I'm doing wrong. Only possible scenarios that I can come up with are that all 5 sensors are broken or my DUE is broken.

Thanks for any advice.  
//Heretiiik

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [May 6, 2017, 6:59pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/2 "2017-05-06T18:59:20Z")

</div>

Did you connect all the grounds together?

---

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 6, 2017, 7:17pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/3 "2017-05-06T19:17:38Z")

</div>

> jremington:  
> Did you connect all the grounds together?

I made a sketch decribing how I did it.

 ![Untitled Sketch_bb.png](https://europe1.discourse-cdn.com/arduino/original/4X/1/7/2/1724c6d2d970450a6d2bc5ff831351bf151a121a.png)

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 6, 2017, 8:55pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/4 "2017-05-06T20:55:46Z")

</div>

That is a Fritzing picture. Frequently proven useless in fault finding.

It seems ground is missing. Check the wiring.  
Maybe you use a long breadboard with split power rails.  
Upload a real picture.  
Leo..

---

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 6, 2017, 9:51pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/5 "2017-05-06T21:51:57Z")

</div>

> Wawa:  
> That is a Fritzing picture. Frequently proven useless in fault finding.
> 
> It seems ground is missing. Check the wiring.  
> Maybe you use a long breadboard with split power rails.  
> Upload a real picture.  
> Leo..

It obviously is. I was too lazy to assemble it again.Below this is a link to folder with some photos, there are only wired 2 of them, the rest wuld be in same manner. Still wired the same way as in Fritzing image.  
[https://drive.google.com/drive/folders/0B-G3LYBbbOSaSHpjYjBBTnlGb3c?usp=sharing](https://drive.google.com/drive/folders/0B-G3LYBbbOSaSHpjYjBBTnlGb3c?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 6, 2017, 10:16pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/6 "2017-05-06T22:16:36Z")

</div>

Wiring seems ok.  
There have been reports of fake LM35.

You could try some decoupling of the supply on the breadboard.  
Or dump the LM35 and go for a string of DS18B20 sensors.  
A whole bunch uses only one pin.  
Leo..

---

<div class="post-metadata">

**Author:** ![756E6C](https://avatars.discourse-cdn.com/v4/letter/7/f08c70/32.png) [@756E6C](https://forum.arduino.cc/u/756E6C)\
**Post date:** [May 6, 2017, 10:53pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/7 "2017-05-06T22:53:35Z")

</div>

In that Fritz picture, did you have the flat side of the LM35s facing the top?  
At room temp (22C) you shoud see ADC numbers around 67, 68, 69.

---

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 7, 2017, 7:51am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/8 "2017-05-07T07:51:16Z")

</div>

> Wawa:  
> Wiring seems ok.  
> There have been reports of fake LM35.
> 
> You could try some decoupling of the supply on the breadboard.  
> Or dump the LM35 and go for a string of DS18B20 sensors.  
> A whole bunch uses only one pin.  
> Leo..

Well, great then.  
As of DS18B20 I heard that it takes about 0.7s to read temperature. That's 2.1s for minimum of 3 sensors I need.Is there a way how to reduce it?

> 756E6C:  
> In that Fritz picture, did you have the flat side of the LM35s facing the top?  
> At room temp (22C) you shoud see ADC numbers around 67, 68, 69.

That Fritz picture is just a illustration, see my reply above for photos of the actual circuit.  
Instead of 68+- I got numbers in range from 400 to 900 as I said in initial post.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 7, 2017, 10:18am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/9 "2017-05-07T10:18:52Z")

</div>

> Heretiiik:  
> I got numbers in range from 400 to 900 as I said in initial post.

I would measure voltage on the analogue pin with a DMM while you have this reading.  
Those numbers indicate several volt is present on the analogue pin.  
It should be about 0.25volt if the sensor is at room temp.  
Maybe the ground wire to the breadboard is open circuit.  
Leo..

---

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 7, 2017, 12:23pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/10 "2017-05-07T12:23:01Z")

</div>

> Wawa:  
> I would measure voltage on the analogue pin with a DMM while you have this reading.  
> Those numbers indicate several volt is present on the analogue pin.  
> It should be about 0.25volt if the sensor is at room temp.  
> Maybe the ground wire to the breadboard is open circuit.  
> Leo..

On all analogue pins theres 1.26V, wethers its connected to output pin of lm35 or not. I checked all 5 LM35s and voltage between Vin and ground pins was 4.9V, output pin measured gave 0V. Well I guess I'll have to buy something else to measure the temperatue.

---

<div class="post-metadata">

**Author:** ![Merv](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Merv](https://forum.arduino.cc/u/Merv)\
**Post date:** [May 7, 2017, 2:53pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/11 "2017-05-07T14:53:37Z")

</div>

You're not following the manufacturer's recommendations for one thing re: twisted pair supply to the device, along with Star grounding with all the grounds and/or you have not provided any shielding of the signal lines plus their is no buffering of the signal being fed directly into a noisy digital environment.

Correct those problems and it should work fine. BTW the buffer should be a ultra low noise, low Vos , rail to rail amp.

LM35 datasheet: [http://www.ti.com/lit/ds/symlink/lm35.pdf](http://www.ti.com/lit/ds/symlink/lm35.pdf)

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 7, 2017, 9:30pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/12 "2017-05-07T21:30:21Z")

</div>

> Heretiiik:  
> On all analogue pins theres 1.26V, wethers its connected to output pin of lm35 or not.

That's not right. You might have damaged your analogue inputs.  
AFAIK the Due is a 3.3volt processor, and analogue inputs are not 5volt tolerant.  
Just measured the Uno analogue inputs with a (10Megohm) DMM, and they were \<0.07 volt.

> Heretiiik:  
> I checked all 5 LM35s and voltage between Vin and ground pins was 4.9V, output pin measured gave 0V.

Did you use Due ground or breadboard ground for these measurements.  
You should ofcourse use Due ground.

Did you already look at/replace that ground wire I mentioned twice before.

I doubt the things that Merv suggested are needed for 20cm breadboard wiring.  
Leo..

---

<div class="post-metadata">

**Author:** ![Merv](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Merv](https://forum.arduino.cc/u/Merv)\
**Post date:** [May 7, 2017, 11:08pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/13 "2017-05-07T23:08:50Z")

</div>

> Wawa:  
> I doubt the things that Merv suggested are needed for 20cm breadboard wiring.  
> Leo..

One should disregard a manufacturer's recommendations only when one might possess superior knowledge of the creators/designers/developers of the device. Further, buffering of low level instrumentation signals is a proven and standard practice for preservation of the signal's coherence. But what do I know after 52 years of experience.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 7, 2017, 11:36pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/14 "2017-05-07T23:36:58Z")

</div>

> Merv:  
> But what do I know after 52 years of experience.

About the same here.  
Leo..

---

<div class="post-metadata">

**Author:** ![756E6C](https://avatars.discourse-cdn.com/v4/letter/7/f08c70/32.png) [@756E6C](https://forum.arduino.cc/u/756E6C)\
**Post date:** [May 8, 2017, 12:16am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/15 "2017-05-08T00:16:07Z")

</div>

Where do you have the NEG (-, black) probe of your DMM connected?

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [May 8, 2017, 12:30am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/16 "2017-05-08T00:30:23Z")

</div>

> One should disregard a manufacturer's recommendations only when one might possess superior knowledge of the creators/designers/developers of the device.

That would depend on the context of the manufacturer's recommendations, which in this case are intended for sensors operating in a noisy (e.g. industrial) environment.

---

<div class="post-metadata">

**Author:** ![Heretiiik](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/heretiiik/32/1172722_2.png) [@Heretiiik](https://forum.arduino.cc/u/Heretiiik)\
**Post date:** [May 8, 2017, 8:59am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/17 "2017-05-08T08:59:42Z")

</div>

> Wawa:  
> That's not right. You might have damaged your analogue inputs.  
> AFAIK the Due is a 3.3volt processor, and analogue inputs are not 5volt tolerant.  
> Just measured the Uno analogue inputs with a (10Megohm) DMM, and they were \<0.07 volt.  
> Did you use Due ground or breadboard ground for these measurements.  
> You should ofcourse use Due ground.
> 
> Did you already look at/replace that ground wire I mentioned twice before.
> 
> I doubt the things that Merv suggested are needed for 20cm breadboard wiring.  
> Leo..

I used Due ground. I changed wires and breadboard several times. I guess I'll try to come up with workarout without using analog pins. The rest seems to work fine.

---

<div class="post-metadata">

**Author:** ![Merv](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@Merv](https://forum.arduino.cc/u/Merv)\
**Post date:** [May 8, 2017, 5:12pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/18 "2017-05-08T17:12:44Z")

</div>

> jremington:  
> That would depend on the context of the manufacturer's recommendations, which in this case are intended for sensors operating in a noisy (e.g. industrial) environment.

No! It depends on what is _actually contained_ in the datasheet included by the manufacturer, which they place there to inform their customers, cover their legal liabilities and protect their reputation to keep the stockholders happy.

The total discussion in the datasheet I cited re: 'noisy environments' was this on page 19:

> In noisy environments, TI recommends adding a 0.1 μF from V+ to GND to bypass the power  
> supply voltage. Larger capacitances maybe required and are dependent on the power-supply noise.

That is TI's recommendation regarding environmental noise. Of course, that presupposes proper attention is given to **ALL** layout considerations including interconnectivity, which IS DISPLAYED on page 16 showing the Star connections, twisted pair power leads and the shielding where needed dependent upon configuration, to which I noted initially!

If one consults their Analog Engineer's Handbook regarding buffering low level instrumentation signals, one can see that signal conditioning is an efficacious practice as I mentioned originally, also.

I doubt I'll be bothering to TRY to help others on this site again given the "welcome" I've received from some of the more senior members.

Have a good day!

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [May 8, 2017, 9:47pm UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/19 "2017-05-08T21:47:38Z")

</div>

@Merv

> Wawa:  
> I doubt the things that Merv suggested are needed for 20cm breadboard wiring.

I think you're referring to this quote. Sorry to hear it annoyed you.  
I still stand by it though, because most problems here result from people not connecting things properly, or using parts from shady sources (rejected/fake).  
We don't know the true experience and skills of a poster untill 100 posts or so. You only had 5.  
Stick with it, and you will find this a great place.  
Leo..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 10:17am UTC](https://forum.arduino.cc/t/lm35-reading-garbage/457012/20 "2021-05-06T10:17:30Z")

</div>

Closed on May 6, 2021, 10:17am UTC


