Skip to main content
Visitor II
May 20, 2025
Solved

STM32L011 temperature sensor accuracy

  • May 20, 2025
  • 2 replies
  • 389 views

I used the example code in RM, and room temperature is arround 31℃,the ADC value is 10644, calculated temperaure is 4127,  does it means 41.27℃?what will happen if minus temperature?

/* Temperature sensor calibration value address */
#define TEMP130_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007E))
#define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007A))
#define VDD_CALIB ((uint16_t) (300))
#define VDD_APPLI ((uint16_t) (330))


int32_t ComputeTemperature(int32_t measure)
{
int32_t temperature;
temperature = ((measure * VDD_APPLI / VDD_CALIB) - (int32_t) *TEMP30_CAL_ADDR ) ;
temperature = temperature * (int32_t)(130 - 30);
temperature = temperature / (int32_t)(*TEMP130_CAL_ADDR - *TEMP30_CAL_ADDR);
temperature = temperature + 30;
return(temperature);
}

    This topic has been closed for replies.
    Best answer by TDK

    > does it means 41.27℃?

    Yes. A +10 C difference from ambient is reasonable. It is measuring the temperature inside the chip, not ambient. Expect an overall accuracy of +/- 5 C or so. The calibration temperatures are not exact, and the sensor is not perfectly linear. It will be more accurate at measuring relative temperature changes.

    > what will happen if minus temperature?

    Then the result will be negative. For example, -1000 for -10.00 C

    2 replies

    TDKAnswer
    Super User
    May 20, 2025

    > does it means 41.27℃?

    Yes. A +10 C difference from ambient is reasonable. It is measuring the temperature inside the chip, not ambient. Expect an overall accuracy of +/- 5 C or so. The calibration temperatures are not exact, and the sensor is not perfectly linear. It will be more accurate at measuring relative temperature changes.

    > what will happen if minus temperature?

    Then the result will be negative. For example, -1000 for -10.00 C

    STM32L09Author
    Visitor II
    May 20, 2025

    Thanks.