I have had a problem with the LM35 sensor on Arduino. The temperature marked 30°, then 29° and went down until it reached 0° then went up and down.
Somehow now it remains stable at 24 and 25 degrees Celsius, however when applying heat with a lighter, the temperature instead of rising begins to drop rapidly.
I bought three LM35 sensors and exactly the same thing happens with all of them (it should be noted that each one cost me $35 Mexican pesos or $1.25 dollars).
I've tried a lot of code but the same thing happens in all of them. I currently use the following code:
const int sensorPin= A0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int value = analogRead(sensorPin);
float millivolts = (value / 1023.0) * 5000;
float celsius = millivolts / 10;
Serial.print(celsius);
Serial.println(" C");
delay(1000);
}
And the circuit as I have it connected is as follows:
And these are the values as they are found and then how it begins to drop when applying heat.
Fixed!
I bought another LM35 and it fixed the problem as the circuit, connections and code was fine.
So the conclusion is that he had previously bought defective devices.