cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151 Temperature Sensor

alexanderpolleti9
Associate II
Posted on April 20, 2015 at 11:24

Hello everyone,

I want to measure the temperature with the built in temperature sensor in a stm32f151 device. As the application is sleeping most of the time the sensor output shall be near the ambient temperature. I am using the formula from the reference manual with the Calibration values. With my external reference voltage between 3.0 V and 3.3V (slowly changing with temperature and battery lifetime) I recognize a drift of the measured temperature with the voltage. I wonder wether or not I have to compensate this drift of my external reference voltage with measurements of the internal reference voltage.

Does the temperature sensor behave like a temperature dependant resistor with a voltage divider from the reference voltage (in this case I must not compensate with measurement of internal reference voltage) or does it generate a voltage independently of the external reference voltage and I have to compensate with the internal reference voltage?

Thans for your answers

Alexander

#adc #stm32l-temperature-sensor
4 REPLIES 4
Hamid.Wasti
Associate III
Posted on April 24, 2015 at 12:42

The temperature sensor output is a voltage that is dependent only on the temperature and NOT on the supply voltage. Therefore you must compensate the ADC reading for the change in your reference voltage, which is the 3.0V to 3.3V supply voltage in your case, to arrive at the actual voltage output by the temperature sensor. You can then convert this voltage to temperature. At least that is how it is supposed to work, but it does not.

The temperature reading on the STM32L151 is horribly inaccurate. Even doing voltage compensation and applying supposedly device specific factory calibration, a lot of 20 units that are measured at the same time will see as much as 15 degree temperature variation from unit to unit. This is true when the devices have just been powered up at room temperature or when they have been in the burn-in oven at a fixed known temperature for an extended period of time.

So if you want the actual temperature with any degree of accuracy, do not bother to use the internal temperature sensor. It does not work very well.

raptorhal2
Lead
Posted on April 27, 2015 at 14:31

The temperature sensor has an offset that varies significantly from one device to another. If you are producing a large number of boards, it is probably better to use an external temperature sensor and read it via the ADC, I2C bus, etc.

But if this is just a project, or a few units, you can program an offset in each unit to produce a usable result.

Cheers, Hal

alexanderpolleti9
Associate II
Posted on April 27, 2015 at 16:35

Thanks for your answers!

I made some tests and it seems that with the compensation of the external reference voltage via the internal reference voltage give me the same temperature every time I measure, no matter the external reference voltage. It's about 5K above room tempreature. I haven't tried another device yet, but I doubt to get a satisfying accuracy with the internal temperature sensor...

Posted on April 30, 2015 at 16:31

> The temperature reading on the STM32L151 is horribly inaccurate. Even doing voltage

> compensation and applying supposedly device specific factory calibration [...]

Note, that according to the errata, the factory calibration is wrong.

The new A-suffixed parts are supposed to have this fixed, according to the migration document (TN1176).

JW