MAX6675 is returning me random values

Hi everyone.

I'm using a chip MAX6675-based module to read measures from a K-Type Thermocouple. First I was trying to directly add this serial amplifier to a bigger project, where other peripherals such as a TFT screen are present. After Google it, I saw that, often, this kind of chips could have some troubles when they are placed into a noisy-grounded environment. So I decided to take it appart to check if this module works properly when isolated.

So I made the circuit you can see in these pics:




As you can see, there is only the module vs my Arduino Mega 2560. And I loaded the following code into my Arduino:

// this example is public domain. enjoy!
// https://learn.adafruit.com/thermocouple/

#include "max6675.h"

int thermoDO = 12;
int thermoCS = 10;
int thermoCLK = 13;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

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

  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   Serial.print("F = ");
   Serial.println(thermocouple.readFahrenheit());
 
   // For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
   delay(1000);
}

However, the lectures keep being crazy. There is an example of them:

MAX6675 test
C = nan
F = nan
C = 2039.25
F = 3702.65
C = 2037.50
F = 3699.50
C = nan
F = nan
C = nan
F = nan
C = nan
F = nan

What am I missing? I have two k-type thermocouples: one that came along with my multimeter, and another one which I bought from the internet. If I plug them in my multimeter, both of them work properly (the one I bought from the internet has bigger error, but still ok).

I'm thinking about purchasing a new MAX module (maybe it would be better some pack with thermocouple). But everything I see has this type of thermocouple:

Which is not valid to me because I need a sensor that I could fix on a surface.

By the way, one more question: Will I have problem if I fix it on a metallic surface? Should I use some kind of electrical isolation for this purpose? This is a secondary question, my biggest problem now is the previous one.

Thank you so much in advance.
Have a nice day. Greetings from Spain.

Thank you in advance.

It's hard for us to check your wiring because you used 3x white wires. We can't see which white wire is connected to what. They could have got mixed up! Even in your first photo, 2 of the white wires could be swapped.

This type of connecting wire ("Dupont") are very unreliable. Test the continuity of each one with your multimeter.

Sorry for that haha But I ran out of wires because all of them are on the other circuit I mentioned. I've checked that connection and it's ok, you have to trust me.

Again, sorry.

EDIT: OK for the continuity. I'll check it.

EDIT2: Just to add some more info for @PaulRB : continuity is OK everywhere.

Disassemble the plug, disconnect the thermocouple wires from the plug and connect the thermocouple wires directly to the terminals on the module.

That's how they were connected before. Now I'm doing this because I tested in my multimeter.

Here you have more information: SPI communications with logic analyzer


photo_2022-05-15_19-08-33

Based on the MAX's datasheet, the screenshot would be showing a 4057 value, which is aproximately 1014ºC (12 bits resolution). The room is hot, but not that much! haha real measures are around 27ºC.

The SPI pin numbers are the same as for hardware SPI on the UNO, but the MEGA's hardware SPI pins are different:

Arduino Mega SPI digital I/O pins:

MISO-pin 50
MOSI-pin 51
SCK- Pin 52
SS- pin 53

Arduino Uno SPI digital I/O pins:

MISO-pin11
MOSI-pin12
SCK-pin13
SS-pin10

If this don't work, you might want to try their software SPI example that uses different pins.

Hi @dlloyd

I have just tested but it did not worked. Same results.

I think the lib is working with SW SPI.

From the max6675.cpp file:

byte MAX6675::spiread(void) 
{
  int i;
  byte d = 0;

  for (i = 7; i >= 0; i--) 
  {
    digitalWrite(sclk, LOW);
    delayMicroseconds(10);
    if (digitalRead(miso)) 
    {
      // set the bit to 0 no matter what
      d |= (1 << i);
    }
    digitalWrite(sclk, HIGH);
    delayMicroseconds(10);
  }
  return d;
}

Yep. However I've tried with SPI as @dlloyd said.

I would like to have an oscilloscope so I can check the signal, but it's not the case.

What are your thoughts about this? Where do you think that the problem is located?

Hey everyone.

Problem solved. I've adquired another MAX6675 module and that one worked fine. All my K-Type Thermocouples are now working with it.

1 Like

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