Pages: [1]   Go Down
Author Topic: TMP36 Reading Very Low  (Read 894 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Uno keeps returning the following:

Temp reading = 147 - 0.47 volts
-2.63 degress C
27.27 degress F

This is in my house at about 70F.

Here is my code:
//TMP36 Pin Variables
int tempPin = A0;        //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures
int tempReading;        // the analog reading from the sensor
   
void setup(void) {
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);   

  // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);
}


void loop(void) {
 
  tempReading = analogRead(tempPin); 
 
  Serial.print("Temp reading = ");
  Serial.print(tempReading);     // the raw analog reading
 
  // converting that reading to voltage, which is based off the reference voltage
  float voltage = tempReading * aref_voltage / 1024;
 
  // print out the voltage
  Serial.print(" - ");
  Serial.print(voltage); Serial.println(" volts");
 
  // now print out the temperature
  float temperatureC = (voltage - .5 ) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
  Serial.print(temperatureC); Serial.println(" degress C");
 
  // now convert to Fahrenheight
  float temperatureF = (temperatureC * 9 / 5) + 32;
  Serial.print(temperatureF); Serial.println(" degress F");
 
  delay(1000);
}

My setup is identical to this:
http://www.ladyada.net/wiki/lib/exe/fetch.php?hash=8d4837&w=514&h=592&media=http%3A%2F%2Fwww.ladyada.net%2Fimages%2Flogshield%2Fsensorwiring.gif

minus the photo resistor.

I've tried everything, no idea why the voltage returned isn't what it should be.
I purchased 12 of these sensors and have tried 3.  All with the same results.


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok,

So I took out my multimeter, crossed it over the direct + to - terminals on the bread board and got 5V.
This is despite having the supply coming out of the 3.3V socket.

Which means the sensors work, but the 3.3v Socket is actually 5v.  Any idea why?

I've got the SMD Uno if that's any help.

Logged

Morganton, NC
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

try this, and make sure your 3.3v is tied to Aref AND pin 1 of the TMP36...
Code:
/* Sensor test sketch
  for more information see http://www.ladyada.net/make/logshield/lighttemp.html
  */
 
#define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!
 
 
 
 
//TMP36 Pin Variables
int tempPin = 0;        //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures
int tempReading;        // the analog reading from the sensor
 
void setup(void) {
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);   
 
  // If you want to set the aref to something other than 5v
  analogReference(EXTERNAL);
}
 
 
void loop(void) {
 
  tempReading = analogRead(tempPin); 
 
  Serial.print("Temp reading = ");
  Serial.print(tempReading);     // the raw analog reading
 
  // converting that reading to voltage, which is based off the reference voltage
  float voltage = tempReading * aref_voltage;
  voltage /= 1024.0;
 
  // print out the voltage
  Serial.print(" - ");
  Serial.print(voltage); Serial.println(" volts");
 
  // now print out the temperature
  float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((volatge - 500mV) times 100)
  Serial.print(temperatureC); Serial.println(" degress C");
 
  // now convert to Fahrenheight
  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
  Serial.print(temperatureF); Serial.println(" degress F");
 
  delay(1000);
Logged

Pages: [1]   Go Up
Jump to: