K type thermocouple, MAX31855K, Basic Stamp = stability/decoding issues.
CuriousOne
Posts: 931
Hello.
I wanted to interface K type thermocouple with the basic stamp. The quick googling showed this page: http://emesystems.com/OL2therm.htm
It was using MAX6675, which is no longer made, and being replaced with MAX31855. So, I ordered that IC, assembled as indicated and started testing. To get idea what data is being forwarded, I've removed this line:
debug dec THC/100,".",dec2 THC,cr
and replaced it with
debug dec result, CR
The code appears to be running properly and result changes when I heat or cool down the thermocouple, but it has very strong fluctuation. For example, thermocouple now lies on the table, and variable RESULT changes from 360 to 420 on it's own. If I touch the shield of thermocouple cable (which is connected to Vss of "stamps in class" board), the reading will jump to from 480 to 510, and very slowly (about 30 minutes) will come back to the initial values. Or it will come to initial values instantly if I cycle the power. Same happens if I put my finger on the USB connector on the board, just this time RESULT will jump to 440-460 range. Wiring is all correct and according to datasheet. Thermocouple is working, checked with factory made thermometer.
I wanted to interface K type thermocouple with the basic stamp. The quick googling showed this page: http://emesystems.com/OL2therm.htm
It was using MAX6675, which is no longer made, and being replaced with MAX31855. So, I ordered that IC, assembled as indicated and started testing. To get idea what data is being forwarded, I've removed this line:
debug dec THC/100,".",dec2 THC,cr
and replaced it with
debug dec result, CR
The code appears to be running properly and result changes when I heat or cool down the thermocouple, but it has very strong fluctuation. For example, thermocouple now lies on the table, and variable RESULT changes from 360 to 420 on it's own. If I touch the shield of thermocouple cable (which is connected to Vss of "stamps in class" board), the reading will jump to from 480 to 510, and very slowly (about 30 minutes) will come back to the initial values. Or it will come to initial values instantly if I cycle the power. Same happens if I put my finger on the USB connector on the board, just this time RESULT will jump to 440-460 range. Wiring is all correct and according to datasheet. Thermocouple is working, checked with factory made thermometer.
Comments
Look at the evaluation kit designs, how they're laid out, how the MAX32855 is bypassed and the inputs are filtered. Look at your own setup and how the grounds are wired. Your ground wires may be too long. How are you wiring the MAX31855? How is it shielded if at all? Thermocouples are very low voltage devices and it doesn't take much for environmental noise to be coupled into the sensing circuitry.
That said, it seems to me the original MAX6675 code should still work up to a point and with small tweaks. Each bit still resolves to 0.25°C.
Are you saying your readings in that instance were jumping from 360 to 420 with nothing in between, or were those the extreme values in a scatter?
"own" fluctuation remains, but changes when touching Vss or Vdd now gone. So now I'm thinking, since I'm reading once in 250ms, let's do 4 readings, average them and feed to output?
red=alumel (-)
yellow=chromel (+)
You should be shifting the result two right for printing.
DEBUG result >> 2
The temperature is in the high most significant 14 bits, and the 2 least significant bits do other things. By including them you are accentuating the noise. The most significant bit is the sign, so at sub-zero temperatures you'd have to deal with that too.
Read fluctuation problem:
The line
THC=result>>5*/3200
Should look like
THC=result>>4
Then readings are stable and realistic.
And the temperature change sign change is caused by rapid heating I think. I was using hot air gun for heating, tried to heat with hands, it works much stable.
http://www.ebay.com/itm/Digital-Thermometer-K-Type-Thermocouple-2-Probe-Sensor-Metal-1300-C-2372-F-New-/200935431980?pt=LH_DefaultDomain_0&hash=item2ec8af5f2c&ssPageName=RSS:B:SHOP:US:101
I've modified the read procedure to look like this:
And sending the value of TCtemp to debug in the binary mode.
I'm getting the 13 bit reading, when according to datasheet, I should get 32 bits!
The bits D0, D1, D2, D3 work as they should do (i.e. detecting thermocouple absence, short to ground or vcc), but above them, I'm getting the "digital moise". Thermocouple is verified and works on factory made thermostat.
What might be the reason?
Then according to the data sheet (my inference) [/FONT][/SIZE]
degCouple = TCtemp1 >> 2 + (-TCtemp1.bit15 << 14)
Not 31. Too much Propeller-think! Not important for temperatures>0.
The internal reference temperature of the chip is measured with a bandgap circuit, not a thermocouple.
Try short circuiting the thermocouple inputs, pin 2 to pin 3 right at the chip. That simulates a thermocouple with its temperature equal to the reference. The two readings should be the same.
Caveat: I don't have one of those sensors, so I'm talking through my hat!
With the SPI it takes only a voltage divider between the Stamp outputs and the MAX' CS\ and CLK inputs.
The high-res ADC interfaces are a good option. TThe ADS1118 is another one to consider. It is bit simpler than the ones you mentioned, 8-pin tssop (msop) package, accommodates 2 thermocouples and has an internal temperature reference. There is a nice TI app note, sbaa189. I use the ADS1115 with the Propeller, which is the same chip but with an i2c interface (sans the internal temperature sensor).
Thermocouple is working properly, verified by connecting to industrial temp meter.
Have you tried shorting the T+ to T-? That is not an error condition. Zero volts at the input is what is expected when the thermocouple temperature equals the reference temperature. So, both of the readings should be the same. That is a quick check on operation. It should be stable.
The MAX31855 data sheet suggests that you include a differential capacitor of about 10nF between the thermocouple inputs, especially under conditions of electrical noise. That may help, or it may take more than that to filter noise at the inputs. Take a look at the app note I linked to in #28 for the ADS1118.
I understand that your thermocouple is working okay with the industrial temperature meter. The meter probably has a lot of filtering both analog and digital. The analog issue is fundamental and has to do with the limited common mode range of the measuring circuit. If external noise pickup exceedsthe common mode range, the readings will be crazy.
Are you operating from a battery, or from a power adapter? Looking back up in your description, you describe "not working" in relation to crazy readings when you dip the thermocouple in a kettle of boiling water. The kettle may increase the pickup of noise, so it is essential that the tip be insulated from direct conductive contact with the water. What about when the thermocouple is just sitting out in the open air? Still the same crazy readings? Your reflow oven will not have a kettle of boiling water, but the thermocouples will be immersed in a fairly intense AC electrical field.
I've soldered 10nf capacitor between thermocouple inputs and problem is gone! Previously, if I just touch the braid of thermocouple, readings were jumping all around, now they are stable. The electronic kettle problem was caused probably by stray current flowing trough the ground path. I've connected the kettle via extender which has no GND pin, so now kettle on/off does not affects reading. The boiling water measures 408-412, based on code you've provided and melting ice in water measures 24-26. How should I convert this to C ?