AVR Freaks

AVR forum - Reading Thermocouples

jsundownr - Jul 26, 2008 - 06:43 PM
Post subject: Reading Thermocouples
As everybody knows thermocouples are non-linear devices which require some form of corrective mechanism to produce accurate results (lookup tables, etc).

I am looking for any information relating to thermocouple usage with AVR controllers. Specifically I want read temperatures and calibrate those temperatures by the simplest means possible.

Thanks for any help.

sundownr
glitch - Jul 26, 2008 - 06:58 PM
Post subject: RE: Reading Thermocouples
Don't get caught up on this being done on an AVR. While the reading part is hardware specific (refer to the data sheet for the ADC functionality) Any analog front-end will be generic, and the concepts in the code will be generic. So except for the actual part of doing the ADC conversion, nothing about your question is AVR specific... so google away, you'll find plenty on info there.
Lennart - Jul 26, 2008 - 07:03 PM
Post subject: RE: Reading Thermocouples
And if you really like AVR's there are older threads that discuss this in detail. Maybe include Excel since those tables can be created by Excel.
ka7ehk - Jul 26, 2008 - 07:07 PM
Post subject: RE: Reading Thermocouples
You will really be well served to get one of the thermocouple interface ICs. It does cold junction compensation, linearization, amplification, etc.

Trying to do anything by just digitizing an uncompensated thermocouple is a big problem. First, you NEED to know the temperature of the digitizer input. Then, you have to deal with microvolt signals. Its NOT pretty. In fact, it is bloody hard.

Jim
jsundownr - Jul 26, 2008 - 07:25 PM
Post subject: RE: Reading Thermocouples
glitch

Granted I know how read a lookup table using C++ or C# but being an AVR newbie I am pressed to build lookup code which will run efficiently within an AVR processor. I am also aware there are specific AVR solutions for thernocouple compensation.

I do appreciate your setting me straight. Google is a great research site which I use often.

Have a great day glitch.

sundownr
glitch - Jul 26, 2008 - 07:34 PM
Post subject: RE: Reading Thermocouples
Don't worry about efficiency, until the resultant code is not efficient/compact enough. Try doing the code the way you would normally. And then, only if there is a problem, do you start to look for ways to trim the fat.
S-Sohn - Jul 26, 2008 - 07:45 PM
Post subject: RE: Reading Thermocouples
What is the temperature range you want to measure. I have build a quad-thermometer with silicon diodes (1N4148) as sensor. The temperature coefficient is very linear (about -2mV/°C). My thermometer has a temperature range of -40°C to +125°C. Resolution is 0.1°C and accuracy is +/- 0.5°C. I have implemented it with an ATtiny461 and some cheap OPs (1x LM324 + 1x CA3140).

Since the diodes are so small the thermometer is very sensitive and reacts very fast on temperature changes.

Regards
Sebastian
jsundownr - Jul 26, 2008 - 07:59 PM
Post subject: RE: Reading Thermocouples
Lennart

Thanks for your input.

Excel tables are one way to go but require considerable flash to implement as temperature compensation tables can be too large when dealing with limited memory space.

I did research Google and this forum before posting... plus over the years I have wrote many lookup routines.

I trust Sweden is not as hot as the American Southwest. We have had a very hot Summer and a lot of tornadoes. If the World's weather keeps changing at the present pace perhaps I will come to Sweden and visit with you.

Thanks again.

sundownr
Lennart - Jul 26, 2008 - 08:21 PM
Post subject: RE: Reading Thermocouples
Well just book your tickets and pack your bags...
Today it was 28 deg C inside and 32 deg C outside (in the shade).
We have even had very small tornados this summer which is not how it used to be.
jsundownr - Jul 26, 2008 - 08:40 PM
Post subject: RE: Reading Thermocouples
Sebastian

My temperature range is 0-300 F (149 C).

Given my poor eyesight I am no longer able to build circuitry... a profession I used to enjoy.

I will probably go with a compensation IC suggested above... but if takes much more than a IC socket and
simple wiring I may have to punt and use a lookup table.

I like German soccer... you guys are good.

sundownr
jsundownr - Jul 26, 2008 - 09:12 PM
Post subject: RE: Reading Thermocouples
Jim

I went to your web site but could not find the information I was looking for.

Could you please send me any information relating to the thermocouple interface ICs you referred to. I am very interested in using this solution for thermocouple compensation.

Thanks for your suggestion.

sundownr
jsundownr@hotmail.com
rstahlhu - Jul 26, 2008 - 10:45 PM
Post subject: RE: Reading Thermocouples
Try ADC594/595 and MAX6674/6674 for starters.
jesper - Jul 26, 2008 - 11:01 PM
Post subject: RE: Reading Thermocouples
You dont want to use thermocouples unless you REALLY REALLY have to (and thats usually only when you need to read very high temps).
It's really messy, and as someelse already suggested, you should use a special IC for this. Even then, it's still messy.
Believe me, I've tried it, it's not pretty.
Kleinstein - Jul 27, 2008 - 12:58 AM
Post subject: RE: Reading Thermocouples
The second possible reason for thermocoules is if needs to be really small, or fast (which implies small). A thermocouple can be less than 0.1 mm in diameter, though that gets hard without good eyes.

Type K thermocouples are quite linear, so that's probably the least problem.

In the 0-300F range an platinum RTD is probabaly more suitable. The 1000 Ohms versions are often easier to handel than the traditional 100 Ohm ones. With the RTD you may even work without an external amplifier if the AVR has a differential input (e.g. Tiny261).
ka7ehk - Jul 27, 2008 - 01:00 AM
Post subject: RE: Reading Thermocouples
The devices rstahlhu suggested were the ones I was going to suggest.

The biggest issues are low signal level and cold-junction compensation. Linearization is relatively simple in comparison.

Jim
tpappano - Jul 27, 2008 - 02:05 AM
Post subject: RE: Reading Thermocouples
I must give a dissenting opinion Cool IMHO, thermocouples aren't messy or difficult at all (they feed me). You do need a gain stage- I like to use the LTC1152 with a gain of 20. With a 1.2 volt Vref, this gives a full scale input range of 60mv, which pretty much covers the full temp ranges for the J,K,T,and E couples I use the most. Ambient compensation is simple. I use a LM50 analog sensor to determine the terminal block ("cold junction") temperature and then mathematically compensate the reading(s) from the couple(s). Adding a multiplexer can turn the system into a multi-channel one for next to nothing. Since your desired temperature range is relatively small, you can increase the gain on the amp for best resolution. The LTC1152 is a very low offset and low price amp that works well for this sort of thing. Using lookup tables is memory space efficient, and the C code is straight forward and compact as well. For such a small measuring range, your tables will have just a few entries.
avrcandies - Jul 27, 2008 - 08:40 AM
Post subject: RE: Reading Thermocouples
My guess is you can do a simple linear interpolation between a few temparature point stored in a table. This makes the math very easy. The closer you want to be to the "curve", the more points you'll need.
As an experiment, you can make your own thermocouple out of an old coathanger and some copper wire. Just make sure its a shirt you can wear while working on your code.

Hoyt
S-Sohn - Jul 27, 2008 - 12:04 PM
Post subject:
jsundownr wrote:
I like German soccer... you guys are good.
Yes, and the best contribution I can do to improve german soccer is to not play soccer. Wink

OK, at school I wasn't so bad because of my really big feet. They were almost insuperable for the adversaries. Razz

Regards
Sebastian
farang - Jul 27, 2008 - 06:34 PM
Post subject:
Go back and make sure you mean thermocouple.

Thermocouples are pretty linear, but their output is on the order of microvolts per degrees. I will bet you mean thermistors. Thermistors gave give you pretty good "sensitivity" are very nonlinear, so they do need compensation. The compensation varies as a function of the particular thermistor.

As pointed out above, a PN silicon junction in either a transistor or a diode can make a pretty good, linear, and inexpensive temperature sensor.

Do a little more research and choose your sensor type.
theusch - Jul 27, 2008 - 11:02 PM
Post subject:
Quote:

Go back and make sure you mean thermocouple...

...and if indeed you do mean "thermistor", then even though non-linear over the entire range, a range of interest can often be made effectively linear by using a suitable "bias resistor". If thermistor, hunt the threads discussing the bias resistor, or report back.

Lee
jsundownr - Jul 29, 2008 - 02:29 PM
Post subject:
farang

Your point is well taken. At my age it is easy to cross thermocouples and thermistors in conversation. I should have been more specific.

As you can see I am no expert but seems thermistors are easier to handle than are thermocouples. I am referring to the cost and effort required for temperature linearization.

What would be the deciding criteria in choosing between thermocouples and thermistors?

Thank you farang.

sundownr
farang - Jul 29, 2008 - 03:08 PM
Post subject:
The deciding factors are cost, accuracy, and design time. Just like nearly everything else.

Thermocouples (two dissimilar metal wires welded together) are pretty linear but they are hard to use. You have to be careful about board layout because the thermal voltages generated in solder joints (as an example) are of the same order of magnitude as those generated by the thermocouple itself. And then there is the problem that thermocouples generate microvolts per degree. And as someone has pointed out, you need one "cold junction" reference as well. You can by a chip (Analog Devices has one or more) that can handle most of the conditioning, but its kind of expensive.

Thermistors (resistors that have a large temperature coefficient) have large coefficients and give you the largest volts/degree/dollar of the basic technologies. They may require linearization, but that can often be handled by careful selection of the series and parallel resistors. Or you can do most of it with look-up tables that you tailor to your circuit. You might not require linearization at all, depending over the temperature range and accuracy requirements of your application.

One other effect that you should consider, because its often the cheapest way to go, is to use a PN junction, as mentioned earlier. Either a simple diode that is supplied current with a large resistor, or the ever popular transistor with the base and collector shorted. Motorola (before the spun off their semiconductor division) sold NPN transistor charactarized and graded for this particular application. PN Junctions provide a predictable and very linear temperature coefficient.

The PN junction gives less volts/degeree/dollar than the thermistor and more than the thermocouple. It provieds a much better trade off between cost and linearity than either the thermocouple or the thermistor in my opinion.


Thermocouple: Highest accuracy, highest cost, longest design time.

Thermistor: Medium cost, low accuracy, shortest design time.

PN Junctions: Medium cost, high accuracy, medium design time.

Opinions will vary.
jsundownr - Jul 29, 2008 - 05:03 PM
Post subject:
farang

Your understanding of temperature sensors seem remarkably advanced.

After reading your reply I believe I will try both a thermistor and a PN juction... the experiment should be fun.

Thank you.

sundownr
tpappano - Jul 29, 2008 - 06:56 PM
Post subject:
I would just add that one important general feature of thermocouples is their wide useful temperature range, ~1300 degC for the popular type K, for example. Noble metal types go much higher. For lab use and general tinkering, TCs are nice because once you have a roll of TC wire, every time you snip off a piece you have a new sensor. When you are ready to connect your new project to a tank, boiler, pipe, etc. thermocouples (like RTDs) are available packaged in various standard mounting arrangements. Thermocouple wire is also available in fine gauges making very tiny probes possible.
All times are GMT + 1 Hour
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits