4 channel K-Type Thermocouple USB interface and data logger
A while ago I created a Thermocouple USB interface with 4 channels that can record the data on a micro SDcard while also sending the measurement values to USB. It uses the MAX31855 ICs from Maxim (now Analog Devices) for connecting to the thermocouples. A Microchip SAMD21G18 microcontroller is used to process the data, connect to the sdcard and to connect to a PC via USB.
The original version uses regular screw terminals to connect to the thermocouples. Recently I also created a version with the typical pluggable connectors for connecting the thermocouples.
A thermocouple is a device that is used to measure temperature. It consists of two different types of metal wires, called dissimilar metals, that are joined at one end. When this junction is heated or cooled, it generates a small voltage that is proportional to the temperature difference between the two ends of the wires.
The cold junction of a thermocouple is the point where the two dissimilar metal wires of the thermocouple are connected to the measurement instrument or control system. It is called the cold junction because it is kept at a constant reference temperature, typically at room temperature, while the other end of the thermocouple is exposed to the environment being measured, which may be hotter or colder.
The voltage produced by the thermocouple is affected not only by the temperature difference between the hot and cold ends of the wires, but also by the temperature of the cold junction. To compensate for this, the voltage at the cold junction is measured using a independent temperature sensor. The instrument calculates the actual temperature at the hot end of the thermocouple by adding or subtracting the temperature of the cold junction.
The MAX31855 IC is a Cold-Junction Compensated Thermocouple-to-Digital Converter. This means, that the IC is able to measure the small voltage produced by a thermocouple precisely and calculate a temperature reading from it. This value is then corrected by the measured cold junction temperature.
The cold junction temperature is measured within the IC, so it is very important to make sure the actual cold junction is at the same temperature as the measurement IC. Any heat produced by the microcontroller or the voltage regulator could skew the measured temperature. Because of this, the PCB layout is critical. All components producing significant warmth have to be isolated from the measurement ICs. In my case it required adding a slot between the component groups
The code for the microcontroller is written with platformio using the Arduino framework. The software for this project is open source and can be found on Github.
There are two ways to use the device.
Standalone data logging requires a micro USB card formatted with FAT16 or FAT32. The logging configuration needs to be written as config.txt directly in the root folder of the SD card.
A template can be found in this repository: config.txt
There are three parameters in the config file.
- csv_delimiter: defines the character separating the entries
- decimal_separator: usually . or ,
- logging_interval: logging interval in seconds
Write the config file to the root folder of the SD card. Insert the SD card into the slot of the board.
Once powered up, the data logging starts when the start/stop button gets pressed.
The LED blinks briefly each time when a new data point is recorded.
Another button press stops the data logging.
USB data acquisition
The sensors can be read using SCPI style commands.
The following commands are supported:
- *IDN? Returns the device id string, something like “MAX31855USB,v1.0”
- :TEMPerature? Returns the temperature of the connected sensors. The values are separated by ,.
- :TEMPerature:INTern? Returns the internal temperature of the MAX31855 chips. The values are separated by ,.
A python library for data acquisition and an example of how to read the sensors can be found in the python folder of this repository.