I have a question regarding the LM35. The sensor is supposed to have values that are to be directly proportional. But instead of the temperature increasing, the sensor values decrease.
This is my setup below. It seems to be a standard setup in different LM35 tutorial pages.
const int sensor= A0; // Assigning analog pin A0 to variable 'sensor'
void setup() {
pinMode(sensor,INPUT); // Configuring sensor pin as input
Serial.begin(9600);
}
void loop() {
float reading=analogRead(sensor); //Reading the value from sensor
float vout= (reading*5000)/1024;
float temp= vout/10;
Serial.print("in DegreeC= ");
Serial.print(temp);
Serial.println("");
delay(500); //Delay of 1 second for ease of viewing
}
These are the results. From room temperature, I applied heat through the use of a lighter and it went lower instead of higher.
I read somewhere that it has something to do with the power supplied by the Arduino. However, when I used a 12V supply to power the Arduino, the readings became very erratic and unstable.
UPDATE:
I have finally returned from the city (Took a long time because of Quarantine Restrictions) and I brought 3 LM35 from another shop. All 3 of the new LM35 worked as intended and didn't lower its temp reading when exposed to heat (With the same configuration). I could rule out these possibilities as to the reason why the LM35 didn't work.
1. Manufacturing Defect - all three of the LM35 didn't work as intended. They all had their temperature lowered when exposed to heat. There could be a defect in the manufacturing process because it doesn't work as advertised. (Leaning towards this)
2. Static Electricity - I remember receiving the LM35 in a plastic bag as packaged by the shop. It could have been affected by static electricity and damaged the circuit inside (on all three though?). The LM35s I received recently had been packaged in those electrostatic discharge protection packaging so it could have probably contributed to it? I need more insight on this I apologize for not being able to properly word it out.
There could be more but these are the most I could come up with as a conclusion.
pinMode
however still the same output. The temperature always scales down when exposed to heat (even with my 3 other spare LM35 but they are from the same shop tho). I will go and buy a capacitor tomorrow to do more testing on the sensor.