Dual Thermocoupler Input

DSC_0547

I wanted a box to handle two thermocoupler as input to my logging software. The problem with thermocouplers is that they are metal wires, this means there is electric connection from what they touch to the measurement circuit. The idea here was to add isolation from the PC and also between the two thermocouplers. I could do that with two multimeters with logging output and have used that before, but this time I decided to make a box that could do it.

Contents
    Dual Thermocoupler Input
    Requirements
        Schematic
        Circuit board
        Enclosure
    Libraries needed
    Software
        General commands
            *IDN?
            ERROR?
            SAVECONFIG
        Configuration
            ENABLE & ENABLE?
            LIMITS & LIMITS?
            OFFSET & OFFSET?
            SENSOR & SENSOR?
            SAMPLES & SAMPLES?
            MODE & MODE?
            CJTEMP & CJTEMP?
        Reading data
            TEMP?
            LIST & LIST?
    Testing and improving
    Testing with better thermocoupler
    Conclusion
    Notes and download


Requirements
Schematic

Schematic

First a search for possible chips at one vendor: Not that many different chips, the MAX31856 and MCP9600 was the most interesting types and because I wanted isolation the MAX31856 (A SPI bus is easy to isolate) looked like the best option.

The schematic was fairly easy to do, the chips I use for the isolation (ADuM1200/ADuM1201) is some I have used in another project, they are fast and works on both 5V and 3.3V. I used 5V to 5V isolation converters with a 3.3V regulator after them. Converters are usually not stabilized on the output and the voltage will vary with input voltage. With the external regulator I get precise and stable 3.3V. I had to use separate pins on the Arduino for MAX31856 outputs (SDI pin) and CS.
I added a status led and a connector for a display.
I added leds to the fault output on the MAX chip, they may be useful when testing.



Circuit board

pcb

I got some real thermocoupler connectors for circuit board montage, mine are designed for K type thermocoupler, this means the temperature reference is the point where the connector is soldered to the circuit board. I could have got some in copper that would move the point to the actual connection between the plug and the socket. I have used a copper area under the connector and chip to get the best possible heat equalization.

The DC-DC converters is a significant heat source and I placed them as far from the termocouplers as possible. The Arduino is also a heat source, but the socket reduces the heat transfer a bit.

For isolation the maximum distance is limited by the DC-DC converters and I made sure all other distance was larger than that.

The layout with Arduino micro usb on the left and the two termocoupler connectors on the top may not be ideal for distances, but means the PCB will fit in just about any box that is large enough.

DSC_9459

The MAX chip is rather small and it do not exist in a larger package. The two thermocoupler connectors are just enough over the edge of the PCB to go through the enclosure. They are also screwed down, making the very robust.

DSC_9460
DSC_9461
DSC_9462
DSC_9463


DSC_9464 DSC_9466

DSC_9465

DSC_9467



Enclosure

DSC_9469

I decided to mount a display, it increases the heat inside the box and for that reason I used a LCD display with very low power consumption.

DSC_9471

DSC_9472

DSC_9474 DSC_9475

I will replace the screws when I get some better looking ones (I have some hex socket button head on order).

DSC_9477

With two thermocouplers connected.



Libraries needed

My libraries:


Software

For the software I used a couple of my own libraries and implemented the same command interface I have used before.



General commands

*IDN?

This command returns the software name and version.



ERROR?

List errors for the two sensors. Each sensor can have multiple errors, to signal sensor two report it will use a comma.


SAVECONFIG

This saves the temperature sensor type, cold junction offset and samples for each sensor.



Configuration

In all configuration commands the first parameter selects sensor input to configure, the options are:


ENABLE & ENABLE?

Enable one or both temperature sensors. This only affect reports, not actual operation of the unit.
Code:

ENABLE 1
ENABLE 2
ENABLE B
ENABLE?


LIMITS & LIMITS?

Define fault/alarm/warning limits, when temperature is outside these limits an alarm will be shown and the ERROR? command will report it. There is no specific way to disable these limits, just place the limits outside normal operating range. The reading command will only show values for enabled channels.
Code:
LIMITS 1 -20 40
LIMITS B -30 100
LIMITS?


OFFSET & OFFSET?

Add a offset to the cold junction temperature, this can be used to calibrate the two channels to show same thermocoupler temperature.
Code:
OFFSET 1 -0.5
OFFSET B 0
OFFSET?



SENSOR & SENSOR?

Define thermocoupler type used, default is type K and when using type K connector other types are not recommended. For voltage input specify x8 or x32 as sensor type.
Code:
SENSOR 1 K
SENSOR 2 x8
SENSOR B x32
SENSOR?
In x8 mode it is possible to measure from -35mV to 110mV
In x32 mode it is possible to measure from -8.8mV to 27mV
Supported thermocouplers are: B, E, J, K, N, R, S, T



SAMPLES & SAMPLES?

Specify number of samples to average, the MAX31856 can do up to 16 values, after that I have added a running average of up to 64 values. The actual number of samples is specified as an index: With 16 samples there is a new value every 0.9 second, with 16+64 samples a 58 seconds averaging is added to that.
Code:
SAMPLES 1 4
SAMPLES 2 1
SAMPLES B 10
SAMPLES?



MODE & MODE?

The MAX31856 can operate in two modes, either on-demand (Sample) or automatic (Run). Without a connection to the DRDY pin it is not possible to know when a sample is done in automatic mode, the software will just do 5 samples each second. In on-demand mode the software can time conversions and will know when a sample is done.
This means that on-demand (Sample) is usual the best mode.

CJTEMP & CJTEMP?

The cold junction is usual measured inside the chip, but it is possible to store a fixed value. Use A to return to automatic, i.e. updating from internal temperature sensor.


Reading data

There is two modes for reading data, on for polling and one for automatic listing in a couple of formats.

TEMP?

This command will return two or four values depending on number of sensors enabled. It will be thermocoupler temperature followed by cold juntion temperature first for sensor 1 and then for sensor 2. Usually with 2 decimals, but in volt mode it is millivolt with 3 decimals.


LIST & LIST?

Using this command will switch to listing mode where the output can be directly saved to a file and used as input to PC programs. It will first list a header and then stream the data with one line each second. Any command (including invalid commands) will stop this listing. The command with or without question mark is exactly the same.
The 3 formats supported are:
Code:
LIST
LIST?
LIST ,
LIST ;




Testing and improving

After the software and hardware is working the first test is recording a few hours of stable temperature:

Test1

Temp1 & CJ1 uses 16+64 samples, Temp2 & CJ2 uses 16 samples. The extra running average looks very good at reducing noise.

But I did say something about stable temperature and it do not look very stable, sensor 1 register a internal temperature raise 4.9°C and sensor 2 of 3.7°C. This by itself it not a huge problem as long as it is close to the connector temperature, but temp1 shows an increase of about 1.4°C and temp2 of 1.0°C, this is a bit much.

The problem is the power dissipated in the enclosure, measuring the current I get about 110mA, this means 0.55W inside the box.
This splits roughly into Arduino 30mA, display 20mA and DC-DC converters 30mA each.

Temp7018

M1: 43.7°C, M2: 47.8°C, M3: 47.1°C, M4: 36.2°C, M5: 32.8°C, M6: 31.0°C, M7: 33.1°C, HS1: 51.4°C
A temperature photo of the circuit board after a couple of hours on time. As can be seen the two DC-DC converters are warm (47°C), on the Arduino the warmests part is a diode (51°C) followed by the processor (44°C). None of this would be a problem, except I need a PCB without temperature gradients.
This is very obvious when looking at the two MAX chips (31.0°C & 32.8°C), there above curve shows 1.2°C in difference.
Can I do something to improve this?

Checking my stock of DC-DC converters I found out that idle current varied between 22mA and 28mA. The two converters I used was 25mA and 28mA.
Replacing them by 22mA idle current converters and adding SLEEP mode (The sleep mode is active between millis interrupts, this means the processor spends 95% of the time in sleep) and disabling unused peripherals in the Arduino I got down to 95mA (92mA when not streaming data) current consumption.

DSC_9494

I did also move the converters away from the circuit board. This will not reduce the heat inside the box, but moves the heat away from the circuit board with the MAX chips on it.

Temp7020

M1: 38.8°C, M2: 36.3°C, M3: 36.4°C, M4: 29.1°C, M5: 28.9°C, HS1: 41.6°C
With the two converters move away the PCB is cooler and the temperature gradient is smaller, the difference between the two MAX chips is now only 0.2°C. Did this improve the curves?

Test2

The answer must be yes, but I still have nearly 1°C temperature change on temp1 at the start, most of it can be avoided if I let the box warm up for 20 minutes before using it.

Test3

Here I did a longer run (A night) with full averaging on both channels. On strange thing is that the two sensors are exactly the same.

TestSensorSwap

Swapping the sensors explains why. The reason temp2 needs a minute to recover (From 3 to 4 minute on scale) is the averaging.

DSC_0543

I had one more idea for improvement, add a thermo transfer pad between the PCB and the box. The stuff is easy to cut.

DSC_0545

Due to the distance between the PCB and the box I used two layers, in the layer nearest the PCB I cut holes for the solderings on the PCB.

DSC_0546

Both layers mounted. I did not remove the thin film on the bottom pad, this means worse heat transfer, but also that I can easily take the PCB out.

TestHeatpad4

A 21 hours test, with the heat pad the two MAX chips tracks perfectly in temperature, but I still have a nearly 1°C drift on the thermocouplers.
It looks like the box get heated about 3°C with the power I use in it.



Testing with better thermocoupler

I started getting suspicious about the termocouplers, could there be something wrong with them, more specific the connector. It is supposed to be made of the same alloy as the two wires to not generate any thermoelectric voltage. Could it be the cheap termocouplers just uses some cheap metal. Thinking that basically answered the question also.

DSC_0693 DSC_0694

I decider to get some expensive and high quality termocouplers.

DSC_0695
DSC_0696
DSC_0699
DSC_0700
DSC_0701

They are much better build quality with thicker wires and moulded connector with strain relief.

TestFluke

A 21 hours test and there is no temperature raise on the sensors when the box warms up, it was the faulty connectors. The MAX31856 nicely compensates for the warmer box. I did this curve with a 1 minute average to reduce the noise.

TestFlukeStart

There is still a 0.2°C temperature raise the first minute, I expect that is due to initialization and warm-up, the one minute may be related to my one minuted average.

TempTest

How precise is the MAX31856 chip? Here I compared it to a calibrator and it follows it nicely, except at very cold temperatures (The calibrator matches my DMM6500 within 0.3°C from -100°C to 800°C).
In the corrected column I have removed any cold junction mismatch between calibration and MAX chip. The error column is error in degrees Celsius.
The datasheet for the MAX31856 says it is within -0.13°C +0.12°C linearity error. The cold-junction is within +/-0.7°C and the Fluke thermocoupler is within +/-1.1°C, this means the total error is around +/-2°C on absolute temperature, but I have a very good resolution on temperature changes.



Conclusion

This project had a couple of problems, but they where solved in the end and the final result is everything I wanted. I can easily see 0.1°C temperature changes and the absolute reading is within 2°C. The small thermocouplers can be mounted on heat sinks or larger transistors and I do not have to worry about isolation (At least when working well below mains voltage).



Notes and download

If I am going to make more of these I will put a slot on the circuit board between the processor+DC-DC and the MAX31856 and try again with mounting the DC-DC on the circuit board. I will also keep the heat transfer pads and the metal enclosure.

pcbslot

The slot would be something like this. This would require moving some parts and rerouting part of the PCB.

Gerber
KiCad project
Arduino project with all libraries included in project folder

LED display driver library
MAX31856 thermo coupler library

TestController, can log data from this device