I'm trying to read the temp of a K-type ThermoCouple using a Max81855-K.
I have tried a lot of different options, pins etc, watched at least 5 videos, but I'm unable to get any logical readings.
(I think the pins are correct now, but the read values are weird)
Once in a while the output is around 16 degrees, mostly it's 0.
Here's my setup:
ESP-WROOM-32D
MAX-81855-K dev board.
I use this library and example: https://github.com/RobTillaart/MAX31855_RT
VSCode with PlatformIO
My code: https://github.com/Timo-Design/esp32-stove-regulator/blob/main/src/main.cpp
This is an example of the output on the serial monitor:
----------------------------
time: 19
stat: 129
raw: 1111 1111 1111 1111 1111 1111 1111 1111
internal: 0.000
temperature: 0.000
time: 19
stat: 129
raw: 1111 1111 1111 1111 1111 1111 1111 1111
internal: 0.000
temperature: 0.000
time: 20
stat: 0
raw: 0000 0000 0000 0000 0000 0000 0000 0000
internal: 0.000
temperature: 0.000
time: 20
stat: 0
raw: 0000 0000 0000 0000 0000 0000 0000 0000
internal: 0.000
temperature: 0.000
time: 20
stat: 0
raw: 0000 0000 0000 0000 0000 0000 0000 0000
internal: 0.000
temperature: 0.000
time: 20
stat: 0
raw: 0000 0000 0000 0000 0000 0000 0000 0000
internal: 0.000
temperature: 0.000
----------------------------
Once in a while I see 16 as a temperature, which seems ok, for the rest it seems quite random.
I tested the Thermocouple with my Multi-meter (instead of the one that came with the meter) and then I do get a normal value.
Can somebody give me a tip what to do fix and or check?
Maybe there's something I misunderstood about this chip and or Thermocouples?
Thanks a lot in advance,
Timo
@timo88 I just did a quick search of the forum and got 7 pages of hits. The search argument is in quotes and is 'K-type ThermoCouple using a Max81855-K'
'
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Can somebody give me a tip what to do fix and or check?
From the README file:
Note that if the read() fails the value of getTemperature() can become incorrect. So it is important to check the return value of read().
I don't see the check in your code.
FWIW, the example sketch only checks for one error. I think the proper check is for read to return OK, else there's an error.
The one who has the most fun, wins!
@thank you for your replies. I'll have a look at your suggestions.
I added the read fail check but 99% of the times it still returns 0
@timo88 I just did a quick search of the forum and got 7 pages of hits. The search argument is in quotes and is 'K-type ThermoCouple using a Max81855-K'
'
Thank you. I did search for Max81855-K but it did not return any results, I'll have another look
@timo88 Sorry, I didn't check close enough, even when quoted the search on the long phrase was finding irrelevant words. It looks like you are the first to look into this Max81855-K device.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@timo88 I just did a google search and got only a couple of pages, most from DBWS. Either this is a new device, or it is not used much. The most interesting headline I see in google is from the klipper group (3D printers) mentioning COLD. A bit of a mystery.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
Hi Ron. No.. I'm an idiot.. I made a typo in a comment and copied it.. 🙁@timo88 I just did a google search and got only a couple of pages, most from DBWS. Either this is a new device, or it is not used much. The most interesting headline I see in google is from the klipper group (3D printers) mentioning COLD. A bit of a mystery.
I'll correct it, sorry about this.
Oh, I can't change that anymore but it should have been MAX31855-K 🙁
I added the read fail check but 99% of the times it still returns 0
I tried to give you a "heads-up" about this. You duplicated the mistake the example makes:
start = micros(); int status = thermoCouple.read(); stop = micros(); if (status == STATUS_NO_COMMUNICATION)
STATUS_COMMUNICATION is just one error code. From the README file
To make a temperature reading call read(). It returns the status of the read which is a value between 0..7
The above is inaccurate. There are 7 distinct return values, but not in the range [0..7]:
value | Description | Action |
---|---|---|
0 | OK | |
1 | Thermocouple open circuit | check wiring |
2 | Thermocouple short to GND | check wiring |
4 | Thermocouple short to VCC | check wiring |
7 | Generic error | |
128 | No read done yet | check wiring |
129 | No communication | check wiring |
The code needs to make sure there's not some other error.
The one who has the most fun, wins!
@timo88 I find very little info re this device. What I do see tells me it is a bear to work with. I suggest you change to a more popular device with more support and successful implementations.
Is the thermocouple insulated? If not that is a problem.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@tfmccarthy That is a common hobbyist error. I suspect you like me spent a long professional career filling pages of code with exception checking.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
I added the read fail check but 99% of the times it still returns 0
I tried to give you a "heads-up" about this. You duplicated the mistake the example makes:
start = micros(); int status = thermoCouple.read(); stop = micros(); if (status == STATUS_NO_COMMUNICATION)STATUS_COMMUNICATION is just one error code. From the README file
To make a temperature reading call read(). It returns the status of the read which is a value between 0..7
The above is inaccurate. There are 7 distinct return values, but not in the range [0..7]:
value Description Action 0 OK 1 Thermocouple open circuit check wiring 2 Thermocouple short to GND check wiring 4 Thermocouple short to VCC check wiring 7 Generic error 128 No read done yet check wiring 129 No communication check wiring The code needs to make sure there's not some other error.
Right, that's probably better. I'll have a go at that.
@tfmccarthy OK even with extra error checking I still get mostly "OK" as a status and 0 value.
Even when I disconnect a data wire, it still reports "OK". 🤣
I'll take the advise of Ron and look for another chip I guess. @zander
Thank you for your time and help 🙂
I'll try the MAX6675 next I guess