# Converting analog 10-bit thermistor reading (MCP3008) to temperature

I'll start by explaining my circuit:

First of all I'm using a Raspberry Pi and the MCP3008 chip on a breadboard. I have 3.3 V going to my thermistor ($1 k\Omega$ at $0^{\circ}C$) when it returns I have a $1 k\Omega$ resistor that goes to ground, and a wire that goes to the MCP3008 chip.

I'm reading the resistance kind of fine using the chip by using this formula:

$$R = \left(\frac{1023}{reading}-1\right) \cdot R_{0^{\circ}C}$$

e.g.

$$R = \left(\frac{1023}{510}-1\right) \cdot 1000 = 1009.82~\Omega~~at~0^{\circ}C~(ice~water)$$

I've been reading about Steinhart and Hart last night, but I simply can't get a formula that works for converting this into a temperature. I even have a spreadsheet showing values of resistance for different temperatures of the thermistor: Pt-1000 Resistance Scheme

I would really appreciate if someone could show me how this conversion is done, and also if I can get a more precise reading, that would be amazing.

• Do you know what a potential divider is? Do you know the analogue range of your ADC? Do you know what ratiometric measurements are? If not, do some background research and re-evaluate your question. Jul 13, 2017 at 8:47

## 1 Answer

I am just suggesting you to try this, consider the below circuit

simulate this circuit – Schematic created using CircuitLab

For example if you read 1.57 volts

from this you can calculate the resistance of the thermistor,

VR2(voltage at resistor R2) = 3.3 * R2/(R1+R2)

in this expression VR2 and R2 is know so you can compute the value of R1.

R1 = ( (3.3 * R2) - (VR2 * R2 ) ) / VR2

for this example the R1 = 1101 OHMS

From this value you can find the temperature by creating a look up table as in the datasheet you included in the link.

• Just a sidenote: In some cases input impedance of ADC pin needs to be taken into account. It would be parallel to R2. Jul 13, 2017 at 11:53
• @karthik: You might be interested to learn about MathJAX for your formulas. See electronics.meta.stackexchange.com/questions/5565/…. Jul 13, 2017 at 11:59