Hello,
I'm actually in a school project and I have a problem with my temperature sensor (LM35).
I use a bread board to wire my LM35.
The LM35 is wired to the Arduino (5V to the left pin, Analog pin to the mid pin, GND to the right pin).
The goal of my project is to show the temperature on a LCD display to the users.
So I used a power supply to heat the sensor(to see if my program works). The power supply is linked to the left pin of the LM35 sensor.
When i check if the voltage at the left pin of the LM35 sensor, the voltage is accurate, the voltage that i get is the voltage that the supply voltage plus the Arduino offers, till that everything is fine.
Whereas when I check my program the temperature does not change when I do change the voltage in my power supply.
My program:
float temp;
int tempPin = A0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp = analogRead(tempPin);
finaltemp = temp * (Supply voltage * 1000 / 1024) / 10)
/*
We get the actual voltage by doing: Supply voltage / 1024.
We multiply by 1000 to convert Volt to milliVolt.
10 is constant, 10 mV correspond to 1°C
*/
Serial.print("The temperature is ");
Serial.print(finaltemp);
Serial.print("*C.");
Serial.println();
Serial.print("Good road ! ");
Serial.println();
Serial.print("--------------------------");
Serial.println();
delay(10000);
(this is not the complete program, in the latest I've done i get the Supply voltage by measuring the voltage at the left pin of the LM35)
I'd like to know if you've any idea or advice to help me in this problem.
Thanks and sorry for my english