# Temp reading reduces when I touch Thermistor! (I'm obviously not hot :( )

Hiya All

Playing with a thermistor temp circuit and some Adafruit code.

So, I have +ve3.3 to a standard 10kΩ thermistor in series with a 10kΩ resistor to gnd, taking the input at the Resistor/Thermistor junction into A0.

Here’s the code:

``````// which analog pin to connect
#define THERMISTORPIN A0
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000
// temp. for nominal resistance
#define TEMPERATURENOMINAL 20
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000

int samples[NUMSAMPLES];

void setup(void) {
Serial.begin(9600);
analogReference(EXTERNAL);
}

void loop(void) {
uint8_t i;
float average;

// take N samples in a row, with a slight delay
for (i = 0; i < NUMSAMPLES; i++) {
delay(10);
}

// average all the samples out
average = 0;
for (i = 0; i < NUMSAMPLES; i++) {
average += samples[i];
}
average /= NUMSAMPLES;

// Serial.println(average);

// convert the value to resistance
average = 1023 / average - 1;
average = SERIESRESISTOR / average;
//Serial.print("Thermistor resistance ");
//Serial.println(average);

float steinhart;
steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
steinhart = log(steinhart);                  // ln(R/Ro)
steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart;                 // Invert
steinhart -= 273.15;                         // convert to C

// Serial.print("Temperature ");
Serial.println(steinhart);
//Serial.println(" *C");

delay(1000);
}
``````

Now, what I don’t understand is that when I hold the thermistor between my fingers, the temperature reading drops!

Can someone help me with the code please and offer some assistance as to what I’ve done wrong.

Thanks

I have +ve3.3 to a standard 10kΩ thermistor in series with a 10kΩ resistor to gnd

Or, you could have the resistor connected to 3.3V. Which order of connection is assumed by the code?

jremington:
Or, you could have the resistor connected to 3.3V. Which order of connection is assumed by the code?

I have the Thermistor connected to 3.3V. The code suggests using 3.3V as it is less noisy.

Stronger hint: try swapping the two components.

jremington: Stronger hint: try swapping the two components.

Ah. OK. D'oh! :) *hides in darkened room, head bowed in shame, never to return! ;)

OK, you can come out now!

Join the klubb. :confused:

jremington: OK, you can come out now!

Phew... thank you! I can get back to my baby Arduino now :)