# MAX31855 Negative Internal Temperature Problem?

Testing my MAX31855 I seem to have come up with a problem, when putting the device into a cold environment like say a freezer or outside (I’m in Canada) where the temperature should read a negative value, the thermocouple temperature goes negative, but once the internal temperature goes below zero we get big positive temperatures. So for example when doing a test from room temperature to negative temperatures we see both the thermocouple and internal temperatures drop down nicely, but once we get to zero the internal temperature goes crazy. Looking at the data returned from the MAX31855 we see values like

11111111111011000111111010000000

so the sign bit for the thermocouple indicates a negative value, but the sign bit for the internal temperature still reads positive, hence why we get temps like 126.5 C which is clearly wrong.

So for example during the cooling the last 3 internal temps that make sense are:

00000000000100100000000000110000 (internal temp = 0.1875, external temp = 1)

00000000000100000000000000011000 (internal temp = 0.0625)

00000000000100000000000000000000 (internal temp = 0)

then it goes to this

00000000000011100111111111110000 (internal temp = 127.9375)

Are we correct to be looking at bit 15 for the sign of the internal temp as I’m think bit 14 looks like it could be the sign bit as 15 doesn’t change or is there possible another problem?

The MAX31855 chip is stamped
M31855K
1506A2
+224AB

Will it be used on the Brainpad ?

@ Duke Nukem - I don’t have a chip, but I am trying to make sense of the data you show. No matter which way I read it, it shows one of the reserved (always 0) bits flipping. Am I reading the spec wrong, because to my reading, you shouldn’t get this output at all?

``````Tth            R F TInt         Rfff
00000000000100 1 0 000000000011 0000
00000000000100 0 0 000000000001 1000
00000000000100 0 0 000000000000 0000
00000000000011 1 0 011111111111 0000

fffR Tint         F R Tth
0000 000000010010 0 0 00000000110000
0000 000000010000 0 0 00000000011000
0000 000000010000 0 0 00000000000000
0000 000000001110 0 1 11111111110000
``````

EDIT: Side question: you are using a K-type thermocouple, yes?

I suspect there’s something wrong with the representation or the reading of the data. From the datasheet, the bit progression for internal temperature is
0.0000 = 0000 0000 0000
-0.0625 = 1111 1111 1111
I doubt something so fundamental is wrong here, so it has to be how the data is read/interpreted

The problem turns out to be I’m an idiot and a left over from my Unix days where the rule was if thou doest, thou must undoest.

``````
UInt32 data = 0;

_cs.Write(false); //set chip select to low to use chip

for (var i = 31; i >= 0; i--)
{
_clk.Write(true);

data |= (uint)(1 << i);

_clk.Write(false);
}

//_clk.Write(true);  <-- bad line which screwed up the next data retrieval, interesting

_cs.Write(true); //set cs to high as we are finished with it

``````

Thanks @ mcalsyn for making me think about the data retrieval, rather then just about the data as I made some changes to experiment with hooking up multiple chips. So data all good now, now to work on supporting multiple max31855 chips.

1 Like

I’m sure you’re not the only one that has been tainted by unix and had bad habits to undo.

great news I looked at that code and didn’t notice that you were toggling CLK there. Now I look again, I wonder how I missed it.

Multiple max31855 chip support working, so now back to testing and once I’m a happy camper, time to post code. Thanks for your help, eyes and motivation.

3 Likes