A
A
Atype2018-09-17 15:12:08
Arduino
Atype, 2018-09-17 15:12:08

Why does the LM35 temperature sensor show wavy values?

The LM35 sensor gives strange values ​​that go up and down, like this:

Sensor output

0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
1.47
7.82
13.20
22.48
28.35
33.24
34.21
34.70
33.24
33.72
33.24
32.75
32.75
31.28
30.30
28.84
28.84
25.90
23.95
19.06
14.17
7.33
0.00
0.00
0.00
0.00
0.00

output cyclic
Program code:
int temp; // освобождаем память для переменной "temp"
float grad; // освобождаем память для переменной "grad"

void setup() // процедура setup
{
  pinMode(A0, INPUT); // сенсор LM35 подключим к аналоговому входу A0
  Serial.begin(9600); // подключаем монитор порта
}

void loop() // процедура loop
{
  temp = analogRead(A0); // переменная находится в интервале 0 - 1023
  //Serial.println(temp);
  grad = ( temp/1023.0 )*5.0*1000/10; // формулу можно изменять
  Serial.println(grad); // выводим значение температуры на монитор
  delay(100); // ставим небольшую задержку
}

Everything is connected correctly
The sensor itself from the Arduino kit ordered on Ali
What could be the matter?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Radjah, 2018-09-17
@Radjah

First, try lowering the polling rate to reduce the error from sensor heating.
Well, you need to order several at once in order to reduce the serviceability error from Chinese sensors. :-)

K
ks0, 2018-09-17
@ks0

Maybe the wire is long and pickups go? It would be possible to pull it through a resistor to the ground.

L
lonelymyp, 2018-09-19
@lonelymyp

What is strange about them? sort of like a simple heating from 0 to 34 and then cooling.
If you mean drift by tenths of a degree, this is also normal for arduinos and such sensors.

L
LampTester, 2018-09-27
@LampTester

This is not 50 Hz interference, by any chance? Schedule to build to check, too lazy. :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question