Page 1 of 1

MAX6675 "K-Thermocouple-to-Digital Converter"

Posted: Mon Sep 10, 2012 2:23 pm
by Enamul
Hi,
I have requested by some users to post SPI communication using MAX6675 "K-Thermocouple-to-Digital Converter" to read temperature data. This post uses the linked pdf for device information..
http://www.sparkfun.com/datasheets/IC/MAX6675.pdf
The MAX6675 performs cold-junction compensation and digitizes the signal from a type-K thermocouple. The data is output in a 12-bit resolution, SPI™-compatible, read-only format.

Temperature Conversion:
The MAX6675 includes signal-conditioning hardware to convert the thermocouple’s signal into a voltage compatible with the input channels of the ADC. The T+ and Tinputs connect to internal circuitry that reduces the introduction of noise errors from the thermocouple wires.
Before converting the thermoelectric voltages into equivalent temperature values, it is necessary to compensate for the difference between the thermocouple cold-junction side (MAX6675 ambient temperature) and a 0°C virtual reference. For a type-K thermocouple, the voltage changes by 41µV/°C, which approximates the thermocouple characteristic with the following linear
equation:
Vout = (41µV / °C) ✕ (Tr - Tamb)
Where:
Vout is the thermocouple output voltage (µV).
Tr is the temperature of the remote thermocouple junction (°C).
Tamb is the ambient temperature (°C)

Interface Protocol:
MAX6675.PNG
(19.95 KiB) Downloaded 5146 times
Output Format:
output_6675.PNG
(12.34 KiB) Downloaded 5146 times
Data read:
The MAX6675 processes the reading from the thermocouple and transmits the data through a serial interface. Force CS low and apply a clock signal at SCK to read the results at SO. Forcing CS low immediately stops any conversion process. Initiate a new conversion
process by forcing CS high. Force CS low to output the first bit on the SO pin. A complete serial interface read requires 16 clock cycles.
Read the 16 output bits on the falling edge of the clock. The first bit, D15, is a dummy sign bit and is always zero. Bits D14–D3 contain the converted temperature in the order of MSB to LSB. Bit D2 is normally low and goes high when the thermocouple input is open. D1 is low to provide a device ID for the MAX6675 and bit D0 is three-state.

Here I have attached the program considering 16-bit SPI read and output format. But to have accurate temperature conversion user need to calibrate with respective thermocouple.

Re: MAX6675 "K-Thermocouple-to-Digital Converter"

Posted: Mon Sep 10, 2012 6:34 pm
by stasiks
Thank you very much.
I'd like to understand how to handle data when MAX6675 transmit 16 bits to read 1bit is used command 'AND 0x02 ",to read 2 bits" AND 0x04 "and the other 15 bit " AND 0x7FF8 ".
I have understood correctly?

Re: MAX6675 "K-Thermocouple-to-Digital Converter"

Posted: Mon Sep 10, 2012 6:46 pm
by Enamul
Hi,
Actually to detect whether any thermocouple is connected or not, I have used..

Code: Select all

(DATA AND 0x04)=0x04
If this is true, in that case the thermocouple is open otherwise it's connected.
TEMP is from Bit3 to bit14; that's why I have right shifted whole TEMP 3 times to get bit3 in LSB and also made higher 4 bit to zeros so that I get 12 bit temperature value in TEMP variable.

Code: Select all

TEMP = (DATA>>3)
TEMP = TEMP AND 0x0FFF

Re: MAX6675 "K-Thermocouple-to-Digital Converter"

Posted: Mon Sep 10, 2012 7:07 pm
by stasiks
Understood if I want to check a particular bit value using the command "(DATA AND 0x04) =0x04" and to read 12bit data shall be removed first three bits "TEMP = (DATA >> 3)", and refer that there are 12 bits read "TEMP = TEMP AND 0x0FFF"
Thank you very much :D