Precautions for RTD temperature measurement of max31865 module

Hello everyone, meet again, I am your friend Quanzhanjun.

Precautions for RTD temperature measurement of max31865 module

Note 1 Reference resistance

The PT100 version of the breakout uses 430Ω The PT1000 version uses 4300Ω Generally, PT100 chooses 400 ohm reference resistance, but the board gives 4300, which is 430Ω. In the program, you need to set the reference resistance to 430, and PT1000 to choose 4300Ω. #define REF_RES 430

Notes 2 Wiring

There are three positions on the board for setting the lines.

Note 3 Electrical Connection

Power Pins: Vin – this is the power pin. Since the chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller – e.g. for a 5V micro like Arduino, use 5V 3Vo – this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like GND – common ground for power and logic

SPI Logic pins: All pins going into the breakout have level shifting circuitry to make them 3-5V logic level safe. Use whatever logic level is on Vin!

SCK – This is the SPI Clock pin, its an input to the chip SDO – this is the Serial Data Out / Microcontroller In Sensor Out pin, for data sent from the MAX31865 to your processor SDI – this is the Serial Data In / Microcontroller Out Sensor In pin, for data sent from your processor to the MAX31865 CS – this is the Chip Select pin, drop it low to start an SPI transaction. Its an input to the chip If you want to connect multiple MAX31865's to one microcontroller, have them share the SDI, SDO and SCK pins. Then assign each one a unique CS pin.

RDY (Ready) – is a data-ready indicator pin, you can use this pin to speed up your reads if you are writing your own driver. Our Arduino driver doesn't use it to save a pin.

Note 4 important details of max31865 module

SPI reads and writes its registers, the registers are as shown below. Configure the register, read 0x00 if you want to read, and write 0x80 if you want to write. The converted RTD value is stored in two 8-bit registers, 0x01 and 0x02. The upper limit and lower limit of the error alarm threshold can be set. Generally speaking, for example, a PT100 can measure the temperature range from -200°C to 420°C. If the user wants to set the lower limit alarm value to -180°C and the upper limit alarm value to 400°C, then when max31865 converts After RTD, the 0x01 and 0x02 register results will be compared with the upper and lower limit values. If it is not within the set range, an error flag will be generated. The error flag is stored in the 0x07 register. Reading temperature process: (1) Read the 0x07 register to see if it is equal to 0x00, which means there is no error flag. When there is an error flag, a certain value in the 0x07 register is 1.

The error flag can be cleared manually, but if the problem is not actually solved, the flag will still be pulled up by the module next time it is checked.

(2) If the error detection can be passed, the following process is started. Write the configuration to 0x80, what is written here is to perform a conversion (One_Shot_Conversion), and then wait for the DRDY pin to become low (meaning the end of the conversion). Then read the two 8-bit registers 0x01 and 0x02. The lowest bit of 0x02 is equipped with the wrong and correct flag. If it is correct, the two 8-bit registers of 0x01 and 0x02 can be used to synthesize the resistance value.

4) PT100 resistance becomes temperature There are various conversion formulas for this.

Note 5 SPI timing interval

Note 6: The reason why max31865 cannot read register data

The data sent by the slave also requires the master to provide a clock signal

Reference Code

//Using RT1052 LPSPI3
//LPSPI3: read and write a byte
//TxData: bytes to write
//Return value: the bytes read
uint8_t LPSPI3_ReadWriteByte(uint8_t TxData)
{ 
   
    uint8_t spirxdata=0;
    uint8_t spitxdata=TxData;
    lpspi_transfer_t spi_tranxfer;
    lpspi_master_handle_t master_handle;

    spi_tranxfer.configFlags=kLPSPI_MasterPcs1|kLPSPI_MasterPcsContinuous;     //PCS1
    spi_tranxfer.txData=&spitxdata;                 //data to send
    spi_tranxfer.rxData=&spirxdata;                 //data to be received
    spi_tranxfer.dataSize=1;                        //Data length
    LPSPI_MasterTransferBlocking(LPSPI3,&spi_tranxfer);     //SPI blocking transmission
// LPSPI_MasterTransferNonBlocking(LPSPI3, &master_handle, &spi_tranxfer);
    return spirxdata;
}
copy
uint8_t max31685_ReadRegister8(uint8_t addr)
{ 
   
    uint8_t ret;
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);
    SysTick_DelayTicks(1U);
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 0U);
    SysTick_DelayTicks(1U);
    ret = LPSPI3_ReadWriteByte(addr);
    SysTick_DelayTicks(1U);
    ret = LPSPI3_ReadWriteByte(0xff);
    SysTick_DelayTicks(1U);
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);
    return ret;

}
copy
uint8_t max31685_WriteRegister8(uint8_t addr, uint8_t data)
{ 
   
    uint8_t ret;
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);
    SysTick_DelayTicks(1U);
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 0U);
    SysTick_DelayTicks(1U);
    ret = LPSPI3_ReadWriteByte(addr | 0x80);
    SysTick_DelayTicks(1U);
    ret = LPSPI3_ReadWriteByte(data);
    SysTick_DelayTicks(1U);
    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);
    return ret;
}
copy
void max31865_Init(void)
{ 
   
    uint8_t ret; //for test

    GPIO_PinWrite(BOARD_USER_SPI_CS0, BOARD_USER_SPI_CS0_PIN, 1U);
    SysTick_DelayTicks(10U);
    //BIAS ON, automatic, three-wire, 50Hz
    max31685_WriteRegister8(MAX31856_CONFIG_REG, MAX31856_CONFIG_BIAS | MAX31856_CONFIG_MODEAUTO | MAX31856_CONFIG_3WIRE | MAX31856_CONFIG_FILT50HZ);
    ret = max31685_ReadRegister8(MAX31856_CONFIG_REG);
}
copy
uint8_t max31865_ReadFault(void)
{ 
   


}


void max31865_ClearFault(void)
{ 
   

}

void max31865_Config(uint8_t reg, uint8_t cfgValue)
{ 
   



}


uint16_t max31865_ReadRTD(void)
{ 
   
    uint16_t rtd = 0;
    rtd = max31685_ReadRegister8(MAX31856_RTDMSB_REG) << 8;
    rtd |= max31685_ReadRegister8(MAX31856_RTDLSB_REG);
    rtd = rtd >> 1;
    return rtd;
}
copy

Reference link 1: https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier?view=all Reference link 2: https://blog.csdn.net/x1131230123/article/details/105446353?spm=1001.2014.3001.5506

Publisher: Full stack programmer, please indicate the source: https://javaforall.cn/149824.html Original link: https://javaforall.cn

Posted by Duje_KH on Tue, 05 Jul 2022 14:16:32 +0530