Skip to main content
kotoel26
Associate II
May 11, 2013
Question

Calculate Temperature Sensor STM32L Discovery

  • May 11, 2013
  • 2 replies
  • 629 views
Posted on May 11, 2013 at 19:44

hi , I have a question , when I  calculate the temperature with this code using the formulate in the data sheet:

val_adc=ADC_GetConversionValue(ADC1);

vsense=(val_adc*Vref)/0xfff;

val_adc=(vsense/Avg_Slope)-273.15;

in the data sheet the values are:

Vref=3V Avg slope=1.61mV

i calculated 33�C , but its strange, i dont know if that result its correct o is wrong... 

#sensor #stm32l #discovery
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    May 11, 2013
    Posted on May 11, 2013 at 21:41

    i calculated 33ºC , but its strange, i dont know if that result its correct o is wrong... 

    Bit hard to cross check without some actual measurements?

    It measures die temperature, normally you'd heat and cool the external package with a thermal source
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    raptorhal2
    Lead
    May 12, 2013
    Posted on May 12, 2013 at 15:13

    Two things to consider:

    1. Vref is 3V on the discovery board, may be something else on another board.

    2. The internal temperature sensor has a large variation in offset, so much so that ST recommends it be used only for relative temperature. To use it for actual temperature, let the processor board stabilize at ambient temperature, then add a numerical correction offset to get the ambient temperature. Then place the board in different ambient temperatures and see  if the results are reasonable.

    Calibrating each board this way in a production environment might be impractical. An external temperature sensor is often used in this case.

    Cheers, Hal