Thought on thermocouples

mrburnette

Senior Member
A week or so ago, I wrote a code snippet Thermocouple-When-fun-and-frugality-are-more-important-than-dead-on-accuracy and presented a snippet of code.

As is often the case, days later, I decided that I had taken the easy way out and used a FOR/NEXT loop to search EEPROM for a value and then presented that with some manipulation. More proper, would have been to invert the table so that instead of reading the mV data that the mV would be the INDEX into the table and I would read the TempC. Now, I admit that lazy is the reason I did it the way I did the first time... that is, mV is always less that 255, so I could configure the table as as Bytes. Configuring the DATA as TempC means having to deal with WORDS.

So, I took the time tonight to do the conversion. Code attached - The results of using a butane lighter to heat the HOT junction. The first part of table is the HEATING then the MAX-OUT, then the COOLING:
Code:
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 139 ... Thermocouple mV= 5 PIC= 23
degree C= 159 ... Thermocouple mV= 6 PIC= 23
degree C= 159 ... Thermocouple mV= 6 PIC= 23
degree C= 199 ... Thermocouple mV= 8 PIC= 23
degree C= 199 ... Thermocouple mV= 8 PIC= 23
degree C= 218 ... Thermocouple mV= 9 PIC= 23
degree C= 237 ... Thermocouple mV= 10 PIC= 23
degree C= 273 ... Thermocouple mV= 12 PIC= 23
degree C= 291 ... Thermocouple mV= 13 PIC= 23
degree C= 308 ... Thermocouple mV= 14 PIC= 23
degree C= 326 ... Thermocouple mV= 15 PIC= 23
degree C= 343 ... Thermocouple mV= 16 PIC= 23
degree C= 343 ... Thermocouple mV= 16 PIC= 23
degree C= 360 ... Thermocouple mV= 17 PIC= 23
degree C= 376 ... Thermocouple mV= 18 PIC= 23
degree C= 393 ... Thermocouple mV= 19 PIC= 23
degree C= 409 ... Thermocouple mV= 20 PIC= 23
degree C= 409 ... Thermocouple mV= 20 PIC= 23
degree C= 409 ... Thermocouple mV= 20 PIC= 23
degree C= 409 ... Thermocouple mV= 20 PIC= 23
degree C= 423 ... Thermocouple mV= 22 PIC= 23
degree C= 423 ... Thermocouple mV= 23 PIC= 23
degree C= 423 ... Thermocouple mV= 25 PIC= 23
degree C= 65535 ... Thermocouple mV= 13 PIC= 23           (ERROR - Too Hot)
degree C= 65535 ... Thermocouple mV= 13 PIC= 23           (ERROR - Too Hot) 
degree C= 423 ... Thermocouple mV= 22 PIC= 23
degree C= 376 ... Thermocouple mV= 18 PIC= 23
degree C= 308 ... Thermocouple mV= 14 PIC= 23
degree C= 273 ... Thermocouple mV= 12 PIC= 23
degree C= 237 ... Thermocouple mV= 10 PIC= 23
degree C= 218 ... Thermocouple mV= 9 PIC= 23
degree C= 199 ... Thermocouple mV= 8 PIC= 23
degree C= 179 ... Thermocouple mV= 7 PIC= 23
degree C= 159 ... Thermocouple mV= 6 PIC= 23
degree C= 159 ... Thermocouple mV= 6 PIC= 23
degree C= 139 ... Thermocouple mV= 5 PIC= 23
degree C= 118 ... Thermocouple mV= 4 PIC= 23
degree C= 118 ... Thermocouple mV= 4 PIC= 23
degree C= 118 ... Thermocouple mV= 4 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 96 ... Thermocouple mV= 3 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 73 ... Thermocouple mV= 2 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 49 ... Thermocouple mV= 1 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
degree C= 24 ... Thermocouple mV= 0 PIC= 23
Many who read this will think that the incremental temperature is simply too great a span: that is, not enough accuracy. But I am of the opinion that sometimes we programmers create systems that simply are too complex and provide far too much information. Take offense if you like, but before digital readouts, mechanical gauges often had marks of 50 to 100 units apart... if not greater. Just look at any automobile that is 10 years old and focus on the fuel gauge: F then marks for 3/4, 1/2, 1/4, and the big E for empty. Does one really need to know that they have 67% of their fuel remaining?

Therefore, think. Look at the simplicity of the code - there is no OpAmp or instrumentation amplifier. Just a homemade type T thermocouple between ground and the AD input. I'm using the internal temperature sensor in the PIC to roughly sense the ambient temperature and I am using the fact that the curve of type T thermocouples is fairly linear... therefore, instead of converting the ambient temperature to mV and then adding the mV to correct for the COLD junction... all that is required is to add the temperature to approximate the results of the linear function. Of course, it is not perfect... but we are back to the automobile fuel gauge again... how much granularity is really needed?

- Ray

Summary:
How good is this technique? Well, it is pretty darn good considering how simple the hardware... would you accept 5% of full-scale for a step-span? Less at higher temperatures?? This equates to a maximum step value of 45F and a minimum step value of 25F. For many applications, this may be good 'nuff.

Here are the numbers: (ref. last column, %FS)



EEPROM__INDEX DATA tempC tF+ambident tF delta %FS

EEPROM 00 ,( 001 ) ; 001C ; 34F+72F ; 106F +45 5%
EEPROM 02 ,( 026 ) ; 026C ; 79F ; 151F +43 5%
EEPROM 04 ,( 050 ) ; 050C ; 122F ; 194F +41 5%
EEPROM 06 ,( 073 ) ; 073C ; 163F ; 235F +40 5%
EEPROM 08 ,( 095 ) ; 095C ; 203F ; 275F +38 5%
EEPROM 10 ,( 116 ) ; 116C ; 241F ; 313F +36 4%
EEPROM 12 ,( 136 ) ; 136C ; 277F ; 349F +36 4%
EEPROM 14 ,( 156 ) ; 156C ; 313F ; 385F +36 4%
EEPROM 16 ,( 176 ) ; 176C ; 349F ; 421F +34 4%
EEPROM 18 ,( 195 ) ; 195C ; 383F ; 455F +34 4%
EEPROM 20 ,( 214 ) ; 214C ; 417F ; 489F +33 4%
EEPROM 22 ,( 232 ) ; 232C ; 450F ; 522F +32 4%
EEPROM 24 ,( 250 ) ; 250C ; 482F ; 554F +32 4%
EEPROM 26 ,($0C,$01 ) ; 268C ; 514F ; 586F +31 4%
EEPROM 28 ,($1D,$01 ) ; 285C ; 545F ; 617F +32 4%
EEPROM 30 ,($2F,$01 ) ; 303C ; 577F ; 649F +31 4%
EEPROM 32 ,($40,$01 ) ; 320C ; 608F ; 680F +31 4%
EEPROM 34 ,($51,$01 ) ; 337C ; 639F ; 711F +28 3%
EEPROM 36 ,($61,$01 ) ; 353C ; 667F ; 739F +31 4%
EEPROM 38 ,($72,$01 ) ; 370C ; 698F ; 770F +29 4%
EEPROM 40 ,($82,$01 ) ; 386C ; 727F ; 799F +25 3%
EEPROM 42 ,($90,$01 ) ; 400C ; 752F ; 824F



[/SIZE]
 

Attachments

Top