A temperature measurement method, apparatus, device, and storage medium thereof
By using a pre-fitted mapping relationship between ambient temperature and temperature change coefficient, the temperature change coefficient is updated, solving the problem of large temperature measurement error in NTC resistors and achieving high-precision temperature measurement and control, which is suitable for kitchen appliances.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2026-03-13
AI Technical Summary
Existing NTC resistance temperature measurement methods have large temperature errors, resulting in low temperature control accuracy in kitchen appliances.
By using a pre-fitted mapping relationship between ambient temperature and temperature change coefficient, combined with the resistance value of a thermistor, the temperature change coefficient is updated, thereby improving the accuracy of temperature measurement.
Within the range of 0 to 300 degrees Celsius, the temperature measurement error is less than 2%, which improves the temperature control accuracy and operating efficiency of kitchen appliances and reduces the MCU memory resource usage.
Smart Images

Figure CN114370950B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of temperature measurement, specifically to a temperature measurement method, apparatus, device, and storage medium. Background Technology
[0002] Many kitchen appliances on the market require heating to cook food, but achieving good results necessitates temperature control to keep the appliance within a set temperature range. Negative Temperature Coefficient (NTC) resistors are commonly used sensors for temperature measurement in kitchen appliances today. An NTC is a thermistor whose resistance decreases as temperature increases.
[0003] Temperature measurement using an NTC (Nearest Temperature Controller) requires measuring the NTC's resistance value, substituting that resistance value into a given temperature resistance formula to calculate the temperature. However, existing temperature resistance formulas use constant coefficients, leading to significant errors in the calculated temperature. Summary of the Invention
[0004] This application provides a temperature measurement method, apparatus, device, and storage medium to improve the accuracy of temperature measurement.
[0005] A first aspect of this application provides a temperature measurement method applied to a temperature measuring device, the temperature measuring device being used to measure the temperature of a target environment, the temperature measuring device including a thermistor, the method comprising:
[0006] Obtain the current first resistance value of the thermistor, where the resistance value of the thermistor is related to the ambient temperature;
[0007] Substituting the preset value of the temperature change coefficient and the first resistance value into the correlation relationship, the predicted temperature value of the target environment is obtained. The correlation relationship is used to represent the numerical influence relationship between the ambient temperature, the temperature change coefficient and the resistance value of the thermistor.
[0008] Based on the pre-fitted mapping relationship between ambient temperature and temperature change coefficient, the target value of the temperature change coefficient corresponding to the predicted temperature value is determined.
[0009] Substitute the first resistance value and the target value of the temperature change coefficient into the correlation to determine the target temperature value of the target environment.
[0010] In this embodiment, a pre-fitted mapping relationship between ambient temperature and temperature change coefficient is used to obtain the target value of the temperature change coefficient based on the predicted temperature value of the target environment. Then, the correlation between ambient temperature, temperature change coefficient and the resistance value of the thermistor is used to obtain the target temperature value of the target environment based on the first resistance value and the target value of the temperature change coefficient. The influence of ambient temperature on the temperature change coefficient is taken into account, and the temperature change coefficient is updated, resulting in higher accuracy of temperature measurement.
[0011] In one implementation of the first aspect of this application, before determining the target value of the temperature change coefficient corresponding to the predicted temperature value, the method further includes:
[0012] Obtain N ambient temperature values and the second resistance value of the thermistor corresponding to each ambient temperature value, where N is a positive integer greater than 1;
[0013] Substituting N ambient temperature values and the second resistance value corresponding to each ambient temperature value into the correlation relationship, a reference value for the temperature change coefficient corresponding to each ambient temperature value is obtained;
[0014] By fitting N ambient temperature values and reference values of the temperature change coefficient corresponding to each ambient temperature value, the mapping relationship between ambient temperature and temperature change coefficient is obtained.
[0015] In this embodiment, N ambient temperature values and their corresponding reference values of temperature change coefficients are used for fitting to obtain the mapping relationship between ambient temperature and temperature change coefficient, which improves the feasibility of this solution.
[0016] In one implementation of the first aspect of this application, fitting is performed using N ambient temperature values and a reference value for a temperature change coefficient corresponding to each ambient temperature value, including:
[0017] A polynomial fitting is performed using N ambient temperature values and reference values of the temperature change coefficient corresponding to each ambient temperature value to obtain a mapping relationship, where B represents the temperature change coefficient and T represents the ambient temperature value.
[0018] In this embodiment, a quadratic function is used as the target function for fitting, which is simpler to calculate and faster to fit.
[0019] In one implementation of the first aspect of this application, obtaining N ambient temperature values and a second resistance value of a thermistor corresponding to each ambient temperature value includes:
[0020] The ambient temperature of the thermistor is divided into M temperature ranges. P ambient temperature values are selected from each of the M temperature ranges. N ambient temperature values are formed by the ambient temperature values selected from the M temperature ranges, where M is a positive integer and P is an integer.
[0021] Obtain the second resistance value of the thermistor corresponding to each ambient temperature value.
[0022] In this embodiment, the ambient temperature range of the thermistor is divided, and an equal number of ambient temperature values are selected in each temperature range for numerical fitting, which improves the feasibility of the solution.
[0023] In one implementation of the first aspect of this application, obtaining N ambient temperature values and a second resistance value of a thermistor corresponding to each ambient temperature value includes:
[0024] The ambient temperature of the thermistor is uniformly divided into G temperature ranges, where G is a positive integer;
[0025] If the i-th temperature range is a preset common temperature range, then select U ambient temperature values in the i-th temperature range.
[0026] In the G temperature ranges, if the i-th temperature range does not belong to the preset common temperature range, V ambient temperature values are selected in the i-th temperature range; U and V are integers, and U is greater than V;
[0027] N ambient temperature values are composed of ambient temperature values selected from G temperature ranges;
[0028] Obtain the second resistance value of the thermistor corresponding to each ambient temperature value.
[0029] In this embodiment, the ambient temperature range of the thermistor is averaged, and the sampling density of the ambient temperature value is determined according to whether each temperature range belongs to the preset common temperature range. If the divided temperature range belongs to the preset common temperature range, the sampling density is large; if the divided temperature range does not belong to the preset common temperature range, the sampling density is small, thereby improving the accuracy of the preset common temperature range.
[0030] In one implementation of the first aspect of this application, the correlation is R0 = R exp B(1 / T0 - 1 / T), where B represents the temperature change coefficient, R represents the resistance value of the thermistor, T represents the ambient temperature, T0 represents the reference temperature, and R0 represents the resistance value of the thermistor at T0.
[0031] In this embodiment, a specific function is used as the correlation, which improves the feasibility of the solution.
[0032] In one implementation of the first aspect of this application, obtaining N ambient temperature values and a second resistance value of a thermistor corresponding to each ambient temperature value specifically includes:
[0033] Use an analog-to-digital converter (ADC) to obtain the second resistance value at N ambient temperatures.
[0034] In this embodiment, an analog-to-digital converter (ADC) is used to measure the second resistance value, which improves the feasibility of the solution.
[0035] A second aspect of this application provides a temperature measuring device, including: a thermistor, a resistance measuring unit, and a processing unit;
[0036] The resistance measurement unit is used to measure the current first resistance value of the thermistor, where the resistance value of the thermistor is related to the ambient temperature.
[0037] The processing unit is used to obtain the current first resistance value of the thermistor from the resistance measurement unit; substitute the preset value of the temperature change coefficient and the first resistance value into the correlation relationship to obtain the predicted temperature value of the target environment, wherein the correlation relationship is used to represent the numerical influence relationship between the ambient temperature, the temperature change coefficient and the resistance value of the thermistor; determine the target value of the temperature change coefficient corresponding to the predicted temperature value according to the pre-fitted mapping relationship between the ambient temperature and the temperature change coefficient; and substitute the first resistance value and the target value of the temperature change coefficient into the correlation relationship to determine the target temperature value of the target environment.
[0038] A third aspect of this application provides a temperature measuring device, including a thermistor, a memory, and a processor. The processor is configured to execute one or more computer programs stored in the memory, and when executing the one or more computer programs, the processor causes the computer device to implement the method of the first aspect.
[0039] A fourth aspect of this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method of the first aspect.
[0040] The fifth aspect of this application provides a chip system including at least one processor and a communication interface, the communication interface and the at least one processor being interconnected via a line, the at least one processor being used to run a computer program or instructions to perform the method of the first aspect. Attached Figure Description
[0041] Figure 1 This is a schematic diagram of the structure of the temperature measuring device according to an embodiment of this application;
[0042] Figure 2 This is a schematic diagram of the structure of the second temperature measurement circuit according to an embodiment of this application;
[0043] Figures 3 to 9This is a flowchart of a temperature measurement method according to several embodiments of this application;
[0044] Figure 10 This is a data diagram of a temperature measurement method according to an embodiment of this application;
[0045] Figure 11 This is another data diagram of the temperature measurement method according to an embodiment of this application;
[0046] Figure 12 This is another data diagram of the temperature measurement method according to an embodiment of this application;
[0047] Figure 13 This is a schematic diagram of the structure of a temperature measuring device according to an embodiment of this application. Detailed Implementation
[0048] This application provides a temperature measurement method, apparatus, device, and storage medium to improve the accuracy of temperature measurement.
[0049] The resistor used in this embodiment is a thermistor. A thermistor is a sensor resistor whose resistance changes with temperature. Based on their temperature coefficient, thermistors are classified into positive temperature coefficient thermistors (PTC thermistors) and negative temperature coefficient thermistors (NTC thermistors). The resistance of a PTC thermistor increases with increasing temperature, while the resistance of a NTC thermistor decreases with increasing temperature; both are semiconductor devices. The following explanation uses an NTC resistor as an example.
[0050] like Figure 1 As shown, the temperature measuring device in this embodiment includes a thermistor, a resistance measuring unit, and a processing unit; the thermistor is connected to the resistance measuring unit. The output terminal of the resistance measuring unit is connected to the input terminal of the processing unit. The resistance measuring unit measures a first resistance value and inputs the first resistance value to the processing unit. The processing unit uses the first resistance value to determine the corresponding target temperature value, thus completing the temperature measurement.
[0051] The resistance measurement unit is used to measure the current first resistance value of the thermistor, where the resistance value of the thermistor is related to the ambient temperature.
[0052] The processing unit is used to obtain the current first resistance value of the thermistor from the resistance measurement unit; substitute the preset value of the temperature change coefficient and the first resistance value into the correlation relationship to obtain the predicted temperature value of the target environment, wherein the correlation relationship is used to represent the numerical influence relationship between the ambient temperature, the temperature change coefficient and the resistance value of the thermistor; determine the target value of the temperature change coefficient corresponding to the predicted temperature value according to the pre-fitted mapping relationship between the ambient temperature and the temperature change coefficient; and substitute the first resistance value and the target value of the temperature change coefficient into the correlation relationship to determine the target temperature value of the target environment.
[0053] It should be noted that the resistance measurement unit can be a resistance measuring instrument.
[0054] like Figure 2 As shown, the resistance measurement circuit of this application embodiment includes a test power supply, a voltage divider resistor R_ref, and an ADC. The voltage of the test power supply is VCC. The first end of the NTC resistor is connected to the test power supply, the second end of the NTC resistor is connected to the first end of the voltage divider resistor R_ref and the input terminal of the ADC, the second end of the voltage divider resistor R_ref is grounded, and the input terminal of the ADC is connected to the second end of the NTC resistor and the first end of the voltage divider resistor R_ref.
[0055] Use such as Figure 2 When using the resistance measurement circuit shown, the formula is...
[0056] Curr_ADC = ADC_PRECISON * R_ref / (R + R_ref) calculates the NTC resistance value. This formula is derived from the circuit characteristics.
[0057] Where Curr_ADC: ADC sampled value;
[0058] ADC_PRECISON: ADC sampling precision, i.e., the maximum sampling value;
[0059] R_ref: The resistance value of the voltage divider resistor;
[0060] R: NTC resistance value.
[0061] The ADC sampling accuracy is determined by the ADC master controller; when the ADC master controller is determined, the ADC sampling accuracy is known. The resistance value of the voltage divider resistor is also known. The ADC sample value is obtained from the ADC input terminal, and substituted into the formula Curr_ADC = ADC_PRECISON * R_ref / (R + R_ref) to obtain the NTC resistor value.
[0062] like Figure 3 As shown in the illustration, a temperature measurement method according to an embodiment of this application is applied to a temperature measuring device. The temperature measuring device is used to measure the temperature of a target environment. The temperature measuring device includes a thermistor. The method includes:
[0063] 301. Obtain the current first resistance value of the thermistor.
[0064] The processing unit receives the current first resistance value of the thermistor from the resistance measurement unit. The thermistor is located within the target environment, and its resistance value changes systematically with the temperature of the target environment. When the thermistor is an NTC resistor, its resistance value decreases as the temperature of the target environment rises.
[0065] 302. Substitute the preset value of the temperature change coefficient and the first resistance value into the correlation to obtain the predicted temperature value of the target environment.
[0066] The processing unit acquires a preset value for the temperature change coefficient and substitutes it along with the first resistance value into a correlation relationship to obtain the predicted temperature value of the target environment. This correlation relationship represents the numerical influence between the ambient temperature, the temperature change coefficient, and the resistance value of the thermistor. In this correlation relationship, if any two of the ambient temperature, the temperature change coefficient, and the thermistor's resistance value are known, the third can be calculated. The correlation relationship can be pre-coded into the processing unit or acquired by the processing unit during use.
[0067] 303. Based on the pre-fitted mapping relationship between ambient temperature and temperature change coefficient, determine the target value of the temperature change coefficient corresponding to the predicted temperature value.
[0068] The processing unit determines the target value of the temperature change coefficient corresponding to the predicted temperature value based on the pre-fitted mapping relationship between ambient temperature and temperature change coefficient. In the mapping relationship, each ambient temperature corresponds to a unique temperature change coefficient. The mapping relationship can be pre-coded into the processing unit or obtained by the processing unit during use.
[0069] 304. Substitute the first resistance value and the target value of the temperature change coefficient into the correlation to determine the target temperature value of the target environment.
[0070] The processing unit inputs the target value of the first resistance value and the target value of the temperature change coefficient into the correlation relationship, and calculates the target temperature value of the target environment.
[0071] In this embodiment, a pre-fitted mapping relationship between ambient temperature and temperature change coefficient is used to obtain the target value of the temperature change coefficient based on the predicted temperature value of the target environment. Then, the correlation between ambient temperature, temperature change coefficient and the resistance value of the thermistor is used to obtain the target temperature value of the target environment based on the first resistance value and the target value of the temperature change coefficient. The influence of ambient temperature on the temperature change coefficient is taken into account, and the temperature change coefficient is updated, resulting in higher accuracy of temperature measurement.
[0072] Calculating temperature using a formula with a constant temperature coefficient of variation results in varying temperature errors across different temperature ranges, sometimes reaching around 10%, leading to inaccurate temperature control.
[0073] Using a given NTC resistance value to correspond to a temperature table, the software creates a table and obtains the current temperature by looking up the table. Although this method can generally control the error within the 3% error range, it affects the running efficiency of the software, and creating the corresponding table also consumes MCU memory resources.
[0074] like Figure 4 As shown, the temperature measurement method in this application embodiment includes steps 401 to 409.
[0075] 401. Obtain the first resistance value.
[0076] The resistance measurement unit measures the NTC resistor, obtains a first resistance value, and sends the first resistance value to the processing unit. The processing unit receives the first resistance value sent by the resistance measurement unit.
[0077] 402. Obtain relevant relationships.
[0078] The processing unit obtains the correlation relationship. The processing unit can use a correlation relationship pre-stored locally; alternatively, it can first determine the model number of the NTC resistor, and then determine and obtain the correlation relationship based on that model number. The correlation relationship is used to represent the change in NTC resistance value at different temperatures.
[0079] The correlation can be a temperature-resistance function, for example, R0 = R exp B(1 / T0 - 1 / T), where B represents the temperature change coefficient, R represents the resistance of the thermistor, T represents the ambient temperature, T0 represents the reference temperature, and R0 represents the resistance of the thermistor at T0. The reference resistance and reference temperature in the correlation are known. When performing temperature calculations, the NTC resistance value R is used as the independent variable, and the temperature value T is used as the dependent variable.
[0080] Steps 401 and 402 are not related in terms of timing.
[0081] 403. Determine whether the first resistance value is equal to the reference resistance. If it is equal, determine the reference temperature T0 as the target temperature value and proceed to step 409; if it is not equal, proceed to step 404.
[0082] Determine whether the first resistance value R is equal to the reference resistance R0. If the first resistance value R is equal to the reference resistance R0, then determine the reference temperature T0 as the target temperature value and proceed to step 409; if the first resistance value R is not equal to the reference resistance R0, then proceed to step 404.
[0083] Step 403 and step 402 are independent in timing.
[0084] 404. Obtain the preset value of the temperature change coefficient.
[0085] The processing unit obtains the preset value B1 of the temperature change coefficient and substitutes it into the relevant relationship. The preset value of the temperature change coefficient is a value of the temperature change coefficient. The preset value of the temperature change coefficient can be any default value. For example, the temperature change coefficient at a specific temperature can be determined as the preset value of the temperature change coefficient, or the median value of the temperature change coefficient can be determined as the preset value of the temperature change coefficient.
[0086] In the case of multiple cycles, the preset value of the temperature change coefficient can also be the temperature change coefficient corresponding to the temperature calculated in the previous cycle.
[0087] When the correlation is R0 = R exp B(1 / T0 - 1 / T), substituting the preset value B1 of the temperature change coefficient into R0 = Rexp B(1 / T0 - 1 / T), we get R0 = R exp B1(1 / T0 - 1 / T). In this case, the reference resistance R0, reference temperature T0, and the preset value B1 of the temperature change coefficient are all known quantities. The NTC resistance value R is the independent variable, and the temperature value T is the dependent variable. It should be noted that the temperature in the above correlation formula should be absolute temperature; that is, in the formula R0 = R exp B(1 / T0 - 1 / T), the temperature uses the thermodynamic temperature scale, with the unit Kelvin, which is converted from the Celsius temperature scale.
[0088] Step 404 is not related to step 402 or step 401 in terms of timing.
[0089] 405. Obtain the predicted temperature value.
[0090] The processing unit substitutes the first resistance value and the preset value of the temperature change coefficient into the correlation to obtain the predicted temperature value T1. The predicted temperature value is a preliminary temperature value calculated under the preset value of the temperature change coefficient.
[0091] 406. Obtain the mapping relationship.
[0092] The processing unit obtains the mapping relationship. The processing unit can use a mapping relationship pre-stored locally; alternatively, it can first determine the model or related relationship of the NTC resistor, and then determine and obtain the mapping relationship based on that model or related relationship. The mapping relationship is used to represent the change in the temperature coefficient at different temperatures. The mapping relationship can be obtained using polynomial fitting.
[0093] Step 406 is not related to step 405 or step 404 in terms of timing.
[0094] Methods for fitting mapping relationships can be as follows: Figure 5 Steps 501 to 503 are shown below:
[0095] 501. Measure the second resistance value corresponding to N temperatures to obtain N sets of temperature resistance parameters.
[0096] The NTC resistor is measured using a thermometer and a resistance measuring circuit, sequentially measuring the corresponding second resistance value at N temperatures. The temperature displayed by the thermometer and the second resistance value measured by the resistance measuring circuit are entered into a set of temperature-resistance parameters.
[0097] 502. Based on N sets of temperature resistance parameters, calculate the temperature change coefficient at N temperatures.
[0098] Using the correlation R0 = R exp B(1 / T0 - 1 / T), the temperature change coefficient calculation function is B = (lnR0 - lnR) / (1 / T0 - 1 / T). Substituting N sets of temperature resistance parameters into the temperature change coefficient calculation function yields the temperature change coefficients at N temperatures. Then, by compiling a temperature and its temperature change coefficient into a set of temperature change coefficient parameters, N sets of temperature change coefficient parameters are obtained.
[0099] 503. Based on N sets of temperature change coefficient parameters, a mapping relationship is obtained by fitting.
[0100] The mapping relationship can be a function of the temperature change coefficient. Fitting is performed on N sets of temperature change coefficient parameters. The fitting method can be polynomial fitting under the least squares method, or logarithmic function fitting; here, polynomial fitting is used as an example. A quadratic function can be used for fitting, resulting in B = -aT. 2 +bT+c, where a, b, and c are all positive numbers. The values of a, b, and c are determined using the temperature change coefficient parameter. We determine a = 0.003, b = 2.2522, and c = 4210.8, thus obtaining B = -0.003T. 2 +2.2522T+4210.8. In the formula B=-aT 2 In +bT+c, the temperature is measured in degrees Celsius.
[0101] It should be noted that the objective function used for fitting can also be a logarithmic function. The objective function for polynomial fitting can also be a cubic or quartic function, etc. The fitting method can also be spline interpolation, especially curve fitting methods such as cubic spline interpolation. Steps 501 to 503 can be executed by the processing unit, or by other devices, and the fitted mapping relationship can be input into the processing unit.
[0102] 407. Obtain the target value of the temperature change coefficient.
[0103] The processing unit substitutes the predicted temperature value into the mapping relationship to obtain the target value B2 of the temperature change coefficient. The target value of the temperature change coefficient is the temperature change coefficient corresponding to the predicted temperature value.
[0104] 408. Obtain the target temperature value.
[0105] The processing unit replaces the preset value B1 of the temperature change coefficient with the target value B2, updating the correlation. The correlation before the update was R0 = R exp B1(1 / T0 - 1 / T), and the correlation after the update is R0 = R exp B2(1 / T0 - 1 / T). The processing unit inputs the first resistance value into the updated correlation to obtain the target temperature value T2.
[0106] It should be noted that multiple iterations can be used to improve accuracy. The specific steps are as follows: Figure 6 Steps 601 to 605 are shown below:
[0107] 601. Initialization: Set the loop counter K = 0 and set the number of loops to a positive integer.
[0108] 602. The processing unit replaces the preset value B1 of the temperature change coefficient with the target value B2, and updates the correlation. The correlation before the update is R0 = R exp B1(1 / T0 - 1 / T), and the correlation after the update is R0 = R expB2(1 / T0 - 1 / T). The processing unit inputs the first resistance value into the updated correlation to obtain the target temperature value T2.
[0109] 603. Assign the target temperature value to the predicted temperature value, that is, let T1 = T2.
[0110] 604. Substitute the predicted temperature value into the mapping relationship to obtain the target value B2 of the temperature change coefficient corresponding to the updated predicted temperature value.
[0111] 605. Let the sequential count K = K + 1. Determine whether the sequential count K is less than the preset number of cycles. If the sequential count K is less than the preset number of cycles, proceed to step 602. If the sequential count K is not less than the preset number of cycles, proceed to step 409.
[0112] 409. Output the target temperature value.
[0113] The processing unit outputs the target temperature value, completing the temperature measurement.
[0114] To further illustrate the fitting process of the mapping relationship, the following example will be used.
[0115] There are several methods to obtain N ambient temperature values, such as random sampling, uniform sampling, and partitioned sampling within the ambient temperature range where the thermistor is located. These methods will be explained below.
[0116] like Figure 7 As shown, the random sampling process for obtaining N ambient temperature values is as described in steps 701 to 703.
[0117] 701. The ambient temperature of the thermistor is randomly divided into M temperature ranges, and P ambient temperature values are selected in each of the M temperature ranges.
[0118] 702. N ambient temperature values are formed by selecting ambient temperature values from M temperature ranges, where M is a positive integer and P is an integer;
[0119] 703. Obtain the second resistance value of the thermistor corresponding to each ambient temperature value.
[0120] like Figure 8 As shown, the uniform sampling process for obtaining N ambient temperature values is as described in steps 801 to 803.
[0121] 801. Divide the ambient temperature of the thermistor into M temperature ranges, and select P ambient temperature values in each of the M temperature ranges; the intervals between different ambient temperature values can be equal.
[0122] 802. N ambient temperature values are formed by selecting ambient temperature values from M temperature ranges, where M is a positive integer and P is an integer.
[0123] 803. Obtain the second resistance value of the thermistor corresponding to each ambient temperature value.
[0124] like Figure 9 As shown, the partition sampling process for obtaining N ambient temperature values is as described in steps 901 to 905.
[0125] 901. The ambient temperature of the thermistor is uniformly divided into G temperature ranges, where G is a positive integer;
[0126] 902. Given G temperature ranges, determine whether the i-th temperature range belongs to a preset commonly used temperature range. The value of i starts from 1 and increments by 1 each time until it equals G. The value of i is a set of positive integers less than or equal to G.
[0127] 903. In G temperature ranges, if the i-th temperature range belongs to a preset common temperature range, then select U ambient temperature values for the i-th temperature range. The common temperature range can be determined according to the actual product and application scenario. For example, in the kitchenware field, the common temperature range can be 70 degrees Celsius to 240 degrees Celsius. There can be multiple common temperature ranges, such as 80 degrees Celsius to 120 degrees Celsius and 180 degrees Celsius to 220 degrees Celsius. The common temperature range can have multiple levels, such as a primary common temperature range and a secondary common temperature range. The primary common temperature range is 80 degrees Celsius to 95 degrees Celsius, and the secondary common temperature range is 95 degrees Celsius to 105 degrees Celsius. The sampling density in the secondary common temperature range can be greater than that in the primary common temperature range, and the sampling density in the primary common temperature range can be greater than that in the non-common temperature range.
[0128] The sampling density of ambient temperature values selected within any temperature range is equal to the length of the temperature range divided by the number of ambient temperature values selected within that temperature range. For example, if 40 ambient temperature values are selected within the temperature range of 90 degrees Celsius to 110 degrees Celsius, then the sampling density = 40 / (110-90) = 2 (values / degree Celsius). Generally speaking, the higher the sampling density, the higher the accuracy.
[0129] 904. In G temperature ranges, if the i-th temperature range does not belong to the preset commonly used temperature range, select V ambient temperature values in the i-th temperature range; U and V are integers, and U is greater than V;
[0130] 905. N ambient temperature values are formed by selecting ambient temperature values from G temperature ranges;
[0131] 906. Obtain the second resistance value of the thermistor corresponding to each ambient temperature value.
[0132] Curve fitting of mapping relationships can use objective functions such as polynomial functions or logarithmic functions. The objective function for polynomial fitting can be a linear, quadratic, cubic, or quartic function, etc. Fitting methods can include least squares fitting or spline interpolation. The following explanation uses polynomial fitting under least squares as an example.
[0133] The ambient temperature range was defined as 10°C to 300°C. Multiple ambient temperature values were randomly selected from 0°C to 300°C, with 100°C as the reference temperature T0. The reference resistance R0 was determined to be 13.062214 ohms. The temperature variation coefficient B under different ambient temperatures was calculated using the manufacturer-provided temperature-to-NTC resistance conversion formula B = (lnR0 - lnR) / (1 / T0 - 1 / T). The results are shown in Table 1. In the formula B = (lnR0 - lnR) / (1 / T0 - 1 / T), the temperature uses the thermodynamic temperature scale in Kelvin, which is converted from the Celsius temperature scale.
[0134] In contrast, if we use the NTC resistance to temperature correspondence table provided by the manufacturer, and apply the formula above with R1 = 13.062214 ohms, T1 = 100 degrees Celsius, R2 = 1 ohm, and T2 = 200 degrees Celsius, we can obtain a value of approximately 4537 for B. If we use a constant B = 4537, and T1 = 100 degrees Celsius and R1 = 13.062214 ohms as reference values, the temperature calculation using the formula B = (lnR1 - lnR2) / (1 / T1 - 1 / T2) will have a significant error, potentially reaching 10%. In the formula B = (lnR1 - lnR2) / (1 / T1 - 1 / T2), the temperature is calculated using the thermodynamic temperature scale in Kelvin, converted from the Celsius scale.
[0135]
[0136]
[0137] Table 1. Measured Temperature Variation Coefficient
[0138] The data in Table 1 were fitted using a polynomial, with ambient temperature T as the independent variable x and the temperature change coefficient B as the dependent variable y. The resulting fitted function was y = -0.003x. 2 +2.2522x+4210.8. Using the data in Table 1, we can create a graph to obtain... Figure 10 .
[0139] To verify the fitting effect, the obtained fitting function was used, and the temperature change coefficient B was calculated based on the multiple ambient temperature values selected during fitting. The results are shown in Table 2. Using the data in Table 2, graphs were created to obtain... Figure 11 Substituting the corresponding ambient temperature into the polynomial formula and comparing it with the original parameters, the maximum error is 0.09%.
[0140] Through software algorithm processing, the NTC temperature measurement range is 0 to 300 degrees Celsius, with a measurement error of less than 2%. Software processing also makes the MCU operate more efficiently and reduces resource consumption.
[0141]
[0142]
[0143] Table 2. Fitting Temperature Variation Coefficients
[0144] To further illustrate the measurement process of the second resistance value, the following example is provided. Table 3 shows the method used... Figure 2 The resistance measurement circuit shown in Table B measures the second resistance value. In the resistance measurement circuit shown in Table B, ADC_PRECISON = 4095; voltage divider resistor R_ref = 6.8 ohms; NTC resistor is the second resistance value of the thermistor; temperature is ambient temperature, ranging from 0 degrees Celsius to 250 degrees Celsius, and the sampling density is 1 sample / degree Celsius.
[0145] The voltage divider resistor can also be other resistance values, such as 2 ohms, 10 ohms, or 100 ohms. For example... Figure 12 As shown, the voltage divider resistors of the ADC change with temperature under different voltage divider resistors. The voltage divider resistor corresponding to curve ADC1 is 6.8 ohms; the voltage divider resistor corresponding to curve ADC2 is 2 ohms; the voltage divider resistor corresponding to curve ADC3 is 10 ohms; and the voltage divider resistor corresponding to curve ADC4 is 100 ohms.
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157] Table 3. Measurement data of the second resistance value.
[0158] like Figure 13As shown, a temperature measuring device includes a thermistor 1301, a memory 1302, and a processor 1303. The processor 1303 executes one or more computer programs stored in the memory 1302. When executing the one or more computer programs, the processor 1303 causes the computer device to perform the following functions: Figures 3 to 9 The method of the illustrated embodiment.
[0159] For example, the temperature measuring device includes a resistance measuring unit for measuring the current first resistance value of the thermistor 1301, wherein the resistance value of the thermistor is related to the ambient temperature; the processor 1303 is used to perform the following: substituting a preset value of the temperature change coefficient and the first resistance value into a correlation to obtain a predicted temperature value of the target environment, wherein the correlation is used to represent the numerical influence relationship between the ambient temperature, the temperature change coefficient, and the resistance value of the thermistor; determining a target value of the temperature change coefficient corresponding to the predicted temperature value based on a pre-fitted mapping relationship between the ambient temperature and the temperature change coefficient; and substituting the first resistance value and the target value of the temperature change coefficient into the correlation to determine the target temperature value of the target environment.
[0160] This application provides a computer-readable storage medium storing a computer program. The computer program includes program instructions, which, when executed by a processor, cause the processor to perform actions such as... Figures 3 to 9 The method of the illustrated embodiment.
[0161] This application provides a chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform tasks such as... Figures 3 to 9 The method of the illustrated embodiment.
[0162] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0163] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0164] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0165] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0166] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A temperature measurement method, characterized by, The application is applied to a temperature measuring device for measuring temperature of a target environment, and the temperature measuring device comprises a thermistor, and the method comprises the following steps: obtaining a current first resistance value of the thermistor, wherein the resistance value of the thermistor is related to the environmental temperature; substituting a preset value of a temperature change coefficient and the first resistance value into a correlation relationship to obtain a predicted temperature value of the target environment, wherein the correlation relationship is used to represent the numerical influence relationship among the environmental temperature, the temperature change coefficient and the resistance value of the thermistor; the correlation relationship is R0=R exp B(1 / T0-1 / T), wherein B represents the temperature change coefficient, R represents the resistance value of the thermistor, T represents the temperature value of the environment, T0 represents the reference temperature value, and R0 represents the resistance value of the thermistor at T0; determining a target value of the temperature change coefficient corresponding to the predicted temperature value according to a mapping relationship between the environmental temperature and the temperature change coefficient obtained through pre-fitting; setting a loop count K=0 and setting the loop count as a positive integer; substituting the first resistance value and the target value of the temperature change coefficient into the correlation relationship to determine a target temperature value of the target environment; assigning the target temperature value to the predicted temperature value; substituting the predicted temperature value into the mapping relationship to obtain a target value of the temperature change coefficient corresponding to the updated predicted temperature value; setting the loop count K=K+1 and judging whether the loop count K is less than the preset loop count; if the loop count K is less than the preset loop count, returning to execute the step of substituting the first resistance value and the target value of the temperature change coefficient into the correlation relationship to determine the target temperature value of the target environment; and if the loop count K is not less than the preset loop count, outputting the target temperature value.
2. The temperature measurement method according to claim 1, characterized in that, Before the step of determining the target value of the temperature change coefficient corresponding to the predicted temperature value, the method further comprises the following steps: obtaining N environmental temperature values and second resistance values of the thermistor corresponding to each environmental temperature value, wherein N is a positive integer greater than 1; substituting the N environmental temperature values and the second resistance values corresponding to each environmental temperature value into the correlation relationship to obtain reference values of the temperature change coefficient corresponding to each environmental temperature value; using the N environmental temperature values and the reference values of the temperature change coefficient corresponding to each environmental temperature value to perform fitting to obtain the mapping relationship between the environmental temperature and the temperature change coefficient.
3. The temperature measurement method of claim 2, wherein, The step of using the N environmental temperature values and the reference values of the temperature change coefficient corresponding to each environmental temperature value to perform fitting comprises the following steps: The mapping relationship is obtained by polynomial fitting using the N ambient temperature values and reference values of the temperature variation coefficient corresponding to each ambient temperature value, and the mapping relationship is , wherein B represents the temperature variation coefficient, and T represents the temperature value of the environment.
4. The temperature measurement method according to claim 2 or 3, characterized in that, The step of obtaining N environmental temperature values and second resistance values of the thermistor corresponding to each environmental temperature value comprises the following steps: dividing the environmental temperature of the thermistor into M temperature ranges, selecting P environmental temperature values in each temperature range in the M temperature ranges, and obtaining the N environmental temperature values from the selected environmental temperature values in the M temperature ranges, wherein M is a positive integer and P is an integer; obtaining the second resistance values of the thermistor corresponding to each environmental temperature value.
5. The temperature measurement method according to claim 2 or 3, characterized in that, The obtaining of the N environment temperature values and the second resistance values of the thermistor corresponding to each environment temperature value comprises: The environment temperature in which the thermistor is located is evenly divided into G temperature ranges, G being a positive integer; In the G temperature ranges, if an i-th temperature range belongs to a preset commonly used temperature range, U environment temperature values are selected in the i-th temperature range; In the G temperature ranges, if the i-th temperature range does not belong to the preset commonly used temperature range, V environment temperature values are selected in the i-th temperature range; U and V are integers, and U is greater than V; The N environment temperature values are composed of the environment temperature values selected from the G temperature ranges; The second resistance values of the thermistor corresponding to each environment temperature value are obtained.
6. The temperature measurement method according to claim 2 or 3, characterized by, The obtaining of the N environment temperature values and the second resistance values of the thermistor corresponding to each environment temperature value specifically comprises: The second resistance values under the N environment temperatures are obtained by using an analog-to-digital converter (ADC).
7. A temperature measuring device, characterized by It comprises: a thermistor, a resistance measurement unit and a processing unit; The temperature measurement device is used to measure the temperature of a target environment; The resistance measurement unit is used to measure a current first resistance value of the thermistor, wherein the resistance value of the thermistor is related to the environment temperature; The processing unit is used to obtain the current first resistance value of the thermistor from the resistance measurement unit; The preset value of the temperature change coefficient and the first resistance value are substituted into a correlation relationship to obtain a predicted temperature value of the target environment, wherein the correlation relationship is used to represent the numerical influence relationship between the environment temperature, the temperature change coefficient and the resistance value of the thermistor; the correlation relationship is R0=R exp B(1 / T0-1 / T), wherein B represents the temperature change coefficient, R represents the resistance value of the thermistor, T represents the temperature value of the environment, T0 represents a reference temperature value, and R0 represents the resistance value of the thermistor at T0; according to a mapping relationship between the environment temperature and the temperature change coefficient obtained in advance, a target value of the temperature change coefficient corresponding to the predicted temperature value is determined; a loop count K is set to 0, and the number of loops is set to a positive integer; the first resistance value and the target value of the temperature change coefficient are substituted into the correlation relationship to determine a target temperature value of the target environment; the target temperature value is assigned to the predicted temperature value; the predicted temperature value is substituted into the mapping relationship to obtain a target value of the temperature change coefficient corresponding to the updated predicted temperature value; the loop count K is set to K+1, and it is judged whether the loop count K is less than the preset number of loops; if the loop count K is less than the preset number of loops, the step of substituting the first resistance value and the target value of the temperature change coefficient into the correlation relationship to determine the target temperature value of the target environment is returned to be executed; if the loop count K is not less than the preset number of loops, the target temperature value is output.
8. A temperature measuring device, characterized by comprising a thermistor, a memory, and a processor for executing one or more computer programs stored in the memory, the processor, when executing the one or more computer programs, causing the temperature measuring device to implement the method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 6.