• PicŪ Basic

  • Steinhart-Hart Linearization Worksheet

    I needed to better understand and to be able to better visualize how a standard 10k NTC (Negative Temperature Coefficient) thermistor would respond to changes in temperature. I knew the basic details, but wanted more visualization. I have made this Excel worksheet a bit flexible, so that you can change the details somewhat to better understand your particular Thermistor. The sheet is locked, to prevent you from accidentally deleting formulas, and allowing you to only change the YELLOW text boxes, etc, but can be unlocked with the password: "proton".

    I have found Thermistors to be very helpful, inexpensive and surprisingly accurate (+/- ~ 0.5°F) though in the future, I will add a method I've come across that increases the accuracy down to 0.2°F.

    Les and others have provided ample code samples, and, should anyone need assistance, I have several variants of my own for both 16F PICŪ (where you cannot use the Log command) and the 18F PICŪ (where you can). Once you get your head around the concept, the code is very simple. You are simply using Stienhart & Hart's (two oceanographer's from the late 60s) algorithm to make the relationship between temperature and resistance a linear relationship. With this simple formula, you get temperature based on 4 inputs: Resistance & 3 coefficients from the thermistor data sheet. We'll call these coefficients a, b & c. That's it.

    The linearization formula is this:
    Temperature (in Kelvin) = 1 / [ a + (b * lnR) + (c * (lnRģ)) ]

    where ln R = the natural log of the resistance.
    The natural logarithm is the logarithm to the base "e", where e is an irrational constant approximately equal to 2.718
    Think of this as e^x = R, or, in other words, e raised to what power = Resistance

    Finally to get from Kelvin to Celsius, you simply add 273.15. (°C = K + 273.15). Should you also want to go to Fahrenheit, you simply take these results and do the following: (°F = 9/5 °C + 32)

    The colder it is, the more resistive the NTC Thermistor will be...

    The standard circuit is a simple resistor divider circuit with the balance resistor on top and the NTC Thermistor on bottom. When choosing the balance resistor, keep in mind that you want the resistor to be large enough to limit the current through the thermistor to prevent "self-heating"

    For a 10-k NTC thermistor, I typically use 16.9kΩ. If my reference voltage is 5.0v, that limits the current to the thermistor to a max of 500ĩA.

    The Thermistor data sheet should have the linearization constants (a, b & c...and sometimes d, etc...but mine had just a, b & c) Enter those values (if known). Next enter your Reference voltage (typically Vdd which is 5.0v or 3.3), unless you're using some other reference source on purpose such as 4.095, etc).

    Here is an example using the constants, etc based on my particular thermistor's data sheet:

    'Carl's Notes from Thermistor Data Sheet
    'NTC Thermistor Probes (10JH/11JH)
    'R-T Formula: 1/T = a + b(ln R) + c(ln R)^3
    'Values for 10K at 25°C:
    'a = 1.125498166 x 10-3
    'b = 2.346771694 x 10-4
    'c = 8.579674698 x 10-8
    'Operating Temperature Range
    '-40° to 80°C
    '(-20° to 105°C with optional UL1015 lead wires)
    'Thermal Time Constant
    '10 seconds typical (liquid)
    'Dissipation Constant
    The Excel file can be found here: http://click-server.com/forumfiles/misc/48946-Steinhart-Hart Worksheet.xls

    This is simply a short article intended to pass on to fellow Proton/Amicus users, a handy worksheet I created for my own purposes. Feel free to use & modify as you wish, though I don't claim it is perfect, it was for my own needs and purposes.

    You will see that it creates a table for Adval, Input voltage, thermistor resistance and the resulting temperatures in 3 different units, all based on 5 simple inputs (the 3 constants mentioned above, plus the Balance Resistor value, along with the Max Reference Voltage)

    For those of you who have seen this before, it has been updated and slightly improved.

    Best Regards,
    Carl (Citius)