Switching action detection circuit, method, computer device and storage medium

CN115754703BActive Publication Date: 2026-09-15KINGCLEAN ELECTRIC GREEN TECHNOLOGY (SUZHOU) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211535658.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-02
Publication Date
2026-09-15
Estimated Expiration
2042-12-02

AI Technical Summary

Technical Problem

[0003]基于此,有必要针对在强电电路中,频繁开关机会使控制器处在不稳定的状态,从而影响控制器采集数据的有效性的问题,提供一种开关动作检测电路、方法、计算机设备及存储介质

Benefits of technology

[0016] The aforementioned switch action detection circuit allows the switch module to be used to connect or disconnect the power supply module and the control module, thereby altering the power supply status of the control module. The control module utilizes a voltage detection circuit and a switch detection circuit to detect a first electrical signal at the common terminal and a second electrical signal at the moving terminal of the switch module, respectively. The main control unit can then determine the switching action of the switch module based on the first and/or second electrical signals. By using the switch action detection circuit to monitor the switch module's action in real time, both the stability and safety of the control module's operation are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115754703B_ABST
    Figure CN115754703B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of circuit detection, and discloses a switch action detection circuit and method, a computer device and a storage medium. A positive electrode of a power module is connected with a first moving end of a switch module, a negative electrode of the power module is connected with a negative electrode of a control module, and a positive electrode of the control module is connected with a common end of the switch module. The control module comprises a switch detection circuit, a voltage detection circuit and a main control unit. The switch detection circuit is connected with a second moving end of the switch module and the main control unit respectively, and the voltage detection circuit is connected with the common end and the main control unit respectively. The voltage detection circuit is used for detecting a first electric signal at the common end. The switch detection circuit is used for detecting a second electric signal at the second moving end. The main control unit is used for determining the switch action of the switch module according to the first electric signal and / or the second electric signal. The switch action detection circuit is used for detecting the action of the switch module, thereby ensuring the stability of the control module and improving the safety of the control module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of circuit testing technology, and in particular to a switch action detection circuit, method, computer device, and storage medium. Background Technology

[0002] When a high-power controller is powered on and off using a high-voltage switch, it takes several seconds for the MCU (Microcontroller Unit) on the controller to lose power after the switch is turned off. During this time, the data detected by the MCU is unstable. Therefore, in a high-voltage circuit, frequent switching can cause the controller to be in an unstable state, thus affecting the effectiveness of the data acquired by the controller. Summary of the Invention

[0003] Therefore, it is necessary to provide a switching action detection circuit, method, computer device, and storage medium to address the problem that frequent switching in high-voltage circuits can cause the controller to be in an unstable state, thereby affecting the effectiveness of the controller's data acquisition.

[0004] A switch action detection circuit includes a switch module, a power supply module, and a control module. The switch module includes a common terminal, a first moving terminal, and a second moving terminal. The positive terminal of the power supply module is connected to the first moving terminal, and the negative terminal of the power supply module is connected to the negative terminal of the control module. The positive terminal of the control module is connected to the common terminal. The control module includes a switch detection circuit, a voltage detection circuit, and a main control unit. The switch detection circuit is connected to both the second moving terminal and the main control unit. The voltage detection circuit is used to detect a first electrical signal at the common terminal. The switch detection circuit is used to detect a second electrical signal at the second moving terminal. The main control unit is used to determine the switching action of the switch module based on the first electrical signal and / or the second electrical signal.

[0005] In one embodiment, the switch detection circuit includes a first resistor, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a Zener diode, a first capacitor, and a first field-effect transistor (FET). The first terminal of the first resistor is connected to the second moving terminal, and the second terminal of the first resistor is connected to the drain of the first FET. The gate of the first FET is connected to the first terminal of the fourth resistor, the first terminal of the fifth resistor, and the anode of the Zener diode. The source of the first FET is connected to the first terminal of the second resistor and the first terminal of the third resistor. The second terminal of the fifth resistor is connected to a power supply. The second terminal of the second resistor is connected to the first terminal of the first capacitor and the main control unit. The second terminals of the first capacitor, the third resistor, the fourth resistor, and the cathode of the Zener diode are all grounded.

[0006] In one embodiment, the power supply module is a DC power supply that outputs a preset electrical signal.

[0007] A switch action detection method is applied to the switch action detection circuit described in any of the above embodiments. The switch action detection circuit includes a switch module, the switch module including a common terminal and a second moving terminal. The method includes acquiring a first electrical signal at the common terminal and a second electrical signal at the second moving terminal; and determining the switch action of the switch module based on the first electrical signal and / or the second electrical signal.

[0008] In one embodiment, determining the switching action of the switch module based on the first electrical signal and / or the second electrical signal includes determining that the switch module is in a closed state when the first electrical signal is greater than a first threshold and the second electrical signal is less than or equal to a second threshold.

[0009] In one embodiment, after determining that the switch module is in a closed state, the method further includes detecting the state of all pins and setting the detection and judgment time of relevant variables.

[0010] In one embodiment, determining the switching action of the switching module based on the first electrical signal and / or the second electrical signal further includes determining that the switching module is in an off state when the second electrical signal is greater than a second threshold.

[0011] In one embodiment, after determining that the switch module is in an off state, the method further includes clearing all detected relevant variables to zero.

[0012] In one embodiment, before acquiring the first electrical signal at the common terminal and the second electrical signal at the second moving terminal, the method further includes setting the detection and judgment time of the relevant variables to be greater than a preset threshold.

[0013] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the switch action detection method described in any of the above embodiments.

[0014] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the switch action detection method described in any of the above embodiments.

[0015] A computer program product includes a computer program that, when executed by a processor, implements the steps of the switching action detection method described in any of the above embodiments.

[0016] The aforementioned switch action detection circuit allows the switch module to be used to connect or disconnect the power supply module and the control module, thereby altering the power supply status of the control module. The control module utilizes a voltage detection circuit and a switch detection circuit to detect a first electrical signal at the common terminal and a second electrical signal at the moving terminal of the switch module, respectively. The main control unit can then determine the switching action of the switch module based on the first and / or second electrical signals. By using the switch action detection circuit to monitor the switch module's action in real time, both the stability and safety of the control module's operation are ensured. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the switch action detection circuit in one embodiment of the present disclosure;

[0019] Figure 2 This is a schematic diagram of the switch detection circuit in one embodiment of the present disclosure;

[0020] Figure 3 This is a schematic flowchart of a switch detection method in one embodiment of the present disclosure;

[0021] Figure 4 This is a schematic flowchart of a switch detection method in another embodiment of the present disclosure;

[0022] Figure 5 This is a schematic diagram of the device structure for implementing the switch action detection method in one embodiment of the present disclosure;

[0023] Figure 6 This is an internal structural diagram of a computer device according to one embodiment of the present disclosure. Detailed Implementation

[0024] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Preferred embodiments of the invention are shown in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a thorough and complete understanding of the disclosure of the invention.

[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0026] When a high-power switch is used to control a high-power controller to switch power on and off, it typically takes several seconds from the time the switch is opened until the MCU on the controller is completely powered down. During this time, the data detected by the MCU is unstable. If the switch is closed before the MCU is completely powered down, the MCU will continue to run. Due to the sudden increase in current or voltage in the circuit, unreasonable protection phenomena may be triggered, leading to problems such as vibration or loud noise in the power tool, affecting the user experience. The switch action detection circuit provided in this disclosure can detect the action of the high-power switch in real time, allowing the controller to make further judgments based on the switch action.

[0027] Figure 1 This is a schematic diagram of the structure of a switch action detection circuit in one embodiment of the present invention. In one embodiment, the switch action detection circuit may include a switch module 100, a power supply module 200, and a control module 300.

[0028] The switch module 100 can be a single-pole double-throw switch, meaning the switch can be flipped to both sides for dual control. The switch module 100 may include a first moving terminal 1, a common terminal 2, and a second moving terminal 3. The positive terminal of the power supply module 200 is connected to the first moving terminal 1, the negative terminal of the power supply module 200 is connected to the negative terminal of the control module 300, and the positive terminal of the control module 300 is connected to the common terminal 2. That is, the power supply module 200 can be connected to the control module 300 through the switch module 100, and the switch module 100 can change the connection or disconnection between the first moving terminal 1 and the common terminal 2 to control the connection or disconnection between the switch module 100 and the control module 300.

[0029] The control module 300 may include a switch detection circuit 310, a voltage detection circuit 320, and a main control unit 330. The switch detection circuit 310 can be connected to the second moving terminal 3 and the main control unit 330, respectively. The voltage detection circuit 320 can be connected to the common terminal 2 and the main control unit 330, respectively. The main control unit 330 may be an MCU. The voltage detection circuit 320 can be used to detect a first electrical signal at the common terminal 2, and the switch detection circuit 310 can be used to detect a second electrical signal at the second moving terminal. The main control unit 330 can determine the switching action of the switch module 100 based on the first electrical signal detected by the voltage detection circuit 320 and / or the second electrical signal detected by the switch detection circuit 310.

[0030] In this embodiment, the first moving terminal 1 can be a normally open terminal, and the second moving terminal 3 can be a normally closed terminal, meaning that the switch module 100 is normally in a state where the second moving terminal 3 and the common terminal 2 are connected. Therefore, in this embodiment, the switch module 100 is defined as closed when the first moving terminal 1 and the common terminal 2 are connected, and open when the second moving terminal 3 and the common terminal 2 are connected.

[0031] When the switch is turned to the first moving terminal 1, the first moving terminal 1 is connected to the common terminal 2, so that the power module 200 can provide power to the control module 300, and the control module 300 is powered on. At this time, the voltage detection circuit 320 can detect that the voltage at the common terminal 2 is relatively high, that is, the first electrical signal is high level. At the same time, since the switch is turned to the first moving terminal 1, the second moving terminal 3 is open circuit, and the switch detection circuit 310 will detect that the voltage at the second moving terminal is 0, that is, the second electrical signal is low level. The main control unit 330 can combine the information that the first electrical signal is high level and the second electrical signal is low level to determine that the power module 200 and the control module 300 are connected, that is, the switch module 100 is in the closed state.

[0032] When the switch is moved from the first moving terminal 1 to the second moving terminal 3, the second moving terminal 1 connects to the common terminal 2, thereby disconnecting the connection between the power module 200 and the control module 300, and de-energizing the control module 300. However, since it takes several seconds for the main control module 310 in the control module 300 to completely lose power after the switch is turned off, the residual power in the control module 300 will be transferred to the second moving terminal 3. Therefore, the switch detection circuit 310 can detect a higher voltage at the second moving terminal 3, i.e., a high-level second electrical signal. Thus, the main control unit 330 can determine that the second moving terminal 3 is connected to the common terminal 2 based on the information that the second electrical signal is high, i.e., the switch module 100 is in the off state.

[0033] If the switch is opened and immediately closed, that is, if the switch is moved from the first moving end 1 to the second moving end 3 and then immediately moved back to the first moving end 1, the control module 300 can also determine all the actions of the switch based on the changes in the first electrical signal and / or the second electrical signal. Therefore, by using the switch action detection circuit, the control module 300 can ensure that when the entire machine frequently opens and closes the switch module 100, it can identify all the relevant actions of the switch module 100, and thus determine the validity of the currently collected data based on the switch actions.

[0034] The aforementioned switch action detection circuit allows the switch module 100 to be used to turn on or off the connection between the power module 200 and the control module 300, thereby changing the power supply status of the control module 300. The control module 300 uses the voltage detection circuit 320 and the switch detection circuit 310 to detect a first electrical signal at the common terminal and a second electrical signal at the second moving terminal of the switch module 100, respectively. The main control unit 330 can then determine the switching action of the switch module 100 based on the first and / or second electrical signals. By using the switch action detection circuit to detect the switch module's action in real time, the stability and safety of the control module 300 can be ensured. This switch action detection circuit improves overall performance with relatively low design cost, effectively enhancing the product's market competitiveness.

[0035] Figure 2 This is a schematic diagram of the switch detection circuit in one embodiment of the present disclosure. In one embodiment, the switch detection circuit 310 may include a first resistor R1, a second resistor R2, a third resistor R3, a fourth resistor R4, a fifth resistor R5, a Zener diode D1, a first capacitor C1, and a first field-effect transistor Q1. Appropriate device parameters can be selected for the first resistor R1, the second resistor R2, the third resistor R3, the fourth resistor R4, the fifth resistor R5, the Zener diode D1, the first capacitor C1, and the first field-effect transistor Q1 according to the actual application requirements of the switch action detection circuit in different application scenarios.

[0036] In this embodiment, the first field-effect transistor Q1 is an N-channel enhancement-mode MOSFET. By using an N-channel enhancement-mode MOSFET for isolation, this embodiment can meet the low-power circuit requirements under various wiring methods. For example, when the common terminal 2 is connected to the positive power supply, the second moving terminal 3 is connected to the switch detection circuit 310, and the first moving terminal 1 is connected to the controller, the first field-effect transistor Q1 can still meet the low-power requirements of the circuit.

[0037] Please see Figure 2The first end of the first resistor R1 is connected to the second moving terminal SWITCH_NC. The second end of the first resistor R1 is connected to the drain of the first field-effect transistor Q1. The gate of the first field-effect transistor Q1 is connected to the first end of the fourth resistor R4, the first end of the fifth resistor R5, and the positive terminal of the Zener diode D1. The source of the first field-effect transistor Q1 is connected to the first end of the second resistor R2 and the first end of the third resistor R3.

[0038] The third resistor R3 and the fourth resistor R4 can be used as pull-down resistors for the first field-effect transistor Q1. When power is off, if the first field-effect transistor Q1 is in the conducting state, the parasitic capacitance between the gate and source has no discharge path, which can easily lead to the breakdown of the first field-effect transistor Q1. The third resistor R3 and the fourth resistor R4 provide a discharge path, preventing the MOSFET from malfunctioning and protecting the first field-effect transistor Q1.

[0039] Zener diode D1 can also be used to maintain the stability of the voltage between the gate and the source. When the voltage VGS between the gate and the source fluctuates, Zener diode D1 can be used to limit the gate voltage of the first field-effect transistor Q1 below the regulated value, thereby protecting the first field-effect transistor Q1 and preventing it from being broken down by high current.

[0040] The second terminal of the fifth resistor R5 is connected to the power supply VCC, and R5 can act as a pull-up resistor for the gate of the first field-effect transistor Q1. During power-up, the pull-up resistor provides a defined voltage level to the gate of Q1, preventing interference caused by the uncertain gate voltage when the GPIO (General-purpose input / output) is in a high-impedance state. The second terminal of the second resistor R2 is connected to the first terminal of the first capacitor C1 and the main control unit 330. When the main control unit 330 is an MCU, the second terminal of the second resistor R2 and the first terminal of the first capacitor C1 can be connected to the MCU_AD pin. The second terminals of the first capacitor C1, the third resistor R3, the fourth resistor R4, and the cathode of the Zener diode D1 are all grounded.

[0041] With the switch module 100 closed, the switch is moved to the first moving terminal 1, which is connected to the common terminal 2. Since the second moving terminal 3 is open at this time, the voltage at SWITCH_NC is 0V, the gate-source voltage VGS = 0, and the first field-effect transistor Q1 is off, resulting in a voltage of 0V at MCU_AD. Therefore, the second electrical signal detected by the switch detection circuit 310 at the second moving terminal 3 is low. Simultaneously, since the first moving terminal 1 is connected to the common terminal 2 and is conducting, the control module 300 is powered on. Therefore, the voltage detection circuit 320 connected to the common terminal 2 detects a high voltage, meaning the first electrical signal is high. The main control unit 330, combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310, can determine that the switch module 100 is in the closed state at this time.

[0042] At the instant the switch module 100 is closed to open, i.e., when the switch is moved from the first moving terminal 1 to the second moving terminal 3 and the second moving terminal 3 is connected to the common terminal 2, due to the residual charge in the control module 300, the charge released by the control module 300 is transmitted to the second moving terminal 3 through the common terminal 2. That is, the voltage at SWITCH_NC is the same as the voltage at the positive terminal of the control module 300. At this time, the gate-source voltage VGS > 0. When VGS is greater than the turn-on voltage, the first field-effect transistor Q1 is turned on, resulting in a high-level signal at MCU_AD. In other words, when the switch is open, the second electrical signal detected by the switch detection circuit 310 at the second moving terminal 3 is high. The main control unit 330 can determine that the switch is in the open state based on the high-level signal at MCU_AD at this time.

[0043] Even if the switch is opened and immediately closed again (i.e., the switch is moved from the first moving terminal 1 to the second moving terminal 3 and then immediately moved back to the first moving terminal 1), the voltage at the MCU_AD changes from a high-level signal to a low-level signal. The main control unit 330 can still determine whether the switch module 100 is frequently switching on and off based on the changes in the first electrical signal and / or the second electrical signal. Furthermore, the control module 300 can execute different instructions based on the detected switch actions to ensure the stability and safety of the control module 300.

[0044] In one embodiment, the power supply module 200 is a DC power supply that outputs a preset electrical signal. In this embodiment, the preset electrical signal can be a high-power, high-current, low-frequency electrical signal, meaning the power supply module 200 is a high-voltage DC power supply. The aforementioned switch action detection circuit is suitable for high-voltage DC circuits.

[0045] Based on the description of the above-described switch action detection circuit embodiments, the present invention also provides a switch action detection method. The switch action detection circuit may include an apparatus (including a distributed system), software (application), module, component, server, client, etc., using the switch action detection method described in the embodiments of this specification, combined with necessary hardware implementation. Based on the same innovative concept, the methods in one or more embodiments provided by the embodiments of the present invention are as described in the following embodiments. Since the implementation schemes for solving the problem by the method are similar to those of the apparatus, the implementation of the specific apparatus in the embodiments of this specification can be referred to the implementation of the foregoing apparatus, and repeated details will not be described again. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that implements a predetermined function. The apparatus described in the above embodiments can be implemented in software or hardware, or a combination of software and hardware.

[0046] Figure 3 This is a schematic flowchart of a switch detection method in one embodiment of the present disclosure. In one embodiment, the switch detection method can be applied to the switch action detection circuit described in any of the above embodiments. The method includes the following steps S100 to S200.

[0047] Step S100: Obtain the first electrical signal at the common terminal and the second electrical signal at the second moving terminal.

[0048] The switch action detection circuit may include a switch module 100, a power supply module 200, and a control module 300. The control module 300 may include a switch detection circuit 310, a voltage detection circuit 320, and a main control unit 330. The voltage detection circuit 320 can detect a first electrical signal at the common terminal 2, and the switch detection circuit 310 can detect a second electrical signal at the second moving terminal. The voltage detection circuit 320 and the switch detection circuit 310 can respectively transmit the detected first and second electrical signals to the main control unit 330 in real time.

[0049] Step S200: Determine the switching action of the switching module based on the first electrical signal and / or the second electrical signal.

[0050] The switch module 100 may include a first moving terminal 1, a common terminal 2, and a second moving terminal 3. In this embodiment, the first moving terminal 1 may be a normally open terminal, and the second moving terminal 3 may be a normally closed terminal, meaning that the switch module 100 is normally in a state where the second moving terminal 3 is connected to the common terminal 2. Therefore, in this embodiment, the switch module 100 is defined as closed when the first moving terminal 1 is connected to the common terminal 2, and open when the second moving terminal 3 is connected to the common terminal 2.

[0051] When switch module 100 is closed, power module 200 can supply power to control module 300, and control module 300 is powered on. At this time, voltage detection circuit 320 can detect that the first electrical signal at common terminal 2 is high. Simultaneously, since the switch is turned to the first moving terminal 1, the second moving terminal 3 is open, and switch detection circuit 310 will detect that the second electrical signal at the second moving terminal 3 is low. The main control unit 330 can combine the information of the first electrical signal being high and the second electrical signal being low to determine that power module 200 and control module 300 are connected, that is, switch module 100 is in the closed state.

[0052] When the switch module 100 is disconnected, the connection between the power supply module 200 and the control module 300 is broken, and the control module 300 is de-energized. However, since it takes several seconds for the main control module 330 in the control module 300 to completely lose power after the switch is disconnected, the residual power in the control module 300 will be transferred to the second moving terminal 3. Therefore, the switch detection circuit 310 can detect that the second electrical signal at the second moving terminal 3 is high. Thus, the main control unit 330 can determine that the second moving terminal 3 is connected to the common terminal 2 based on the information that the second electrical signal is high, i.e., the switch module 100 is in the off state.

[0053] If the switch module 100 closes immediately after opening, the control module 300 can also determine all actions of the switch based on changes in the first and / or second electrical signals. Therefore, by using the switch action detection circuit, the control module 300 can identify all relevant actions of the switch module 100 when the entire machine frequently opens and closes the switch module 100, and thus determine the validity of the currently collected data based on the switch actions.

[0054] The aforementioned switch action detection method detects the switching action of the switch module 100 by detecting a first electrical signal at the common terminal and a second electrical signal at the second moving terminal. Based on the first and / or second electrical signals, the switching action of the switch module 100 can be determined. By monitoring the action of the switch module 100 in real time, both the stability and safety of the control module 300 can be ensured. Therefore, applying the aforementioned switch action detection method can improve overall machine performance and enhance the product's market competitiveness.

[0055] Figure 4 The following is a flowchart illustrating a switch detection method in another embodiment of this disclosure. In one embodiment, determining the switching action of the switch module based on a first electrical signal and / or a second electrical signal may include the following step S210.

[0056] Step S210: When the first electrical signal is greater than the first threshold and the second electrical signal is less than or equal to the second threshold, it is determined that the switch module is in a closed state.

[0057] The second threshold can be the turn-on voltage of the first field-effect transistor Q1. When the second electrical signal at the second moving terminal 3 is less than or equal to the turn-on voltage of the first field-effect transistor Q1, the first field-effect transistor Q1 is turned off, and thus the voltage at MCU_AD is a low-level signal. That is, when the switch is closed, the second electrical signal detected by the switch detection circuit 310 at the second moving terminal 3 is a low-level signal less than or equal to the second threshold. The first threshold can be a value used to determine whether the common terminal 2 is connected to the power module 200. That is, when the switch is closed, the first electrical signal detected by the voltage detection circuit 320 at the common terminal 2 is a high-level signal greater than the first threshold. The main control unit 330, combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310, can determine that the switch module 100 is in a closed state at this time.

[0058] In one embodiment, after determining that the switch module is in a closed state, the method may further include the following step S211.

[0059] Step S211: Detect the status of all pins and set the detection and judgment time of relevant variables.

[0060] When the main control unit 330 determines that the switch module 100 is in a closed state by combining the first electrical signal detected by the voltage detection circuit 320 and the second electrical signal detected by the switch detection circuit 310, the MCU can perform the operation of re-detecting the state of all pins and setting the detection and judgment time of relevant variables to ensure the validity of the data collected by the MCU.

[0061] In one embodiment, determining the switching action of the switching module based on the first electrical signal and / or the second electrical signal may further include the following step S220.

[0062] S220: When the second electrical signal is greater than the second threshold, it is determined that the switch module is in the off state.

[0063] When the switch module 100 is open, the switch is moved from the first moving terminal 1 to the second moving terminal 3, and the second moving terminal 3 is connected to the common terminal 2. Because there is residual charge in the control module 300, the charge discharged by the control module 300 is transmitted to the second moving terminal 3 through the common terminal 2. That is, the voltage at SWITCH_NC is the same as the voltage at the positive terminal of the control module 300. The second threshold can be the turn-on voltage of the first field-effect transistor Q1. When VGS is greater than the turn-on voltage, the first field-effect transistor Q1 is turned on, resulting in a high-level signal at MCU_AD. In other words, when the switch is open, the switch detection circuit 310 detects a second electrical signal greater than the second threshold at the second moving terminal 3. The main control unit 330 can determine that the switch is in the open state based on the high-level signal at MCU_AD at this time.

[0064] In one embodiment, after determining that the switch module is in an open state, the method may further include the following step S221.

[0065] S221: Clear all detected relevant variables to zero.

[0066] When the main control unit 330 determines that the switch module 100 is in the off state based on the second electrical signal detected by the switch detection circuit 310, the MCU can clear all detected relevant variables to zero. This prevents unstable detection data from causing unnecessary problems such as vibration or excessive noise in the power tool, thus optimizing the user experience.

[0067] Because frequent power-on and power-off cycles can cause the control module 300 to be in an unstable state, the motor circuit's protection mechanism may be triggered unnecessarily. The aforementioned switch action detection method can clear unreasonable changes in the software through the switch's action. When the MCU detects the switch being open, it clears the relevant variables, ensuring that the variables detected again during the next rapid power-on are not erroneous values. This allows the control module 300 to reasonably determine the validity of the collected data.

[0068] In one embodiment, before acquiring the first electrical signal at the common terminal and the second electrical signal at the second moving terminal, the method may further include setting the detection and judgment time of the relevant variables to be greater than a preset threshold. The preset threshold can be the time required from when the switch is turned off to when the MCU is completely powered off, that is, after the MCU is powered on, it waits for a certain period of time before performing the data acquisition action, thereby preventing the detected relevant variables from having unreasonable values. By setting the detection and judgment time of the MCU's relevant variables to be greater than a preset threshold, and by using software to extend the detection and judgment time of the relevant parameters to be greater than the time when the control module 300 is powered off, the validity of the acquired data can be guaranteed without detecting the switch action, thereby increasing the stability of the operation of the control module 300.

[0069] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple steps or stages, which are not necessarily completed at the same time, but may be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but may be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0070] It is understood that the various embodiments of the methods, apparatuses, etc. described in this specification are presented in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. Related details can be found in the descriptions of other method embodiments.

[0071] Figure 5 This is a schematic diagram of a device structure for implementing a switch action detection method in one embodiment of this disclosure. (Refer to...) Figure 5 The switch action detection device S00 may include a processing component S20, which further includes one or more processors, and memory resources represented by a memory S22 for storing instructions executable by the processing component S20, such as application programs. The application programs stored in the memory S22 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component S20 is configured to execute instructions to perform the aforementioned switch action detection method.

[0072] The switch action detection device S00 may further include: a power supply component S24 configured to perform power management for the switch action detection device S00; a wired or wireless network interface S26 configured to connect the switch action detection device S00 to a network; and an input / output (I / O) interface S28. The switch action detection device S00 can operate on an operating system stored in memory S22, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or similar.

[0073] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory S22 including instructions, which can be executed by the processor of the switch action detection device S00 to complete the above method. The storage medium can be a computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.

[0074] In an exemplary embodiment, a computer program product is also provided, the computer program product including instructions that can be executed by the processor of the switch action detection device S00 to perform the above method.

[0075] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, Figure 6This is an internal structural diagram of a computer device according to one embodiment of the present disclosure. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores relevant data used in the aforementioned switch action detection method. The network interface communicates with an external terminal via a network connection. When the computer program is executed by the processor, it implements a switch action detection method.

[0076] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0077] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0078] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, hardware + program embodiments are basically similar to method embodiments, so they are described more simply; relevant parts can be referred to the descriptions in the method embodiments.

[0079] It should be noted that the devices, electronic devices, servers, etc., described above according to the method embodiments may also include other implementation methods, and specific implementation methods can be referred to the description of the relevant method embodiments. Furthermore, new embodiments formed by the combination of features between various methods, devices, and server embodiments still fall within the scope of this disclosure, and will not be elaborated upon here.

[0080] In the description of this specification, references to terms such as "some embodiments," "other embodiments," and "ideal embodiments" indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative descriptions of the above terms do not necessarily refer to the same embodiments or examples.

[0081] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0082] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A switch action detection circuit, applied to power tools, characterized in that, The switch action detection circuit includes a switch module, a power supply module, and a control module. The switch module includes a common terminal, a first moving terminal, and a second moving terminal. The positive terminal of the power supply module is connected to the first moving terminal, the negative terminal of the power supply module is connected to the negative terminal of the control module, and the positive terminal of the control module is connected to the common terminal. The control module includes a switch detection circuit, a voltage detection circuit, and a main control unit. The switch detection circuit is connected to the second moving terminal and the main control unit, respectively. The voltage detection circuit is connected to the common terminal and the main control unit, respectively. The voltage detection circuit is used to detect the first electrical signal at the common terminal; The switch detection circuit is used to detect the second electrical signal at the second moving end; The main control unit is used to determine the switching action of the switch module based on the first electrical signal and / or the second electrical signal; wherein, when the switch of the switch module is switched from the first moving end to the second moving end, the residual power in the control module is transferred to the second moving end, the switch detection circuit detects that the second electrical signal is high level, and the main control unit determines that the second moving end is connected to the common end based on the information that the second electrical signal is high level, and the switch module is in the off state.

2. The switch action detection circuit according to claim 1, characterized in that, The switch detection circuit includes a first resistor, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a Zener diode, a first capacitor, and a first field-effect transistor. The first terminal of the first resistor is connected to the second moving terminal, the second terminal of the first resistor is connected to the drain of the first field-effect transistor, the gate of the first field-effect transistor is connected to the first terminal of the fourth resistor, the first terminal of the fifth resistor and the positive terminal of the Zener diode, the source of the first field-effect transistor is connected to the first terminal of the second resistor and the first terminal of the third resistor, the second terminal of the fifth resistor is connected to the power supply, the second terminal of the second resistor is connected to the first terminal of the first capacitor and the main control unit, and the second terminals of the first capacitor, the third resistor, the fourth resistor and the negative terminal of the Zener diode are all grounded.

3. The switch action detection circuit according to claim 1 or 2, characterized in that, The power supply module is a DC power supply that outputs a preset electrical signal.

4. A method for detecting a switch action, applied to the switch action detection circuit according to any one of claims 1 to 3, the switch action detection circuit comprising a switch module, the switch module comprising a common terminal and a second active terminal, characterized in that, The method includes: Acquire the first electrical signal at the common terminal and the second electrical signal at the second moving terminal; The switching action of the switching module is determined based on the first electrical signal and / or the second electrical signal.

5. The switch action detection method according to claim 4, characterized in that, When the first electrical signal is greater than the first threshold and the second electrical signal is less than or equal to the second threshold, the switch module is determined to be in a closed state.

6. The switch action detection method according to claim 5, characterized in that, When the second electrical signal is greater than the second threshold, it is determined that the switch module is in the off state.

7. The switch action detection method according to claim 4, characterized in that, After determining that the switch module is in a closed state, the method further includes: The detection and judgment time for detecting the status of all pins and setting relevant variables.

8. The switch action detection method according to claim 4, characterized in that, After determining that the switch module is in the off state, the method further includes: Clear all detected relevant variables to zero.

9. The switch action detection method according to claim 4, characterized in that, Before acquiring the first electrical signal at the common terminal and the second electrical signal at the second moving terminal, the method further includes: The detection and judgment time of the relevant variables is set to be greater than a preset threshold.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the switching action detection method according to any one of claims 4 to 9.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the switching action detection method according to any one of claims 4 to 9.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the switching action detection method according to any one of claims 4 to 9.

Citation Information

Patent Citations

  • Relay detecting method and device

    CN109490771A