Rapid Online supply a range of pipe-clip temp sensors, for a couple of pounds each, that will be useful for monitoring temperatures within the heating system. Granted, they’re never going to give me actual water temperatures as they’re measuring the pipe rather than the water itself, however, over time they (should) give consistent data, which is just as good for my purposes. For 15mm copper pipe, the clip size to get is 16-18mm – I checked.

Based upon the thermistor example from the Arduino Playground, I wired it up like this;

Semitec CH Series Pipe-Clip Temperature Sensor_bb

With these thermistors, the resistance varies with temperature and the datasheet gives a complete lookup table of values from 0 to 120°C. You could implement that lookup in code, but it would be a ball-ache. Instead you can use something called the Steinhart-Hart equation to calculate the values based upon knowing a few key facts about the sensor. I won’t pretend to understand how the equation works, but the principle is that if you know the resistance (R0) for a particular temperature (T0) and have a “magic number” (B), all the other values can be calculated for a given resistance.

So;

  • B : 3969
  • T0: 298.15  (25°C in Kelvins = 25 + 273.15)
  • R0: 10000 (10kΩ resistance at 25°C)

There’s also another good reference to using thermistors with an Arduino, which is a set of student class notes for a course entitled Engineering Problem Solving run by Portland State University. It goes into an awful lot of the background and the rest of the course materials make for interesting reading too.

A quick bit of example code;

#include "Math.h"
// enumarating 3 major temperature scales
enum {
  T_KELVIN=0,
  T_CELSIUS,
  T_FAHRENHEIT
};
#define SEMITEC_103FT1005_10k 3969.0f,298.15f,10000.0f  // B,T0,R0   

// Temperature function outputs float , the actual
// temperature
// Temperature function inputs
// 1.AnalogInputNumber - analog input to read from
// 2.OuputUnit - output in celsius, kelvin or fahrenheit
// 3.Thermistor B parameter - found in datasheet
// 4.Manufacturer T0 parameter - found in datasheet (kelvin)
// 5. Manufacturer R0 parameter - found in datasheet (ohms)
// 6. Your balance resistor resistance in ohms
float Temperature(int AnalogInputNumber, int OutputUnit, float B, float T0, float R0, float R_Balance) {
  float R, T;
  R = 1024.0f * R_Balance / float(analogRead(AnalogInputNumber)) - R_Balance;
  T = 1.0f / (1.0f / T0 + (1.0f / B) * log(R / R0));
  switch(OutputUnit) {
    case T_CELSIUS :
      T -= 273.15f;
      break;
    case T_FAHRENHEIT :
      T = 9.0f * (T - 273.15f) / 5.0f + 32.0f;
      break;
    default:
      break;
  };
  return T;
}
void setup(void) {
  Serial.begin(9600);
}   

void loop(void) {
  Serial.println("*************************");
  Serial.println(Temperature(1, T_CELSIUS, SEMITEC_103FT1005_10k,10000.0f));
  Serial.println("*************************");
  delay(500);
}

Gives us the output;

Pipe clip sensor output

There’s some floating around in the calculated values, so I’ll probably use an average of readings over a second to get a final figure. Like I say, I’m not doing rocket science here, so having a consistent number is realistically more important than having a dead accurate super-calibrated one.