Author Topic: Little more accurate ntc measurement  (Read 2301 times)

0 Members and 1 Guest are viewing this topic.

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Little more accurate ntc measurement
« on: May 22, 2022, 09:15:51 am »
Hi all!

How can i measure accuratly the temperature (0-110celsius) with 2,7kohm ntc thermistor? Now i'm using a circuit, but this isn't accurate above 80celsius. On 100celsius the error is 10celsius degree.
I'm using Ads7828 single ended ic, with buffer op amp. Internal voltage reference 2,5v in adc, but i'm using 5v on ntc series resistor, op-amp is working on 3,3V.
I think that this circuit is bad or the chinese ntc bad.
I'm using in my code Steinerhart-hart equation, with i read by the calculate resistance.


" alt="" class="bbc_img" />
Thanks!
« Last Edit: May 22, 2022, 10:09:57 am by Thomas8607 »
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Little more accurate ntc measurement
« Reply #1 on: May 22, 2022, 10:19:26 am »

Remove D12 and check if the results are getting better. Such zeners have a very flat "knee" and might draw enough current at voltages below 2V to interact with R55. Just a guess, didn't look up any datasheet nor did any calculation.
Safety devices hinder evolution
 
The following users thanked this post: Thomas8607

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Little more accurate ntc measurement
« Reply #2 on: May 22, 2022, 10:29:09 am »
What are the calibration measurements you made to determine the Steinhart-hart parameters?
 
The following users thanked this post: Thomas8607

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8168
  • Country: fi
Re: Little more accurate ntc measurement
« Reply #3 on: May 22, 2022, 10:31:35 am »
Possible problems, not in any order of significance:
* D12 starting to conduct more than you expect,
* Unnecessary complexity by unnecessary opamp buffer (just remove it, 100nF alone works as low-impedance source for ADC; if unsure, increase to 1uF)
* Ratiometric measurement not used; use the same (or derived) voltage to excite the NTC and act as ADC VREF. Easiest would be to use the same Vdd for ADC VREF, if possible.
* Incorrect or poor formula; note, NTCs do not actually obey Steinhart-Hart equation, it's only a (relatively good) model. For best results, you need a LUT, and calibrate against a reference sensor over the whole operating range.

If I have to guess, the problem's either D12, or significantly incorrect Steinhart-Hart coefficients (Steinhart-Hart should do an order of magnitude better than 10degC error).
 
The following users thanked this post: Thomas8607

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Little more accurate ntc measurement
« Reply #4 on: May 22, 2022, 12:40:26 pm »
Adding to Siwastaja's list, the MC33202 is not a precision op-amp and may introduce DC offsets that may be significant at higher temperatures where the slope of the thermistor is flattening off.  Low voltage zeners are pretty useless devices in general and of absolutely no use in clamping signals like this.

Providing more details for the thermistor you are using (e.g. part number, Beta or the Steinhart coefficients) would be useful, your bias resistor values seem very high for a 2k7@25C part which will mean a very flat response at high temperatures.  Also what tolerance does the thermistor have?  Your Steinhart coefficients are presumably based on the nominal response, but a 5% tolerance part will add error that is likely greatest at high temperatures.

The separate supply used to bias the thermistor circuit gives scope for some significant errors as you are at the mercy of the stability of your 5v rail, an op-amp (a proper precision op-amp) would be much better employed buffering the reference voltage output from the ADC to bias the thermistor or, as Siwastaja suggests, using the 3v3 supply as the reference for both.  The latter may not be so convenient if you want to use the other ADC inputs for non-ratiometric measurements.
« Last Edit: May 22, 2022, 01:11:10 pm by mikerj »
 
The following users thanked this post: Thomas8607

Offline BeBuLamar

  • Super Contributor
  • ***
  • Posts: 1192
  • Country: us
Re: Little more accurate ntc measurement
« Reply #5 on: May 22, 2022, 12:48:45 pm »
How accurate can you get just by using an ohm meter and a calculator. Doing it manually?
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #6 on: May 22, 2022, 06:13:05 pm »
I will try and remove the diode.
Thanks!
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #7 on: May 22, 2022, 06:17:16 pm »
I display the calculated resistance values. And I describe the corresponding temperatures:
16Celsius: 3668ohm
43Celsius: 1246ohm
48Celsius: 1193ohm
87Celsius: 626ohm
99.6 Celsius: 454ohm
From this I calculate the Steinerhart coefficients.
https://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #8 on: May 22, 2022, 06:25:32 pm »
If I leave a buffer circuit (replace it with precision), how should I connect it?
Should I use 2.5V reference voltage for both NTC and OPamp?
How can I solve to operate from the same reference voltage?
I process 3 thermometer signals. How much do I calculate the power consumption of the opamp? Would a 2.5V reference source be enough for the 3 NTCs and their opamps? Example: LM385BM-2.5 or TL431?

For everyone:
I don’t want a decimal precision, just don’t have a 10Celsius error (maximum 2-3Celsius).
The strange thing is that below 80-75 degrees Celsius, the accuracy is good for me, but I want to make a smaller error around 100 degrees Celsius as well.
 

Offline BeBuLamar

  • Super Contributor
  • ***
  • Posts: 1192
  • Country: us
Re: Little more accurate ntc measurement
« Reply #9 on: May 22, 2022, 07:47:44 pm »
As I said in the previous post. You need to isolate the problem in the electronic circuitry or in the calculation. I would use an ohm meter and use your calculation and see if you would get accurate results. If you do your calculation is good and the problem is in your electronic circuit. If you don't get good results then it's the calculations.
 
The following users thanked this post: thm_w, Tom45, taste_tester

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #10 on: May 23, 2022, 04:38:36 am »
I measured.
I put Potmeter in place of the NTC.
If the potmeter is 0ohm, the voltages are shown in the figure.
It is very sensitive to 5V, 480ohm for 5.02V and 395ohm for 5.05V.
The displayed value is in my program which can be measured at the 100ohm output.
Based on this, the zener diode conducts and current flows on the 100ohm?
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #11 on: May 23, 2022, 08:28:04 am »
I removed the zener diode.
Now the voltage before and after the opamp is the same (there is a difference of 0.001).
In contrast, the 10kohm and 6.8kohm resistors have a tolerance of 1%. I could not measure their exact value, only approximately:
10kohm: 10000ohm?
6.8kohm: 6790ohm
Can I make a linear relation to this?
y = a * m + b

Now what the program calculates and what I measure:
Calculated: Measured:
2355ohm 2370ohm
1482ohm 1663ohm
653ohm 830ohm
-172ohm 0ohm


My calculation in the program:
int ntc_adc = ADS7828_reading (ADS7828_ADDRESS, 07_CH);
float ntc_voltage = mapfloat (ntc_adc, 0.0, 4095.0, 0.0, 2.5);
float ntc_6k8and10k = R3_6k8 + R1_10k;
float ntc_R2 = (((5.02 * R3_6k8) / ntc_voltage) - ntc_6k8and10k);
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #12 on: May 23, 2022, 10:37:13 am »
If the 5V is 5,00V by multimeter, then the error of calculated resistance is +/-50ohm.

Voltage of the power supply 5V fall 0,05V if the circuit switched on (after 30min)
« Last Edit: May 23, 2022, 12:06:20 pm by Thomas8607 »
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #13 on: May 23, 2022, 12:20:35 pm »
If I used a TL431 IC as the reference voltage, set to 2.5V? Would the reference voltage of the ADC also come from here and would the thermistors get 2.5V instead of the current 5V?
So there is only the fault of the resistors.

The current 5V change of 0.03-0.05V causes a big change at high temperatures.

https://www.ti.com/lit/ds/symlink/tl431.pdf?ts=1653293245296&ref_url=https%253A%252F%252Fwww.google.com%252F

Thank you!
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: Little more accurate ntc measurement
« Reply #14 on: May 23, 2022, 01:32:40 pm »
Let's start by optimising the circuit to measure thermistor resistance, and worry about the Steinhart & Hart coefficients later. The ADC measures a voltage, but you want to measure a resistance. One way to do this is to send an accurately-known, constant current through the unknown resistance, and measure the voltage that appears across it. then using Ohm's law, calculate the resistance as R = V_measured/I_known. An easier way to do it is to pass a current, the value of which does not have to be constant, through the unknown resistance and a reference resistance connected in series, and to measure the voltage across each. Then the unknown resistance can be calculated from the ratio of measured voltages and the known value of the reference resistance.

Your ADS7828 ADC will accept reference voltage inputs right up to its supply voltage, if you set bit PD1 to 0 in the command byte. So you can connect the VREF pin to +3.3V (through an RC filter to remove any switching noise present) and also connect the reference resistor and thermistor (in series) between the VREF pin and GND (thermistor at the GND end). Connect the junction of the reference resistor and thermistor to an ADC input channel.

Now when the ADC measures the input voltage, it measures the fraction of the reference voltage that appears across the thermistor, so for a 12-bit ADC:

ADC_reading/4096 = R_thermistor/(R_thermistor + R_reference)

From this you can calculate the thermistor resistance, and use that in the Steinhart & Hart formula.
  • To get the best resolution, you should choose a reference resistor value that is roughly equal to the mean value of the thermistor resistance at the lowest and highest temperatures of interest. This spreads the working temperature range over the largest number of ADC codes
  • The resistance tolerance of the reference resistor, and any change in value with temperature (its own temperature, not the thermistor temperature - they may not be the same) will limit the maximum accuracy of resistance measurement.
  • You don't need a zener diode to protect the ADC inputs - they are safe up to the supply voltage of the ADC
  • As @Siwastaja said, you don't need an OPAMP buffer, just a capacitor on the ADC input
You should build this circuit and test it with a known value resistor in place of the thermistor first
 
The following users thanked this post: Thomas8607

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #15 on: May 23, 2022, 06:18:32 pm »
Thanks!
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Little more accurate ntc measurement
« Reply #16 on: May 23, 2022, 07:19:58 pm »
10% sounds about right. In practice you wont be able to apply the Steinerhart-Hart eqn because Beta will change a bit (or a lot) with temperature. Getting accuracy over 100C range will be hard work. Note the often quoted "B25/85-value 2880 to 4570 K" Values. This gets added to your basic tolerance.  Your DAS is 12-bits but you'll likely only get 7-bits from a thermistor set up.  Run the opamp on 3V3 or less and lose the zener. If you have a long lead, put a small cap across the thermistor to contol RFI. A higher precision opamp wont hurt but given the low starting accuracy you might be wasting your money. A semiconductor sensor might work out to be economical.





 
The following users thanked this post: Thomas8607

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #17 on: May 23, 2022, 07:41:51 pm »
If I measure 100Celsius(+/- 5Celsius) for 100Celsius water is already perfect  ;D

Thanks!
« Last Edit: May 23, 2022, 07:58:24 pm by Thomas8607 »
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: Little more accurate ntc measurement
« Reply #18 on: May 23, 2022, 08:35:11 pm »
10% sounds about right. In practice you wont be able to apply the Steinerhart-Hart eqn because Beta will change a bit (or a lot) with temperature. Getting accuracy over 100C range will be hard work. Note the often quoted "B25/85-value 2880 to 4570 K" Values. This gets added to your basic tolerance.  Your DAS is 12-bits but you'll likely only get 7-bits from a thermistor set up.  Run the opamp on 3V3 or less and lose the zener. If you have a long lead, put a small cap across the thermistor to contol RFI. A higher precision opamp wont hurt but given the low starting accuracy you might be wasting your money. A semiconductor sensor might work out to be economical.

Actually, the Steinhart & Hart model was originally designed to account for the change in effective beta with temperature, and it will comfortably model the resistance/temperature behaviour to better than ±0.5˚C over a 100˚C range - provided its parameters are optimised for the individual thermistor. Even better results can be had if you include the missing second-order term. Thermistors are generally quite stable over time, but they are difficult to make repeatably to close tolerances. Most of the quoted error comes from unit-to-unit variability, unless you pay a lot for close-tolerance matched parts.

Assume the resistance of your thermistor at 0˚C is 5kΩ and that at 100˚C it is 500Ω (these values are about right, I think). Then with a 2.75k reference resistor the ADC reading will be 2642 at 0˚C and 630 at 100˚C. So you get a total range of 2012 counts - 11 bits resolution near as damn it. This should plenty for your needs, even though it is not evenly distributed over the temperature range.

To get the best calibration results, you should have about twice as many measurement points as you have calibration parameters & make a least-squares fit, so ideally 6 different temperatures. 0˚C is easily realised using an ice point: with care, you can get within 10mK quite repeatably. For the other 5, the best way is to use a stirred water bath (e.g. a saucepan or bain marie) with a reference thermometer (but keep your thermistor leads dry, unless it is a fully waterproof type). This is OK up to about 90˚C. Alternatively, use an aluminium 'dry block' with holes drilled for the thermistor and reference thermometer. This can be heated in a domestic oven (not a microwave!), ideally a fan type, with a thermostatic control. If you use a reasonably large block the temperature within should be uniform enough for your needs

For the accuracy you need (I'm assuming ±1˚C), the typical K-type thermocouple thermometer is not accurate enough. A good T-type thermocouple should just about be OK, or a known calibrated thermistor or better, platinum resistance thermometer. A precision semiconductor sensor is also OK, but not all of them maintain their rated accuracy above 85˚C.

A good rule of thumb is that achieving anything better than a genuine ±0.5˚C calibration uncertainty, except over a limited temperature range such as for a clinical thermometer, is difficult and will cost you serious money.

I second the recommendation to put a small capacitor across the thermistor leads, at the ADC input. It keeps EMI out and maintains a low impedance at high frequencies, required by the ADC's sampling input.

Have fun! :)
 
The following users thanked this post: thm_w, Wolfram

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #19 on: May 28, 2022, 06:05:52 pm »
Hi

I have a question, what i do use for reference? Current source or voltage reference?
I saw this: https://www.bristolwatch.com/ccs/LM334_sensors.htm
Or do i use the ads7828 2,5v reference voltage for 3 ntc thermistor? As on attach picture.
Thanks
 

Offline Sauli

  • Contributor
  • Posts: 43
  • Country: fi
Re: Little more accurate ntc measurement
« Reply #20 on: May 29, 2022, 01:28:55 pm »
Normally I would say that use the filtered 3.3V for both the AD converter and to feed the NTC sensor. And use a preamplifier with gain to utilize the full dynamic range of the AD converter.

But your link to the use of the LM334 got me thinking that maybe you could do with a simpler solution if you don't need all 12 bits of the AD converter. Modified your schematic to show the idea.
Actually there are two possibilities: Measure the voltage over the NTC with ADC in differential mode or measure the voltages over the NTC and R3 in single ended mode. The smaller the values of R3 and R4, the more of the AD converter dynamic range can be used. The downside is that the self heating of the NTC will also be greater. To avoid too much self heating you could switch off the current during AD converter idle by connecting ON/OFF control directly to microcontroller output pin. The benefit of the single ended measurement of both NTC and R3 is that you then have a reference resistance value to compare the NTC resistance to.

R4 probably is unnecessary and you could leave it out.

Finally I have to say that I am not an electronics designer and those who are may react with  :-DD
 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #21 on: May 29, 2022, 02:04:18 pm »
I need all 8 channels for anything else, I haven't mentioned them before, but that's why I chose 8 channel IC.

I solved it a little easier, so how accurate it can be? I replaced the operation amplifier with a precision type(or i will remove it) . R42-R44 I set the approximately 400uA (169ohm 0.1%).
400uA * 6250ohm = 2,5v
400uA * 100 ohm = 0,04V
400uA * 10 ohm = 0,004V

The other circuits are linear 0-5V input.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3342
  • Country: nl
Re: Little more accurate ntc measurement
« Reply #22 on: May 29, 2022, 02:44:38 pm »
Can I make a linear relation to this?
y = a * m + b


You can, and apparently you already did, but an NTC is an inherently non-linear device.
It's quite common to use a simple analog frontend, with the only goal of getting your temperatures of interest into the range of the ADC, and then use software for linearisation, offset corrections etc. This can be done with some formula such as quadratic fitting, or a look up table with a few points and linear interpolation between those points.
 

Offline Sauli

  • Contributor
  • Posts: 43
  • Country: fi
Re: Little more accurate ntc measurement
« Reply #23 on: May 29, 2022, 03:29:13 pm »
So, this is for measuring various engine temperatures..

Oil temperature can easily go above 110 degrees. How are you going to attach the sensor to the point being measured? You cannot immerse it directly in water or oil. There are sensors embedded in a mounting plug, but those are expensive. An engine is a tough environment, I would consider using PT1000 instead of NTC.

Quote
The other circuits are linear 0-5V input.
With the 2.5V internal reference you can only measure up to 2.5V.

 

Offline Thomas8607Topic starter

  • Contributor
  • Posts: 22
  • Country: hu
Re: Little more accurate ntc measurement
« Reply #24 on: May 29, 2022, 03:35:08 pm »
This is the intake temperature sensor: https://a.aliexpress.com/_mOB6cAe
This oil and coolant sensor: https://a.aliexpress.com/_mLbFdoO

I measure the 5v on pressure sensor, with voltage divider (10k/10k), these sensors are measuring well the pressure value.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf