Key circuit detection method and system and storage medium

Through the ADC voltage detection method, combined with the voltage divider path and sliding average filtering algorithm, the insufficient electrical characteristic identification of key circuit detection in the existing technology is solved, efficient and accurate key circuit detection is achieved, and product quality and resource utilization are improved.

CN120334718APending Publication Date: 2025-07-18BOSEN ELECTRONICS (DONGGUAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510593977.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing key circuit detection methods cannot accurately identify electrical characteristics, resulting in unresponsiveness and misjudgment of key presses, and occupying a large amount of MCU port resources.

Method used

The ADC voltage detection method based on the standard key circuit is adopted. By setting the voltage divider path, the voltages of the key circuit to be tested and the standard key circuit are collected and compared, and the sliding average filtering algorithm and the multi-layer voltage tolerance ADC module are combined for accurate detection.

Benefits of technology

It improves the accuracy and efficiency of button circuit detection, saves MCU port resources, can accurately capture voltage offset problems, ensures consistent electrical performance, and improves product quality and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120334718A_ABST
    Figure CN120334718A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of embedded electronic detection and human-computer interaction, and mainly relates to a key circuit detection method and system and a storage medium. Firstly, according to the number of keys of a standard key circuit, a corresponding number of voltage division path ADC modules are configured, the resistance values of voltage division resistors of all voltage division paths are different and are in one-to-one correspondence with key positions of the standard key circuit, the standard key circuit is connected to the ADC modules, and the ADC modules collect starting voltages of all the keys in the standard key circuit; secondly, according to the key positions of the standard circuit keys, the ADC module collects the test voltage of each start key in the to-be-tested key circuit; and finally, similarity judgment is performed on the test voltage of the keys in the to-be-tested key circuit with the same key position and the starting voltage of the keys in the standard key circuit. The key circuit detection method not only can realize key identification, but also can be used for judging whether the key circuit to be detected meets the electrical performance requirement of a standard prototype circuit or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of embedded electronic detection and human-computer interaction, and particularly relates to a method, a system and a storage medium for detecting a key circuit. Background Art

[0002] In many fields such as intelligent terminals, industrial control boards, and consumer electronic products, physical buttons are still one of the basic human-computer interaction methods. Especially in a circuit board with multiple buttons arranged, the circuit connection state and voltage output characteristics of the buttons are directly related to whether the product can accurately identify user operation instructions. However, during the production and manufacturing process, the reliability of the key circuit often decreases due to welding process problems, resulting in problems such as no response when the button is pressed and misjudgment of the button (recognized as other key positions) in the prepared key circuit. Therefore, it is necessary and crucial to perform electrical consistency detection on the key circuit board to be tested before leaving the factory.

[0003] Currently, the widely used detection method mainly adopts a conduction test scheme based on independent GPIO or a switch matrix. Its principle is to connect each button of the key circuit to be tested to a separate MCU GPIO, and confirm that the button is pressed through software polling or interruption; however, this technical solution requires a large number of MCU ports, is difficult to detect the actual divided voltage level, can only judge "whether it is conductive", and cannot identify electrical characteristics (such as resistance error); and it is even more impossible to confirm the voltage offset problem under the divided voltage structure.

[0004] Based on this, it is urgent to improve the existing key circuit detection methods, systems and storage media to solve the defects existing in the above-mentioned technologies. Summary of the Invention

[0005] One of the purposes of the present invention is to provide an ADC voltage detection method based on the matching of a standard key circuit, which can not only realize key recognition, but also be used to determine whether the key circuit to be tested meets the electrical performance requirements of the standard prototype circuit.

[0006] In order to achieve the above-mentioned invention purpose, the following technical solutions are implemented in this application:

[0007] A method for detecting a key circuit includes the following steps:

[0008] S101. Set an ADC module with a corresponding number of voltage division paths according to the number of buttons of the standard key circuit. The resistance values of the voltage division resistors in each voltage division path are different, and the resistance value of the voltage division resistor corresponds to the button position of the standard key circuit;

[0009] S201. Connect the standard key circuit to the ADC module, and the ADC module collects the start voltage of each button in the standard key circuit;

[0010] S301. Connect the keys of the key circuit to be measured to the ADC module according to the key positions of the standard circuit keys, and the ADC module collects the test voltages of each activated key in the key circuit to be measured.

[0011] S401. Perform a similarity judgment on the test voltages of the keys in the key circuit to be measured at the same key position and the activation voltages of the keys in the standard key circuit.

[0012] When the similarity judgment value is less than the judgment threshold, output the matching result.

[0013] When the similarity judgment value is greater than the judgment threshold, output the non-matching result.

[0014] The above technical solution has the following technical effects:

[0015] Through the key circuit detection method provided by the present invention, the electrical performance of the key circuit to be measured can be accurately identified and matched with the standard prototype circuit, effectively solving the problem in the prior art that only conduction testing can be achieved and the electrical characteristics cannot be identified. This method not only improves the accuracy and reliability of detection, but also greatly saves the occupancy of the main control module (MCU) ports and improves the detection efficiency. In addition, by introducing the ADC module and the similarity judgment algorithm, the present invention can accurately capture the voltage offset problem, ensure the consistency of the electrical performance between the key circuit to be measured and the standard prototype circuit, and thus improve the overall product quality and user experience.

[0016] As a further improvement of a key circuit detection method of the present application, both the test voltage and the activation voltage collected by the ADC module are converted into ADC values, and a similarity judgment is made through the ADC value of the test voltage and the ADC value of the activation voltage.

[0017] The conversion method of the ADC value is as follows:

[0018]

[0019] where ADC is the ADC value output by the test voltage or the activation voltage; V n is the test voltage or the activation voltage corresponding to the key position n collected by the ADC module; V ef is the reference voltage; N is the resolution of the ADC module.

[0020] As a further improvement of a key circuit detection method of the present application, the formula for the ADC module to collect the test voltage or the activation voltage corresponding to the key position n is:

[0021]

[0022] where is the resistance of the voltage division path corresponding to the key position n of the standard key circuit; R ull-upThe pull-up resistor set for the ADC module.

[0023] As a further improvement to a key circuit detection method of the present application, the value range of N is: 4 - 12.

[0024] As a further improvement to a key circuit detection method of the present application, the calculation method for similarity judgment is:

[0025] |ADC measured -ADC expected |≤δ

[0026] Among them, ADC measured is the ADC value of the test voltage; ADC expected is the ADC value of the startup voltage; δ is the judgment threshold.

[0027] As a further improvement to a key circuit detection method of the present application, the value range of the judgment threshold δ satisfies 20 - 60.

[0028] As a further improvement to a key circuit detection method of the present application, during the process of the ADC module collecting the test voltage or the startup voltage, a sliding average filtering algorithm is used to filter the ADC value of the test voltage or the startup voltage;

[0029] The sliding average filtering algorithm is:

[0030]

[0031] Among them, FilteredADC is the ADC value after filtering; ADC i is the i-th ADC value collected by the ADC module; N is the number of times the ADC module filters and collects.

[0032] The second object of the present invention is: aiming at the deficiencies of the prior art, a multi-key press circuit detection system based on a voltage division network, combined with a multi-layer voltage tolerance ADC module, multi-ADC channel comparison, and EEPROM storage mechanism, solves the misjudgment problem caused by temperature drift and unstable power supply in the traditional resistor voltage division scheme, and improves the detection accuracy and stability of the system.

[0033] In order to achieve the above invention object, the present application has implemented the following technical solutions:

[0034] A key circuit detection system includes at least one ADC module set in any of the above key circuit detection methods, and the ADC module is connected to the main control module and the storage module;

[0035] The main control module drives the ADC module to collect the test voltage of the key in the key circuit to be tested and the start voltage of the key in the standard key circuit; the main control module is provided with a judgment unit and a conversion unit, and the judgment unit conducts a similarity test on the start voltage and the test voltage;

[0036] The main control module is electrically connected to the display module, and the display module is used to display the result of the similarity judgment between the test voltage of the key in the key circuit to be tested with the same key position and the start voltage of the key in the standard key circuit;

[0037] The storage module is used to store the test voltage and the start voltage output by the ADC module, and the storage module outputs the test voltage of the key in the key circuit to be tested with the same key position and the start voltage of the key in the standard key circuit to the judgment unit for a similarity test.

[0038] The above technical solution has the following technical effects:

[0039] Through the key circuit detection system provided by the present invention, the efficient and accurate detection of the key circuit to be tested is realized. The system of this application combines the ADC module, the main control module, the storage module and the display module, which not only simplifies the detection process, but also improves the degree of automation of the detection. The judgment unit and the conversion unit in the main control module can accurately conduct a voltage similarity test to ensure the reliability of the detection result. At the same time, the storage module can store a large amount of test data, which provides convenience for subsequent data analysis and fault troubleshooting. The display module intuitively displays the detection result, enabling the operator to quickly judge whether the key circuit to be tested is qualified. In addition, the system also has good stability and adaptability, can adapt to the detection requirements under different environmental conditions, and further improves the overall product quality and user experience.

[0040] As a further improvement of a key circuit detection system of this application, the main control module is provided with an ADC conversion unit, and the ADC conversion unit converts both the test voltage and the start voltage collected by the ADC module into ADC values;

[0041] One end of each voltage division path in the ADC module is connected in series with a pull-up resistor R ull-up The other end of the pull-up resistor is connected to the voltage source of the reference voltage V ef The ADC module is provided with a filter capacitor;

[0042] The storage module is connected to the judgment unit through an IIC interface;

[0043] The display module is connected to an LED buzzer.

[0044] The third object of the present invention is to provide a storage medium to implement the key circuit detection method designed in this application in view of the deficiencies of the prior art.

[0045] To achieve the above-mentioned invention objectives, the following technical solutions are implemented in this application:

[0046] A storage medium, when the computer instructions are executed by one or more main control modules, causes the one or more processors to execute the steps in the key circuit detection method described in any one of the above.

[0047] The above technical solutions have produced the following technical effects:

[0048] Through the storage medium provided by the present invention, it is possible to conveniently store and execute the key circuit detection method designed by the present invention, further improving the convenience and flexibility of detection. In addition, this storage medium also has good compatibility and scalability, and can adapt to the key circuit detection requirements of different models and specifications. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0050] Figure 1 is a flowchart of the key circuit detection method in Embodiment 1 of the present invention;

[0051] Figure 2 is a flowchart of similarity judgment in Embodiment 1 of the present invention;

[0052] Figure 3 is one of the circuit diagrams of the ADC module in Embodiment 2 of the present invention;

[0053] Figure 4 is the circuit diagram of the standard key circuit in Embodiment 2 of the present invention;

[0054] Figure 5 is one of the circuit diagrams of the ADC module in Embodiment 2 of the present invention;

[0055] Figure 6 is one of the schematic structural diagrams of the key circuit detection system in Embodiment 4 of the present invention;

[0056] Figure 7 is the second schematic structural diagram of the key circuit detection system in Embodiment 4 of the present invention;

[0057] Figure 8 is the circuit diagram of the main control module in the key circuit detection system in Embodiment 4 of the present invention;

[0058] Figure 9 is the circuit diagram of the storage module in the key circuit detection system in Embodiment 4 of the present invention;

[0059] Wherein:

[0060] 1 - Main control module;

[0061] 11 - ADC conversion unit;

[0062] 12 - Judgment unit;

[0063] 13 - IIC interface;

[0064] 2 - ADC module;

[0065] 3 - Storage module;

[0066] 4 - Display module;

[0067] 5 - LED buzzer. Detailed implementation mode

[0068] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.

[0069] The following detailed descriptions are all exemplary descriptions, aiming to provide further detailed descriptions of the present invention. Unless otherwise specified, all technical terms adopted by the present invention have the same meaning as commonly understood by those of ordinary skill in the art to which the present invention belongs. The terms used in the present invention are only for describing specific implementation manners, and are not intended to limit the exemplary embodiments according to the present invention.

[0070] To facilitate understanding of the solutions provided in the following embodiments of the present invention, before describing the technical solutions provided by the present invention, the terms involved in the present invention are explained as follows:

[0071] ADC: Analog-to-Digital Converter, an analog-to-digital converter, which converts the analog voltage after button voltage division into a multi-bit digital value in this application. In the specific implementation process, only one ADC channel is used in this solution to distinguish all buttons.

[0072] EEPROM, Electrically Erasable Programmable Read-Only Memory, is connected to the MCU through the IIC bus and permanently stores the "standard button voltage template" and system parameters.

[0073] IIC, Inter-Integrated Circuit bus, is a communication interface between the MCU and peripherals such as EEPROM and light sensors, with a rate of 100kHz - 400kHz.

[0074] The voltage dividing resistor network refers to multiple resistors connected between the input pins of the ADC module 2 and the ground. They are connected in each key path according to different resistance values, and are used to achieve different voltage outputs corresponding to different key presses. That is, a unique key recognition voltage is formed through Ohm's law.

[0075] The startup voltage refers to the ADC startup voltage generated when a loop is formed in this path after the user presses a key, that is, the actual voltage measured at the ADC sampling point after the resistor network is turned on. This voltage is the direct data for identifying the key.

[0076] The standard key circuit refers to a reference circuit board with a confirmed normal circuit and correct layout in advance, which is used to collect the voltage of each key and store it in the EEPROM as a template. The system will make a comparison and judgment based on this template later.

[0077] Moving average filtering is a method of software filtering algorithm, which is used to perform multiple sampling averages on the ADC sampling to suppress random electrical noise and improve stability.

[0078] As is known by common technical knowledge, the present invention can be implemented by other embodiments that do not depart from its spiritual essence or essential features. Therefore, the above-disclosed embodiments are illustrative in all aspects and are not exclusive. All changes within the scope of the present invention or within the scope equivalent to the present invention are encompassed by the present invention.

[0079] Embodiment 1

[0080] It is known that the existing technical solutions for detecting key circuits usually use the independent GPIO ports of the main control module 1 (MCU) or the method of switch matrix conduction test to detect each key of the key circuit. Among them, the specific working principle of the above existing technical solution is: through the setting of the main control module 1 (MCU), each key can be connected to a separate GPIO port of the MCU through the circuit. When the key is pressed, the corresponding GPIO port will be grounded or energized, thereby changing the level of this port.

[0081] Furthermore, the software stored in the main control module 1 (MCU) detects the level change of each GPIO port through polling or interruption to determine whether the key is pressed. It can be seen that the common judgment method is to confirm the switch state of the key by reading the state (high level or low level) of each GPIO. This method can identify whether the key is pressed, but does not use any voltage dividing circuit, so it cannot detect the specific voltage change or voltage offset.

[0082] However, the above technical solution cannot detect voltage changes. Specifically, the existing solution uses a single GPIO port to detect the key press state and cannot determine the key state through voltage changes. This means that it is impossible to accurately identify voltage changes and key resistance values, and electrical characteristics such as resistance errors cannot be recognized. For example, when a key is pressed, the voltage should be within a predetermined range, but in some cases, due to power supply noise or inaccurate resistance, the key voltage may change. If only the high and low level states of the GPIO port are used to judge, this voltage offset cannot be recognized.

[0083] In addition, the above technical solution causes a large number of GPIO ports in the main control module 1 (MCU) to be occupied. The reason is that considering that each key requires an independent GPIO port, this leads to the occupation of a large amount of GPIO resources. For application scenarios that need to detect multiple keys, especially high-density key matrices, this solution requires a large number of GPIO ports, resulting in a waste of hardware resources and is not suitable for the main control module 1 (MCU) with limited port resources.

[0084] As Figure 1 shown, in order to solve the technical defects of the above technical solution, this application makes improvements to the existing key circuit detection method. Specifically, the key circuit detection method of this application includes the following steps:

[0085] S101. Set the ADC module 2 with the corresponding number of voltage division paths according to the number of keys in the standard key circuit. The resistance values of the voltage division resistors in each voltage division path are different, and the resistance value of the voltage division resistor corresponds to the key position of the standard key circuit;

[0086] S201. Connect the standard key circuit to the ADC module 2, and the ADC module 2 collects the start voltage of each key in the standard key circuit;

[0087] S301. Connect the keys of the key circuit to be measured to the ADC module 2 according to the key positions of the keys in the standard circuit, and the ADC module 2 collects the test voltage of each started key in the key circuit to be measured;

[0088] S401. Perform a similarity judgment on the test voltage of the keys in the key circuit to be measured with the same key position and the start voltage of the keys in the standard key circuit;

[0089] When the similarity judgment value is less than the judgment threshold, output the matching result;

[0090] When the similarity judgment value is greater than the judgment threshold, output the non-matching result.

[0091] Specifically, the working principle of the above technical solution is as follows: In this application, an ADC module 2 with a corresponding number of voltage division paths is set according to the number of keys of the standard key circuit, thereby constructing a voltage division resistor network with different resistance values for each voltage division path. The resistance value of the voltage division resistor corresponds one-to-one with the key positions of each key of the standard key circuit.

[0092] Thus, the above voltage division resistor network divides the voltage value corresponding to each key press to obtain different analog voltages. These analog voltages are converted into digital values by the ADC module 2, and each key corresponds to a unique digital value, realizing the unique identification of the keys. During the detection process, first, the start-up voltages of each key are collected through the standard key circuit, and these voltage values are stored in the storage module 3 (EEPROM module in the specific implementation process) as templates.

[0093] In the specific implementation process, when detecting the key circuit to be measured, the keys of the key circuit to be measured are connected to the ADC module 2 for test voltage acquisition, and compared with the start-up voltages stored in the EEPROM. By judging the similarity between the test voltage and the start-up voltage, the state of the keys can be accurately identified, including whether the keys are pressed and whether there are problems such as voltage offset. This method not only improves the accuracy of detection but also avoids the occupation of a large number of GPIO ports, saving hardware resources.

[0094] Specifically, the voltage of the keys is realized through a voltage division circuit. Each key is connected in series with a specific resistor to form different voltage division paths. When the key is pressed, the voltage signal is sampled by the ADC module 2 and converted into a digital signal. The test voltage collected by the ADC module 2 and the start-up voltage are both converted into ADC values, and the similarity is judged by the ADC value of the test voltage and the ADC value of the start-up voltage; among them, the conversion method of the ADC value is as follows:

[0095]

[0096] In the above formula, ADC is the ADC value output by the test voltage or the start-up voltage; V n is the test voltage or the start-up voltage corresponding to the key position n collected by the ADC module 2; V ef is the reference voltage; N is the resolution of the ADC module 2.

[0097] In the specific implementation manner of this application, the value range of N is: 4 - 12, and the preferred value of N in this application is 12. When the value of N is 12, the conversion is carried out according to the following formula:

[0098]

[0099] Among them, ADC is the converted digital signal, with a range of 0 - 4095 (12-bit ADC). Through the processing of the above formula, the voltage signal corresponding to each key can be converted into a specific digital value.

[0100] Furthermore, due to the characteristics of the resistor voltage division circuit, when the key is pressed, the relationship between voltage and resistance is described by the formula:

[0101]

[0102] Among them, as in the way of the ADC module 2 collecting the test voltage or start voltage corresponding to the key position n in the above formula, it needs to be further converted into an ADC value and stored in the storage module 3 subsequently. is the resistor corresponding to the key position of the standard key circuit; R ull-up is the pull-up resistor set for the ADC module 2.

[0103] Further, as Figure 2 shown, in the test voltage of the key in the key circuit to be measured with the same key position and the start voltage of the key in the standard key circuit are judged similarly and the matching result is output. If the judgment result is a matching result, the matching result is output to the user. If the output result is a non-matching result, while outputting the non-matching result to the user, the similar judgment in step S401 is performed again to avoid misjudgment, and the result of the re-performed similar judgment is output to the user side for the user's reference.

[0104] Embodiment 2

[0105] As Figure 1-5 shown, different from Embodiment 1: In order to further reflect the circuit structure of the ADC module 2 constructed in the present application. In the specific implementation process, one of the manifestation forms of the ADC module 2 constructed in the present application is Figure 3 shown. In the Figure 3 U9 interface (ADC module 2) is a connector connected to each key in the key circuit; as Figure 4 shown, the present application selects a seven-key standard key circuit as the reference key circuit, so the ADC module 2 of the present application has interfaces (Selection 2 - Selection 8) matching seven keys, and is connected to a voltage division network composed of multiple voltage division paths in a "common ground" manner.

[0106] Furthermore, when the key in the standard key circuit is closed, it forms a unique resistance path with the voltage division path of the ADC module 2. Among them, C15 (100 nF) and C18 (4.7 μF) are capacitors, which are used to decouple the power supply voltage and filter out possible high-frequency noise. Thus, the stability of the input and output of the ADC module 2 is ensured. In addition, the above capacitors (decoupling) help to improve the accuracy of the ADC signal and reduce the influence of power supply noise on the sampling accuracy.

[0107] Specifically, the standard key circuit matching the above ADC module 2 is as follows Figure 4 shown. In the Figure 4 , there are 7 keys on the standard key board. In the prior art, it is impossible to distinguish the key positions of the keys only by using one-way ADC to collect signals. It is necessary to divide the voltage through a resistor to the corresponding pin, and confirm which key is pressed through the signal quantity collected by the ADC module 2.

[0108] During the actual operation of this application, when the key corresponding to the 2 interface in the standard key circuit (U11) and the U9 connector is pressed, the circuit is closed, so that the standard key circuit (U11) accesses the voltage-dividing resistor corresponding to the selected 2 interface. By performing ADC value conversion processing on the startup voltage collected by the ADC module 2, the startup voltage corresponding to the key position can be set in the ADC voltage range.

[0109] Furthermore, the following table is an example of the matching table of each interface in the ADC module 2 and each key in the standard key circuit as follows Figure 4 shown:

[0110] Button Resistance Value Voltage ADC Output Value Button Selection 2 No Additional Resistance 2.45V 3035 Button Selection 3 8.2 kΩ 2.07V 2592 Button Selection 4 4.7 kΩ 2.45V 3035 Button Selection 5 3 kΩ 1.29V 1592 Button Selection 6 1.5 kΩ 0.80V 991 Button Selection 7 820 Ω 0.49V 609 Button Selection 8 20 kΩ 2.67V 3271

[0111] Table 1

[0112] It should be noted that there is no additional voltage-dividing resistor in the voltage-dividing path corresponding to the selected 2 interface. Although no resistor is set on the above voltage-dividing path in this application, in essence, a 0Ω resistor can be equivalently set on this voltage-dividing path. Further, this voltage-dividing path is directly connected to the output end of the ADC module 2 through the pull-up resistor R81 (4.7kΩ in the specific implementation process); and R76 corresponds to the resistor in the ADC module 2 for the selected 3 interface; R80 corresponds to the resistor in the ADC module 2 for the selected 4 interface; R75 corresponds to the resistor in the ADC module 2 for the selected 5 interface; R74 corresponds to the resistor in the ADC module 2 for the selected 6 interface; R72 corresponds to the resistor in the ADC module 2 for the selected 7 interface; R73 corresponds to the resistor in the ADC module 2 for the selected 8 interface; among them, the design of each resistor takes into account the voltage-dividing effect and the acquisition accuracy of the ADC module 2, ensuring that a unique and distinguishable voltage value can be generated when each key is pressed, and then accurately converted into a digital signal by the ADC module 2 for identification.

[0113] It can be seen from this that this embodiment provides a key circuit based on voltage-dividing resistors. By pairing the resistors on each voltage-dividing path with the pull-up resistor of 4.7 kΩ, the corresponding voltage values are finally collected by the ADC module 2. The voltage values of each key are calculated through the voltage-dividing formula and converted into digital signals through ADC. This method ensures that even if the voltages of multiple keys are close, accurate judgment can be made through the high resolution of the ADC.

[0114] In the specific implementation process, the ADC module 2 provided in this application can be 2, which further improves the detection efficiency of the key circuit. The circuit design of the second ADC module 2 refers to Figure 5 as shown, and its design principle is the same as that of the ADC module 2 shown in Figure 3 , which will not be elaborated in this embodiment.

[0115] For those that are the same as those in Embodiment 1, they will not be elaborated in this embodiment.

[0116] Embodiment 3

[0117] Different from Embodiment 2: In order to further improve the accuracy of the similarity judgment of the technical solution of this application. Further, the calculation method for the similarity judgment of this application is:

[0118] |ADC measured -ADC expected |≤δ

[0119] Wherein, ADC measured is the ADC value of the test voltage; ADC expected is the ADC value of the startup voltage; δ is the judgment threshold. Among them, the value range of the judgment threshold δ satisfies 20 - 60.

[0120] 1) Taking the test key selection 2 as an example:

[0121] The startup voltage of the standard key circuit: The resistance of the key selection 2 is 4.7 kΩ, and the voltage when the key corresponding to the key position of the key selection 2 in the marked key circuit is pressed is 2.45 V. The corresponding ADC value is 3035.

[0122] The test voltage of the key circuit to be tested: When the test key selection 2 is pressed, the test voltage is 2.47 V, and the ADC value is 3040.

[0123] Assuming that the judgment threshold is 40, since the similarity judgment result value is 5 which is less than the set judgment threshold of 40, the test result is "match successful".

[0124] 2) Taking the test key selection 3 as an example:

[0125] Startup voltage of the standard key circuit: The resistance of the key selection 3 is 8.2 kΩ. When the key corresponding to the key selection 3 in the marked key circuit is pressed, the voltage is 2.07 V. The corresponding ADC value is 2592.

[0126] Test voltage of the key circuit to be measured: When the key selection 3 to be measured is pressed, the voltage to be measured is 2.08 V, and the ADC value is 2598.

[0127] Assume the judgment threshold is 40. Since the similarity judgment result value of 6 is less than the set judgment threshold of 40, the test result is "matching successful".

[0128] Specifically, in the above detection process, if the test key matches the standard circuit key in the key circuit detection system set in this application, the LCD display module 4 will display "Key X matching successful" in real time. If the test key does not match the standard circuit key, the LCD display module 4 will display "No matching key" in real time and prompt the user to retest.

[0129] In summary, the technical solution of this application accurately identifies which key is pressed by collecting the voltage of the key circuit to be measured and comparing the ADC values of the voltages with those of the standard key circuit. By setting a reasonable judgment threshold, the system can tolerate a certain range of voltage errors (caused by factors such as resistance, temperature fluctuations, and power supply noise), thereby improving the reliability and stability of key detection.

[0130] In addition, during the process of the ADC module 2 collecting the test voltage or startup voltage, the sliding average filtering algorithm is used to filter the ADC values of the test voltage or startup voltage;

[0131] The sliding average filtering algorithm is:

[0132]

[0133] Among them, FilteredADC is the ADC value after filtering; ADC i is the i-th ADC value collected by the ADC module 2; N is the number of times the ADC module 2 filters and collects. Thus,

[0134] Through the sliding average filtering algorithm, voltage fluctuations caused by accidental factors (such as power supply noise and resistance temperature fluctuations) can be effectively reduced, and the accuracy and stability of ADC collection can be improved.

[0135] In the specific implementation process, the value of N can be adjusted according to actual needs to achieve the best filtering effect. Generally speaking, the larger the value of N, the better the filtering effect, but the corresponding calculation amount will also increase. In practical applications, the appropriate value of N can be selected for filtering according to the specific situation of the key circuit and the detection requirements. The preferred value of the number of filtering acquisitions of the ADC module 2 selected in this application is 25.

[0136] For those that are the same as those in Embodiment 1, they will not be elaborated in this embodiment.

[0137] Embodiment 4

[0138] As Figure 1-9 shown, the difference from Embodiment 1 is that: in order to further demonstrate the technical solution of this application that combines the multi-layer voltage tolerance ADC module 2, multi-ADC channel comparison, and EEPROM storage mechanism to solve the misjudgment problem caused by temperature drift and unstable power supply in the traditional resistor voltage division scheme. This application designs a multi-key press circuit detection system based on a voltage division network.

[0139] Specifically, the key circuit detection system of this application includes at least one ADC module 2 set in any of the above key circuit detection methods, and the ADC module 2 is connected to the main control module 1 and the storage module 3. In the specific implementation process of this application, there are two ADC modules 2, which are specifically represented by the U9 interface and the U10 interface.

[0140] The main control module 1 drives the ADC module 2 to collect the test voltage of the key in the key circuit to be measured and the start voltage of the key in the standard key circuit; at the same time, the main control module 1 is provided with a judgment unit 12 and a conversion unit, and the judgment unit 12 conducts a similarity test on the start voltage and the test voltage.

[0141] Further, the main control module 1 is electrically connected to the display module 4, and the display module 4 is used to display the result of the similarity judgment between the test voltage of the key in the key circuit to be measured and the start voltage of the key in the standard key circuit with the same key position.

[0142] Further, the storage module 3 is used to store the test voltage and the start voltage output by the ADC module 2, and output the test voltage of the key in the key circuit to be measured and the start voltage of the key in the standard key circuit with the same key position to the judgment unit 12 for similarity testing.

[0143] Further, as Figure 8The circuit diagram of the main control module 1 of the present application is shown. Among them, PC1-ADC1 is the main sampling channel, and PA1-ADC2 is default idle. In the specific implementation process, the circuit under test can be connected to the ADC module 2 with interface U9 and then connected to the ADC module 2 with interface U10 again. By making a cross comparison of the detection results of the two different ADC modules 2, it is confirmed whether the two channels of references are consistent. In this way, the "voltage drift" is left to the hardware redundancy to handle. In addition, by setting two ADC modules 2, the working efficiency can be further improved, and the simultaneous detection of multiple key circuits can be achieved.

[0144] In addition, the main control module 1 is provided with an ADC conversion unit 11. The ADC conversion unit 11 converts both the test voltage and the startup voltage collected by the ADC module 2 into ADC values. Further, a pull-up resistor R is connected in series to each voltage division path in the ADC module 2 ull-up at one end, and the other end of the pull-up resistor is connected to the voltage source of the reference voltage V ef ; the ADC module 2 is provided with a filter capacitor;

[0145] Specifically, as Figure 9 shown, the storage module 3 is connected to the judgment unit 12 through the IIC interface 13; among them, VCC is powered by a 3V bus; and both C6 (100 nF) and C7 (10 μF) are arranged in the storage module 3. Among them, 100 nF is responsible for absorbing the high-frequency spikes brought by the IIC clock edge, and 10 μF maintains the energy for several milliseconds when the whole board instantaneously loses power or hot-plugs the keypad, ensuring that the EEPROM does not lose power when writing pages.

[0146] Further, the display module 4 is connected to the LED buzzer 5. The LED buzzer 5 is one of the specific implementation manners of the alarm module. When the similarity judgment result output by the judgment unit 12 does not match, the LED buzzer 5 gives an audible and visual alarm prompt to remind the user to check and process the key circuit. In the specific implementation process, the LED buzzer 5 is indirectly connected to the main control module 1 through the display module 4. Through the control of the main control module 1, the on / off of the alarm prompt and the recording of the alarm information are realized. In addition, the LED buzzer 5 can also be set to different alarm modes, such as the flashing frequency, the sound volume, etc., to provide richer alarm information and help the user more accurately judge the problem of the key circuit.

[0147] In summary, the technical solution of the present application effectively solves the misjudgment problem caused by temperature drift and unstable power supply in the traditional resistor voltage division scheme by combining a multi-layer voltage tolerance ADC module 2, multi-ADC channel comparison, and EEPROM storage mechanism.

[0148] In order to further improve the applicability of the multi-button circuit detection system based on the voltage division network of the present application, the present application also provides a storage medium. When the computer instructions are executed by one or more main control modules 1, the one or more processors are caused to execute the steps in the button circuit detection method described in any one of the above. This storage medium also has good compatibility and scalability and can adapt to the button circuit detection requirements of different models and specifications.

[0149] For other aspects identical to those in Embodiment 1, they will not be elaborated in this embodiment.

Claims

1. A method for detecting a key circuit, characterized in that, It includes the following steps: S101. Set an ADC module with a corresponding number of voltage division paths according to the number of buttons in the standard button circuit. The resistance values of the voltage division resistors in each voltage division path are different, and the resistance value of the voltage division resistor corresponds to the button position of the standard button circuit; S201. Connect the standard button circuit to the ADC module, and the ADC module collects the start-up voltage of each button in the standard button circuit; S301. Connect the buttons of the to-be-tested button circuit to the ADC module according to the button positions of the buttons in the standard circuit. The ADC module collects the test voltage of each activated button in the to-be-tested button circuit; S401. Perform a similarity judgment on the test voltage of the buttons in the to-be-tested button circuit with the same button position and the start-up voltage of the buttons in the standard button circuit; When the similarity judgment value is less than the judgment threshold, output a matching result; When the similarity judgment value is greater than the judgment threshold, output a non-matching result.

2. The method for detecting a key circuit according to claim 1, wherein Convert both the test voltage and the start-up voltage collected by the ADC module into ADC values, and perform a similarity judgment through the ADC value of the test voltage and the ADC value of the start-up voltage; The conversion method of the ADC value is: where ADC is the ADC value output for the test voltage or the start voltage; V n is the test voltage or the start voltage corresponding to key n collected by the ADC module; V ef is the reference voltage; N is the resolution of the ADC module.

3. The method for detecting a key circuit according to claim 2, wherein The formula for the ADC module to collect the test voltage or the start-up voltage corresponding to button position n is: Wherein, is the resistor corresponding to the voltage division path of the key position n of the standard key circuit; R ull-up is the pull-up resistor set for the ADC module.

4. A key circuit detection method according to claim 2, characterized in that The value range of N is: 4 - 12.

5. A key circuit detection method according to claim 2, characterized in that The calculation method of the similarity judgment is: |ADC measured -ADC expected |≤δ wherein, ADC measured is the ADC value of the test voltage; ADC expected is the ADC value of the start voltage; δ is the judgment threshold value.

6. A key circuit detection method according to claim 5, characterized in that, The value range of the judgment threshold δ satisfies 20 - 60.

7. A key circuit detection method according to claim 1, characterized in that During the process of the ADC module collecting the test voltage or the start-up voltage, a sliding average filtering algorithm is used to filter the ADC values of the test voltage or the start-up voltage; The sliding average filtering algorithm is: Among them, FilteredADC is the ADC value after filtering processing; ADC i is the i-th ADC value collected by the ADC module; N is the number of times of filtered acquisition by the ADC module.

8. A key circuit detection system, characterized in that It includes at least one ADC module set in the button circuit detection method of any one of claims 1 - 7. The ADC module is connected to the main control module and the storage module; The main control module drives the ADC module to collect the test voltage of the buttons in the to-be-tested button circuit and the start-up voltage of the buttons in the standard button circuit; the main control module is provided with a judgment unit, and the judgment unit performs a similarity test on the start-up voltage and the test voltage; The main control module is electrically connected to the display module, and the display module is used to display the result of the similarity judgment between the test voltage of the buttons in the to-be-tested button circuit with the same button position and the start-up voltage of the buttons in the standard button circuit; The storage module is used to store the test voltage and the start-up voltage output by the ADC module. The storage module outputs the test voltage of the buttons in the to-be-tested button circuit with the same button position and the start-up voltage of the buttons in the standard button circuit to the judgment unit for similarity testing; 9. A key circuit detection system according to claim 8, characterized in that, The main control module is provided with an ADC conversion unit, and the ADC conversion unit converts both the test voltage and the start-up voltage collected by the ADC module into ADC values; In the ADC module, a pull-up resistor R is connected in series to each voltage division path. ull-up One end of the pull-up resistor is connected to the voltage source of the reference voltage V ef ; the ADC module is provided with a filter capacitor. The storage module is connected to the judgment unit through an IIC interface; The display module is connected to an LED buzzer.

10. A computer-readable storage medium storing computer instructions, characterized in that, When the computer instructions are executed by one or more master modules, the one or more processors are caused to execute the steps in the key circuit detection method according to any one of claims 1-7.