MAx6675 thermocouple and Micro:bit example

In this article we connect a MAX6675 to a Micro:bit

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.

The MAX6675 is available in a small, 8-pin SO package.

Key Features

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

Parts List

Name Link
Microbit Micro:bit Development Board,
Extension Board for BBC micro:bit Edge Breakout I/O Expansion Extension Board for BBC micro:bit
Connecting cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
Max6675 module MAX6675 Module + K Type Thermocouple Thermocouple Senso Temperature Degrees Module

Schematic

The part is not an exact match but the connection is the same, I also had a thermocouple with the MAX6675 which is not shown in this layout

microbit and max6675
microbit and max6675

Code

I used the following library as it worked with th emicro:bit and the ARduino IDE, you can import it via the library manager or download from https://github.com/YuriiSalimov/MAX6675_Thermocouple

[codesyntax lang=”cpp”]

#include <MAX6675_Thermocouple.h>

#define SCK_PIN 2
#define CS_PIN  1
#define SO_PIN  0

MAX6675_Thermocouple* thermocouple = NULL;

// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(9600);
  thermocouple = new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN);
}

// the loop function runs over and over again forever
void loop() {
  const double celsius = thermocouple->readCelsius();
  const double kelvin = thermocouple->readKelvin();
  const double fahrenheit = thermocouple->readFahrenheit();
  Serial.print("Temperature: ");
  Serial.print(String(celsius) + " C, ");
  Serial.print(String(kelvin) + " K, ");
  Serial.println(String(fahrenheit) + " F");
  delay(500);
}

[/codesyntax]

Output

Open the serial monitor and you will see something like this

Temperature: 26.50 C, 299.65 K, 79.70 F
Temperature: 26.75 C, 299.90 K, 80.15 F
Temperature: 26.50 C, 299.65 K, 79.70 F
Temperature: 26.50 C, 299.65 K, 79.70 F
Temperature: 27.00 C, 300.15 K, 80.60 F
Temperature: 27.75 C, 300.90 K, 81.95 F
Temperature: 27.25 C, 300.40 K, 81.05 F
Temperature: 27.50 C, 300.65 K, 81.50 F
Temperature: 28.00 C, 301.15 K, 82.40 F
Temperature: 28.00 C, 301.15 K, 82.40 F
Temperature: 28.25 C, 301.40 K, 82.85 F

 

Links

https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf

Leave a Comment

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :