yet another problem with temperature sensor max6675

Hi there,

some time ago I was able to read the temperature with a sensor Max6675 bought from Adafruit on my Arduino micro.
Now it is giving me those values:
either C =nan and F=32, or C=0 and F=32.

I have tried the following configuration

  1. Using Analog input
  2. Using different digital input
  3. Using strictly the SS, MISO, SCK pin.
  4. Trying with the corrisponding pins of an Arduino Nano.
  5. Trying using 3.3 or 5 V as power supply from the Arduino to the Max6675

the code I uses is as simple as this

// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"

int thermoDO = 15;
int thermoCS = 13;
int thermoCLK = 16;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int vccPin = 3;
int gndPin = 1;
  
void setup() {
  Serial.begin(9600);
  // use Arduino pins 
  pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
  pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
  
  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());
 
   delay(1000);
}

In this case I am using an Arduino Nano, so the pins 15, 13, 16.

Is the Max6675 gone banana?

Am I doing something wrong?

Do I have to stricly use the SS,MISO and SCK pin or I can set up analog input in
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); ?

Check for a bad connection to the thermocouple, or a bad thermocouple.

thanks,
and regarding my other question:

Do I have to stricly use the SS,MISO and SCK pin or I can set up analog input in
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); ?

Do I have to stricly use the SS,MISO and SCK pin

According to Adafruit, you can use any three digital pins. Those could also be analog pins in the digital mode. Consider reading the documentation.

You didn't accidentally reverse polarity of TC wires,? Did you? :slight_smile:

What do you mean with “reverse”?
TC wires have polarity but I guess they don’t really mean anything, as the wires are the same and after all the “touch” or connect something which is conductive (what I am measuring the temperature) so they are shortcircuited somehow

TC wires have polarity but I guess they don’t really mean anything

What a silly idea. Where did you get it?

If you install batteries the wrong way around in your devices, do you expect the devices to work?

And the thermocouple should not touch any conductive object. The MAX chip can detect this and will return an error code if it is a problem.

I think there are a series of misunderstanding

  1. "If you install batteries the wrong way around in your devices, do you expect the devices to work?"
    A cable with no polarity is not a battery, the polarity is on the MAX not in the cable

  2. I have seen several projects on instructables using the MAX to measure the temperature of metal things (which are conductive). Otherwise how would you measure the temperature of a metal thing?
    I am openminded to other suggestions.

  3. The MAX chip can detect this and will return an error code if it is a problem.
    No, it doesn't today I tried with another arduino and it worked, it seems it was an issue with my permissions on the USB. I noticed that /dev/ttyAMC0 was keeping appearing and disappearing

  1. The thermocouple is a power-producer like a battery. It has polarity.

  2. There must be electrical insulation between the thermocouple and the rest of the circuit. a) there is an insulator between the thermocouple and the metal; b)the Arduino is not grounded; c)the metal is not grounded.

  3. You changed the wiring. Now it works.

I think there are a series of misunderstanding

Certainly. Thermocouples have polarity, for one, which you could have checked in about 30 seconds of Googling.

Avoid Instructables, as most of those in electronics and Arduino are posted by people who have no idea what they are doing.

Ok, I don't know why I cannot make it clear, as I said "the MAX has a polarity", see the picture there is a sign "+" and a "-" on the other side, but the cable is touching something, and the cable apart the color (one green and one white) has no polarity (it is simply screwed to this metal), I pealed to show even more this as it is touching this metal thing which now I have unscrewed to show you the end points of the cable.

Then I can believe it is better to isolate it electrically but not thermally. I am heating up this metal thing up to 90 degrees, what should I buy to isolate electrically? I guess it should be something in paper.

and as I said, I changed the arduino that one was giving other issues, so it was not the wiring it was the arduino, since with the same wiring is working (maybe not perfect as you are mentioning but it is working).

Lastly, you mentioned the grounding, how do you ground a piece of metal? Shuold there be a cable connecting to the common ground?

alecrimi:
I am heating up this metal thing up to 90 degrees...

Then why a thermocouple.
That temp falls within the range of e.g. a DS18B20, with a much higher resolution than a termocouple.
Leo..

as the DS18B20 and the MAX have more or less the same price and need the same numbers of code I can ask the same for the DS18B20, unless there is a difference in precision. Is there?

Seems that the DS18B20 has twice the resolution of the MAX/TC.

Default accuracy of the MAX/TC is about twice as bad as the DS18B20, but that can be calibrated out.
Drift (supply dependence) is another issue, and could be worse with the MAX/TC.

In general, use semiconductor sensors with normal/human temp ranges.
And thermocouples for the extreme ranges.
Leo..