On Fri, 7 Jul 2017 17:52:25 -0700 (PDT), Mala Dies

<functt@gmail.com> declaimed the following:

Hello Rob,

Seth here, again. I tried out the *(reading.value / 4096.0) * 1800;* in the

software. It tells me that I have a temperature of -49.99 degrees in

Celsius. I am trying to make believe my calculations from the software are

correct with the inside/climate controlled temp. in this house.

So, what value are you getting for "reading.value" and does it make

sense?

Working backwards (with the above correction)

function displayTemp(reading)

{

var millivolts = reading.value * 1800;

var tempC = (millivolts - 500) / 10;

for a temperature of -49.99

-49.99 = (mv - 500) / 10

-499.9 = (mv - 500)

0.1 = mv

0.1 = (rv / 4096) * 1800

5.555E-5 = rv / 4096

0.227 = rv

For all practical purposes, your -49.99 is what would be expected if

you were reading ground (actual ground would result in -50degC).

Comparing the same circuit and (similar) code between (Monk)

Programming the Beaglebone Black and (Chavan) Programming the BeagleBone...

Neither use the 4096 divisor; apparently bonescript is supposed to already

scale the ADC value to 0.0-1.0; the 4096 would be needed if you were

getting the actual ADC counter (12-bit). They differ on the temperature

equation (beyond the difference between mV and V)

v = rv * 1.8

vs

mv = rv * 1800

degC = (100 * v) - 50

vs

degC = (mv - 500) / 10

If "rv" were 0.5, then

v = 0.9 mv = 900

degC = 40.0 degC = 40.0

... so the two formulation will display the same value. Now, if rv were 0.0

it gives

v = 0.0 mv = 0

degC = -50 degC = -50

Note that the sensor is rated for a minimum of -40degC, so there must

be some residual voltage on the ADC at all times -- equivalent to 0.1v (or

0.055 from the ADC)

According to the spec sheet, the TMP36 has an offset of 0.5v, and

produces 0.75v at 25degC.

degC = (v - 0.5) * 100

is the direct translation, and again, an ADC value of 0.0 gives a -50degC.