About thermocouples

Some time ago there was some discussion about the system load of doing the polynomials for thermocouple temperature calculation. I did some hardware and software design, this is what I have now.

The hardware: A PIC with 5 analog input channels used, one measures a LM135 sensor that measures the 'cold side', where the thermocouple wires are connected. The other 4 channels are amplified by a quad opamp, and alternatively measure the and + and - side of the thermocouple connections via HC4053 CMOS switches. The PIC does no math whatsoever, but just sends the ADC values (9 in total) with 19200 Bd via a RS232 (optionally using a RS232 to USB adaptor) to the PC. The PC uses the latest version of the 'th' program I published in this thread. I wrote a second program 'thpc' (thpc stands for 'th pic in c', to interface with the PIC, it calls 'th' to do the thermocouple math, does all the other math, calculates the cold side in C from the measured LM135 value, and gets the temperatures from the measured thermocouple values by calling th, corrects for the cold side, and displays in various ways (options). It is possible to use different thermocouples, below is some log output to stdout (-l is log mode, else it prints only one line with a CR). I hope you have a wide screen in your newsreader, over time I moved to more and more characters per line on my PC, very nice, think I am close to 256 characters / line in my rxvt these days... wide screen monitor :-) Anyways, the amount of CPU cycles this uses : 11632 root 15 0 0 0 0 Z 0.7 0.0 0:00.02 th

------------------------------------------^^^^_^^^^^ %CPU %MEM The thc program itself does not even show up in 'top'. And that is on a 1 GHz, with the measurements updated 1 x per second, the -1 J .. -4 S sets the thermocouple type. the -l forces logging like this, The PIC is connected to the serial port directly here. I did not intend to do exactly 1 measurement per second, just estimated it in the PIC delay, but somehow it comes out at exactly 1 per second. Should be fast enough for most things. grml: ~ # thpc -1 J -2 E -3 K -4 S -l Panteltje thpc-0.1 using device /dev/ttyS0

ESC exits.

2010 10 02 00:06:31 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:32 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:33 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:34 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:35 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:36 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C 2010 10 02 00:06:37 cold_side 21.0 °C channel 1 type J 310.130 K 36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C etc...

So .7 % CPU load. I think this is a nice solution, and many of these boxes can be connected via USB, it gets power from the RS232 or RS232 to USB adaptor too. Maybe this will be a mass product I will sell. This PIC has more analog input channels of course, but that needs more opamps and CMOS switches, also one could put a LM135 on each terminal block, use a big PIC with 13 or more analog channels, market segmentation :-) Made in China it could be done for maybe a few $, a nice competition for J. L. ;-)

Just need to order some thermocouple wire of all different kind to test, and have to decide on a box to fit it in. Of course the output above is also easily parsed for alarms, control etc, for example using 'awk'.

Reply to
Jan Panteltje
Loading thread data ...

polynomials

thermocouple wires are connected.

the and + and - side of the thermocouple connections via HC4053 CMOS switches.

with the PIC, it calls 'th' to do the thermocouple math,

value,

corrects for the

stdout

and more characters per line

these days... wide screen monitor :-)

directly here.

the PIC delay,

36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C
36.980 °C channel 2 type E 307.550 K 34.400 °C channel 3 type K 314.040 K 40.890 °C channel 4 type S 409.140 K 135.990 °C

USB, it gets power from the RS232 or RS232 to USB adaptor too.

and CMOS switches,

more analog channels, market segmentation :-)

;-)

have to decide on a box to fit it in.

example using 'awk'.

I'm certainly interested in something like this. I've wanted to do this and just haven't had the time. Temp logging in my workshop comes up more often than I would have figured. Looking forward to seeing your work. Jim

Reply to
Jim Flanagan

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.