As a main temperature measuring element, thermocouple has the characteristics of simple structure, easy manufacture, convenient use, wide temperature measurement range and high temperature measurement accuracy. However, there are some problems in the application of thermocouple in embedded system based on MCU. ① Nonlinearity: the relationship between the output thermoelectric potential of thermocouple and temperature is nonlinear, so it must be linearized in application. ② Cold compensation: the thermoelectric potential output by thermocouple is the potential difference between the cold end and the measuring end when the cold end is kept at 0 ℃. In practical application, the temperature of the cold end changes with the ambient temperature, so cold junction compensation is needed. ③ Digital output: the interface with embedded system must adopt digital output and digital interface, and thermocouple as analog small signal temperature measuring element can directly meet this requirement. Therefore, if the thermocouple is used in embedded system, the hardware and software design of complex signal amplification, a / D conversion, look-up linear line, temperature compensation and digital output interface must be carried out. If the above functions can be integrated into an integrated circuit chip, that is, using a single chip to complete the functions of signal amplification, cold junction compensation, linearization and digital output, the application design of thermocouple in embedded field will be greatly simplified.
Maxim’s MAX6675 is a thermocouple amplifier and digital converter integrated with thermocouple amplifier, cold junction compensation, a / D converter and SPI serial port.
1. Performance characteristics
The main characteristics of MAX6675 are as follows:
① Simple SPI serial port temperature value output;
② The temperature range of 0 ℃ to + 1024 ℃;
③ 12 bit resolution of 0.25 ℃;
④ On chip cold end compensation;
⑤ High impedance differential input;
⑥ Thermocouple broken wire detection;
⑦ Single + 5V supply voltage;
⑧ Low power consumption characteristics;
⑨ The working temperature range is – 20 ℃ to + 85 ℃;
⑩ 2000V ESD signal. The device adopts 8-pin so chip package. The pin arrangement is shown in Figure 1, and the pin functions are listed in Table 1.
2. How it works
The internal structure of MAX6675 is shown in Figure 2. The device is a complex single-chip thermocouple digital converter, which has signal conditioning amplifier, 12 bit analog / digital thermocouple converter, cold junction compensation sensing and correction, digital controller, one SPI compatible interface and one related logic control.
2.1 temperature conversion
MAX6675 has a signal regulating amplifier which converts thermocouple signal into compatible voltage with ADC input channel. T + and t-inputs are connected to low noise amplifier A1 to ensure high accuracy of detection input and isolate thermocouple connecting wire from interference source. The thermoelectric potential from the thermocouple is amplified by low noise amplifier A1, buffered by A2 voltage follower, and then sent to the input of ADC. Before converting the temperature and voltage value to the equivalent value, it needs to compensate the cold junction temperature of thermocouple. The cold junction temperature is the difference between the ambient temperature of MAX6675 and the actual reference value of 0 ℃. For K-type thermocouple, the voltage change rate is 41 μ V / ℃, and the voltage can be approximated by the linear formula Vout = (41 μ V / ℃) × (TR tamb). In the above formula, Vout is the thermocouple output voltage (MV), TR is the temperature of the measuring point, and tamb is the ambient temperature.
2.2 cold end compensation
The function of thermocouple is to detect the temperature difference between hot and cold ends. The temperature of hot node of thermocouple can change from 0 ℃ to + 1023.75 ℃. The temperature around the circuit board installed with MAX6675 at the cold end varies from – 20 ℃ to + 85 ℃. When the cold end temperature fluctuates, MAX6675 can still accurately detect the temperature change of the hot end.
MAX6675 detects and corrects ambient temperature changes through cold junction compensation. The device can convert the ambient temperature into temperature compensation voltage through the internal temperature detection diode. In order to generate the actual thermocouple temperature measurement value, MAX6675 measures the voltage from the thermocouple output and the detection diode output. The internal circuit of the device transfers diode voltage and thermocouple voltage to ADC to calculate the hot junction temperature of thermocouple. When the temperature of the cold end of the thermocouple is equal to the chip temperature, MAX6675 can obtain the best measurement accuracy. Therefore, it is necessary to avoid placing heating devices or components near MAX6675 in practical temperature measurement applications, because this will cause cold junction error.
2.3 thermal compensation
In temperature measurement applications, the chip self heating will reduce the temperature measurement accuracy of MAX6675. The error size depends on the thermal conductivity, installation technology and ventilation effect of MAX6675 package. In order to reduce the measurement error caused by chip self heating, large area grounding technology can be used to improve the temperature measurement accuracy of MAX6675.
2.4 noise compensation
The measurement accuracy of MAX6675 is sensitive to power coupling noise. In order to reduce the influence of power supply noise, a 0.1 μ f ceramic bypass capacitor can be connected near the power pin of MAX6675.
2.5 improvement of measurement accuracy
The measurement accuracy of the thermocouple system can be improved by the following preventive measures: ① use the large cross-section wire which can not dissipate heat from the measurement area as far as possible; ② if it is necessary to use the small cross-section wire, it can only be applied in the measurement area, and the expansion wire can be used in the area without temperature change rate; ③ avoid the mechanical extrusion and vibration that can tension the wire; ④ when the thermocouple is far away, double section wire should be used Stranded wire is used as thermocouple wire; 5) thermocouple wire is used within the temperature rating range; 6) sharp temperature change is avoided; 7) proper protective sleeve is used to ensure thermocouple wire in severe environment; 8) expansion wire is used only in low temperature and small change rate area; 9) event record and continuous record of thermocouple resistance are maintained.
SPI serial interface
MAX6675 uses standard SPI serial peripheral bus to interface with MCU, and MAX6675 can only be used as a slave device. The format of output temperature data of MAX6675 so terminal is shown in Fig. 3, and the timing of MAX6675 SPI interface is shown in Fig. 4. The process of MAX6675 outputting data from SPI serial interface is as follows: MCU makes CS lower and provides clock signal to SCK, so reads measurement results. A lower CS will stop any conversion process; a higher CS will start a new conversion process. A complete serial interface read operation requires 16 clock cycles, and 16 output bits are read at the falling edge of the clock. The first and the 15th bits are pseudo flag bits and are always 0; the 14th to 3rd bits are the conversion temperature values arranged in the order of MSB to LSB; the second bit is usually low, and it is high when the thermocouple input is open. The open thermocouple detection circuit is fully realized by MAX6675, which is open thermocouple detection For device operation, t-must be grounded, and the enabling site should be as close to GND pin as possible; bit 1 is low to provide MAX6675 device identity code, and bit 0 is tri state.
3. Application of temperature measurement
The specific method of MAX6675 applied to embedded system is given below. Taking AT89C2051 single chip microcomputer as an example, the temperature measuring circuit composed of MAX6675 and single chip microcomputer interface and the corresponding temperature value reading and conversion program are given.
MAX6675 is a single-chip digital thermocouple amplifier. It doesn’t need any external components when it works. In order to reduce the power coupling noise, a capacitance of 0.1 μ f is connected before the power pin and ground terminal.
The interface circuit between MAX6675 and AT89C2051 is shown in Figure 5.
Because AT89C2051 does not have SPI bus interface, this paper uses the method of simulating SPI bus to realize the interface with MAX6675. Among them, P1.0 simulates the miso of SPI, P1.1 simulates the serial clock output of SPI, P1.2 simulates the slave selection terminal of SPI. The corresponding temperature reading program and data conversion program are given below.
; temperature reading program
; bit definition
So bit t1.0; data input
CS bit P1.1; slave selection
SCK bit P1.2; clock
; data byte definition
Datah data 30h; read high bit of data
Data data 31h; read data low bit
Tdatah data 32H; high temperature
Tdatal data 33H; low temperature
; reading temperature value subroutine
Ready: CLR CS; stops conversion and outputs data
CLR CLK; clock down
RLC a; read d15-d8 high 8-bit data
Mov datah, a; save the high 8-bit data read
Readl: mov C, so; read d7-d0 low 8-bit data
Mov data, a; save the read low 8-bit data
; start another conversion process
The data conversion subroutine converts the read 16 bit data into 12 bit temperature value and removes the useless bits.
The whole data is shifted to the right by 1 bit,
Mov a, datah; to remove D15 pseudo log bit
Swap a; swap the high and low 4 bits of data in datah
Mov B, a; data is temporarily stored in B
Mov a, ා 0Fh; d11-d8 and d15-d12 positions 0
Mov tdatah, a; the converted data is sent to high temperature
Mov a, B; take out d7-d4 of temperature value
ANL A, #0F0H
Mov B, a; temporary B
Anl a, ා 0f0h; take out D3 ～ d0 of temperature value
ORL a, B; merge into low order byte
Mov tdatal, a; the converted data is sent to high temperature
MAX6675 focuses on one chip to solve the problems of complex linearization, cold junction compensation and digital output in the application of thermocouple temperature measurement. It simplifies the complex hardware and software design when the thermocouple temperature measurement scheme is applied to the field of embedded system. Therefore, the device is an ideal choice for the application of thermocouple temperature measurement scheme in the field of embedded system.
Editor in charge: GT