• The expression will be different for Espruino vs Arduino because analogRead() gives a reading between 0 and 1.
    If you have a resistive divider connected to the ADC input and the top resistor is 10k and the NTC resistor is the bottom resistor in the divider, the ADC reading (val) will be R/(10k+R). Where R is the resistance of the NTC. From this simple expression you derive the expression
    ohms=10000*val/(1-val),
    (ohms in this case is the same as R in the first expression).

    so by taking a reading we can calculate the resistance of the NTC resistor. then it is relatively straightforward to use the Steinhart-Hart equation to figure out the temperature.

    I don't remember exactly how I got the coefficients, it was something I did about a year ago. I probably found some online calculator. I can look into that tomorrow. The NTC resistor I use has a characteristic as shown in this table
    -20 68.915
    -15 54.166
    -10 42.889
    -5 34.196
    0 27.445
    5 22.165
    10 18.010
    15 14.720
    20 12.099
    25 10.000
    30 8.309
    35 6.939
    40 5.824
    45 4.911
    50 4.160
    55 3.539
    60 3.024
    65 2.593
    70 2.233
    75 1.929
    80 1.673

    You could try this online calculator, and plug in three values from the table.
    http://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm

About

Avatar for tage @tage started