Go Down

Topic: Is my brain or my TMP36 broken? (Read 2063 times) previous topic - next topic


So I hook up my TMP36 sensor tonight and run the example code.
I am using the 5v and analog 0

703 - analog
3.43 - voltage output
293 - converted to degrees C

when I heat the sensor with my fingers, the temperature drops...

Code: [Select]

int temperaturePin = 0;
void setup()
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor
                       //last button beneath the file bar (looks like a box with an antenae)

void loop()                     // run over and over again
float temperature = getVoltage(temperaturePin);
Serial.println(temperature);             //getting the voltage reading from the temperature sensor
temperature = (temperature - 0.50) * 100.0;          //converting from 10 mv per degree wit 500 mV offset                                                 //to degrees ((volatge - 500mV) times 100)
Serial.println(temperature);                     //printing the result
delay(1000);                                     //waiting a second


* getVoltage() - returns the voltage on the analog input defined by
* pin
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1024 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts


That output voltage looks out of spec - check how you've wired up the sensor.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


293 seems awfully close to room temperature in kelvin scale. Just that if you don't recall from physics class, 293K=20DegC=room temperature. Are you sure the sensor is report DegC or K?
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


This should work:
Code: [Select]
float tempvoltage = analogRead(tempsensorpin) * 5.0;
  tempvoltage /= 1024.0;
  float temp = (tempvoltage - 0.5) * 100;

As long as you have a 5v arduino!

if you are still getting readings of 293+, then have a close look at your sensor, you probably have an LM335 instead of a 36GZ...  In that case, simply add the line:
Code: [Select]
temp = temp - 273.15
to the end of the above.

I happen to have both of these sensors in front of me


Wait a second, you should never see 700+ on the analog input from this sensor.  It should be down around .73- about 1.76 v If I am not mistaken- So 1.76/5 = .352 = only 360 on the scale... and that would only be if it was around 125 C in your workspace!

Check your connections-

Also, are you using a 3.3v arduino? because all of this would make sense then.


I've try some sketches to work with LM35DZ, and I found this one works okay http://www.danielandrade.net/2008/07/05/temperature-sensor-arduino/ .

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131