Shop OBEX P1 Docs P2 Docs Learn Events
Thermocouple measurement — Parallax Forums

Thermocouple measurement

ManAtWorkManAtWork Posts: 2,078
edited 2015-01-18 06:12 in Propeller 1
I plan to make a propeller based reflow oven controller. To measure high temperatures (up to 300°C) I have to use thermocouples. I think I'll use the LTC2440 as ADC. It has enough resolution to measure the thermo voltage directly without pre-amplifier, so I can get rid of any offset and calibration problems.

But as thermocouples only measure relative temperatures I have to add an absolute temperature sensor for cold junction compensation. What is the preferable device for this? The LM75B would be nice as it has an I²C interface and doesn't require any extra pins but can be connected to pins 28/29 where the EEPROM already is connected. It is cheap but has relatively poor accuracy (+/-2° in the -25 to +100°C range).

I have seen there is a TMP102 object in the OBEX and a DS2760 thermocouple kit. The TMP102 looks good but when I look at the datasheet of the DS2760 it shows a Li battery monitor that has nothing to do with a thermocouple, IMHO.

I have to read at least 6 thermocouples. There is a 4-input version of the LTC2440 but as I need 6 I think I'd better handle multiplexing externally. (The 8 channel versions are single ended, only) Has anybody already done something similar. What would you suggest?
«1

Comments

  • JonnyMacJonnyMac Posts: 8,927
    edited 2014-03-20 05:05
    I wrote some code for an industrial HVAC system a few years ago. They went with the MAX31855 for each input (six). To minimize Propeller pin use, an MCP32017 (I2C, connected to P28/29) was used for chip selects and low-speed IO. The net effect was only three IOs used (MOSI, MISO, SCLK) and after the chip selects they had 10 extra low-speed IOs. I've attached the object for that chip in case this solution is of interest.
  • TCTC Posts: 1,019
    edited 2014-03-20 05:44
    I am doing the exact same thing as you, making a Propeller based reflow oven.

    I agree with JonnyMac. The MAX31855 is a great chip. it takes care of the cold junction for you. and outputs a 14-bit value for your thermocouple temperature. Evey bit is equaled to .25ºC.

    I got these for mine. Maxim made them and tested them, so I know they would work right out of the box. They even came with a thermocouple wire in the box.
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-03-20 08:00
    I must admit I haven't told you the complete truth...:innocent: My one and only Zevatech oven wouldn't justify the development of the controller, alone. As a side effect, I thought it could be also useful for this project.
    biggrin.gif


    I agree that the MAX31855 is a nice chip for a single (or low number of) thermocouple(s). But I'd prefer a general purpose ADC so that I can also connect other sensors (pressure, vibration, strain gauges) later for the turbine or other projects.

    BTW, Maxim makes different versions of the chip for 7 different types of thermocouples?
    pillepalle.gif
    What a waste of money, time and stock space. A uP could easily select the type if they assigned an SDI to the DNC pin. If Parallax had those resources, they'd had the P2 out years ago.
    23 x 15 - 1K
    15 x 15 - 173B
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-03-20 10:43
    I've used thermocouples extensively in projects with the ADS1115. It is a 16 bit sigma-delta with 4 configurable inputs. I've used it with channel 3 as reference and channels 1, 2, and 3 for sensors, but for lower noise it can be two thermocouples straight differential on channels 0/1 and 2/3. I've mounted a TMP102 right next to it for temperature compensation. TI also sells the ADS1118, which is meant specifically for thermocouples and has an internal temperature sensor. It has a nice ap-note, sbaa189.pdf. If this is your first time using thermocouples, be sure to read up and ask questions!
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-03-21 04:04
    Thanks, Tracy, for the app-note, it's very informative. Well, the cold junction isothermal issue sounds quite logical, also the layout considerations. What's new to me is that you have to perform polynomial correction (or lookup table linear interpolation as suggested in the app-note) to compensate non-linear effects. I've found theese tables.
  • Mark_TMark_T Posts: 1,981
    edited 2014-03-21 05:16
    I've used thermocouples extensively in projects with the ADS1115. It is a 16 bit sigma-delta with 4 configurable inputs. I've used it with channel 3 as reference and channels 1, 2, and 3 for sensors, but for lower noise it can be two thermocouples straight differential on channels 0/1 and 2/3. I've mounted a TMP102 right next to it for temperature compensation. TI also sells the ADS1118, which is meant specifically for thermocouples and has an internal temperature sensor. It has a nice ap-note, sbaa189.pdf. If this is your first time using thermocouples, be sure to read up and ask questions!

    The temperature sensor should be "right next to" the cold junction, not the ADC. The cold junction is where the thermocouple
    wires bond to copper wires - the t'couple I have sitting here has spade terminals, so the cold junction is actually the crimped-on
    spades, which might be on the outside of the box, not the warm circuit board inside the enclosure, which would give significant
    error in fact! I presume screw terminals mounted on the PCB would be a good compromise, then the thermal sensor can be
    right next to the terminal block (and away from any sources of heat like voltage regulators).
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-03-21 08:23
    I agree, my terminals are mounted on the circuit board right next to the ADC and temperature sensor. The whole thing is mounted inside an enclosure, so the thermocouple leads have to come in from outside into the more uniform environment. Hot components on the circuit board are another no-no, which would generate a thermal gradient on the board itself.

    Devices like the MAX31855 and AD595 do cold junction compensation, but AFAIK they don't do linearity correction. The MAX31855 claims +/- 2 degrees over the range of -200 to +700 °C for type K, or +/- 6°C over -270 to +1370 °C, but the specs are a bit dodgy, always, "Note 4: Not including cold-junction temperature error or thermocouple nonlinearity."

    The DS2760 is (discontinued? was) intended as a battery management IC. It includes a high gain amplifier with a narrow span that was intended for current sensing but made it suitable for a thermocouple. Parallax sold a kit for a while.
  • evanhevanh Posts: 15,192
    edited 2014-03-22 10:05
    At higher temperatures, Type N is the more modern stabilised replacement for Type K.
  • LawsonLawson Posts: 870
    edited 2014-03-22 17:05
    Mark_T wrote: »
    the t'couple I have sitting here has spade terminals, so the cold junction is actually the crimped-on
    spades, which might be on the outside of the box, not the warm circuit board inside the enclosure, which would give significant
    error in fact!

    Huh, most of the thermocouple connectors I've see are made out of the same material as the thermocouple wire to specifically avoid extra junctions. I.e. with copper-constantan (T-type) wire you use a set of terminals with copper and Constantan contacts. (i.e. also use T-type terminals)

    Marty
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-03-23 10:22
    It's a funny thing though, many multimeters come with an option for temperature, which is usually a K thermocouple mounted on dual banana plugs, to go into the voltage input. I suppose the junctions quickly reach equilibrium, because the reference temperature has to be measured on the circuit board inside. Specialty temperature measurement instrumentation does use the $$ connectors made of matching thermocouple metals.
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-03-31 04:14
    I just finished placement of the layout:
    ReflowRegler.png

    The board size is 100x100mm. The gap in the middle is to install a "heat shield" between the analogue part on the left side and the power output stages (top right) and voltage regulators (bottom right).
    892 x 839 - 126K
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-03-31 10:55
    Nice. What chips did you end up using for the thermocouples and the reference?
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-03-31 23:25
    I use the LTC2440 as ADC and the LT1236-5 as voltage reference, two MAX4638 as multiplexers and the TMP102 as cold junction reference. I know... why do I ask when I don't take advice?:innocent: But sometimes you have to hear a second opinion to know the first choice was right. I'd like to have "universal" inputs so I can use different kinds of sensors or do the linearisation calculations on my own.

    The other features are:
    • 12 digital outputs 250mA@24V (VNQ860 automotive lamp drivers)
    • 4 digital inputs (24V) for (proximity) switches
    • one encoder input / speed sensor
    • one analogue output (belt speed, 0..5V for VFD)
    • wide range (10..40V) input SMPS, LMR14206 as pre-regulator + LDOs
    • keyboard and VGA connectors
    • 4 servo outputs
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-04-01 09:42
    It sounds good, a nice application board! I too like the versatility of the high resolution general purpose ADC.

    I'm attaching my thermocouple object, in case it might help with the linearization/compensation. It is set up with a table for the K thermocouple. There is a PUB degC_to_uV(refTemp), which converts the reference temperature to the equivalent µV that a K couple would produce at that temperature. That is a direct lookup/interpolation in the table. Then there is a PUB compensate(refuV, hotuV), which takes the reference µV from the first step and combines it with the µV reading from thermocouple. That is a lookdown with interpolation in the same table. The PUB temperature(refTemp, hotuV) is a direct chaining of the two operations that returns °C to tenths.
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-04-03 08:22
    Thank you very much for your code, Tracy. I'll test it as soon as I have finished the hardware which might take some weeks.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-04-03 16:30
    Hi Tracy;
    It sounds good, a nice application board! I too like the versatility of the high resolution general purpose ADC.

    I'm attaching my thermocouple object, in case it might help with the linearization/compensation. It is set up with a table for the K thermocouple. There is a PUB degC_to_uV(refTemp), which converts the reference temperature to the equivalent µV that a K couple would produce at that temperature. That is a direct lookup/interpolation in the table. Then there is a PUB compensate(refuV, hotuV), which takes the reference µV from the first step and combines it with the µV reading from thermocouple. That is a lookdown with interpolation in the same table. The PUB temperature(refTemp, hotuV) is a direct chaining of the two operations that returns °C to tenths.
    Have you considered using polynomial equations to do thermocouple conversions?
    See ITS-90 Thermocouple Direct and Inverse Polynomials.
    It would be nice if the polynomials would fit into 32bit integer math.
    I suspect one doesn't need to use all the polynomials.

    Just a thought.

    Duane J
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-04-04 10:03
    I thought about using the polynomials, but not for very long! It would need to implement both the direct and inverse cases. It should be pretty easy to do that with floating point, but who'd like to take it on in integer math :innocent:? If the FP machinery is in place, the polynomial code would probably occupy less memory than the look-up table, and it could easily accommodate different thermocouple types with a change of coefficients. I usually don't have the floating point object loaded though. The table look-up is quick and easy.
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-04-10 07:33
    Routing finished.
    ReflowRegler2.png
    890 x 839 - 154K
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-05-07 03:09
    The PCB is ready:
    ThermoCon-Prototyp.jpg

    The cold junction temperature sensor (TMP102) and the ADC (LTC2440) are already working. What caused me some headache is that the LTC2440 seems to have a bug, it doesn't ignore SCLK pulses while chip select is inactive and the converter is ready. Although the data sheet does nowhere guarantee that SCLK is allowed to toggle while /CS is high, I think, calling that pin "chip select" should imply that assumption.:frown:

    As I share SCLK, SDI and SDO signals with the IO expansion shift registers to save propeller pins this results in the restriction that I can only drive the shift registers while the ADC is busy. But toggling the serial bus signals while the conversion is in progress adds noise to the analogue inputs. So I only have 22 instead of 24 usable bits. This is around 1.2µV Resolution which means much better than 0.1°C with a type K or J thermocouple.
    1014 x 760 - 136K
  • ManAtWorkManAtWork Posts: 2,078
    edited 2014-05-07 09:41
    Good news: The conversion of the ADC output to °C units including cold junction compensation is also working. Thanks to Tracy Allen for the CJCK object (table based conversion) and photomankc for the TMP102 object! I modified them slightly to support type J thermocouples and negative temperatures.

    The whole board is highly specialized for my existing Zevatech reflow oven, so I think it doesn't fit very well for anybody else and it doesn't make sense to put it to OBEX. However, if anybody is interested I could post schematics and source code (when it's finished).
  • artkennedyartkennedy Posts: 174
    edited 2014-05-17 00:47
    Hi Tracy. I was searching the forum for references to the ADS1115 and . . . here I am. I am attempting to use this chip which I bought on a tiny board by adafruit. I'm working with it in Tachyon. I've written some code and had some success at first but then not so much.
    At first I was writing successfully to the configuration register and then started to fail without seeming to have changed anything. Do you have any example code for reading and writing the registers that would help me check my work?

    I've used thermocouples extensively in projects with the ADS1115. It is a 16 bit sigma-delta with 4 configurable inputs. I've used it with channel 3 as reference and channels 1, 2, and 3 for sensors, but for lower noise it can be two thermocouples straight differential on channels 0/1 and 2/3. I've mounted a TMP102 right next to it for temperature compensation. TI also sells the ADS1118, which is meant specifically for thermocouples and has an internal temperature sensor. It has a nice ap-note, sbaa189.pdf. If this is your first time using thermocouples, be sure to read up and ask questions!
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2014-05-17 09:12
    Sure. Attached, ADS1115 object in Spin.
  • nomorebotsnomorebots Posts: 6
    edited 2015-01-15 17:48
    Has anyone used a TMP102 with a k-type thermocouple to measure things? Are there any help or example out there? So far I've only found examples on the TMP102 by itself.

    Thanks.
  • kwinnkwinn Posts: 8,697
    edited 2015-01-16 06:28
    The TMP102 is a single chip temperature measurement system with a built in sensor. No way to add a thermocouple to it. You need one of the chips designed to work with a thermocouple.
  • ManAtWorkManAtWork Posts: 2,078
    edited 2015-01-16 06:52
    Hello Momorobots,

    if you only have to handle one thermocouple then an all-in-one-chip solution like the MAX31855 (see post #2) would be better, I think. I use a general purpose high resolution ADC plus a TMP102 for the cold junction compensation because I wanted to be more flexible about the types of sensors. This way I could also connect strain gauges or pressure sensors or different types of thermocouples with the same board.
  • bte2bte2 Posts: 154
    edited 2015-01-17 05:28
    ManAtWork wrote: »
    but can be connected to pins 28/29 where the EEPROM already is connected.

    Not trying to speak out of turn, and certainly off-topic, but as much as possible I don't connect additional hardware to those pins. When I started with the Propeller, I would do the usual things that people do with those pins, and I hung a Wii Nunchuk on them too, but then it occurred to me that any hardware failure on those pins could eliminate the ability of the Propeller to load any program. I wondered what might happen if my little Nunchuk's cord got damaged somehow, and I stopped using those pins for my stuff.

    I'm not completely neurotic about it, just something that I try to consider.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-01-17 05:47
    bte2 wrote: »
    Not trying to speak out of turn, and certainly off-topic, but as much as possible I don't connect additional hardware to those pins. When I started with the Propeller, I would do the usual things that people do with those pins, and I hung a Wii Nunchuk on them too, but then it occurred to me that any hardware failure on those pins could eliminate the ability of the Propeller to load any program. I wondered what might happen if my little Nunchuk's cord got damaged somehow, and I stopped using those pins for my stuff.

    I'm not completely neurotic about it, just something that I try to consider.

    Well that might not be neurotic for something that extends the I2C pins over a flexible cable that is constantly being jerked through the air but to apply it to ANYTHING ELSE on the bus is illogical. I2C was originally designed for use within a TV chassis, so between boards and tuner etc, and all this was within one protected assembly, no problem there. I just think that if you quote one extreme use as justification for or against then you are not being realistic or practical, you need to have a balanced holistic view.

    One of the things I tend to be "neurotic" about is this tendency to have this one single big 3.3V regulator powering the CPU and all the peripheral chips on and off board. There is no sense in that, and a fault or noise on that line will affect the CPU. Much easier and better and just as cheap to have multiple smaller regulators close to where they are needed and if a peripheral overloads its 3.3V line then at least the CPU can continue to operate and take appropriate action. With one single big regulator you have no recourse.

    EDIT: My apologies if this is a little OT
  • kwinnkwinn Posts: 8,697
    edited 2015-01-17 07:39
    @ Peter and bte2

    Both of you have valid points for the particular situations you refer to. No point in wasting pins if you can use one I2C connection for multiple peripherals as long as it can be done safely. OTOH once you start running cables outside of an enclosure the risk of damage goes up, particularly if the cable has higher voltage signal or power conductors in it. In the case of pins on the propeller a +5V supply shorting to the I2C conductors would be bad. Even cable in conduit is vulnerable. I had a card reader on a post outside an entrance door stop working and found the wires for the Weigand zero and one signals were shorted together. Looked like the building settled and crushed the conduit.

    @Peter

    Like you, I prefer to put small regulators on each board rather than have a single one for all of them. Must be a holdover from the S100 days. It makes sense though, since it enhances heat removal, increases reliability, and allows for more flexible modular systems.
  • bte2bte2 Posts: 154
    edited 2015-01-17 17:05
    kwinn wrote: »
    @Peter

    Like you, I prefer to put small regulators on each board rather than have a single one for all of them. Must be a holdover from the S100 days. It makes sense though, since it enhances heat removal, increases reliability, and allows for more flexible modular systems.

    I've been doing that more and more lately myself.
  • dbpagedbpage Posts: 217
    edited 2015-01-18 06:12
    ManAtWork wrote: »
    Thanks, Tracy, for the app-note, it's very informative. Well, the cold junction isothermal issue sounds quite logical, also the layout considerations. What's new to me is that you have to perform polynomial correction (or lookup table linear interpolation as suggested in the app-note) to compensate non-linear effects. I've found theese tables.


    I recommend the following:
    1. To compensate from non-linearities with a lookup table, interpolate using straight line linear or polynomial segments of unequal lengths instead of one polynomial for large temperature ranges. Polynomials that are tweaked for each segment can improve accuracy, but straight line segments can achieve adequate accuracy by using small enough segments
    2. Average the thermocouple readings over a time period equal to one cycle of 60 Hz (50 Hz in Europe) to achieve very high noise immunity
Sign In or Register to comment.