# Selecting bias resistor for thermistor

Rt is thermistor. Rb is bias resistor, which value I need to calculate. The temperature that I'm interested in is giving Rt resistance range of 4k...115k. What I want is to scale this to whole ADC resolution, which is 10 bit ie 0...1023. So when Rt = Rb ADC will convert it to 511. Not sure if it's possible, but ideally I would like to get 0 ADC reading when Rt = 4k and 1023 when Rt = 115k (or the other way).

Internally in MC I have lookup table, which will convert ADC value to temperature, according to curve described in thermistor datasheet. • Why not have a potentiometer so you can change the value?
– Dean
Dec 21, 2012 at 12:09
• Why would I need to change the value for the given parameters and ranges? I think Rb should be very certain value. Dec 21, 2012 at 12:19
• It would allow you to set the value more accurately, and I wasn't thinking of a POT with a long knob but a preset resistor instead.
– Dean
Dec 21, 2012 at 12:24
• Once I know how to calculate the value of Rb, it's good idea to put preset resistor. Dec 21, 2012 at 12:29

If $R_T$ lowest resistance is 4k, then you can easily calculate the resistance required to make a voltage divider. If you select an ADC reference voltage from the internal band gap (usually 2V56 or 1V1), you can use almost whole ADC range. Thus (provided $V_{CC}$ is constant):

$$U_{REF} = U_{IN,MAX} = \frac{R_{B}}{R_{B}+R_{T,MIN}} × V_{CC}$$ $$R_B = \frac{U_{REF}×R_{T,MIN}}{V_{CC} - U_{REF}}$$

And round $R_B$ down, so you will never hit full scale on the ADC. Once you have $R_B$ you should be able to calculate the lowest input voltage that you can reach. Knowing this is valuable because you can do two sanity checks in your program:

1. When the ADC-value is (near) 1023, this indicates that the sensor failed short circuit (bad wiring, ...);
2. When the ADC-value is (near) 0, this indicates that the sensor failed open (not attached, broken wire, ...)

Based on these two checks you can make your program decide what to do: Eg. set an error output high, remove power from a load, ...

Mind you that with this resistive voltage divider, resolution of your measurement will vary widely along the scale.

Eg. with band gap reference set to 1V1 and supply voltage 5V: $$R_B = \frac{1.1V×4k\Omega}{5V-1.1V}= \frac{4.4k}{3.9}= 1.13k\Omega$$ Rounded down to first available E12 value makes $1k\Omega$

$$U_{IN,MIN} = \frac{1k\Omega}{1k\Omega+115k\Omega}×5V = 43mV$$

$$U_{IN,MAX} = \frac{1k\Omega}{1k\Omega+4k\Omega}×5V = 1000mV$$

The advantage of using the 1V1 reference is that it is pretty easy to predict an approximate ADC value range: 43 - 1000

• ADC reference voltage is equal to VCC. Do you think average resolution along the scale will make around 1 degree C tolerance? Dec 21, 2012 at 12:54
• What controller do you use and are you sure you don't want to change to the band gap reference? Dec 21, 2012 at 13:01
• ATMega328P. I thought AVCC reference gives me better resolution. Certainly I can setup to work with 1.1 VBG reference if it would give me better results. Dec 21, 2012 at 13:05
• Just make sure your Vcc is stable, as it is part of the equation. Of course you can measure Vcc with the same ADC (using a second voltage divider) and correct the measurements for varying Vcc. Dec 21, 2012 at 13:09
• Rb = Constant Current. That will double it's effectiveness, add some linearity to the output, and provide isolation from voltage fluctuations. Dec 21, 2012 at 14:33

With a simple resistive divider, you won't be able to stretch the range of output voltages to cover the full range of the ADC input, but you'll get the best overall resolution by setting your bias resistor to the geometric mean of the minimum and maximum resistance values of your sensor (for the temperature range of interest).

For your specific setup, that would be $\sqrt{4K * 115K} = 21.447K$

You could select a 21.5K 1% resistor or a 22K 5% resistor. The voltages you get will run from 15.7% to 84.3% of the ADC input range.

To get output voltages that cover the full range of the ADC, you'll need an active (e.g., op-amp) circuit that has gain and offset capability.

• your solution also worked. I wish I could accept more than one answer. Dec 21, 2012 at 16:25
• Can you give any reference for this formula. Feb 1, 2022 at 4:17

Here's a quick derivation for @Dave's answer.

Our goal is to optimize the output range of the voltage divider. This range is the difference between two voltage divider ratios. $$\frac{output\: swing}{V_{DDA}} = \frac{R_B}{R_B+R_{T,min}} - \frac{R_B}{R_B+R_{T,max}}$$

To optimize this, we can take the derivative with respect to $$\R_B\$$ and set it equal to 0. The math is simpler if $$\R_B\$$ and $$\R_T\$$ are flipped, you should get the same result either way. $$\frac{output\: swing}{V_{DDA}} = \frac{R_{T,max}}{R_{T,max}+R_B} - \frac{R_{T,min}}{R_{T,min}+R_B}$$

$$\frac{d}{dR_B} \left[\frac{output\: swing}{V_{DDA}}\right] = \frac{R_{T,min}}{(R_{T,min}+R_B)^2} - \frac{R_{T,max}}{(R_{T,max}+R_B)^2}=0$$

\begin{align*} \\ &R_{T,min}(R_{T,max}+R_B)^2-R_{T,max}(R_{T,min}+R_B)^2 = 0 \\ &(R_{T,min}-R_{T,max})R_B^2-(R_{T,max}R_{T,min}^2-R_{T,min}R_{T,max}^2) = 0 \\ &(R_{T,min}-R_{T,max})R_B^2-R_{T,min}R_{T,max}(R_{T,min}-R_{T,max}) = 0 \\ &R_B^2=R_{T,min}R_{T,max} \\ \\ &\boxed{R_B = \sqrt{R_{T,min}R_{T,max}}} \\ \end{align*}

There's probably a deeper reason why it works out to be the geometric mean, but this is how I approached the problem. Hope this helps simulate this circuit – Schematic created using CircuitLab

This simple circuit will give you a fairly linear range of output voltage from 0 to 3.3V, but it requires a stable -3.3 VDC bias voltage. Without the negative bias, the curve is similar, but ranges from 3.3V to 1.67V. 