MAX31855K temperature readings return 0

Hello everyone.

I'm using the Adafruit MAX31855K library in order to read temperature for my thermocouple. For some reason the output for both internal temperature and regular temp is 0. I'll attach the schematic, code and output.

#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Adafruit_SPIDevice.h>

#include <Adafruit_MAX31855.h>
  
/***************************************************
  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K
  Designed specifically to work with the Adafruit Thermocouple Sensor
  ----> https://www.adafruit.com/products/269
  These displays use SPI to communicate, 3 pins are required to
  interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!
  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <SPI.h>
#include "Adafruit_MAX31855.h"

// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO   51
#define MAXCS   25
#define MAXCLK  20

// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

// Example creating a thermocouple instance with hardware SPI
// on a given CS pin.
//#define MAXCS   10
//Adafruit_MAX31855 thermocouple(MAXCS);

// Example creating a thermocouple instance with hardware SPI
// on SPI1 using specified CS pin.
//#define MAXCS   10
//Adafruit_MAX31855 thermocouple(MAXCS, SPI1);

void setup() {
  Serial.begin(9600);

  while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc

  Serial.println("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
  Serial.print("Initializing sensor...");
  if (!thermocouple.begin()) {
    Serial.println("ERROR.");
    while (1) delay(10);
  }
  Serial.println("DONE.");
}

void loop() {
  // basic readout test, just print the current temp
   Serial.print("Internal Temp = ");
   Serial.println(thermocouple.readInternal());

   double c = thermocouple.readCelsius();
   if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {
     Serial.print("C = ");
     Serial.println(c);
   }
   //Serial.print("F = ");
   //Serial.println(thermocouple.readFahrenheit());

   delay(1000);
}


Hi @aaronschanz
At the time of testing, were all 6 sensors and the SD card connected to your arduino mega?

RV mineirin

Hello, thanks for your reply. At the time of testing, only 1 thermocouple and the SD card were connected. However, in the code you will see there is only one chip select pin, which is where the thermocouple is connected.

Hi,
Can I suggest you connect ONLY one MAX, and northing else, and run the Example code in the IDE to confirm you have comms with the MAX?

Did you write this code in stages and get the MAX working before getting to this multifunction code?

Can I also suggest 100nF cap across the K type terminal. 10nF helps, but I find 100nF or 0.1uf is better.

Tom... :smiley: :+1: :coffee: :australia:

Hi Tom thanks for your reply,

At the moment only one thermocouple is connected, I'm trying to get the code to work for just one before I connect the remaining thermocouples and get them all to work at once. Unfortunately I'm very inexperienced with electrical engineering and therefore am unsure how to change the cap value. The system I'm writing the Arduino for is very complex (not built by me) and I don't want to mess anything up.

Hi,
Is all this already on a PCB?
The 10nF, okay understand.

Have you tried one of the examples that comes with the ;

#include <Adafruit_MAX31855.h>

Library?

Tom... :smiley: :+1: :coffee: :australia:
PS. I'm at work so can't always reply.

Yes, the code I pasted above is the "serialthermocouple" example from the library. Also yes, these thermocouples are part of a pretty large PCB that's supposed to act as a data acquisition system. Unfortunately I can't send schematics for the whole thing, as it is confidential information.

Hi,
Okay so you can communicate with the thermocouple PCB but its returning 0's.

Can you breadboard your controller and MAX to check you have fully working MAX modules?
In other words don't use the PCB for connections.
What model Arduino are you using?
Is the MAX module happy with 3V3 operation?
Do you have a DMM to check supplies?

Tom.. :smiley: :+1: :coffee: :australia:

Hey Tom, really sorry for the late solution, but I've been very busy the last few days. We just ordered the thermocouple modules a week ago and they were recommended to us from a reliable source. I am using a MEGA 2560

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.