Spent days trying to get a MAX31865 to read an RTD value - no luck
A setup value must be written in register h80, and a ratio value of two resistors (15 bits) must be read. Should be simple, but obviously not for me.
The MAX31865 also has some "error registers", but since I know which measurement range interests me, I don't care about them.
It's obviously SPI I don't understand.
Is there anyone who knows it and can give me a hint?
Hardware, linearization, etc. I have it under control.
https://www.analog.com/media/en/technic ... X31865.pdf
Best regards
Richo
MAX31865 - RDT Thermometer
- cicciocb
- Site Admin
- Posts: 2069
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 441 times
- Been thanked: 1364 times
- Contact:
Re: MAX31865 - RDT Thermometer
What is exactly the module that you have? Is for a PT100?
Edit:
As it seems interesting, I've just bought one module to integrate the driver directly inside Annex
Edit:
As it seems interesting, I've just bought one module to integrate the driver directly inside Annex
- Richo
- Posts: 13
- Joined: Mon Apr 04, 2022 3:37 pm
- Location: Nakskov, Denmark
- Has thanked: 30 times
- Been thanked: 2 times
Re: MAX31865 - RDT Thermometer
https://www.aliexpress.com/item/1005005 ... Redirect=y
Yes, it's for PT100
I got it with a 400 Ohm reference resistor, but I want to change it to a lower value.
Since it only has to cover 0-100 C, I can get a higher resolution - it could be 150 Ohm
/Richo
Yes, it's for PT100
I got it with a 400 Ohm reference resistor, but I want to change it to a lower value.
Since it only has to cover 0-100 C, I can get a higher resolution - it could be 150 Ohm
/Richo
- cicciocb
- Site Admin
- Posts: 2069
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 441 times
- Been thanked: 1364 times
- Contact:
Re: MAX31865 - RDT Thermometer
I bought the same ... I'll try to integrate the driver inside but I'll not be able to test until the reception of the module
- Richo
- Posts: 13
- Joined: Mon Apr 04, 2022 3:37 pm
- Location: Nakskov, Denmark
- Has thanked: 30 times
- Been thanked: 2 times
Re: MAX31865 - RDT Thermometer
Linearization is straight forward and may be that could be part of the function?
Long-term stabilization/temp. depends on the comparison resistance. It is not the tolerance, but the temperature coefficient it depends on.
If you want a precision instrument, the whole thing must be calibrated together, and here it doesn't matter if it's a class A or AA you have, nor the absolute value of the comparison resistor.
I myself am thinking of temperature stabilizing the PCB (oven)
If you have an ice bath, and boiling water (clean), and the air pressure, you have 0c and 99.9xC, and then it is just a matter of using the Callendar–Van Dusen equation to linearize.
https://en.wikipedia.org/wiki/Callendar ... n_equation
https://www.physics.utoronto.ca/apl/fe/ ... ersion.pdf
/Richo
Long-term stabilization/temp. depends on the comparison resistance. It is not the tolerance, but the temperature coefficient it depends on.
If you want a precision instrument, the whole thing must be calibrated together, and here it doesn't matter if it's a class A or AA you have, nor the absolute value of the comparison resistor.
I myself am thinking of temperature stabilizing the PCB (oven)
If you have an ice bath, and boiling water (clean), and the air pressure, you have 0c and 99.9xC, and then it is just a matter of using the Callendar–Van Dusen equation to linearize.
https://en.wikipedia.org/wiki/Callendar ... n_equation
https://www.physics.utoronto.ca/apl/fe/ ... ersion.pdf
/Richo
- cicciocb
- Site Admin
- Posts: 2069
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 441 times
- Been thanked: 1364 times
- Contact:
Re: MAX31865 - RDT Thermometer
The linearization formula is quite easy so, just having the resistance, it can be also be implemented in basic
- cicciocb
- Site Admin
- Posts: 2069
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 441 times
- Been thanked: 1364 times
- Contact:
Re: MAX31865 - RDT Thermometer
Hello,
I received yesterday the module with a PT100.
I did a quick "library" using an ESP32-S3 (the one I have on the bench in this moment) and it seems to work.
I think that this code contains all you need.
Some pictures
I received yesterday the module with a PT100.
I did a quick "library" using an ESP32-S3 (the one I have on the bench in this moment) and it seems to work.
I think that this code contains all you need.
Code: [Local Link Removed for Guests]
'simple library for the MAX31865
'datasheet https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31865.pdf
MAX31865_CONFIG_REG = 0
MAX31865_RTDMSB_REG = 1
spi.setup 100000,1,1
spi.cspin 10
r$ = ""
read8 MAX31865_CONFIG_REG, r$
wlog "MAX31865_CONFIG_REG" , r$
'datasheet Table 2
'VBIAS ON, COnversion mode Auto, no one shoot, 2 or 4 wires, fault clear, 50 Hz filter
write8 MAX31865_CONFIG_REG, &b11000011 'datasheet Table 2
pause 100
read8 MAX31865_CONFIG_REG, r$
wlog "MAX31865_CONFIG_REG" , r$
r = 0
Rref = 430 ' reference resistance on the module
for z = 1 to 1000
read16 1, r$
v = val("&h" + r$) >> 1
convert v, r
wlog "value" , r$, v, v/(2^15), v/(2^15)*Rref, r
pause 500
next z
end
sub read8(address, ret$)
local a$
a$ = str$(address,"%02X", 1)
a$ = a$ + "00"
ret$ = spi.hex$(a$, 2)
ret$ = mid$(ret$, 3)
end sub
sub read16(address, ret$)
local a$
a$ = str$(address,"%02X", 1)
a$ = a$ + "0000"
ret$ = spi.hex$(a$, 3)
ret$ = mid$(ret$, 3)
end sub
sub write8(address, value)
a$ = str$(address + 128,"%02X", 1)
a$ = a$ + str$(value,"%02X", 1)
ret$ = spi.hex$(a$, 2)
end sub
sub convert(raw, temp)
rt = v/(2^15) * Rref
RTDnominal = 100
RTD_A = 3.9083e-3
RTD_B = -5.775e-7
Z1 = -RTD_A
Z2 = RTD_A * RTD_A - (4 * RTD_B)
Z3 = (4 * RTD_B) / RTDnominal
Z4 = 2 * RTD_B
temp = Z2 + (Z3 * Rt)
temp = (sqr(temp) + Z1) / Z4
if temp >=0 then exit sub
Rt = Rt / RTDnominal
Rt = Rt * 100 ' normalize to 100 ohm
temp = -242.02 + 2.2228 * Rt + 2.5859e-3 *(rt^2) -4.8260e-6 *(Rt^3) - 2.8183e-8 *(Rt^4) + 1.5243e-10 * (Rt^5)
end sub
You do not have the required permissions to view the files attached to this post.