Home Code MAX6675 and Arduino example

MAX6675 and Arduino example

by shedboy71

In this example we take a look at the MAX6675 Cold-Junction-Compensated K-Thermocouple-to-Digital Converter

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.
This converter resolves temperatures to 0.25°C, allows readings as high as +1024°C, and exhibits thermocouple accuracy of 8 LSBs for temperatures ranging from 0°C to +700°C.

Key Features

Cold-Junction Compensation
Simple SPI-Compatible Serial Interface
12-Bit, 0.25°C Resolution
Open Thermocouple Detection

Usually you use these in a breakout/module form and can also purchase a kit which includes a thermocouple. Here is a picture of the module that I purchased

MAX6675 module

MAX6675 module

Here are the connections , sometimes these are named differently on the modules, in particular the CS connection

Vcc connected to 5v
Gnd connected to Gnd
SO Connected Pin 8
SS/CS connecetd to Pin 9
CSK connected to Pin 10

Code

You will need the MAX6675 library – https://github.com/adafruit/MAX6675-library

[codesyntax lang=”cpp”]

#include "Max6675.h"
 
Max6675 ts(8, 9, 10);
// Max6675 module: SO on pin #8, SS on pin #9, CSK on pin #10 of Arduino UNO

void setup()
{
  ts.setOffset(0);
  // set offset for temperature measurement.
  Serial.begin(9600);
}
 
void loop()
{
  Serial.print(ts.getCelsius(), 2);
  Serial.print(" C / ");
  Serial.print(ts.getFahrenheit(), 2);
  Serial.print(" F / ");
  Serial.print(ts.getKelvin(), 2);
  Serial.print(" Kn");
  Serial.println();
  delay(2000);
}

[/codesyntax]

 

Results

Open the serial monitor window and you should see something like this

24.00 C / 75.20 F / 259.15 Kn
24.00 C / 75.20 F / 259.15 Kn
25.50 C / 77.90 F / 260.65 Kn
26.75 C / 80.15 F / 261.90 Kn
27.50 C / 81.50 F / 262.65 Kn
27.25 C / 81.05 F / 262.40 Kn

 

Links

You can pick up the module and a thermocouple for about $15
MAX6675 thermocouple sensor type K thermocouple module , thermoelectric coupling electrode

Share

You may also like