6
\$\begingroup\$

I need some help to choose resistor for voltage divider circuit to read temperature using NTC Thermistor. I'm planning to use STM32 with his 12bit ADC.

The NTC I'm using has the following properties:

  • Sensing Element: Thermistor NTC
  • No-load resistance at 25°C: 10Kohms
  • Tolerances at 25°C: ±1%
  • Beta(25/85) Constant: 3977K ±1%
  • Operating temperature range: -40C ÷ 125C

More information available here: Datasheet.

The temperatures I will be measuring are between 15C and 65C.

I'm planning to build a simple circuit like this:

NTC Voltage Divider

What would be a good value for Rs for this conditions? I believe is better to use the 3.3v rail instead of 5v from STM32, is that correct?

I think with this circuit when temperature raises the voltage on Vout will decrease. I also saw some designs where Rs and Rt are flipped. Is there any advantage of the other (flipped) approach? With this approach I believe I can pass less current on Thermistor as ideally should be max 1mA.

Can I get reasonable good precision with circuit like this or shall I consider noise cleaning with capacitor or more complex circuits using OpAmp etc?

\$\endgroup\$
4
  • \$\begingroup\$ To reach maximum accuracy, max volts at min temperature. Maximum voltage take equal to Vref of ADC. But right way to measure resistance is to use constant current source. \$\endgroup\$
    – user263983
    Jan 13, 2022 at 13:18
  • 1
    \$\begingroup\$ Could record DAC values and temperature at many points along the range of interest, then curve-fit this (regression) to a formula. Then apply any arbitrary DAC value to the formula, and you'll have a fairly accurate temperature. This can work for very non-linear "sensors" also, like a diode junction. \$\endgroup\$
    – rdtsc
    Jan 13, 2022 at 13:38
  • \$\begingroup\$ You have an NTC, so if you want an output voltage that's positively correlated to your temperature you need to switch your thermistor and resistor positions. \$\endgroup\$
    – Reinderien
    Jan 13, 2022 at 13:43
  • 1
    \$\begingroup\$ electronics.stackexchange.com/questions/602599/… \$\endgroup\$
    – Antonio51
    Jan 13, 2022 at 13:45

2 Answers 2

6
\$\begingroup\$

The STM32 most likely uses 3.3 V as the DAC reference so for the sensing circuit it makes sense to use 3.3 V too.

Usually the approach is to select a resistance \$R_{s}\$ which will maximize the voltage swing seen at the ADC pin for the temperature range you want, which depends on the sensor resistance at those temperatures.

So, based on min and max temperature you want, calculate the min and max thermistor resistances \$R_{min}\$ and \$R_{max}\$.

Then the optimum \$R_{s}\$ that maximizes the voltage swing is the geometric mean of \$R_{min}\$ and \$R_{max}\$, i.e.

$$ R_s=\sqrt{R_{min} \cdot R_{max}} $$

Just make sure that the \$R_{s}\$ value is sensible and does not lead to too much current flowing and affect the reading by heating up the thermistor. Also it should not make much difference which way the thermistor \$R_{t}\$ and resistor \$R_{s}\$ are in the circuit.

\$\endgroup\$
1
4
\$\begingroup\$

As you want to cover the range 15°C to 65°C, you should use a resistor equal to its resistance at the mid temperature of 40°C. This will give you the best (or least worst) resolution, more or less equal resolution at both extremes of your temperature range, assuming your ADC goes rail to rail. That said, ADC resolution at the extremes will be somewhat worse than your mid-range resolution.

You might want to consider changing the value of RS as the temperature changes, perhaps with the use of three-state outputs from your MCU, or with analogue switches or FETs, to keep your resolution up. The best resolution is obtained at around half rail, where RS ~ RT. The bonus from this is that you'll have excellent linearity of temperature to voltage over about ±5°C from the equal resistance point.

\$\endgroup\$
3
  • \$\begingroup\$ To have an idea, using a resistor for mid of 40C, which order of magnitude will be the precision? +- 1C or 0.5C or 0.1C ? \$\endgroup\$ Jan 13, 2022 at 14:06
  • 1
    \$\begingroup\$ @lealoureiro You have the beta value for the thermistor, you work it out. Resolution is easy, but if you need precision, then you need to know more about the ADC on the STM32, like its linearity, and if you're not using the same supply that's powering the thermistor for the ADC reference, then the tracking of those two voltages as well. \$\endgroup\$
    – Neil_UK
    Jan 13, 2022 at 14:14
  • 1
    \$\begingroup\$ @lealoureiro - You're not going to get +/-1 deg C, much less 0.5C or 0.1C accuracy without some type of calibration. And remember that the beta value is only accurate over a relatively narrow temperature range. Look on this site for some info on using the Steinhart-Hart equation for converting resistance to temperature. \$\endgroup\$
    – SteveSh
    Jan 14, 2022 at 0:39

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.