Little more accurate ntc measurement - Page 1
Forum section: electronics / beginners

author: Thomas8607
author_rank: Contributor
timestamp: May 22, 2022, 09:15:51 am
content: 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!

author: capt bullshot
author_rank: Super Contributor
timestamp: May 22, 2022, 10:19:26 am
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: May 22, 2022, 10:29:09 am
content: What are the calibration measurements you made to determine the Steinhart-hart parameters?

author: Siwastaja
author_rank: Super Contributor
timestamp: May 22, 2022, 10:31:35 am
content: 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).

author: mikerj
author_rank: Super Contributor
timestamp: May 22, 2022, 12:40:26 pm
content: 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.

author: BeBuLamar
author_rank: Super Contributor
timestamp: May 22, 2022, 12:48:45 pm
content: How accurate can you get just by using an ohm meter and a calculator. Doing it manually?

author: Thomas8607
author_rank: Contributor
timestamp: May 22, 2022, 06:13:05 pm
content: I will try and remove the diode.Thanks!

author: Thomas8607
author_rank: Contributor
timestamp: May 22, 2022, 06:17:16 pm
content: I display the calculated resistance values. And I describe the corresponding temperatures:16Celsius: 3668ohm43Celsius: 1246ohm48Celsius: 1193ohm87Celsius: 626ohm99.6 Celsius: 454ohmFrom this I calculate the Steinerhart coefficients.https://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm

author: Thomas8607
author_rank: Contributor
timestamp: May 22, 2022, 06:25:32 pm
content: 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.

author: BeBuLamar
author_rank: Super Contributor
timestamp: May 22, 2022, 07:47:44 pm
content: 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.

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 04:38:36 am
content: 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?

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 08:28:04 am
content: 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: 6790ohmCan I make a linear relation to this?y = a * m + bNow what the program calculates and what I measure:Calculated: Measured:2355ohm 2370ohm1482ohm 1663ohm653ohm 830ohm-172ohm 0ohmMy 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);

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 10:37:13 am
content: 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)

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 12:20:35 pm
content: 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%252FThank you!

author: nfmax
author_rank: Super Contributor
timestamp: May 23, 2022, 01:32:40 pm
content: 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 voltageinputsright 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 codesThe 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 ADCAs @Siwastaja said, you don't need an OPAMP buffer, just a capacitor on the ADC inputYou should build this circuit and test it with a known value resistor in place of the thermistor first

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 06:18:32 pm
content: Thanks!

author: Terry Bites
author_rank: Super Contributor
timestamp: May 23, 2022, 07:19:58 pm
content: 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.

author: Thomas8607
author_rank: Contributor
timestamp: May 23, 2022, 07:41:51 pm
content: If I measure 100Celsius(+/- 5Celsius) for 100Celsius water is already perfectThanks!

author: nfmax
author_rank: Super Contributor
timestamp: May 23, 2022, 08:35:11 pm
content: Quote from: Terry Bites on May 23, 2022, 07:19:58 pmActually, 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 orbain 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 needsFor 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!

author: Thomas8607
author_rank: Contributor
timestamp: May 28, 2022, 06:05:52 pm
content: HiI have a question, what i do use for reference? Current source or voltage reference?I saw this:https://www.bristolwatch.com/ccs/LM334_sensors.htmOr do i use the ads7828 2,5v reference voltage for 3 ntc thermistor? As on attach picture.Thanks

author: Sauli
author_rank: Contributor
timestamp: May 29, 2022, 01:28:55 pm
content: 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

author: Thomas8607
author_rank: Contributor
timestamp: May 29, 2022, 02:04:18 pm
content: 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,5v400uA * 100 ohm = 0,04V400uA * 10 ohm = 0,004VThe other circuits are linear 0-5V input.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 29, 2022, 02:44:38 pm
content: Quote from: Thomas8607 on May 23, 2022, 08:28:04 amYou 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.

author: Sauli
author_rank: Contributor
timestamp: May 29, 2022, 03:29:13 pm
content: 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.QuoteWith the 2.5V internal reference you can only measure up to 2.5V.

author: Thomas8607
author_rank: Contributor
timestamp: May 29, 2022, 03:35:08 pm
content: This is the intake temperature sensor:https://a.aliexpress.com/_mOB6cAeThis oil and coolant sensor:https://a.aliexpress.com/_mLbFdoOI measure the 5v on pressure sensor, with voltage divider (10k/10k), these sensors are measuring well the pressure value.

author: Sauli
author_rank: Contributor
timestamp: May 30, 2022, 01:40:48 pm
content: My second circuit suggestion: Take full advantage of the AD converter capability.The circuit is as shown in the first picture. If you have spare I/O pins on the microcontroller you can multiplex the temperature measure channels to the same AD input as I have shown. If not, you must have a separate preamplifier for each channel. You can feed the NTC resistors from the reference voltage either with a constant current source or via resistor (Rb). Resistor Rref is a precision resistor you can use for measuring the offset in the AD reading. You know the exact value of Rref and you know the exact AD reading it should produce, the difference of the expected and actual AD reading is the offset.For determining the component values for R1-R4 I would like to take a graphical approach shown in the second picture. The Y scale in the picture is voltage and the X scale is any linear scale you want to use. Just for an example I have chosen temperature measuring range from 25 degrees to 100 degrees. V25 is the NTC voltage at 25 degrees and V100 is the NTC voltage at 100 degrees. With V25 NTC voltage you want 0V output voltage from the opamp and from V100 NTC voltage the 2.5V AD converter reference voltage. I have drawn lines from V25 on the left to 0V on the right and V100 on the left to 2.5V on the right. These lines cross at some point. The voltage value where they cross (Vb) is the voltage you want the opamp noninverting input to have, so you choose R1 and R2 values to accomplish this. The ratio x4/x3 is opamp gain you want and you choose resistors R4 and R3 to give you that ratio. Most likely you won't find resistor values that give you the exact Vb and gain, so you need to calculate the V25 and V100 values which you actually get with the chosen component values. Of course they no longer are NTC voltages at temperatures 25 and 100, but close and tell you the actual temperature measure range. You can shift the temperature measure range up/down by modifying Vb and broaden/narrow the range by modifying the gain.

author: ledtester
author_rank: Super Contributor
timestamp: June 03, 2022, 02:55:07 am
content: Here is a relevant TI design video:Temperature sensing with NTC thermistor circuit -- Texas Instrumentshttps://youtu.be/by37HiEWEYk