Electronic – arduino – Thermistor resistance to celsius conversion

arduinothermistor

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?

Best Answer

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.