1
\$\begingroup\$

I'm new to electronics, and experimenting with a thermistor plugged into an Arduino. It is a 4.7k thermistor (full specs) and I'm using it in conjunction with a 10k resistor (product page).

enter image description here

When rigged up to the Arduino (and powered via a 3.3V pin) it returns an analog reading of around 2870 at room temperature.

I've looked at a few different conversion scripts out there, but most seem to be working when the analog reading is ~600-700. Have I done something wrong? If not, how do I go about working out how to do the conversion?

\$\endgroup\$
5
  • \$\begingroup\$ Show the schematic. \$\endgroup\$
    – Eugene Sh.
    Nov 4, 2015 at 19:53
  • \$\begingroup\$ Done! Let me know if you need anything else. Pin A5 is set to high, so it should give a constant 3.3v output. \$\endgroup\$
    – richwol
    Nov 4, 2015 at 20:07
  • \$\begingroup\$ Swap the thermistor and the 10K and see if your numbers are then closer to the "other people's numbers" perchance? It's a voltage divider either way. \$\endgroup\$
    – Ecnerwal
    Nov 4, 2015 at 20:09
  • \$\begingroup\$ Damn, that's confusing! That's now returning values around ~1300 \$\endgroup\$
    – richwol
    Nov 4, 2015 at 20:14
  • \$\begingroup\$ So, try 20K (or two 10K in series) - it should not be all that confusing - I would hope that your unit-less numbers have some reasonable relationship to voltage (perhaps the handy one of being millivolts, though that does not seem to fit what you've reported. Might be 4096 to 3.3V??) If you are doing the calibration/LUT yourself, you don't really need a particular value to start with so long as the current is not excessive for the part (self-heating can cause errors in a manner that should self-explanatory.) \$\endgroup\$
    – Ecnerwal
    Nov 4, 2015 at 22:19

2 Answers 2

2
\$\begingroup\$

There are two formulas describing the resistance-temperature dependency. The most commonly used formula is

The B-Formula

$$R(T)=R_0\cdot \exp \left(B\cdot\left(\frac{1}{T}-\frac{1}{T_0}\right)\right)$$

where \$R_0=4.7k\Omega\$ and \$T_0=298.15K\$ (Note that the formula uses Kelvin, and the nominal resistance \$R_0\$ is given for 25°C=298.15K)

\$B=3977K\$ is a constant specific for your part, and usually listed in the datasheet, or your product page.

the inverse of the formula is $$T=\frac{T_0\cdot B}{T_0\cdot \ln(R/R_0)+B}$$

This formula is usually suitable for a temperature range of -20...+120°C, but you may find your own value for B if your measurement range is far away from this. However, I observed a deviation of just 1°C at -40°C for a type I used.

The Steinhart-Hart-Formula

If the B-Formula doesn't meet your accuracy needs, you can use this:

$$T=\frac{1}{A+B\cdot\ln\frac{R}{R_0}+C\cdot\ln^2\frac{R}{R_0}+D\cdot\ln^3\frac{R}{R_0}}$$

However, the Steinhart-Hart coefficients A, B, C, D are usually not given in datasheets, and you have to find them out on your own. (Also, calculation of the inverse is... one of my professors would say something for long Christmas night without girlfriend...)


I would advise you to go with the B-Formula, as it's the easiest and the B value is usually known. A look-up table eats some memory, and the work to determine the values is in vain when you have to exchange the thermistor due to part spread.


About your analog readings

If A5 outputs 3.3V, you should get about \$\frac{10k\Omega}{10k\Omega+4.7k\Omega}\cdot 3.3V=2.24V\$ for high room temperatures (25°C). For lower temperatures, the thermistor has a higher resistance, and the voltage should be lower.

\$\endgroup\$
2
\$\begingroup\$

Thermistors have weird and whacky "resistance to temperature" curves. While you can get all excited about trying to model them and curve-fit, the standard method of dealing with them is a look-up table, perhaps combined with interpolation.

If you are using one in the same configuration as someone else, you might be able to borrow their figures, though there are still part-to part variations that can be inconvenient. Otherwise a calibration step where you generate the look-up table is required.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.