Skip to main content
Visitor II
January 6, 2025
Question

LPS25HBTR pressure reading decreasing over time

  • January 6, 2025
  • 2 replies
  • 2440 views

I have bought a MKI-165V1 to test LPS25HBTR,but I find that the pressure value is decreasing for a long time ,from 1014.117 to 1002.970 in an hour.It is not stable,the next is my initial code,what is the reason for it

uint8_t data = 0x90;
HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x20 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
HAL_Delay(10);
data = 0x00;
HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x21 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
// HAL_Delay(10);
// HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x22 , I2C_MEMADD_SIZE_8BIT, pData, Size, 0xFF);
HAL_Delay(10);
HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x23 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
HAL_Delay(10);
    This topic has been closed for replies.

    2 replies

    Technical Moderator
    January 7, 2025

    Hi @2067 ,

    Can you please implement our official drivers and let me know if you still have the problem?

    2067Author
    Visitor II
    January 8, 2025

    I think this sensor doesn't have many registers, so there's no need to use the official driver. Are there any other reasons for this, or are there any stable sensor configurations you would recommend?

    Technical Moderator
    January 8, 2025

    Hi @2067 ,

    It was just a way to check that your fw was correct.

    Do you have a reference sensor with which you measure humidity?

    Graduate
    February 5, 2025

    Hi 2067

    That drift can be attributed to both weather wind and ventilation.

    But to find what is weather, what is drift, what is noise, make a science project of it!

    1 Get your grandma's biggest preservation jar and put your device in it

    2 If you have an analogue barometer put it there as well, it will likely show a constant offset to your device.

    3 Program your device to make ten samples or more per hour for 24 hours. You'll see both drift and noise level.

    4 Watch out for any heating on the sensor.

    5 Watch out for windy days as air pressure on the facade makes readings wobbly.

    6 And close the lid, make it air tight with soap, and have it all in shadow. Maybe in the basement.

    7 Do regular analogue readings too, if you had a barometer

    And please show the results here :)

    If your readings differ from the local digital weather report, then you and ST can start a discussion!

    2067Author
    Visitor II
    February 14, 2025

    Here is the code I wrote in Keil for configuring and reading data from the LPS25. Please tell me if this code could cause the values to decrease.

    void LPS25_Init(void)
    {
    uint8_t data;
     
    data = 0x05;
    HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x10 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
    HAL_Delay(10);
    data = 0xC1;
    HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x2E , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
    HAL_Delay(10);
    data = 0x40;
    HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x21 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
    // HAL_Delay(10);
    // HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x22 , I2C_MEMADD_SIZE_8BIT, pData, Size, 0xFF);
    HAL_Delay(10);
    // data = 0x00;
    // HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x23 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);
    // HAL_Delay(10);
     
    data = 0x94;
    HAL_I2C_Mem_Write(&hi2c4, 0xB8, 0x20 , I2C_MEMADD_SIZE_8BIT, &data, 1, HAL_MAX_DELAY);//注意用哪个IIC
    HAL_Delay(10);
     
    }
     
    float LPS25_getdata(void)
    {
    uint8_t qiya_buff[3];
    uint32_t qiya_data;
    float qiya;
    HAL_I2C_Mem_Read(&hi2c4, 0xB9, 0x28 , I2C_MEMADD_SIZE_8BIT, &qiya_buff[0], 1, HAL_MAX_DELAY);
    HAL_I2C_Mem_Read(&hi2c4, 0xB9, 0x29 , I2C_MEMADD_SIZE_8BIT, &qiya_buff[1], 1, HAL_MAX_DELAY);
    HAL_I2C_Mem_Read(&hi2c4, 0xB9, 0x2A , I2C_MEMADD_SIZE_8BIT, &qiya_buff[2], 1, HAL_MAX_DELAY);
    qiya_data = (uint32_t)(qiya_buff[2] << 16) | (uint32_t)(qiya_buff[1] << 8) | (uint32_t)qiya_buff[0];
    qiya = (float)qiya_data/4096.0f;
    return qiya;
    }