LM35 another topic

Hello,

I played with LM35 5 years ago, without success. Now i have time again, so i bought 30 pieces of this sensor from 3 different places, and my problem is the same as 5 years ago.

The values are fluctating, in that way above (the list is long, buit shows how fluctating).

Is it possible that the more than 50 pcs of this sensors are bad (the new the old, both) ? I tried using arduino uno, nano leonardo, the problem is the same. I read many articles how to use this sensor. So i put resistor

Yes, i know using dallas 18b20 solves this problem, i'm using it, but i want to know what i do wrong.

TEMPRATURE = 13.18C
TEMPRATURE = 10.74
C
TEMPRATURE = 8.30C
TEMPRATURE = 6.84
C
TEMPRATURE = 6.35C
TEMPRATURE = 6.35
C
TEMPRATURE = 6.35C
TEMPRATURE = 6.35
C
TEMPRATURE = 8.30C
TEMPRATURE = 10.74
C
TEMPRATURE = 12.70C
TEMPRATURE = 15.14
C
TEMPRATURE = 17.09C
TEMPRATURE = 19.53
C
TEMPRATURE = 21.97C
TEMPRATURE = 24.90
C
TEMPRATURE = 27.83C
TEMPRATURE = 30.76
C
TEMPRATURE = 32.71C
TEMPRATURE = 33.20
C
TEMPRATURE = 32.23C
TEMPRATURE = 32.23
C
TEMPRATURE = 32.23C
TEMPRATURE = 31.74
C
TEMPRATURE = 31.25C
TEMPRATURE = 29.79
C
TEMPRATURE = 28.81C
TEMPRATURE = 26.86
C
TEMPRATURE = 24.90C
TEMPRATURE = 23.44
C
TEMPRATURE = 21.48C
TEMPRATURE = 19.53
C
TEMPRATURE = 17.09C
TEMPRATURE = 15.63
C
TEMPRATURE = 13.18C
TEMPRATURE = 11.23
C
TEMPRATURE = 10.25C
TEMPRATURE = 9.28
C
TEMPRATURE = 8.79C
TEMPRATURE = 8.79
C
TEMPRATURE = 9.28C
TEMPRATURE = 9.28
C
TEMPRATURE = 9.77C
TEMPRATURE = 11.23
C
TEMPRATURE = 13.67C
TEMPRATURE = 15.14
C
TEMPRATURE = 16.60C
TEMPRATURE = 17.58
C
TEMPRATURE = 18.55C
TEMPRATURE = 21.48
C
TEMPRATURE = 22.95C
TEMPRATURE = 21.00
C
TEMPRATURE = 21.97C
TEMPRATURE = 26.37
C
TEMPRATURE = 24.90C
TEMPRATURE = 23.44
C
TEMPRATURE = 25.39C
TEMPRATURE = 27.34
C
TEMPRATURE = 30.27C
TEMPRATURE = 27.83
C
TEMPRATURE = 29.79C
TEMPRATURE = 30.27
C

Welcome to the forum.

Could you show a schematic, the sketch and perhaps a photo ?
If you changed the Arduino board and the LM35, did you also change the breadboard, the wires and the USB cable ?

It is a analog sensor with a voltage output.
The Arduino measures a voltage relative to the 5V. That 5V fluctuates when the Arduino board is powered with 5V from a USB cable. You can set the reference to the internal 1.1V, but that is not enough range for the LM35.

Adafruit uses the 3.3V output as a reference. If you follow this tutorial you get there in the third page or so: https://learn.adafruit.com/tmp36-temperature-sensor

The LM35 needs at least 4V, so you can power it with 5V, but still connect 3.3V to AREF.

By the way, if you bought 30 pieces in the same order from AliExpress/Ebay/Amazon, then they could be counterfeit or they might be from a batch that was rejected by the manufacturer, or something else could be wrong with them.

1 Like

Fine if you don't have to measure more than about 110 degrees C.
The LM35 outputs 1volt at 100C.
You might have to use 3.3volt Aref if you use a TMP36,
because that one only has a top range of 55C on 1.1volt Aref.

Default Aref (potentially unstable 5volt supply) is a poor choice for the LM35.
1.1volt Aref is the way to go,
but don't expect a higher resolution than one decimal place with a 10-bit A/D.

is 2734 A/D steps. 100.00 degrees C would be 10000 steps.
10x the capability of a 10-bit common Arduino.
Leo..

1 Like

Assuming you use the 5v power as a reference, your data would be something like the below.

The readings do not act like one would expect from noise. Variations are more than you would expect for a drifting 5V power supply.

You should post your code and photo / description of the connections, but it certainly seems to point to bad sensors.

Often counterfeit devices can be recognized as such by looking at the details of the markings.

Basic Uno test sketch for the LM35.
Do not share LM35 ground with other devices (direct ground, not via breadboard).
Leo..

// connect LM35 to 5volt A0 and ground
// calibrate temp by changing the last digit(s) of "0.1039"

const byte tempPin = A0;
float calibration = 0.1039;
float tempC; // Celcius
float tempF; // Fahrenheit

void setup() {
  Serial.begin(9600);
  analogReference(INTERNAL); // use internal 1.1volt Aref
  // change INTERNAL to INTERNAL1V1 for a Mega
}

void loop() {
  tempC = analogRead(tempPin) * calibration; // get temp

  tempF = tempC * 1.8 + 32.0; // C to F
  Serial.print("Temperature is  ");
  Serial.print(tempC, 1); // one decimal place resolution is all you get
  Serial.print(" Celcius  ");
  Serial.print(tempF, 1);
  Serial.println(" Fahrenheit");

  delay(1000); // use a non-blocking delay when combined with other code
}

The circuit is the simplest what i've seen on websites.
Output is on an analogue pin, 5v and gnd.

Using a multiemter i cant test the sensors, because the values depends on my distance from the cables..

Hi, @ant7517
Welcome to the forum.

It will show you how to post your code.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Finally.. It looks like all of them counterfeit, doesnt matter if its 5 years old and new.
I disassembled my sons slightly burnt skyrc charger, and inside found an lm35 which worked well.

So it looks like all of them were wrong.

I agree with you if you do the following final test with few of the supposed to be bad LM35s.

Solder nicely (no cold solder or solder bridge) three wires with the three legs of a suspected LM35 sensor. Solder other ends of the three wires with 5V (Pin-1), A0 (Pin-2), and GND (Pin-3). Now, report that the temperature readings are still fluctuating. (Breadboard testing of the LM35 is a bad experience.)

Well, i did this test..

The values become different, but it doesnt seem to following the temperature..
(without touching the sensor it starts 27c, (21 in this room but ok, i can correct it via software) if i touch the top of sensor the value goes down to 23C after release slowly goes up to 33-34, if i heat up with a hair dryer is goes down to 24, so nowhere near to the real values.

If this is the case, and the LM35 works in the same circuit, this means likely you have another component marked as an LM35. I would guess a MosFet as it would appear to be an open circuit.

You have your solution so additional testing does not matter, however it would be interesting to see if you measurement go to zero if you put a 10k from the signal pin to ground.

yes, 10K resistor between gnd and signal, the measured value is 0.

There you go..... you were basically measuring an open circuit :frowning:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.