# K thermocouple values not stable (Max31855) / Information on Relay

Joined May 11, 2018
148
Hello
I have a max31855 Datasheet , using arduino (1.8.13) and I am seeing the values of the thermocouple bouncing, I would love to say that the problem lies in the code but the code uses a library that is a bit hard for me to understand . Or that the problem is in connection

I also noticed that the code belongs to another breadkoub board that is completely different from mines on the left is my breakout board and on the right is the board that the library uses

The library board’s datasheet is Datasheet of the arduino used in the library

Thank you very much

The code below looks like this

Code:
/***************************************************
This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

Designed specifically to work with the Adafruit Thermocouple Sensor

These displays use SPI to communicate, 3 pins are required to
interface
Adafruit invests time and resources providing this open source code,

BSD license, all text above must be included in any redistribution
****************************************************/

#include <SPI.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   3  // pin 3 connect to pin 3
#define MAXCS   4  // pin 3 connect to pin 4
#define MAXCLK  5

// initialize the Thermocouple

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

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 = ");

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

delay(1000);
}
The setup looks like

the results look like this

#### Furieux F

Joined Aug 15, 2016
7
I also had the same problem which I solved by placing 100nF capacitor between thermocouple’s positive and negative rails.
But I had a different MAX31855 breakout board.

F.

#### jpanhalt

Joined Jan 18, 2008
11,088
@Furieux F
The Adafruit board already has a 10 nF cap between rails. Do you have the schematic for your board?

Joined May 11, 2018
148
@Furieux F
The Adafruit board already has a 10 nF cap between rails. Do you have the schematic for your board?
yes i have the schematics of my board

I think he meant between the Vcc and 0

Joined May 11, 2018
148
Those boards do not look completely different to me. The Adafruit board follows the reference design closely. Excluding the voltage regulator on the Adafruit board, both boards have about the same number of passive devices. It's a very simple design.

I do not find your results for "jumping around" too impressively excessive. Air currents can cause that much difference. You may want to skip the next paragraph and go to experimental results.

Some things to check, which you probably have already done:
Let's assume you have triple checked the voltage supply and your supply is stable and regulated. Do you have the red TC wire connected to negative? (It might be a good habit to use yellow instead of red for + in the design you show.) Did you scrape the TC leads a little before connecting? Are the screw contacts tight? Is your TC the correct one? Is the junction welded?

1) Shield both the PCB and TC from air currents. I put a little piece of soft insulating foam on top the IC chip. I did not encase the chip as it probably produces some heat too.
2) As for the TC, a mixture of ice and water in a styrofoam container or thermos will be fairly constant (but not 0.00°). You can also stick the TC into a chunk of Styrofoam to shield it.
I have tried to eliminate the air and everything but the values seem to be not constant i don't get it

#### MrSoftware

Joined Oct 29, 2013
1,975
If the posts above didn't solve it, especially #3, then scope the power for your ADC board. If there's any noise then that can be a problem. You can also take a guess at it and put a couple of ceramic capacitors across the power terminals, start with a 10nF and try different sizes. Also check the datasheet for the MAX chip to be sure that breakout board followed their recommendations. Additionally you can try to solve it in software by oversampling and averaging your readings.

#### jpanhalt

Joined Jan 18, 2008
11,088
If problems continue, you might consider the MAX31856. It's digital (SPI), but since you are already using the Arduino, that should not be a be great issue. It recommends more filtering, as well as a bias.

You cannot add that bias to the MAX31855, but you could try that filtering design to see if it helps. However, until you rule out air currents (i.e., the TC results are correct), I would not make any changes.

#### Furieux F

Joined Aug 15, 2016
7
If the posts above didn't solve it, especially #3, then scope the power for your ADC board. If there's any noise then that can be a problem. You can also take a guess at it and put a couple of ceramic capacitors across the power terminals, start with a 10nF and try different sizes. Also check the datasheet for the MAX chip to be sure that breakout board followed their recommendations. Additionally you can try to solve it in software by oversampling and averaging your readings.
Yes, in software I also took 10 readings and then average of that. This helps to stabilize final reading as well.

#### jpanhalt

Joined Jan 18, 2008
11,088
Yes, in software I also took 10 readings and then average of that. This helps to stabilize final reading as well.
The digital version (MAX 31856) allows that to be done by setting a single register value.

Joined May 11, 2018
148
The digital version (MAX 31856) allows that to be done by setting a single register value.
@jpanhalt which capacitor is good for small ground noise ?
is it the high capactor( that have high capacitance in micro farads) or small capacitance (nano farads) , how does capacitance works with the noise . what's the relationship i read but did not understand well .

#### jpanhalt

Joined Jan 18, 2008
11,088
I would use the capacitors recommended by Maxim. Too big, and the signal will be severely slowed.

Joined May 11, 2018
148
Another question from the below adafruit library code ?
Should the value that we are supposed to read be internal Temp or C ?
I am having trouble becoming familiar with the library i am learning the library as i post this question so Please bear with me.

Because if it is Internal Temp then it makes sense but if it is C, something must be wrong because of the variations are too high

Here is my readings ( please tell me if it is C or Internal Temp )

/***************************************************
This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

Designed specifically to work with the Adafruit Thermocouple Sensor

These displays use SPI to communicate, 3 pins are required to
interface
Adafruit invests time and resources providing this open source code,

BSD license, all text above must be included in any redistribution
****************************************************/

#include <SPI.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   3  //pin 3 connect to pin 3
#define MAXCS   4   //pin 1 connect to pin 4
#define MAXCLK  5   //pin 4 connect to pin 5
// initialize the Thermocouple

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

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 = ");

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

delay(1000);
}

#### Attachments

• 134.5 KB Views: 1

#### jpanhalt

Joined Jan 18, 2008
11,088
I don't know what the Arduino library does. However, the MAX31855 datasheet calls the "cold junction" temperature the internal temperature. That's consistent with the meaning of the words:

The cold junction is sometimes called reference too. It is inside the epoxy shell of the chip, so basically, it is the chip's temperature.

Have you tried a Styrofoam block or ice water as a more constant test of your TC?

Joined May 11, 2018
148
I don't know what the Arduino library does. However, the MAX31855 datasheet calls the "cold junction" temperature the internal temperature. That's consistent with the meaning of the words:

View attachment 213340

The cold junction is sometimes called reference too. It is inside the epoxy shell of the chip, so basically, it is the chip's temperature.

Have you tried a Styrofoam block or ice water as a more constant test of your TC?
Oooh ok i am going to try it now i will tell you . the result

Thank you

Joined May 11, 2018
148
I don't know what the Arduino library does. However, the MAX31855 datasheet calls the "cold junction" temperature the internal temperature. That's consistent with the meaning of the words:

View attachment 213340

The cold junction is sometimes called reference too. It is inside the epoxy shell of the chip, so basically, it is the chip's temperature.

Have you tried a Styrofoam block or ice water as a more constant test of your TC?
Oooooh ok now it makes sense . i didn't know about the principle of a thermocouple to know about the cold junction.

thanks

i am going to prepare a glass of ice to check . thanks very much i will get back to you

#### jpanhalt

Joined Jan 18, 2008
11,088
A glass of ice water may work. But there will be temperature gradients in it. An insulated glass, thermos, or foam cup might be better.

#### MrSoftware

Joined Oct 29, 2013
1,975
As stated above, read the maxim data sheet, the info they put in those is extremely important, and the devil is always in the details. Some chips generate noise themselves and need capacitors to be stable, this is one reason the datasheet is so important. In general, different size capacitors will filter different noise frequencies, it's not unusual to need multiple capacitors of different sizes if you've got a lot of noise at different frequencies. Here is an excellent introduction video on it:

Joined Jan 15, 2015
5,787
In a few words from the manufacturers data sheet:

"Noise Considerations Because of the small signal levels involved, thermocouple temperature measurement is susceptible to powersupply coupled noise. The effects of power-supply noise can be minimized by placing a 0.1µF ceramic bypass capacitor close to the VCC pin of the device and to GND. The input amplifier is a low-noise amplifier designed to enable high-precision input sensing. Keep the thermocouple and connecting wires away from electrical noise sources. It is strongly recommended to add a 10nF ceramic surface-mount differential capacitor, placed across the T+ and T- pins, in order to filter noise on the thermocouple lines".

You make no mention which I saw if your Type K Thermocouple is of the grounded or un grounded type?

A type K thermocouple is not exactly a precision temperature measuring device:

Type K:
MAXIMUM TEMPERATURE RANGE
– 328 to 2282°F
– 200 to 1250°C
32 to 392°F
0 to 200°C
LIMITS OF ERROR
(Whichever is greater)
Standard: 2.2°C or 0.75% Above 0°C
2.2°C or 2.0% Below 0°C
Special: 1.1°C or 0.4%