The method of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation
Technical field
The present invention relates to a kind of temperature measurement technology, particularly a kind of method of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation.
Background technology
Temperature is one of production process parameters the most frequently used in current commercial production, and measuring method and the device of therefore studying temperature are significant.Practical temperature sensor kind is a lot, take radiation temperature measurement abroad as main (accounting for 2/3), domestic thermopair and the thermal resistances (accounting for 98%) of adopting more.
The lead-in wire of thermal resistance mainly contains two-wire system, three-wire system and three kinds of modes of four-wire system at present.
Two-wire system: respectively connect mode that a wire draws resistance signal at the two ends of thermal resistance two-wire system.This lead-in wire method is very simple, but certainly exists lead resistance R owing to connecting wire, and the size of resistance R is relevant with the factor of the material of wire and length, and therefore this lead-in wire mode is only applicable to the occasion that measuring accuracy is lower.
Three-wire system: the one end at the root of thermal resistance connects a lead-in wire, the mode that the other end connects two lead-in wires is called three-wire system, this mode conventionally supports the use with electric bridge, can eliminate preferably the impact of lead resistance, is the most frequently used lead resistance in industrial process control.
Four-wire system: the mode that respectively connects two wires at the root two ends of thermal resistance is called four-wire system, wherein two lead-in wires, for thermal resistance provides steady current I, convert voltage signal U to R, then by another two lead-in wires, U are caused to secondary instrument.This lead-in wire mode can be eliminated the Resistance Influence of lead-in wire completely, is mainly used in high-precision temperature detection.
Therefore, not only there is the impact of conductor resistance on thermal resistance resistance in traditional two-wire system thermal resistance resistance measuring method, but also exist the temperature causing because of temperature variation to float.
Summary of the invention
The present invention be directed to two line system temp measuring accuracy low and be subject to the problem that extraneous thermal effect is large, a kind of method of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation has been proposed, utilize capacitor charge and discharge principle and function of the MCU, the ingenious thermoelectricity resistance that accurately calculates.
Technical scheme of the present invention is: a kind of method of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation, specifically comprises the steps:
1) set up sample circuit: circuit is comprised of interior single-chip microcomputer and constant current source with A/D conversion, and constant current source output connects two-wire system thermal resistance, and the A/D port of single-chip microcomputer connects two-wire system thermal resistance, an electric capacity in parallel at thermal resistance two ends, this electric capacity is sampling capacitance;
2) sampling: set the A/D converter sampling time, the port of constant current source switch is controlled in single-chip microcomputer output, first ports-settings is 1, close constant current source, to the discharge lag time, ports-settings is 0, open constant current source, to constant current source Current rise to the specified working current time, A/D converter starts sample voltage value, sampled value is assigned to V1, and then time delay is to the duration of charging, A/D converter gathers for the second time, collection value is for the second time assigned to V2, single-chip microcomputer calculates the voltage V3=V1-V2 on thermal resistance, voltage obtains thermal resistance resistance divided by constant current source output constant current value,
3) the V1 value capacitance verification: replace electric capacity with a shorting stub, A/D converter collects actual V1 value, comparison step 2), as two values are different, return to step 1) and changes after capacitor's capacity, repeating step 2) sampling, until two values are identical.
The described sampling capacitance duration of charging is less than the specified working current time of rising to of constant current source.
In described constant current source, single-chip microcomputer is selected MC9S12XS128 single-chip microcomputer, the A/D converter of inner 12 successive approximations.
Beneficial effect of the present invention is: the method for two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation of the present invention, can be applicable in the various temperature surveys of industry spot, comparing common two line system temp measuring accuracy improves greatly, reach certain class requirement, can save hardware resource, simply, efficiently, economy, reliability is high, can be applicable in the various temperature surveys of industry spot.
Accompanying drawing explanation
Fig. 1 is that the method for two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation of the present invention realizes circuit diagram;
Fig. 2 is constant current source powered on moment capacitance short-circuit isoboles in the method for two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation of the present invention;
Fig. 3 is the method constant current source of the two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation of the present invention electric capacity isoboles that opens circuit that powers on after certain hour;
Fig. 4 is the method program process flow diagram of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation of the present invention.
Embodiment
The method of two-wire system Thermistor Temperature Measurement conductor resistance auto-compensation is based on acquisition system, adds a sampling capacitance being skillfully constructed, and system is used the simplest equipment to solve a complicated problem.
As Fig. 1 circuit diagram, comprise by interior singlechip group and constant current source with A/D conversion and forming, constant current source output connects two-wire system thermal resistance and powers to it, the A/D port of single-chip microcomputer connects two-wire system thermal resistance, a capacitor C in parallel at thermal resistance two ends, this capacitor C is referred to as sampling capacitance, electric capacity is equivalent to one and contains electric container, it is capacitive to the impedance of electric current, therefore be called capacitive reactance, a key property of capacitive reactance is exactly to be directly proportional to current electric capacity, and the current electric capacity of electric capacity is larger, capacitive reactance is larger, just larger to the impedance of electric current; The current electric capacity of electric capacity is less, and capacitive reactance is less, just less to the impedance of electric current.Electric capacity is before powering on, and being equivalent to electric capacity is zero, is not with any electric charge, and capacitive reactance is at this moment also minimum, energising immediate current is very large, is almost equivalent to short circuit, after a period of time that powers on, owing to being full of electric charge on electric capacity, capacitive reactance is at this moment maximum, has played the effect of opening circuit.
This scheme is controlled the open and close of constant current source by the I/O mouth of single-chip microcomputer.When opening constant current source, current flowing on thermal resistance loop, owing to just powering on, is not with any electric charge in capacitor C, be almost equivalent to short circuit, and its isoboles as shown in Figure 2, is exactly two voltage sums on conductor resistance so utilize the voltage V1 that A/D samples; At constant current source, open after a period of time, on electric capacity, be full of electric charge, be equivalent to open circuit, isoboles as shown in Figure 3, total be exactly the voltage in two conductor resistances of the voltage V2 at this moment sampling by A/D again and thermal resistance resistance, by single-chip microcomputer, can calculate the voltage V3 on thermal resistance, i.e. V3=V2-V1.What the present invention adopted is constant current source, and the voltage calculating on thermal resistance has also just been known the resistance of thermal resistance, has so just eliminated the impact of conductor resistance on thermal resistance resistance, thereby has made temp measuring system more accurate.
Program circuit of the present invention as shown in Figure 4.First master routine is set bus clock, for transformation period of A/D provides clock reference.Afterwards A/D converter is carried out to initialization, i.e. the setting to registers such as the working method of A/D converter, switching time, precision.Then to the I/O mouth of single-chip microcomputer, be that PA0 mouth is set to delivery outlet, and be first set as 1, the object of doing is like this to close constant current source, and time delay 100ms, allows capacitor discharge arrive zero charge afterwards.After electric capacity is discharged, PA0 is set as 0, opens constant current source.And then time delay 20us, object is in order to allow constant current source rise to specified working current 1mA.Carry out A/D sampling again, the value of adopting is assigned to V1, V1 is exactly the voltage on the conductor resistance that measures of the short-circuiting effect of electric capacity powered on moment.Then at time delay 100ms, allow electric capacity be full of electricity, make electric capacity form the effect that opens circuit, finally carry out A/D sampling again, the value of adopting is assigned to V2, V2 is exactly the voltage in conductor resistance and thermal resistance all-in resistance.Like this, just can learn the voltage V3=V1-V2 on thermal resistance.
Image data is as table 1-5, and table 1 is worked as C=22uf, the sampling code value of V1 during t=5.3us; Table 2 is worked as C=22uf, the sampling code value of V1 during t=10.6us; Table 3 is worked as C=22uf, the sampling code value of V1 during t=21.2us; Table 4 is worked as C=47uf, the sampling code value of V1 during t=21.2us; Table 5 is worked as C=680uf, the sampling code value of V1 during t=31.8us.
Table 1
Table 2
Table 3
Table 4
Table 5
V1
|
10 |
10 |
10 |
10 |
10 |
10 |
10 |
10 |
10 |
10 |
When experimental data gathers, with a shorting stub, replace electric capacity, can collect like this V1 value actual correct on conductor resistance, V1=4V.
From experimental data, can find out, when capacitance is 22uf and 47uf, while only having be greater than 21.2us time delay, just can adopt data, that is to say, the rise time 10.6us<t<21.2us of constant current source.Meanwhile, the value that capacitance C adopts when larger is larger compared with the value error of hour adopting than capacitance C, thus can not choose larger electric capacity in order to obtain larger capacitor charging time, otherwise easily produce larger error.Through too much group experiment contrast, the value that system is adopted when capacitance C=47uf is the most accurately, and capacitor C is full of the rise time that the electric time is less than constant current source, and the effect of measurement is fine.So native system adopts the sampling capacitance of 47uf.
Can find, having used the electric capacity of appropriate electrical capacitance, still there is certain error in the data value of adopting simultaneously.This is that what to adopt due to the data sampling of native system is the A/D converter of 12 successive approximations carrying of MC9S12XS128 single-chip microcomputer inside, and the reference voltage of sampling is 5V, so the minimum analog quantity changing value that can detect is 1/2
12, the sampling resolution that is to say native system is 5/2
12=1.221mV.
The V1=4 of code value accurately that systematic survey obtains, but the code value of sampling is sometimes 5, that is to say minimum one that between actual value and exact value, differs as A/D, the sampling resolution that maximal value of native system absolute error is A/D.The range of native system is
.According to accuracy of instrument computing formula:
, therefore, native system precision is:
so,, the precision that native system thermal resistance is measured is just 0.024%.