MAX31865 correction and concerns

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kharsivan
 
Posts: 10
Joined: Mon Jan 16, 2017 3:55 pm

MAX31865 correction and concerns

Post by kharsivan »

Having fiddled with the MAX31865 board and a Pt100 RTD for a few weeks, I have a few concerns and list them in order of decreasing importance.

1.) The MAX31865 board dumps a whopping ~4 ma into a Pt100 sensor at room temperature causing visible self-heating while the resistance stabilizes. Sampling it less frequently made no difference until the bias voltage was shut off after reading in ReadRTD(). With the bias voltage strobed only as needed and the RTD sampled at 15+ second intervals, self-heating was at a tolerable minimum.

A patch file, were it uploadable, would look like:

Code: Select all

*** Adafruit_MAX31865.cpp	2017-02-22 18:26:54.216557800 -0600
--- Adafruit_MAX31865.cpp	2017-02-22 18:26:54.216557800 -0600
***************
*** 184,189 ****
--- 184,190 ----
  	delay(65);
  
  	uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
+ 	enableBias(false);	// to lessen sensor self-heating
  
  	// remove fault
  	rtd >>= 1;

2.) People use Pt100 RTDs because they have the best uncalibrated accuracy and drift the least with age. The MAX31865 reference design is based on a 400 ohm (or similar) reference resistor. A 0.1% tolerance 430.0 ohm reference resistor confers a 0.43 ohm inaccuracy which propagates to a ~1 degree Celsius inaccuracy and reduces a Class A RTD to Class B at best. The cheaper K thermocouple can match that.

Nothing to be done in the hardware however it could be much mitigated by a nice short video on calibrating the sensor in ice+water and how the 0C offset is subtracted from computed temperatures.

Canonical Lists of Pt100 RTD Class A and Class B tolerance limits are had Pythonically:

Code: Select all

ClassA_tolerances = [(T,(0.15 + abs(0.002 * T))) for T in range(-200,851)]
ClassB_tolerances = [(T,(0.30 + abs(0.005 * T))) for T in range(-200,851)]
3.) The resistance-to-Celsius function, temperature(float,float), needs comment. In it, Adafruit provides a default inverse Callendar Van Dusen function in the module whose conversions are only 2.43 degrees off at -200C and which meet Class A accuracy (+/-0.4C) down to -125C ; above -60C, it matches the ITS-90 temperature to within 0.025C and usually better -- very good news, I think.

The definitive temperature conversion code is a NIST or ITS-90 resistance lookup table with interpolation for intermediate resistances. A preliminary Arduino Uno-type library module is ready but needs more testing and prettyfication before release into the wild.

I hate GitHub, hate pull requests, would rather hand off the library to Adafruit.


4.) The foregoing suggests a need for a more accurate (= more expensive) Pt100 RTD interface board with the usual fixtures such as a constant current excitation source <= 1ma and a marginally better dual ADC, perhaps 16-18 bits. All the usual suspects (TI,Linear,Analog,etc) have a reference design. Can a feasibility discussion be had on this?

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: MAX31865 correction and concerns

Post by adafruit_support_bill »

Thanks for the feedback. I will forward that to the design team.

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: MAX31865 correction and concerns

Post by adafruit2 »

hiya, thanks for the details - instead of a pull req (which we agree are annoying to make) could you put your notes in an issue?
https://github.com/adafruit/Adafruit_MAX31865
we wont get to fixing the library today but this will keep track of the notes close to the source :)

if not we'll do it but then you won't get updates.

for the transfer function we used an analog devices app note - agree a lookup would be ideal but we were concerned we'd fat-finger something and we don't have the ability to fully test. thx!

User avatar
kharsivan
 
Posts: 10
Joined: Mon Jan 16, 2017 3:55 pm

Re: MAX31865 correction and concerns

Post by kharsivan »

Thanks for the timely reply.
Don't care about notifications or credit on bug fixes, am more interested that the fixes happen.
adafruit2 wrote: for the transfer function we used an analog devices app note - agree a lookup would be ideal but we were concerned we'd fat-finger something and we don't have the ability to fully test. thx!
I read the app note AN709 stuff. That 5th order polynomial blows up above +165C so you might want to use it for -60C and below where it's actually needed. I'd no idea the Callendar Van Dusen eqn was as generally good as it is until I put the canonical output on a spreadsheet.

Mosaic Industries page on RTD Calibration has a polynomial fraction, 4th order / 3rd order, that is usually accurate to 0.005 C or so for the entire Pt100 temperature range. Ugly, computationally expensive, but probably accurate beyond its intended range.

This code has been tested for valid inputs, but not fuzzed yet since it's called by a wrapper with boundary checks/clipping.

Code: Select all

float Celsius_rationalpolynomial (float R_ohms)
{
	float num, denom, T ;

	float c0= -245.19 ;
	float c1 = 2.5293 ;
	float c2 = -0.066046 ;
	float c3 = 4.0422E-3 ;
	float c4 = -2.0697E-6 ;
	float c5 = -0.025422 ;
	float c6 = 1.6883E-3 ;
	float c7 = -1.3601E-6 ;

	num = R_ohms * (c1 + R_ohms * (c2 + R_ohms * (c3 + R_ohms * c4))) ;
	denom = 1.0 + R_ohms * (c5 + R_ohms * (c6 + R_ohms * c7)) ;
	T = c0 + (num / denom) ;

	return (T );
}
The lookup table version has been well-tested but awaits Adafruit-compliant prettyfication before release.

Thanks again.

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: MAX31865 correction and concerns

Post by adafruit2 »

ok rad - you've got way more experience with RTDs than us :)
if you do make a lookup table please reply to this thread and we'll add it to the library/tutorial!

User avatar
kharsivan
 
Posts: 10
Joined: Mon Jan 16, 2017 3:55 pm

Re: MAX31865 correction and concerns

Post by kharsivan »

adafruit2 wrote:ok rad - you've got way more experience with RTDs than us :)
Er, hmn.

The rational polynomial code snippet was for your delectation, were you interested.

Would you believe this all started because the standard boiling point tests for alcohol determination are run on either primitive $,$$$ junk or modern $$,$$$ gear? I reasoned that if someone could do it better (and cheaper!!) with a platinum RTD and an Arduino, it would save a lot of time+ effort+ money for the small brewers and vintners. And it would be a wake-up whack in the chops to the excessively complacent local regulating bodies, in my not so humble and vindictive opinion.
adafruit2 wrote:if you do make a lookup table please reply to this thread and we'll add it to the library/tutorial!
I did.
It's fugly.
It needs a couple days for janitorial coding.
Where would I deliver it?
Appended as a .zip?

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: MAX31865 correction and concerns

Post by adafruit2 »

yep! posting here is best - i'll sub to this thread

User avatar
kharsivan
 
Posts: 10
Joined: Mon Jan 16, 2017 3:55 pm

Re: MAX31865 correction and concerns

Post by kharsivan »

Y'alls,

Appended here is a library intended to work with the MAX31865 Pt100 RTD board output.
If your Pt100 sensor and interface board are up to it, the temperature is as accurate
as a lookup table + interpolation can make it.

I place this in the public domain via Adafruit for reasons of pragmatic laziness, i.e.,
I'm not so good at maintenance via GitHub.
pt100rtd.zip
Pt100 RTD library to accurately convert sensor resistance to Celsius temperature. size = 11k
(10.89 KiB) Downloaded 215 times
[EDIT] Violating my own Principle of Maximum Laziness, I've placed the library on GitHub at
https://github.com/drhaney/pt100rtd

User avatar
adafruit2
 
Posts: 22192
Joined: Fri Mar 11, 2005 7:36 pm

Re: MAX31865 correction and concerns

Post by adafruit2 »

lol thanks - this is cool!

User avatar
petevree
 
Posts: 5
Joined: Wed Oct 18, 2017 2:19 pm

Re: MAX31865 correction and concerns

Post by petevree »

I was having similar issues with the Adafruit Pt100 RTD Breakout w/MAX31865
This is a phenomenal fix! The 1 degree Celsius inaccuracy is accounted for and
the temp. readings are mint! Thanks adafruit & drhaney for all your hard work!

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”