Skip to content

Temperature measurement with cheap NTC's

dberenguer edited this page Nov 23, 2014 · 15 revisions

Thermistors

Thermistors provide a simple and inexpensive way to measure temperatures. They are resistors whose resistance change significantly with temperature. Compared with other solutions like the TP36 or LM35 IC's, thermistors are cheaper and more accurate. They can work at any voltage, they are very robust and can be simply powered from an output pin.

Among thermistors, NTC's (Negative Temperature Coeficient) are easier to use for temperature measurements whilst PTC's are mostly used in switching applications. The downside of thermistors is that they are not linear so look-up tables or more complex formulas have to be implemented in order to transform voltage (or resistance) into temperature readings. For this aplication we will apply the Steinhart–Hart equation wich will release us from having to create our own look-up table.

Wiring

The simplest thermistors circuit consists of a thermistor and a series resistor. We are using the following parts in our example:

  • 10 Kohm 1% thermistor
  • 10 Kohm 1% series resistor

panStamp NRG includes SM0603 footprints for a NTC circuit on the bottom side. In case you are using a panStamp AVR or you don't feel comfortable with SMD soldering, external through-hole components can be used instead.

panStamp NRG with on-board NTC

Power

Our NTC circuit can be powered from any voltage so sensor and panStamp can share the same source of power. This lets us power the NTC from an output pin for example and, as result, we can power the whole wireless module from a simple 3V battery. This makes this wireless temperature sensor really simple, cheap and low-power. Current consumption is under 2 uAmps during sleep mode and around 30 mAmps when measuring and transmitting.

panStamp NRG powered from CR2032 battery

Sample code

We provide a SWAP-compatible sample application called ntc for the pinout shown in the above picture. If you use any other I/O pins from your module then you will have to change the code accordingly in ntc.ino.

// Digital output used to power the thermistor circuit
#define NTC_POWER_PIN         10
// Analog pin used to read the NTC
#define NTC_PIN               A1

This code is quite simple. It relies on our thermistor library and SWAP stack. If you don't want to dive into the code, simply grab the application into your panStamp and configure your desired transmission interval from SWAPdmt.

SWAP packets

SWAP status packets transmitted by this application are very simple. Data payload simply consists of two bytes. temp.xml is the device definition file used for this application. In order to transform this 2-byte number into a readable temperature you have to apply the formulas defined in the units section of this XML file:

  • Celsius degrees: Temperature (ºC) = data x 0.1 - 50
  • Fahrenheit degrees: Temperature (ºF) = data x 0.18 - 58
  • Kelvin degrees: Temperature (ºK) = data x 0.1 + 223.15

Anti Swap

API for Anti Swap

Clone this wiki locally