Signal calibration method and device, computer device and storage medium

By generating calibration coefficients to calibrate the ADC sampling values ​​of the MCU, the problem of inaccurate sampling caused by VCC power supply fluctuations is solved, and the sampling accuracy of the MCU is improved.

CN114499521BActive Publication Date: 2025-11-21ZHEJIANG TENGEN ELECTRIC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210148901.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-18
Publication Date
2025-11-21
Estimated Expiration
2042-02-18

AI Technical Summary

Technical Problem

The inaccurate sampling problem of the MCU's ADC is mainly due to the instability of the reference voltage caused by fluctuations in the VCC power supply, which affects the sampling accuracy.

Method used

By receiving a reference voltage signal, a calibration coefficient is generated to calibrate the sampled value of the signal under test, thereby reducing sampling error and improving sampling accuracy.

Benefits of technology

By calibrating the signal sampling values, the sampling error of the MCU is reduced and the sampling accuracy is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114499521B_ABST
    Figure CN114499521B_ABST
Patent Text Reader

Abstract

The application provides a signal calibration method and device, computer equipment and a storage medium. The signal calibration method is applied to an MCU. The MCU is connected with a reference voltage generation circuit. The reference voltage generation circuit is used for inputting a reference voltage signal to the MCU. The method comprises the following steps: receiving and collecting the reference voltage signal to obtain a first reference voltage sampling value; receiving and collecting the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sampling value and a first ADC sampling value; generating a calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset true value; receiving and collecting the reference voltage signal and a to-be-tested signal to obtain a third reference voltage sampling value and a second ADC sampling value; and calibrating a sampling value of the to-be-tested signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a true value of the to-be-tested signal.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of signal acquisition, and in particular to a signal calibration method and device, computer equipment and a storage medium. BACKGROUND

[0002] ADC (Analog-to-Digital Converter, analog / digital converter) sampling technology is a commonly used signal acquisition technology, which is used to acquire analog signals such as sound, image and temperature. MCU (Microcontroller Unit) is also known as single-chip microcomputer, which internally integrates an ADC sampling device.

[0003] Generally, the reference voltage required by the ADC sampling device of the MCU is provided by the VCC (Volt Current Condenser, power supply voltage) power supply. At the same time, the VCC power supply also needs to provide a rated operating voltage for the processor, memory and counter of the MCU. During the operation of the MCU, the VCC power supply is easily disturbed. Specifically, the discreteness of the devices of the MCU, the process of the VCC power supply rising to a stable voltage when the MCU starts, and the poor working environment of the MCU can all cause the VCC power supply to fluctuate. The accuracy of the ADC sampling is directly related to the accuracy and stability of the VCC power supply, and the fluctuation of the VCC power supply causes the VCC power supply to be unable to provide an ideal reference voltage, thereby causing the ADC sampling of the MCU to be inaccurate. SUMMARY

[0004] Therefore, the purpose of the present application is to overcome the deficiencies in the prior art and provide a signal calibration method, device, computer equipment and storage medium to solve the problem of inaccurate ADC sampling of the MCU.

[0005] In a first aspect, one embodiment of the present application provides a signal calibration method applied to a MCU, wherein the MCU is connected with a reference voltage generating circuit, the reference voltage generating circuit is used to input a reference voltage signal to the MCU, and the method comprises the following steps:

[0006] receiving and acquiring the reference voltage signal to obtain a first reference voltage sampling value;

[0007] receiving and acquiring the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sampling value and a first ADC sampling value;

[0008] generating a calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset true value;

[0009] receive and collect the reference voltage signal and the to-be-tested signal to obtain a third reference voltage sampling value and a second ADC sampling value;

[0010] calibrate the sampling value of the to-be-tested signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a real value of the to-be-tested signal.

[0011] With reference to the first aspect, in a first possible implementation manner, the generating the calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset real value comprises:

[0012] obtaining a first compensation coefficient of the detection signal according to the first reference voltage sampling value and the second reference voltage sampling value;

[0013] generating the calibration coefficient of the MCU according to the preset real value, the first ADC sampling value and the first compensation coefficient.

[0014] With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the generating the calibration coefficient of the MCU according to the preset real value, the first ADC sampling value and the first compensation coefficient comprises:

[0015] obtaining an ADC sampling value of the detection signal after compensation according to the first compensation coefficient and the first ADC sampling value;

[0016] generating the calibration coefficient of the MCU according to the ADC sampling value of the detection signal after compensation and the preset real value.

[0017] With reference to the first aspect, in a third possible implementation manner, the calibrating the sampling value of the to-be-tested signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a real value of the to-be-tested signal comprises:

[0018] obtaining a second compensation coefficient of the to-be-tested signal according to the first reference voltage sampling value and the third reference voltage sampling value;

[0019] calibrating the sampling value of the to-be-tested signal according to the second ADC sampling value, the second compensation coefficient and the calibration coefficient to obtain a real value of the to-be-tested signal.

[0020] With reference to the first aspect, in a fourth possible implementation manner, the MCU further comprises a memory, and the receiving and collecting the reference voltage signal to obtain a first reference voltage sampling value comprises:

[0021] receive and collect the reference voltage signal, zero signals other than the reference voltage signal, obtain a first reference voltage sample value, and store the first reference voltage sample value to a memory.

[0022] In a fifth possible implementation manner of the fourth possible implementation manner of the first aspect, after the calibration coefficient of the MCU is generated according to the first reference voltage sample value, the second reference voltage sample value, the first ADC sample value and the preset true value, the method further includes:

[0023] storing the calibration coefficient to the memory.

[0024] In a sixth possible implementation manner of the first aspect, the reference voltage generation circuit includes a reference voltage source and a follower, and the reference voltage source is connected to the MCU through the follower.

[0025] In a second aspect, an embodiment of the present application provides a signal calibration device applied to an MCU, the MCU being connected to a reference voltage generation circuit, the reference voltage generation circuit being configured to input a reference voltage signal to the MCU, and the signal calibration device comprising:

[0026] a voltage signal receiving module configured to receive and collect the reference voltage signal to obtain a first reference voltage sample value;

[0027] a detection signal receiving module configured to receive and collect the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sample value and a first ADC sample value;

[0028] a calibration coefficient generating module configured to generate a calibration coefficient of the MCU according to the first reference voltage sample value, the second reference voltage sample value, the first ADC sample value and the preset true value;

[0029] a to-be-measured signal receiving module configured to receive and collect the reference voltage signal and a to-be-measured signal to obtain a third reference voltage sample value and a second ADC sample value;

[0030] a to-be-measured signal calibration module configured to calibrate a sample value of the to-be-measured signal according to the first reference voltage sample value, the third reference voltage sample value, the second ADC sample value and the calibration coefficient to obtain a true value of the to-be-measured signal.

[0031] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory, the memory having a program or instruction stored thereon, the program or instruction being executed by the processor to enable the computer device to perform the steps of the above-mentioned signal calibration method.

[0032] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a program or instructions, and the program or instructions, when executed by a processor, implement the steps of the signal calibration method described above.

[0033] The present application provides a signal calibration method applied to an MCU, wherein the MCU is connected with a reference voltage generation circuit, and the reference voltage generation circuit is used to input a reference voltage signal to the MCU, and the method comprises the following steps: receiving and collecting the reference voltage signal to obtain a first reference voltage sample value; receiving and collecting the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sample value and a first ADC sample value; generating a calibration coefficient of the MCU according to the first reference voltage sample value, the second reference voltage sample value, the first ADC sample value and the preset true value; receiving and collecting the reference voltage signal and a to-be-tested signal to obtain a third reference voltage sample value and a second ADC sample value; and calibrating a sample value of the to-be-tested signal according to the first reference voltage sample value, the third reference voltage sample value, the second ADC sample value and the calibration coefficient to obtain a true value of the to-be-tested signal. By calibrating the sample value of the to-be-tested signal, the sampling error of the MCU is reduced, and the sampling accuracy of the MCU is improved. BRIEF DESCRIPTION OF DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are denoted by similar reference numerals.

[0035] Figure 1 A flow chart of the signal calibration method provided by the embodiment of the present application is shown;

[0036] Figure 2 A structural schematic diagram of the reference voltage generation circuit provided by the embodiment of the present application is shown;

[0037] Figure 3 Another structural schematic diagram of the reference voltage generation circuit provided by the embodiment of the present application is shown;

[0038] Figure 4 Another flow chart of the signal calibration method provided by the embodiment of the present application is shown;

[0039] Figure 5 A structural schematic diagram of the signal calibration device provided by the embodiment of the present application is shown. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application.

[0041] The components of the embodiments of the present application generally described and illustrated in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.

[0042] Hereinafter, the terms "include", "have", and their conjugates used in various embodiments of the present application are only intended to denote a certain characteristic, number, step, operation, element, component, or combination thereof, and should not be construed as excluding the presence or addition of one or more other characteristics, numbers, steps, operations, elements, components, or combinations thereof.

[0043] In addition, the terms "first", "second", "third", and the like are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0044] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present application belong. The terms (such as those defined in a generally used dictionary) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning, unless clearly defined in various embodiments of the present application.

[0045] Embodiment 1

[0046] Please refer to Figure 1 , Figure 1 A flowchart of a signal calibration method provided by an embodiment of the present application is shown. Figure 1 The signal calibration method in the embodiment of the present application is applied to an MCU, wherein the MCU is connected with a reference voltage generation circuit, and the reference voltage generation circuit is used to input a reference voltage signal to the MCU, Figure 1 The signal calibration method in the embodiment of the present application comprises the following steps:

[0047] Step 101, receiving and collecting the reference voltage signal to obtain a first reference voltage sampling value.

[0048] The reference voltage generation circuit is connected with the ADC sampling device of the MCU, and is used for providing the required reference voltage for the ADC sampling device of the MCU, wherein the reference voltage refers to the voltage value of the ADC sampling device when the ADC sampling device is placed in a 0℃ temperature field and input rated working current. The ADC sampling device of the MCU receives and collects the reference voltage signal, and obtains the reference voltage sampling value when only the reference voltage signal is input, that is, the first reference voltage sampling value.

[0049] Referring to Figure 2 , Figure 2 The structure schematic diagram of the reference voltage generation circuit provided by the embodiment of the application is shown. As an example, the reference voltage generation circuit comprises a reference voltage source 210 and a follower U, and the reference voltage source 210 is connected with the MCU 220 through the follower U.

[0050] The reference voltage generation circuit comprises the reference voltage source 210 and the follower U, and is connected with the ADC sampling device of the MCU 220. The reference voltage generation circuit is used for generating the required reference voltage for the ADC sampling device of the MCU, and the generated reference voltage will not change with the change of the VCC power supply 201, thereby reducing the influence of the VCC power supply 201 on the ADC sampling precision, and without the need of additionally designing a sampling control chip. It should be understood that the capacitance, resistance and inductance contained in the reference voltage generation circuit are set according to actual needs, and are not limited herein.

[0051] Referring to Figure 3 , Figure 3 Another structure schematic diagram of the reference voltage generation circuit provided by the embodiment of the application is shown. In order to facilitate understanding of the present application, Figure 3 An example of the reference voltage generation circuit is given. The reference voltage source 210 in the present application is composed of the VCC power supply 201 and TL431, and the TL431 is a parallel voltage stabilization integrated circuit, which can be equivalent to a transistor. The TL431 is used for stabilizing the output voltage of the reference voltage source 210. For example, when the input voltage of the reference voltage source 210 increases, the TL431 increases the current passing through itself through adjustment, and then increases the voltage drop of the resistance. It should be understood that the output voltage of the reference voltage source 210 is equal to the difference between the input voltage and the voltage drop of the resistance. When the input voltage of the reference voltage source 210 changes, the output voltage is adjusted by adjusting the voltage drop of the resistance, the output voltage of the reference voltage source 210 is stabilized, and then the reference voltage source 210 is used for providing stable reference voltage.

[0052] When the circuit input impedance is small, the signal is easy to lose in the resistance. The follower U has the characteristics of high input impedance and low output impedance. The follower U acts as an isolation stage and a buffer stage between the reference voltage source 210 and the MCU, improving the load of the reference voltage generation circuit.

[0053] At step 102, the reference voltage signal and the detection signal with the preset true value are received and collected to obtain the second reference voltage sampling value and the first ADC sampling value.

[0054] The reference voltage generation circuit continuously provides the reference voltage for the ADC sampling device of the MCU, and at the same time, the detection signal with the preset true value is input to the MCU. The ADC sampling device receives and collects the detection signal to obtain the ADC sampling value of the detection signal, i.e., the first ADC sampling value. At the same time, the input detection signal will cause interference to the reference voltage signal, and the ADC sampling device receives and collects the reference voltage signal to obtain the reference voltage sampling value when the detection signal is synchronously input, i.e., the second reference voltage sampling value. Since the true value of the detection signal is known to be the preset true value, the sampling error of the ADC sampling device can be obtained by the preset true value of the detection signal and the first ADC sampling value.

[0055] It should be understood that the true value is the ideal error-free value of the detection signal, and the sampling value is the value collected by the ADC sampling device. Specifically, when collecting the voltage value of the detection signal, if the true value of the detection signal is 2V, the first ADC sampling value collected by the ADC sampling device can be any voltage value with error, such as 1.9V.

[0056] At step 103, the calibration coefficient of the MCU is generated according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value, and the preset true value.

[0057] The change of the reference voltage sampling value when the MCU only receives the reference voltage signal and when the MCU receives the reference voltage signal and the detection signal at the same time is obtained, i.e., the relationship between the first reference voltage sampling value and the second reference voltage sampling value. The error between the first ADC sampling value and the preset true value is obtained, and the calibration coefficient of the MCU is generated according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value, and the preset true value.

[0058] As an example, the calibration coefficient of the MCU is generated according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value, and the preset true value, including:

[0059] According to the first reference voltage sampling value and the second reference voltage sampling value, a first compensation coefficient of the detection signal is obtained;

[0060] According to the preset real value, the first ADC sampling value and the first compensation coefficient, a calibration coefficient of the MCU is generated.

[0061] The first reference voltage sampling value is denoted as Vref_ADC0, the second reference voltage sampling value is denoted as Vref_ADC1, the first ADC sampling value is denoted as ADC1, the preset real value of the detection signal is denoted as Real_value0, and the first compensation coefficient is denoted as Kc1. The first compensation coefficient calculation formula is as follows:

[0062] Kc1=Vref_ADC0 / Vref_ADC1

[0063] According to the error between the first ADC sampling value and the preset real value and the first compensation coefficient, a calibration coefficient of the MCU is generated.

[0064] In an optional example, the generation of the calibration coefficient of the MCU according to the preset real value, the first ADC sampling value and the first compensation coefficient comprises:

[0065] According to the first compensation coefficient and the first ADC sampling value, a compensated ADC sampling value of the detection signal is obtained.

[0066] According to the compensated ADC sampling value of the detection signal and the preset real value, a calibration coefficient of the MCU is generated.

[0067] The compensated ADC sampling value of the detection signal is denoted as ADC_real0. The compensated ADC sampling value calculation formula of the detection signal is as follows:

[0068] ADC_real0=ADC1*Kc1

[0069] The error of the reference sampling value is compensated by the first compensation coefficient, and then the error of the first ADC sampling value is compensated, so as to improve the accuracy of the ADC sampling value. After obtaining the compensated ADC sampling value of the detection signal, the compensated ADC sampling value of the detection signal is compared with the preset real value, and a calibration coefficient of the MCU is obtained. The calibration coefficient is denoted as K. The calibration coefficient calculation formula is as follows:

[0070] K=Real_value0 / ADC_real0

[0071] In step 104, the reference voltage signal and the to-be-measured signal are received and collected, and a third reference voltage sampling value and a second ADC sampling value are obtained.

[0072] The reference voltage generating circuit continuously provides a reference voltage for an ADC sampling device of the MCU, and a signal to be detected is input into the MCU, wherein the signal to be detected is any signal to be sampled and detected, which is not limited herein. The ADC sampling device receives and collects the signal to be detected to obtain an ADC sampling value of the signal to be detected, i.e., a second ADC sampling value. Meanwhile, the ADC sampling device receives and collects the reference voltage signal to obtain a reference voltage sampling value when the signal to be detected is input, i.e., a third reference voltage sampling value.

[0073] In step 105, the sampling value of the signal to be detected is calibrated according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a real value of the signal to be detected.

[0074] The second ADC sampling value obtained by collection is calibrated by the first reference voltage sampling value, the third reference voltage sampling value and the calibration coefficient to obtain the real value of the signal to be detected. By calibrating the sampling value of the signal to be detected, the error of the ADC sampling device in collecting the signal to be detected is reduced, and the accuracy of the ADC sampling of the MCU is improved.

[0075] As an example, the calibration of the sampling value of the signal to be detected according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain the real value of the signal to be detected includes:

[0076] A second compensation coefficient of the signal to be detected is obtained according to the first reference voltage sampling value and the third reference voltage sampling value;

[0077] The sampling value of the signal to be detected is calibrated according to the second ADC sampling value, the second compensation coefficient and the calibration coefficient to obtain the real value of the signal to be detected.

[0078] Let the third reference voltage sampling value be Vref_ADCx, the second ADC sampling value be Real_ADCx, and the second compensation coefficient be Kc2. The calculation formula of the second compensation coefficient is:

[0079] Kc2=Vref_ADC0 / Vref_ADCx

[0080] Let the real value of the signal to be detected be Real_value. The calculation formula of the real value of the signal to be detected is:

[0081] Real_value=Real_ADCx*Kc2*K

[0082] The second compensation coefficient of the to-be-tested signal is calculated according to the first reference voltage sampling value and the third reference voltage sampling value. The sampling value of the to-be-tested signal is calibrated by the second compensation coefficient and the calibration coefficient, and the real value of the to-be-tested signal is obtained, and the real value of the to-be-tested signal obtained is taken as the output value of the to-be-tested signal, thereby improving the accuracy of the ADC sampling of the MCU.

[0083] As an example, the MCU further comprises a memory, and the receiving and collecting the reference voltage signal to obtain the first reference voltage sampling value comprises:

[0084] The reference voltage signal is received and collected, signals other than the reference voltage signal are zeroed, the first reference voltage sampling value is obtained, and the first reference voltage sampling value is stored in the memory.

[0085] The ADC sampling device of the MCU is usually provided with a plurality of ADC sampling channels, each of which corresponds to a pin to sample a plurality of different signals. The signals of the ADC sampling channels other than the ADC sampling channel connected to the reference voltage generating circuit are all zeroed to obtain the sampling value of only the reference voltage signal, i.e., the first reference voltage sampling value in the present application.

[0086] The first reference voltage sampling value is stored in the memory of the MCU to facilitate quick calling of the first reference voltage sampling value for calculation. It should be understood that the memory of the MCU in the present application is an EEPROM (Electrically Erasable Programmable Read-Only Memory) chip, and the first reference voltage sampling value stored in the EEPROM chip can be erased by a computer device, and the collected first reference voltage sampling value can be updated.

[0087] After the first reference voltage sampling value is written into the memory, power is re-applied, and it is detected whether the first reference voltage sampling value stored in the memory is restored to the default value of the first reference voltage sampling value. If the first reference voltage sampling value in the memory is not restored to the default value of the memory, it is determined that the first reference voltage sampling value has been stored in the memory. By storing the first reference voltage sampling value in the memory, loss of information stored in the memory is effectively avoided.

[0088] Please refer to Figure 4 , Figure 4 Another flowchart of the signal calibration method provided by the embodiment of the present application is shown. In an optional example, after the calibration coefficient of the MCU is generated according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset real value, the method further comprises:

[0089] Step 106, store the calibration coefficient to the memory.

[0090] The generated calibration coefficient is stored in the memory in a power-off state, so as to quickly call the calibration coefficient for calculation. If the calibration coefficient in the memory is not restored to the default value of the memory after the MCU is powered on again, it is determined that the calibration coefficient has been stored in the memory, thereby avoiding loss of information stored in the memory.

[0091] The application provides a signal calibration method applied to an MCU, wherein the MCU is connected with a reference voltage generation circuit, and the reference voltage generation circuit is used for inputting a reference voltage signal to the MCU, and the method comprises the following steps: receiving and collecting the reference voltage signal to obtain a first reference voltage sampling value; receiving and collecting the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sampling value and a first ADC sampling value; generating a calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset true value; receiving and collecting the reference voltage signal and a to-be-tested signal to obtain a third reference voltage sampling value and a second ADC sampling value; and calibrating a sampling value of the to-be-tested signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a true value of the to-be-tested signal. By calibrating the sampling value of the to-be-tested signal, the sampling error of the MCU is reduced, and the sampling accuracy of the MCU is improved.

[0092] Embodiment 2

[0093] Please refer to Figure 5 , Figure 5 The application provides a signal calibration device. Figure 5 The signal calibration device 300 in the embodiment of the application is applied to an MCU, the MCU is connected with a reference voltage generation circuit, the reference voltage generation circuit is used for inputting a reference voltage signal to the MCU, and the signal calibration device 300 comprises:

[0094] A voltage signal receiving module 310 is configured to receive and collect the reference voltage signal to obtain a first reference voltage sampling value.

[0095] A detection signal receiving module 320 is configured to receive and collect the reference voltage signal and a detection signal with a preset true value to obtain a second reference voltage sampling value and a first ADC sampling value.

[0096] A calibration coefficient generating module 330 is configured to generate a calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset true value.

[0097] The to-be-measured signal receiving module 340 is configured to receive and collect the reference voltage signal and the to-be-measured signal, to obtain a third reference voltage sampling value and a second ADC sampling value.

[0098] The to-be-measured signal calibration module 350 is configured to calibrate the sampling value of the to-be-measured signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient, to obtain the true value of the to-be-measured signal.

[0099] As an example, the calibration coefficient generation module 330 is further configured to obtain a first compensation coefficient of the detection signal according to the first reference voltage sampling value and the second reference voltage sampling value.

[0100] The calibration coefficient of the MCU is generated according to the preset true value, the first ADC sampling value and the first compensation coefficient.

[0101] In an optional example, the calibration coefficient generation module 330 is further configured to obtain an ADC sampling value of the detection signal after compensation according to the first compensation coefficient and the first ADC sampling value.

[0102] The calibration coefficient of the MCU is generated according to the ADC sampling value of the detection signal after compensation and the preset true value.

[0103] As an example, the to-be-measured signal calibration module 350 is further configured to obtain a second compensation coefficient of the to-be-measured signal according to the first reference voltage sampling value and the third reference voltage sampling value.

[0104] The sampling value of the to-be-measured signal is calibrated according to the second ADC sampling value, the second compensation coefficient and the calibration coefficient, to obtain the true value of the to-be-measured signal.

[0105] As an example, the MCU further includes a memory, and the voltage signal receiving module 310 is further configured to receive and collect the reference voltage signal, to zero the signal other than the reference voltage signal, to obtain a first reference voltage sampling value, and to store the first reference voltage sampling value to the memory.

[0106] In an optional example, the signal calibration apparatus 300 further includes:

[0107] The calibration coefficient storage module is configured to store the calibration coefficient to the memory.

[0108] The signal calibration apparatus 300 is configured to perform the corresponding steps in the above-mentioned signal calibration method, and the specific implementation of each function is not described one by one here. In addition, the optional examples in Embodiment 1 are also applicable to the signal calibration apparatus 300 of Embodiment 2.

[0109] The embodiment of the present application further provides a computer device, comprising a processor and a memory, wherein the memory stores programs or instructions, and the programs or instructions are executed by the processor to enable the computer device to perform the signal calibration method.

[0110] The embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores programs or instructions, and the programs or instructions are executed by a processor to implement the signal calibration method.

[0111] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other manners. The apparatus embodiments described above are only schematic, for example, the flow charts and structural diagrams in the drawings show the possible implementation architectures, functions and operations of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flow charts or structural diagrams can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that, in alternative implementation manners, the functions noted in the blocks can also occur in an order different from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the structural diagram and / or flow chart, and the combination of blocks in the structural diagram and / or flow chart, can be implemented by a dedicated hardware-based system for implementing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0112] In addition, each functional module or unit in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0113] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0114] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A signal calibration method, characterized by, The application is applied to MCU, the MCU is connected with reference voltage generation circuit, the reference voltage generation circuit is used for inputting reference voltage signal to the MCU, comprising: Receiving and collecting the reference voltage signal, obtaining the first reference voltage sampling value; Receiving and collecting the reference voltage signal and the detection signal with the real value being the preset real value, obtaining the second reference voltage sampling value and the first ADC sampling value; According to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset real value, the calibration coefficient of the MCU is generated; Receiving and collecting the reference voltage signal and the to-be-measured signal, obtaining the third reference voltage sampling value and the second ADC sampling value; According to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient, the sampling value of the to-be-measured signal is calibrated, and the real value of the to-be-measured signal is obtained; According to the first reference voltage sampling value and the second reference voltage sampling value, the first compensation coefficient of the detection signal is obtained; the first compensation coefficient calculation formula is: Kc1=Vref_ADC0 / Vref_ADC1, wherein Kc1 is the first compensation coefficient, Vref_ADC0 is the first reference voltage sampling value, and Vref_ADC1 is the second reference voltage sampling value; According to the first compensation coefficient and the first ADC sampling value, the ADC sampling value of the compensated detection signal is obtained; the calculation formula of the ADC sampling value of the compensated detection signal is: ADC_real0=ADC1×Kc1, wherein ADC_real0 is the ADC sampling value of the compensated detection signal, and ADC1 is the first ADC sampling value; According to the ADC sampling value of the compensated detection signal and the preset real value, the calibration coefficient of the MCU is generated; the calculation formula of the calibration coefficient is: K=Real_value0 / ADC_real0, wherein K is the calibration coefficient, Real_value0 is the preset real value, and ADC_real0 is the ADC sampling value of the compensated detection signal; According to the first reference voltage sampling value and the third reference voltage sampling value, the second compensation coefficient of the to-be-measured signal is obtained; the calculation formula of the second compensation coefficient is: Kc2=Vref_ADC0 / Vref_ADCx, wherein Kc2 is the second compensation coefficient, and Vref_ADCx is the third reference voltage sampling value; ​ ​ According to the second ADC sampling value, the second compensation coefficient and the calibration coefficient, a sampling value of the to-be-tested signal is calibrated to obtain a real value of the to-be-tested signal; a calculation formula of the real value of the to-be-tested signal is Real_value=Real_ADCx×Kc2×K, wherein Real_value is the real value of the to-be-tested signal, and Real_ADCx is the second ADC sampling value.

2. The signal calibration method of claim 1, wherein, The MCU further comprises a memory, and the receiving and collecting the reference voltage signal to obtain the first reference voltage sampling value comprises: The receiving and collecting the reference voltage signal, zeroing signals other than the reference voltage signal, obtaining the first reference voltage sampling value, and storing the first reference voltage sampling value to the memory.

3. The signal calibration method of claim 2, wherein, After the generating the calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset real value, the method further comprises: Storing the calibration coefficient to the memory.

4. The signal calibration method of claim 1, wherein, The reference voltage generating circuit comprises a reference voltage source and a follower, and the reference voltage source is connected to the MCU through the follower.

5. A signal calibration apparatus characterized by comprising: The MCU is connected with a reference voltage generating circuit, the reference voltage generating circuit is used for inputting a reference voltage signal to the MCU, and comprises: A voltage signal receiving module is configured to receive and collect the reference voltage signal to obtain a first reference voltage sampling value. A detection signal receiving module is configured to receive and collect the reference voltage signal and a detection signal with a preset real value to obtain a second reference voltage sampling value and a first ADC sampling value. A calibration coefficient generating module is configured to generate a calibration coefficient of the MCU according to the first reference voltage sampling value, the second reference voltage sampling value, the first ADC sampling value and the preset real value. A to-be-tested signal receiving module is configured to receive and collect the reference voltage signal and a to-be-tested signal to obtain a third reference voltage sampling value and a second ADC sampling value. A to-be-tested signal calibration module is configured to calibrate a sampling value of the to-be-tested signal according to the first reference voltage sampling value, the third reference voltage sampling value, the second ADC sampling value and the calibration coefficient to obtain a real value of the to-be-tested signal. The calibration coefficient generating module is further configured to obtain a first compensation coefficient of the detection signal according to the first reference voltage sampling value and the second reference voltage sampling value; and the first compensation coefficient is calculated according to a formula Kc1=Vref_ADC0 / Vref_ADC1, wherein Kc1 is the first compensation coefficient, Vref_ADC0 is the first reference voltage sampling value, and Vref_ADC1 is the second reference voltage sampling value. According to the first compensation coefficient and the first ADC sampling value, an ADC sampling value of the compensated detection signal is obtained; a calculation formula of the ADC sampling value of the compensated detection signal is: ADC_real0=ADC1×Kc1, wherein ADC_real0 is the ADC sampling value of the compensated detection signal, and ADC1 is the first ADC sampling value; According to the ADC sampling value of the compensated detection signal and the preset real value, a calibration coefficient of the MCU is generated; a calculation formula of the calibration coefficient is: K=Real_value0 / ADC_real0, wherein K is the calibration coefficient, Real_value0 is the preset real value, and ADC_real0 is the ADC sampling value of the compensated detection signal; The signal calibration module is further configured to obtain a second compensation coefficient of the to-be-measured signal according to the first reference voltage sampling value and the third reference voltage sampling value; a calculation formula of the second compensation coefficient is: Kc2=Vref_ADC0 / Vref_ADCx, wherein Kc2 is the second compensation coefficient, and Vref_ADCx is the third reference voltage sampling value. According to the second ADC sampling value, the second compensation coefficient and the calibration coefficient, a sampling value of the to-be-measured signal is calibrated to obtain a real value of the to-be-measured signal; a calculation formula of the real value of the to-be-measured signal is: Real_value=Real_ADCx×Kc2×K, wherein Real_value is the real value of the to-be-measured signal, and Real_ADCx is the second ADC sampling value.

6. A computer device, comprising: The computer readable storage medium stores programs or instructions, and the programs or instructions are executed by the processor to realize the steps of the signal calibration method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer readable storage medium stores programs or instructions, and the programs or instructions are executed by the processor to realize the steps of the signal calibration method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Self-correction AD (analogue / digital) sampling device

    CN102111157A

  • Background calibration of ADC reference voltage due to input signal dependency

    CN104052478A

  • Software-based ADC automatic calibration method

    CN109245767A