2013-08-21 08:07 AM
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!!2013-08-21 05:06 PM
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, Hal2013-08-22 01:21 AM
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.2013-08-22 04:28 AM
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.2013-08-22 07:19 AM
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.2013-08-22 07:21 AM
@Hal, one solution here
https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32Discovery%2fCapteur%20Internal%20Temperature%20sensor.!!&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE6... actually works, but this time as Clive mentioned, it goes backward.2013-08-22 09:29 AM
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, Hal2013-08-22 09:44 AM
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!