Wemos D1 and MAX6676 Thermocouple

It took me a while to find out how to connect MAX6676 to Wemos D1 to read temperature. Many references suggested to use Wemos D1 pins D6-D8 but this fails. Following pinout works:

  • D5 – SCK
  • D6 – CS
  • D7 – S0

Here is the sample code with correct pin definitions:

/*
  Average Thermocouple
  Reads a temperature from a thermocouple based
  on the MAX6675 driver and displays it in the default Serial.
  https://github.com/YuriiSalimov/MAX6675_Thermocouple
  Created by Yurii Salimov, May, 2019.
  Released into the public domain.
*/
#include <MAX6675_Thermocouple.h>
#include <Thermocouple.h>

#define SCK_PIN D5
#define CS_PIN D7
#define SO_PIN D6

Thermocouple* thermocouple;

// 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() {
  // Reads temperature
  const double celsius = thermocouple->readCelsius();
  const double kelvin = thermocouple->readKelvin();
  const double fahrenheit = thermocouple->readFahrenheit();

  // Output of information
  Serial.print("Temperature: ");
  Serial.print(celsius);
  Serial.print(" C, ");
  Serial.print(kelvin);
  Serial.print(" K, ");
  Serial.print(fahrenheit);
  Serial.println(" F");

  delay(500); // optionally, only to delay the output of information in the example.
}

Leave a Reply

Your email address will not be published. Required fields are marked *

15 − = thirteen