ST Nucleo and MAX6675 example

100

In this example we take a look at the MAX6675 Cold-Junction-Compensated K-Thermocouple-to-Digital Converter and connect it to a Nucleo-F334R8

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

 

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

Vcc connected to 3v3
Gnd connected to Gnd
SO Connected Pin 12
SS/CS connecetd to Pin 10
CSK connected to Pin 13

Code

You will need to import the MAX6675 library into the mBed compiler – https://developer.mbed.org/users/tecnosys/code/max6675/

 #include "mbed.h"
#include "max6675.h"
 
SPI spi(D11,D12,D13);
max6675 max(spi,D10);
 
Serial pc(USBTX,USBRX);
 
int main() {
 
    while (1) {
    
        float temp = max.read_temp();
        pc.printf("\n\rT: %f",temp );
       
        wait(1);
    }
 
 
}

 

Results

 

T: 22.750000
T: 22.500000
T: 22.500000
T: 22.500000
T: 22.750000
T: 23.500000
T: 24.250000

 

Links

You can pick up the module and a thermocouple for about $3

MAX6675 K-type Thermocouple Temperature Sensor Temperature 0-800 Degrees Module Free Shipping

Share