Hello all,
I have been following this: https://learn.adafruit.com/thermocouple/overview tutorial, using the same max31855 board and a variety of thermocouples. I've gotten the project working on my arduino uno no problem, and it seems accurate to within a couple degrees fahrenheit! However, when I plug it into a feather m0, the sensor reads 30-40 degrees higher than what it reads on the arduino. I am pretty confident that SPI is working for both cases, and I am using 3.3v and GND from each respective board (whichever one it is connected to). I have tested this with multiple different thermocouples, and all read ~30 degrees higher on the feather. Note, the thermocouples still change temperature very responsively when connected to the feather, they are just consistently higher.
I am aware that thermocouples can be off by a few degrees, but 30 seems a bit much, especially for multiple different thermocouples that seem to work fine on the arduino. Has anyone else come across this issue?
Feather M0 thermocoupler reading consistently higher than on
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
- PaulRowntree
- Posts: 391
- Joined: Sun Apr 03, 2016 12:41 am
Re: Feather M0 thermocoupler reading consistently higher tha
Odd, almost as if it is measuring F instead of C.
Could you give some example readings for the thermocouple in an ice-water mix, and in boiling water?
Could you give some example readings for the thermocouple in an ice-water mix, and in boiling water?
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Feather M0 thermocoupler reading consistently higher tha
Very strange. Which code are you using to test?
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
https://github.com/adafruit/Adafruit-MA ... ermocouple
I've been running serialthermocouple.ino from the examples directory, in the github code linked above. I will post some pictures tomorrow of the serial output, as the setup is at work currently. I tried throwing a 0.1 µF cap on it just for fun, and both setups still exhibited the same behavior.
I've been running serialthermocouple.ino from the examples directory, in the github code linked above. I will post some pictures tomorrow of the serial output, as the setup is at work currently. I tried throwing a 0.1 µF cap on it just for fun, and both setups still exhibited the same behavior.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Feather M0 thermocoupler reading consistently higher tha
Since it is a digital (spi) interface, the sensor should not care what kind of processor it is connected to. There is a difference in floating point calculations on the M0 vs the UNO (64 bit vs 32 bit). But I don't think it should make anywhere near that much of a difference.
Another thing to try: Edit the readCelsius() function in the Adafruit_MAX31855.cpp file and un-comment the line indicated below.
That will show us the raw value coming from the sensor. That will tell us if it is library/calculation issue or if it is coming directly from the sensor.
Another thing to try: Edit the readCelsius() function in the Adafruit_MAX31855.cpp file and un-comment the line indicated below.
That will show us the raw value coming from the sensor. That will tell us if it is library/calculation issue or if it is coming directly from the sensor.
Code: Select all
double Adafruit_MAX31855::readCelsius(void) {
int32_t v;
v = spiread32();
//Serial.print("0x"); Serial.println(v, HEX); // << ----- un-comment this line
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
Arduino serial output at room temperature, including hex reading:
F = 0x17818A0
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
[/code]
Feather serial output at room temperature, including hex reading:
Seems like it is coming from the sensor? i haven't had a chance to test both boards with boiling or freezing water yet.
Code: Select all
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50[code]
74.30
Internal Temp = 24.62
0x17818A0
C = 23.50
F = 0x17818A0
74.30
[/code]
Feather serial output at room temperature, including hex reading:
Code: Select all
Internal Temp = 48.88
0x38030E0
C = 56.00
F = 0x38030E0
132.80
Internal Temp = 48.88
0x3B030E0
C = 59.00
F = 0x3B030E0
138.20
Internal Temp = 49.00
0x3803100
C = 56.00
F = 0x3803100
132.80
Internal Temp = 49.00
0x3783100
C = 55.50
F = 0x3783100
131.90
Internal Temp = 49.00
0x3703100
C = 55.00
F = 0x3703100
131.00
Internal Temp = 49.00
0x3683100
C = 54.50
F = 0x3683100
130.10
Internal Temp = 48.88
0x36030E0
C = 54.00
F = 0x36030E0
129.20
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Feather M0 thermocoupler reading consistently higher tha
Looks like both internal and external temperatures are being reported on the high side. If you touch the sensor while connected to the Feather, does it feel warm at all?
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
It doesn't feel warmer when I connect it to a feather. I even shot it with an infrared thermometer, the sensor itself seems to be about the same temperature when plugged into the arduino and the feather. I will continue fooling around with it
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Feather M0 thermocoupler reading consistently higher tha
Both internal and external values seem to be doubled. It almost looks as if the raw value is shifted left by one bit. Are you using hardware or software SPI?
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
I was using hardware spi for both the arduino and feather, I tried software on the feather and was unable to get it working. What max speed should I use for the software spi on the feather, should it be different from the 4MHz from the library?
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
I managed to find a fix, it was exactly as you said, the spi values were shifted by a bit. I have no idea why, but I'm glad it works now. Thanks for all of your help!
Thanks again!
Code: Select all
if(sclk == -1) {
// hardware SPI
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE[color=#40BF00][/color]0));
d = SPI.transfer(0);
d <<= 8;
d |= SPI.transfer(0);
d <<= 8;
d |= SPI.transfer(0);
d <<= 8;
d |= SPI.transfer(0);
d >>= 1; //hack // <-------------------- shifted back the data a bit, and now works. see output below.
SPI.endTransaction();
Code: Select all
Internal Temp = 25.25
0x17C1940
C = 23.75
F = 0x17C1940
74.75
Internal Temp = 25.25
0x17C1940
C = 23.75
F = 0x17C1940
74.75
Internal Temp = 25.31
0x17C1950
C = 23.75
F = 0x17C1950
74.75
Internal Temp = 25.31
0x17C1950
C = 23.75
F = 0x17C1950
74.75
Internal Temp = 25.31
0x17C1950
C = 23.75
F = 0x17C1950
74.75
- wjd13
- Posts: 9
- Joined: Mon Jun 18, 2018 12:28 pm
Re: Feather M0 thermocoupler reading consistently higher tha
Actually, it seems a little disconcerting that the SPI would behave differently on the feather and on the arduino. Any guesses as to why?
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Feather M0 thermocoupler reading consistently higher tha
Not sure why it would be different. One possibility is the difference in processor speed. I'll call this to the attention of the library author.
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Feather M0 thermocoupler reading consistently higher tha
Sorry for huge lag in looking into this. It came up again in another thread and finally got around to investigating. The behavior has been recreated and an issue opened here:
https://github.com/adafruit/Adafruit-MA ... /issues/33
https://github.com/adafruit/Adafruit-MA ... /issues/33
- adafruit_support_carter
- Posts: 29150
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Feather M0 thermocoupler reading consistently higher tha
Please try the 1.0.5 version of the library when it becomes available in Library Manager:
https://github.com/adafruit/Adafruit-MA ... /tag/1.0.5
https://github.com/adafruit/Adafruit-MA ... /tag/1.0.5
Please be positive and constructive with your questions and comments.