Searching \ for '[EE]: Thermistor temperature measurement' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'Thermistor temperature measurement'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Thermistor temperature measurement'
2000\12\19@222724 by Gordon Williams

picon face
----- Original Message -----
From: "Lawrence Lile" <>
To: "pic microcontroller discussion list" <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>;
Sent: Tuesday, December 19, 2000 12:45 PM
Subject: Re: [EE] Thermistor temperature measurement

> Hi Gordon,
> You are describing my first oven controller to the letter.  Yes, there are
> problems with thermistors, but if CHEAP is what you want, there is nothing
> finer in this world.  I'd love to discuss it to death with you.
> First, is this a one-off, or a production design?  It makes a difference.

It will be a one off design.

> How much accuracy and what range of temperatures do you want to measure?
> You can achieve +/- 25F/12C with the setup you describe quite easily.  If
> you want greater accuracy, you may need to shift gears.

I'm looking for about 1-2 deg. C accuracy over the range of -5 to 20 deg. C.
Most of the time I will be running it at -5 to +5 deg. C so I will be
calibrating around these temperatures once everything is set up and working

Your +/- 12 C is a concern to me.
> Thermistors (see the thread from a day or two ago)  are inaccurate,
> nonlinear, vary from part to part, and otherwise crude.  That's why they
> so cheap.  That's also why I love 'em, I'm a cheapskate.

I know that they are non-linear but I am expecting that they will follow the
Steinhart-Hart equation:
1/T= A + BlnR+ C(lnR)^3
T in Kelvin
R in Ohms
A,B,C fitting constants

I will use a lookup table with some interpolation.
> AN512 is a great way to make a cheap A/D input, but it suffers again from
> crudeness.  AN512 A/D introduces it's own quirky inaccuracies,
> issues,  and noise susceptibility.  But it's cheap, and can make a great
> oven controller.  If you want a medical thermometer or a thermostat for
> million dollar science experiment, forget these methods.
> You can get more accuracy out of an AN512 A/D by:  timing for longer
> (reducing your quantization noise, if you will) Cleaning up your power
> supply, keeping lead lengths to your thermistor short, using twisted pair
> your thermistor, and using software median filters to smooth out noise.
> All thse would be de rigeur for a commercial product, and kind of nuts for
> one-off.

I will use 16 bits for the timer.  I plan to select a capacitor so I will
use almost the full 16 bits. Do you think this is enough.

I will be using a linear regulator on the power supply.  The thermistor will
be about 2-3 feet away from the PIC.  The electronics will be at the same
temperature as the thermistor (i.e. about 5 deg. C).  PIC will be in RC
mode, but I havent decided on a frequency.

Im not sure about noise as I havent worked out the power section.  Total
power switched will be about 50 W at most (120V, 60 Hz).  Otherwise, I will
be driving a 4 digit LED off of the B port plus a couple of multiplex lines
from the A port.

The heating requirement will be almost constant with slow fluctuations.  Im
thinking of using a proportional control only.

> Remember, you can have something that is Accurate, Cheap, or Built
> but not all three at the same time!
> (some famous electronics guy said that whose name escapes me now)

Wasnt there also something about it actually working in that quote or maybe
I am thinking of another one. :)


Gordon Williams

{Quote hidden}

> > The temperature setpoint will be from -5 C to 20 C.  I am going to be
> > measuring temperature using a cheap thermistor that I got from a surplus
> > store for about 5 cents.  The room temperature resistance is about 25K
> > it changes about 20% over the temperature range that I will be using.
> >
> > I will be using a 16F84 with the technique in AN512.  The code in AN512
> > for the 16C54 so I have re-written some parts for the 16F84.
> is
> > very simple and very low cost.
> >
> > 1. A capacitor is discharged.
> > 2. The time is measured to charge the cap using a known resistor with
{Quote hidden}

-- hint: The list server can filter out subtopics
(like ads or off topics) for you. See

2000\12\20@064052 by Roman Black

Gordon Williams wrote:

{Quote hidden}

Don't ever think the humble thermistor is dead. I often use these
and get good reliability and stability. 1 degree C is fine.

I also buy cheap electronic thermometers from electronic stores.
I have these hooked up to certain machinery in my lab. Also great
for testing heatsinks and power stages I seem to build all the
time. Having pulled a few of these apart they just use a standard
cheap thermistor "bead". I check them against my expensive glass
laboratory thermometer (which came with calibration papers) and
they are quite stable. If they come a couple of degrees out you
can pull them apart and change the calibration resistor (obvious)
and mine are all within 0.5 degree C now.

So if you want to build a thermistor based setup it can work
well. Calibrating it might be a bit difficult. I suggest manually
generating a lookup table, then using a trim resistor in the
design to compensate for differences between thermistors. This
seems like what the commercial products do.

-- hint: The PICList is archived three different
ways.  See for details.

2000\12\20@104908 by Lawrence Lile


So far I think you are taking on quite a task.  I know you can solve these
problems, but  Here are my concerns:

1. Thermistor accuracy.  You'll need one of the more expensive thermistors.
Of course, you can calibrate out many problems in a one-off.  What about

2.  Lookup table - this is the bet way to get a leg up.  Once you get the
thing halfway working, CALIBRATE your lookup table against an accurate
thermometer.  The math will get you 3/4 the way there.

3. 2-3 feet of "antennae" between your sensor and the PIC.  this is
definitely going to cause trouble.  Shield that cable!  For this reason
alone I'd consider another approach.  AN512 is by nature a relatively high
impedance input, and

       IF ((high impedance) & (long antannae) )


if ya know what I mean.

4.  switching 50Watts - this will also cause trouble.  No doubt you'll end
up with a slight power supply variation each time you switch some power,
making your sensor reading bobble one or two bits. If there is a big space
between your calibrated lookup points, maybe 10 or 12 bits, this won't be a
problem.  Same with driving an LED display.

5. 16 bits - this is good.

6.  Linearize with a parallel resistor - this is an old trick which can help
keep the readings in a nice range.  Do a few calculations, you'll find a
range where a parallel resistor makes your thermistor behave a lot nicer.
This is less critical with a lookup table but can be a problem solver.

7. RC mode oscillator - these also introduce inaccuracies. Since you are
measureing *time* when you use AN512 A/D, your oscillator actrually
contributes a lot to the accuracy.  I'd use a 4mhz ceramic resonator or

8. LED display - see above.  These current hogs eat power supply regulation
for breakfast.  If you weren't operating in a freezer, I;d recommend a
serial LCD, but they don't like cold.  You may be stuck with LEDs, or
expensive wide temperature LCD's. Maybe you should run this thing from a
separate regulator?

9. Use a temperature stable capacitor for your RC oscillator and especially
for your AN512 measuring cap.  I know AN512 supposedly is immune to
capacitor vatiations and power supply variations.  Also, santa claus is
supposed to show up next week.  Don't bet on them.

Of course, you are a smart guy, and can probably solve ALL of these
problems.  Just watch out for them.

I'd seriously consider one of those packaged temperature chips (Dallas xxxxx
can't remember it) in your
application.  It will be easier to implement, less susceptible to noise,
more accurate, and only cost a couple bucks more.  If it saves you pulling
out hair it'll be worth it.  If you are getting paid and it saves you 5
minutes it will pay for itself.

--Lawrence Lile

-- hint: The PICList is archived three different
ways.  See for details.

2000\12\20@130133 by Gordon Williams

picon face
Hi Lawrence,

Thanks for all your input.  You have some good ideas that I will have to
think about.

What can you tell me about thermistor drift?  I haven't seen any specs so I
don't know what to expect.  I know self heating can be a problem but the
ones that I have are the size of dimes, so I wasn't expecting any problems.
What is the difference between the expensive thermistors and the cheap ones?
My impression was that it is very difficult to make thermistors that are
identical in performance and can be used as interchangeable items.  What you
were paying for is the interchangeability and therefore didn't have to
calibrate each thermistor.

A quick calculation for the resolution of the resistance using 16 bits (for
my interest):
Assume only 15 bits will actually be used to be conservative.
Thermistor change in resistance is about 15% for the -5 to +20 deg C range.
Therefore, the number of counts per degree is
2^15* 15%/25 deg. = 197 counts / deg.  (a high degree of comfort)
Of course this assumes that everything is repeatable and there is no noise!
Repeatability of the Schmitt trigger on TOCK1 is an unknown to me.  Any

It is a good idea to use caps for the PIC RC and measurement that are not
affected too much by temperature.  What type do you suggest.  These timing
and cap errors should be removed though (in theory) by doing a calibration
cycle using a known resistance just prior to doing a temperature
measurement.  Do you have a suggestion for the type of resistor that I
should use for the reference resistance?  I haven't looked to see if I could
find some temperature coefficients.  In my mind this is going to be more
important as the temperature accuracy is only going to be as good as the

Yes you are right about the noise on the wires, twisting is a minimum and
shielding is likely required.  I will have to see how much noise I get and
it is something to watch out for.  Maybe, as you suggested, an averaging of
values is a good idea.

Thanks for all your ideas,

Gordon Williams

{Original Message removed}

2000\12\20@132216 by Bob Blick

I've used a PIC and thermistor combo and found that the schmitt trigger
inputs should be avoided on the pic, the thresholds change depending on
the state and load on other pins. Use one of the pins that is not shcmitt
trigger. I got +- 2 degree C repeatability over 0 to 40 C ambient
temperature. Length of lead did not matter, the thermistor was charging a
cap and other than acting as an antenna on the 5 volt rail, the input was
in effect quite well filtered by the timing cap.

Note that I was using a regulated 5 volts and a crystal oscillator in this

This was a temperature regulator, not a thermometer, so the ambient
varied and the temperature on the theremistor was constant.



-- hint: The PICList is archived three different
ways.  See for details.

2000\12\20@134127 by Lawrence Lile

A quick look through a capacitor supplier's book shows that Polycarbonate
and Dipped Polypropylene have pretty flat capacitance change vs temp curves
in the region you are looking at.  Polycarbonate caps should vary less than
1/2% over the -5 to 20C range.  Polystyrene should be similar.  Avoid
ceramics with dielectrics such as x7r, y5v, z5U,  and all electrolytics.
Some of these can vary 40% over the temperature range you specified!!!!

--Lawrence Lile

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...