While the MAX31855 is still very useful for "ordinary" K-type thermocouples, Maxim Integrated have a more versatile device which can handle a greater variety of thermocouple types, including K type.
It also has a SPI data in, for configuring.
The method which data is read is also different from he MAX6675 and MAX31855, and isn't a drop in replacement, and therefore will need to be catered for in Marlin
https://datasheets.maximintegrated.com/en/ds/MAX31856.pdf
At some point pretty soon I will put in the time to implement this. Currently focused on fixing a few minor issues to prep for the RC8 release.
for reference:
adafruit/Adafruit_MAX31856: Arduino Library for Adafruit MAX31856
https://github.com/adafruit/Adafruit_MAX31856
PlayingWithFusion/PWFusion_MAX31856: Maxim MAX31856 Thermocouple to Digital Converter Arduino Library
https://github.com/PlayingWithFusion/PWFusion_MAX31856
engineertype/MAX31856: Arduino library and example code for Maxim's MAX31856 Thermocouple IC
https://github.com/engineertype/MAX31856
I am willing to test your coding, as a non programming user, as I already ordered the MAX31856 Board and a professional thermocouple type S :) Both is supposed to arrive next week.
It will be quite some time until I can get a board, so I am in no rush
But I am in rush, I need to print steel :p
Actually I need to test/proof that one can print metal via the FDM/FFF process and that the layers will adhere properly. After that I can dive into the second iteration and make the printer a little less ugly and more durable and usable for non-engineers ;)
@derletztename
"1.1.1 milestone" label was added to this thread, it means that maybe official implementation of MAX31856 will be during in next year.
(1.1.0-RC (current) → 1.1.0 Release (winter or next year)→ 1.1.1 (next year or later?))
Therefore for the moment, I handle about your wish.
I'm proceeding with implementation gradually. (This doesn't works completely yet)
https://github.com/esenapaj/Marlin/tree/support-max31856
But it's slowly, therefore I'm not able to assure that I can make working version by 27.10.16.
No worrys. If it works at all, I will be quite happy :)
Although I forgot to pay for the breakout board and have to wait for about another week :(
But at least the thermocouple is here and looks very promising in it's quality :)
1.1.1 will be the first patch to 1.1.0, which will be released pretty soon.
As much as I like your post, I'd love to know what's pretty soon for you ;)
Is it days or weeks or month?
Maybe it's the same for esenapaj...
Does the little green bar on the right indicates the current status of 1.1.1?
The more testing and feedback we get from enthusiastic users, the more quickly it will be released. My plan is to release RC8 once the most pressing current issues are fixed. At the moment two issues are pressing: CoreXY G29 is wonky and dual Z endstops are wonky.
The green bar indicates the number of milestone issues closed versus the number of milestone issues still open. These are new features that we want to put off until after 1.1.0.
Thanks for the explanations. I'm learning more and more about git and I like it :)
I received my MAX31856 board and wanted to do some testing now. How did you wire it up?
Regarding https://learn.adafruit.com/adafruit-max31856-thermocouple-amplifier/wiring-and-test you need one more cable than for the MAX31855; one for SDI. Which Pin did you choose for that? I couldn't find it in the code...
Here you need to talk to the board, for example to set the right type of sensor. So MOSI (Master Out Slave In) on the other boards is not needed. On RAMPS AUX3-4 = D51.
@derletztename
I'm terribly sorry, Implementation in my branch is still work in progress, it's still doesn't work yet.
My quad-MAX31856 board arrive at Nov 6 - Nov 10.
About wiring, like this.
SDI of MAX31856 is connected to D51 (MOSI) of RAMPS.

@Blue-Marlin
In case of MAX31856, it needs command (access from host to register of MAX31856) at initialization and reading temperature.
Therefore, Marlin needs MOSI connection at using a MAX31856.
EDIT Nov 08 17:18:
My MAX31856 board arrived. I'll assemble tomorrow.
EDIT Nov 13 22:35:
Soldering has been done. But plug can't be inserted to jack... Maybe the reason is tolerance.
Thanks for the beautiful explanation esenapaj :)
And thanks for doing the coding job for us :)
I changed the plug and start test and integration, but It's not stable at all.
My first integration of MAX31856 for Marlin caused MINTEMP Err.
So I tested sample programs of libraries in previous comment, results are extremely unstable and strange...
log of adafruit's library
Cold Junction Temp: 16.00
Thermocouple Temp: MAX31856 thermocouple test
Thermocouple type: Unknown
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 15.99
Cold Junction Temp: 16.00
Thermocouple Temp: 15.99
Cold Junction Temp: 16.00
Thermocouple Temp: -112.20
Cold Junction Temp: 16.00
Thermocouple Temp: -16.01
Cold Junction Temp: 16.00
Thermocouple Temp: 15.87
Cold Junction Temp: 16.00
Thermocouple Temp: 15.99
Cold Junction Temp: 16.00
Thermocouple Temp: 15.87
Cold Junction Temp: 16.00
Thermocouple Temp: 15.99
Cold Junction Temp: 16.00
Thermocouple Temp: 15.94
Cold Junction Temp: 16.00
Thermocouple Temp: 15.94
Cold Junction Temp: 16.00
Thermocouple Temp: 15.94
Cold Junction Temp: 16.00
Thermocouple Temp: 15.96
Cold Junction Temp: 15.62
Thermocouple Temp: 15.98
Cold Junction Temp: 16.00
Thermocouple Temp: 127.98
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.98
Cold Junction Range Fault
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 14.00
Thermocouple Temp: 127.99
Cold Junction Range Fault
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.98
Cold Junction Temp: 15.50
Thermocouple Temp: 127.94
Cold Junction High Fault
Cold Junction Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 15.75
Thermocouple Temp: 127.94
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Cold Junction Temp: 14.74
Thermocouple Temp: 127.94
Cold Junction High Fault
Cold Junction Low Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 16.00
Thermocouple Temp: 127.99
Cold Junction Range Fault
Thermocouple Range Fault
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Cold Junction Temp: -1.50
Thermocouple Temp: 127.99
Cold Junction Temp: 14.50
Thermocouple Temp: 127.99
Cold Junction Temp: 14.50
Thermocouple Temp: 127.99
Cold Junction Temp: -1.00
Thermocouple Temp: 127.99
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: -0.02
Thermocouple Temp: 127.99
Cold Junction Temp: -1.50
Thermocouple Temp: 127.99
Cold Junction Temp: 15.00
Thermocouple Temp: 127.99
Cold Junction Temp: 16.00
Thermocouple Temp: -0.01
Cold Junction High Fault
Cold Junction Low Fault
Thermocouple High Fault
Thermocouple Low Fault
Over/Under Voltage Fault
Thermocouple Open Fault
Cold Junction Temp: 64.00
Thermocouple Temp: 127.99
Cold Junction Temp: 15.00
Thermocouple Temp: 127.99
log of PlayingWithFusion's library
Thermocouple 0: no0: no faults detected
Tint = 23.86
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.75
Playing With Fusion: MAX31856, SEN-30005
Thermocouple 0: no faults detected
Tint = 23.78
TC Temp = 31.18
Thermocouple 0: no faults detected
Tint = 23.78
TC Temp = 31.93
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.20
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.95
Thermocouple 0: no faults detected
Tint = 23.73
TC Temp = 31.12
Thermocouple 0: no faults detected
Tint = 23.73
TC Temp = 31.08
Thermocouple 0: no faults detected
Tint = 23.70
TC Temp = 31.86
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.96
Thermocouple 0: fault(s) detected
Fault List: OPEN Overvolt/Undervolt TC Low TC High CJ Low CJ High TC Range CJ Range
Thermocouple 0: fault(s) detected
Fault List: TC Range CJ Range
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.23
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.21
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.96
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.23
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.98
Thermocouple 0: no faults detected
Tint = 23.73
TC Temp = 31.91
Thermocouple 0: no faults detected
Tint = 23.73
TC Temp = -0.09
Thermocouple 0: no faults detected
Tint = 23.73
TC Temp = 31.16
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.76
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.76
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.80
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.80
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.80
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.20
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.77
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.27
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.98
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.98
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.83
Thermocouple 0: no faults detected
Tint = 23.98
TC Temp = 31.83
Thermocouple 0: no faults detected
Tint = 23.98
TC Temp = 31.83
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.80
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.20
Thermocouple 0: no faults detected
Tint = 23.91
TC Temp = 31.33
Thermocouple 0: no faults detected
Tint = 23.97
TC Temp = 31.83
Thermocouple 0: no faults detected
Tint = 23.75
TC Temp = 31.93
Thermocouple 0: fault(s) detected
Fault List: TC Range CJ Range
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.28
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.78
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.25
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.25
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.25
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.02
Thermocouple 0: no faults detected
Tint = 23.81
TC Temp = 31.98
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.20
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.80
Thermocouple 0: no faults detected
Tint = 23.98
TC Temp = 31.82
Thermocouple 0: no faults detected
Tint = 23.98
TC Temp = 31.82
Thermocouple 0: no faults detected
Tint = 23.98
TC Temp = 31.32
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.78
TC Temp = 31.96
Thermocouple 0: no faults detected
Tint = 23.78
TC Temp = 31.21
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.28
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.78
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.78
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = -0.22
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.83
TC Temp = 31.75
Thermocouple 0: no faults detected
Tint = 23.86
TC Temp = 31.78
Thermocouple 0: no faults detected
The fault saying under/over voltage might have something to do with it.
What does a multimeter say for the 5V rail?
Thanks for the advice.
My METEX P-10 says 4.99V - 5.00V. It seems to be very accurate and stable.
...But just now, I __blew up__ my quad-MAX31856 board by elementary mistake.
I remembered that my power unit has 5V output, thus I tried to take the board power supply from there.
But I connected a board to __400V__ connector instead of a 5V output, then board was blown up in a moment.
The line pattern evaporated, and a crater was pierced in the regulator.
...But, I never falter.
I've ordered Adafruit's board just now.
@derletztename
I'm sorry for the delay and delay.
However, the minimal implementation was completed yesterday.
you're able to test your board.
https://github.com/esenapaj/Marlin/tree/support-max31856
__EDIT Nov 23 19:03:__
Now packet in transit.
__EDIT Nov 28 23:47:__
Adafruit MAX31856 board arrived. I'll assemble tomorrow.
Thank you very much, I will test this tonight :)
Sorry for your loss, though. But it's a great picture for "blown up electronics". You could use it on wikipedia or something, it's really representable.
Ah the magic smoke makes an appearance
I always get depressed when I do something like that.
I tested your code today and got a min temp error which led to a system halt :(
I checked the wiring again but it's just as you have shown on you picture. I did not change anything else than maxtemp and the -4 for MAX31856 in you code. Should I change something else maybe?
If you're using type __S__ thermocouple, additional changing is needed.
https://github.com/esenapaj/Marlin/blob/support-max31856/Marlin/Configuration.h#L258
// Select thermocouple type when use a MAX31856
// :{ '0': B Type, '1': E Type, '2': J Type, '3': K Type, '4': N Type, '5': R Type, '6': S Type, '7': T Type }
-#define THERMOCOUPLE_TYPE 3
+#define THERMOCOUPLE_TYPE 6
// Dummy thermistor constant temperature readings, for use with 998 and 999
__EDIT Dec 05 02:03: This information is outdated.__
Still got a mintemp error and the printer was halted :(
I also checked the wiring of the thermocouple again and white is at minus and orange at plus.
Is there something else I need to adjust in the software maybe?
If you're using type S thermocouple and set #define TEMP_SENSOR_0 -4 and #define THERMOCOUPLE_TYPE 6,#define THERMOCOUPLE_TYPE S, __(EDIT Dec 03 02:14)__
settings are completed, and there is nothing else to do.
In my case I got also MINTEMP Err, furthermore hardware was unstable for some reason. (and finally I blew up it.)
So, why don't you try the sample program provided by the board maker, if you are interested.
I modified a samples a little, you can use it on your MEGA2560 + RAMPS + MAX31856 system.
When testing, please set a baud rate on serial monitor of Arduino IDE to 115200.
By adafruit: https://github.com/esenapaj/Adafruit_MAX31856
By PlayingWithFusion: https://github.com/esenapaj/PWFusion_MAX31856 (please use a SEN30005_MAX31856_example.ino)
Anyway, my new MAX31856 board is still in transit. (USPS tracking site says it's still 10000km beyond my place)
But, I'll check the implementation tomorrow.
It seems that Hardware SPI + MAX31856 had a problem, and it was solved yesterday in Adafruit's library.
Adafruit customer service forums • View topic - Max31856 and Hardware SPI
https://forums.adafruit.com/viewtopic.php?f=19&t=104926&p=535630&hilit=max31856
Sorry I got you wrong in the first message. I understood it's suppose to work already.
That's great news, that the (or an) error was at the adafruit site. I am seeing forward to test again :)
Meanwhile I concentrate on the hardware if you don't mind. I am really not that good with electronics and software and it always eats up a lot of time to get into it.
Meanwhile I concentrate on the hardware
I don’t mind. Nothing is so precious as time, thus time should be used efficiently and effective.
Now my Adafruit's MAX31856 works, tentatively.
https://github.com/esenapaj/Marlin/tree/support-max31856
But implementation is really really ugly (at least perhaps SD Card read is broken?) and still needs works, therefore I don't recommend that you test my branch at this time.
Now temperature measurement of MAX31856 is stable.
But, the error detection function is completely malfunctioning.
When error detection function is enabled, all kinds of errors are thrown...
When i scanned over the MAX31856 data sheet i registered a lot of registers like max/min temperatures for internal reference and external sensor. But i can't remember if they are set to a reasonable values at boot time, or if one has to set them explicitly.
I am sorry for always being so slow with testing. I just was able to test the new version and it's running without errors so far :) :) :)
But its measures too-low values. I touched the tip of the thermocouple Type S and nothing happened. I put it into a flame and it slowly crawled up to about 40°C. Nevertheless before starting the tests the value was very near to the real room-temperature value.
Maybe it's just extremely slow because of SPI related issues or something?
Did you set a #define THERMOCOUPLE_TYPE S?
At newest version of my branch, setting was changed from number to alphabet.
https://github.com/esenapaj/Marlin/blob/support-max31856/Marlin/Configuration.h#L262
//
// Select thermocouple type when using MAX31856
//
// Options are: B, E, J, K, N, R, S, or T
//
// :[ 'B', 'E', 'J', 'K', 'N', 'R', 'S', 'T' ]
-#define THERMOCOUPLE_TYPE K
+#define THERMOCOUPLE_TYPE S
// Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25
And, Could you try turning the power off completely?
I'm realizing that it looks like that MAX31856 keep wrong setting when it was given or an incorrect operation is performed.
without errors so far
Currently, MIN / MAX temp error detection function of Marlin works, however MAX31856's own error detection function is omitted.
Because it's completely malfunctioning at this time.
If you're interested in MAX31856's own error detection function, when you uncomment a #define MAX31856_ERROR_DETECTION
https://github.com/esenapaj/Marlin/blob/support-max31856/Marlin/Conditionals_post.h#L229
, it will be effective.
SPI related issues or something?
And if you'd like to test a another method of SPI communication, when you uncomment a #define USE_SPI_LIB_FOR_THERMOCOUPLE
https://github.com/esenapaj/Marlin/blob/support-max31856/Marlin/Conditionals_post.h#L227
, it will be effective.
By the way this is unrelated to MAX 31856, you have a MAX31855SASA soldered board.
If you combine it with a new (expensive) S type thermocouple, is there a possibility that you can measure over 1400 degrees?
Thank you for the fast answer. Yes I did choose the type S thermocouple this time ;)
What do you mean by turning off the power, for the software testing there is no external power on the RAMPS.
And no, I don't need the error function for now, I just meant no mintemp or other software errors.
And yes I still have the MAX31855SASA soldered board, I can try combining it with the high quality thermocouple, I thought there were other issues, but why not trying and find out :) Thanks for the hint.
I'll come back with results soon
What do you mean by turning off the power, for the software testing there is no external power on the RAMPS.
In that case, removing the USB cable that connecting between the RAMPS and the PC, and leaving it for about 20 to 30 seconds then the charge stored in the capacitor is escaped.
Hey Guys
It has been quite a while. Sorry for that.
So in the meantime, I got a new professional thermocouple, the first one had an issue and the manufacturer made me a new one. This seems to work find now :)
Though, still with the MAX31856 I am measuring very slow raising numbers and too low temperatures. Should be in the hundreds, but is only about 45°C.
And with the modified MAX31855 board, I again face the 1000°C max limit, which I fail to solve again. I am not sure which version was the working one, but the RCBugFix won't help me with the 1000°C limit. Though I remember we were beyond this, the last barrier we face was 1400°C and this was an issue with the thermocouple(s). Could you maybe help me again with this, esenapaj?
Good day, im new here , and i really need your help
i was testing the code above from @esenapaj for my adafruit universal MAX31856 but cant go more than 440 celsius, and it rise very slow the sensor get really red hot when i heat it with a map pro torch , i dont think that is real temperature, my thermocouple "K" is this https://www.amazon.com/Temperature-Thermocouple-Ceramic-Furnace-CR-01/dp/B01N5MTOES/ref=sr_1_5?ie=UTF8&qid=1509944895&sr=8-5&keywords=High+Temperature+K+Type+Thermocouple+Sensor+Ceramic+Kiln+Furnace+2372%C2%B0F+1300%C2%B0C&dpID=41NDtxlpwwL&preST=_SX342_QL70_&dpSrc=srch
Im using arduino MEGA2560 and ramp 1.4
and 2 extruders
ambient temperature reading is 26 degrees and im sure that real temperature because my second extruder sensor PT100 its reading 24
im testing adafruit max31856 because my old ad597 cant get more than 395-400 celsius degrees, i set max temp to 700 degrees, and -4 for the sensor in configuration.h but nothing change, can someone help me please? , is there a solution for this? what im doing wrong
BTW. i test the example file from adafruit and works great i was reading more than 700 degres when sensor get red hot, what im trying to do is 3d printing PEEK for delamination issue but im stuck, sorry for my bad english.
Thank you in advanced
Most helpful comment
I am willing to test your coding, as a non programming user, as I already ordered the MAX31856 Board and a professional thermocouple type S :) Both is supposed to arrive next week.