I'm having a little trouble hooking up my 10k themistor and resistor to my UNO, but I think i got it. I am trying to sense the ambient temperature. I am using a code that i used in a LilyPad project, so i know the code works. However, when i run the code with my UNO, this is what I get:

Temp reading = 1023 - 3.30 volts 279.68 degress C 535.42 degress F

Anyone have any advice? Thanks

Assuming 1023 is the analog reading you are getting from the A/D converter, looks like it is just reading 5V, and not doing any resister-divider kind of function.

How do i fix that? I'm totally new to arduino!

Since you are new, you need to provide your code and picture of your connections. That's typically needed for an answer. We don't have crystal balls.

Maybe it is just a bit warmer than usual.

Maybe you could post your code and your circuit.

think you need to add conditional code, something like

if defined(AVR_ATmega168) || defined(AVR_ATmega328P) // the 5 volt devices

code for 5 Volt devices

else

code for 3.3Volt devices

endif

OK, I need to start thinking!! Sorry, i can't take a picture. But here are my connections

I have my thermistor in gnd i have my resistor in a different gnd I have both of them in analog in (A0)

Here is my code:

/* Sensor test sketch
*/

#define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!

//TMP36 Pin Variables
int tempPin = 1;        //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) {

Serial.print("Temp 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);
}


Thanks so much!

Please modify your post, select the code and press # button --> looks so much better

I have my thermistor in gnd i have my resistor in a different gnd

There's a good write-up here: http://www.arduino.cc/playground/ComponentLib/Thermistor2

This is my version, where the thermistor goes to ground and the pad resistor goes to positive. sensorTempValue is already returned from analog read.

float calcTempValue;

void calcTemperature()
{
// utilizes the Steinhart-Hart Thermistor Equation
// sample code from Arduino playground Thermistor2

// this will have to be tested using resistors to simulate the thermistor
// using values from CityCell's datasheet. (DONE 2011-05-26 AW)
// As an example, typical values for a thermistor with a resistance of 3000 ? at room temperature (25 °C = 298.15 K) are:

//  a = 1.40 \times 10^{-3}

//  b = 2.37 \times 10^{-4}

//  c = 9.90 \times 10^{-8}

// float thermR = 3000;            // nominal value of thermistor
const float pad = 10000;               // value of pull-up resistor
const float factorA = 1.4E-03;
const float factorB = 2.37E-04;
const float factorC = 9.90E-08;

long resistance;
float Temp;                      // a local temporary variable

resistance = sensorTempValue * pad / (1024 - sensorTempValue);   // changed from sample code as our thermistor
// goes to ground (NOT Vcc)
// we use 1024  so an open cct thermister won't throw a divide-by-zero error

Temp = log(resistance);
Temp = 1 / (factorA + (factorB * Temp) + (factorC * Temp * Temp * Temp));
calcTempValue = Temp - 273.15;            // convert Kelvin to Celsius

}  // end calcTemperature()


Amanda

Here's my tutorial with real pictures:

http://liudr.wordpress.com/2011/02/10/measure-temperature/

The circuit shows that your "other ground" is supposed to be 5V.

The R_unknown is the thermistor and R_known is the 10Kohm resistor.

I think you used the wrong code. The code is for a TMP36 sensor, not a thermistor.

Here is the loop(). You will need Serial.begin(9600); in setup()

  float resistance, voltage, r_fixed, T0, T, R0,B;
T0 = 298.15;//initial temperature for calibration
R0 = 10000;//initial resistance for calibration
r_fixed = 10972;//known resistance
B = 4050;//B for normalization
Serial.println("Temperature");

while(1)
{
voltage = analogRead(sensor_a)*5.0/1024;// Renormalizing from 0 to 5 volts.
resistance = voltage*r_fixed/(5.00-voltage);//find unknown resistance
T = 1/(log(resistance/r_fixed)/B+1/T0)-273.14;//find temperature from unknown ressistance
Serial.println(T);
delay(500);
}


ABIA: I have reconnected my thermistor according to liudr's blog. However, no code i try is uploading, even codes that were working before!!

What do you mean by not uploading? What error message?

Okay, it is finally uploading again!! Here is the code i uploaded. However, it still gives me insanely high readings. What can i do??? BTW, i am on 9600 baud

/* Sensor test sketch

*/

#define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!

//TMP36 Pin Variables
int tempPin = 1;        //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) {

Serial.print("Temp 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);
}


I don't think you read my replies very carefully. You are using the wrong code so re-read my replies and upload the right code.

I got it working! I needed a different code and resistor. I posted those details in Sensors under Arudino thermistor. Thanks to all for their help!

ABIA:
I got it working! I changed the voltage (originally at 1024) to like 5000.
Thanks to all for their help!

You must have a peculiar way of defining “working”. Whatever you see, if you are truly using a thermistor, is wrong. You used the wrong code and bent it to display a value that you think is right. I offered my help but I don’t think you took it all, though. Good luck walking blind on the forum.