7 years, 11 months ago.

tempC calculation

Hi Gautam,

i want to ask a question about tempC calculation. What is the number of "3.685503686"? How do you find it? Thank you.

1 Answer

7 years, 11 months ago.

I'm not sure where that number came from. If the LM35 is connected directly to the analog in then you want to use 3.3 *.

The output of an LM35 is 10mV per degree C, AnalogIn gives 1.0 for Vcc (3.3V) and 0.0 for 0V so AnalogIn * 100 * 3.3 should give you the temperature in C.

However if you have any sort of resistor network or other setup between the LM35 and the analog input pin then that multiplier could be different.

  • On a lot of mbed boards the Vcc is actually closer to 3.2V than 3.3V and so using 3.2 rather than 3.3 may give you a more accurate number if you care about a few percent error.