Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: LM35CZ reading or calculation errors on: July 07, 2011, 11:11:55 am
thanks for the response,

@john, ive just had a look at the datasheet and your right about the offset. I was working off altered code and didn't double check.

ive attached a picture showing how i have the lm35 setup with my Arduino. As far as i am aware its connected correctly?? I just dont understand the high voltage output?

2  Using Arduino / Sensors / LM35CZ reading or calculation errors on: July 07, 2011, 06:15:06 am
Heya all,

Ive got an Arduion Uno and I've hooked up a LM35CZ +5, GRD, and Analog1.

Below is the code I'm using to produce a Celsius printout to the serial monitor

Code:
int sensorPin = A1;

void setup()
{
  Serial.begin(9600); 
                       
}
 
void loop()                     
{
 
 int reading = analogRead(sensorPin); 
 float voltage = (reading * 5) / 1024.0; //voltage calculation
 float temperatureC = (voltage-0.5) * 100 ;  // temp calculation (-500mV for offset)
 
 Serial.print(voltage); Serial.println(" Volts ");
 Serial.print(temperatureC); Serial.println(" degress C");
 Serial.println();
 
 delay(1000);   
}


This is the serial output

Code:
3.07 Volts
256.64 degrees C

3.07 Volts
256.64 degrees C

3.07 Volts
256.64 degrees C

Also if i put my finger on the sensor to warm it the voltage drops and the temp decreases and the opposite for cold
???

Im rather new to the Arduion and am probably missing something simple, but any guidance would be appreciated
Pages: [1]