LM35 sensor programming

Hello, I am making a project and using the LM35 temperature sensor, but the sensor does not give me correct values. I tried more than one code and it did not work. I tried to change the sensor and it did not work either. Did I try to use the library, but I do not know what functions are used in the library? Please help.

Post your sketch along with the name of the Arduino that you are using.

Arduino uno

I can't read your picture. Please, write the name of the Arduino and post your codes that yo have tried.

Disconnect everything except the LM35.
Connect as shown in this tutorial.
Use the code in the tutorial

If it still does not work, you may have a bad LM35

You have not posted your code. So I can't be sure if the problem is in your component itself or in your code. There are many other components in your circuit including peltier plate and moisture sensor. I suggest you check the LM35 with a small test code, disconnecting other components from the circuit or using a separate Arduino. Here you will find a test code.

In your referred link's sketch, I see the following lines. My question is why the voltage variable should be multiplied by 100 (to get temperatureC) -- is this 100 a magic number or it has a scientific basis?

 // Convert that reading into voltage
  float voltage = reading * (5.0 / 1024.0);

  // Convert the voltage into the temperature in Celsius
  float temperatureC = voltage * 100;

In your referred link's sketch, does the following line stand corect? If yes, then from where the figure 500 has come?

float TempCel = ( TempValue/1024.0)*500; // Getting the celsius value

Vout = (10mV/ºC) x T

Where Vout is the LM35 output voltage
and T is the temperature in degrees Celsius

So T = Vout/10mV

Mr. Jim-p has already explained the calculation. Hope there is no confusion now.

I am not confused; I have just raised the issue to begin discussion from which some others (particularly the OP) might be benefitted.

Jim-p has given some correct hints; but, he has not shown the number 100. I will complete the rest when I will be responding to his post #9.

The datasheet for the LM35 might help the OP, and others, understand the 100.

I tried it and it did not work. Are there other temperature sensors that can be used? This is the second sensor that I brought and I am facing the same problem.

What are the reading you are getting?

It's hard to tell from your out of focus image but it looks like you have 5V and GND reversed on your LM35.

You follow the tutorial exactly?

Random values and then 0

No connections I'm sure of

Check the connections. Sometimes the breadboard connections are loose an can be intermittent.
There have been reports of fake LM35s being sold.
Where did you but the sensor and how much did you pay?

1.
===> T should be equal to 100*Vout // Vout is in Volt, T is in 0C

(1) From the referred link:

Output scale factor: 10mV/°C
Output at 25°C: 250mV

So,

A(T1, Vout1) = A(25, 0.25)
B(T2, Vout2) = B(40, 0.40)
P(T, Vout) = unkown point
==> (T1 - T2)/(Vout1 - Vout2) = (T1 - T)/(Vout1 - Vout)
==> T = 100 x Vout

2. From your above quote, it also turns out ---

So T = Vout/10mV
==> T = Vout/0.001
==> T = 100*Vout