cancel
Showing results for 
Search instead for 
Did you mean: 

temperature sensor for stm32f4discovery

ran2
Associate III
Posted on August 21, 2013 at 17:07

Could anyone kindly through me a working example for the temperature sensor.

I have build one on my own but have no way to verify it (use a glass of ice water?).

So I'd like to see how someone else wrote the code.

Thanks in advance!!
7 REPLIES 7
raptorhal2
Lead
Posted on August 22, 2013 at 02:06

Each chip has a different temperature sensor offset, and each board design will dissipate CPU heat differently, so your results will be different.

Let the board stabilize at room temperature and take a reading. Then place the board with the USB still connected in a thick plastic bag and partially submerge in ice water. Allow to stabilize and take another reading. Simple math will give you a gain and offset.

Cheers, Hal

ran2
Associate III
Posted on August 22, 2013 at 10:21

Well, thanks for the reply, you are right about verifying the result.

However there is another possibility: I made it wrong.Something is wrong in my code.

In the this case, I am asking a simple way to see if my code is actually working.

Posted on August 22, 2013 at 13:28

Do you get different measurements at different temperatures?

Do they look roughly the same at the same temperature?

As I recall the slope is backward.

Not much to work with here. Supply some measurements, or code to review.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ran2
Associate III
Posted on August 22, 2013 at 16:19

In my case, it is not backward.

Nailed that now, the variation is simply too small to be observed.

I tried to magnify the reading and then pressed the Core chip hard with all my fingers, then I can see the difference.

raptorhal2
Lead
Posted on August 22, 2013 at 18:29

If you wire a reference to a fixed resister, negative temperature coefficient resister and ground in series, the reading from the input to the NTC resister ''goes backwards''.

So what was the problem ? Not enough sampling time ?

Cheers, Hal

ran2
Associate III
Posted on August 22, 2013 at 18:44

Hi Hal, your code is fine. And mine is fine as well, just the changes is too small that can be barely seen from my poor multimeter. I multiply the readings from the ADC and it become more obvious now.

Cheers!