CN109633426B - Switch detection method - Google Patents
Switch detection method Download PDFInfo
- Publication number
- CN109633426B CN109633426B CN201811496371.8A CN201811496371A CN109633426B CN 109633426 B CN109633426 B CN 109633426B CN 201811496371 A CN201811496371 A CN 201811496371A CN 109633426 B CN109633426 B CN 109633426B
- Authority
- CN
- China
- Prior art keywords
- switch
- voltage value
- switch detection
- sampling
- detection circuit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R31/00—Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
- G01R31/327—Testing of circuit interrupters, switches or circuit-breakers
Abstract
The invention provides a switch detection method, which comprises the steps of enabling a control chip MCU to output a voltage value for switching on an MOS tube Q1, and obtaining the current value flowing through an MOS tube Q1 in a switch detection circuit connected to the control chip MCU; when a first control instruction indicating that the current value is smaller than a preset threshold value is received, enabling the control chip MCU to output a voltage value for closing the MOS tube Q1, and obtaining a sampling voltage value at an AD sampling end in the switch detection circuit after the MOS tube Q1 is disconnected; if the sampling voltage value is greater than the standard voltage value, judging that the switch SW is in a closed state; if the sampled voltage value is zero, SW is determined to be off. According to the sampling voltage values of the external switch SW in different states, the MOS tube Q1 is detected in the on and off states, the judgment of the state of the switch SW is completed in a mode that the current flowing through the Q1 in different states of the SW is changed so as to cause the change of the sampling voltage value, compared with the prior art, the detection of the state of the switch can be completed without adopting expensive electric elements, and the cost of manufacturers is reduced.
Description
Technical Field
The invention belongs to the field of circuit detection, and particularly relates to a switch detection method.
Background
In the process of detecting the on-off state in the prior art, the detection precision is often improved in a circuit by increasing a plurality of resistors to improve the voltage division of the resistors, but the resistors are alloy resistors, so that the cost is high while the size is large, and the cost for compressing products is not facilitated. In another mode, a plurality of wires are led out of the switch SW, so that the detection is conveniently finished by changing the electrical parameters in the detection circuit according to different states of the switch, but the switch is high in cost, not beneficial to reducing the product cost and increasing the manufacturing pressure of manufacturers.
Disclosure of Invention
In order to solve the defects in the prior art, the invention provides a switch detection method without using expensive elements, which can reduce the product cost.
In order to achieve the above technical object, the present invention provides a switch detection method for detecting an open/close state of a switch SW installed at one side of a dc motor by a control chip MCU, the switch detection method comprising:
after the control chip MCU is powered on, the control chip MCU is enabled to output a voltage value for conducting the MOS tube Q1, a current value which flows through the MOS tube Q1 in a switch detection circuit connected to the control chip MCU is obtained, and a control instruction corresponding to the current value is generated;
when a first control instruction indicating that the current value is smaller than a preset threshold value is received, enabling the control chip MCU to output a voltage value for closing the MOS tube Q1, and obtaining a sampling voltage value at an AD sampling end in the switch detection circuit after the MOS tube Q1 is disconnected;
if the sampling voltage value is greater than the standard voltage value, judging that the switch SW is in a closed state;
if the sampled voltage value is zero, SW is determined to be off.
Optionally, the switch detection method includes:
and when the current value is larger than the preset threshold value, enabling the control chip MCU to generate a second control instruction for maintaining the current state of the switch SW, and judging that the switch SW is in the closed state based on the second control instruction.
Optionally, when receiving a first control instruction indicating that the current value is smaller than the preset threshold, the control chip MCU is enabled to output a voltage value for turning off the MOS transistor Q1, and obtain a sampling voltage value at the AD sampling terminal in the switch detection circuit after the MOS transistor Q1 is turned off, including:
and when the first control instruction is received, acquiring a sampling voltage value at an AD sampling end in the switch detection circuit after a preset time interval.
Optionally, the preset time period is 10 s.
Optionally, the switch detection circuit is configured to detect a switch state installed on one side of the dc motor, an input end of the switch detection circuit is connected to a negative electrode of the battery pack, an output end of the switch detection circuit is connected to a negative electrode of the dc motor, and a positive electrode of the dc motor is connected to a positive electrode of the battery pack through a switch SW;
the AD sampling end of the switch detection circuit is also connected with a control chip MCU, a first detection end of the MCU is connected with a voltage stabilizing circuit, a second detection end of the MCU is connected with a voltage detection loop, the other end of the voltage stabilizing circuit is connected to the anode of the battery pack, and the other end of the voltage detection loop is connected to the anode of each battery in the battery pack;
the switch detection circuit is provided with a MOS tube Q1 arranged between the input end and the output end of the switch detection circuit.
Optionally, the switch detection circuit includes:
the grid of Q1 is connected with detection point DOC in the AD sampling end through resistance R1, the source of Q1 is ground, be equipped with resistance R22 between the grid of Q1 and source, be connected with resistance R3 between the source and the drain-source resistance of Q1, the drain-source resistance of MOS pipe Q1 is connected with detection point CUTT in the AD sampling end through resistance R23, detection point CUTT is ground connection through electric capacity C1, at the both ends of electric capacity C25 parallel connection have zener diode DZ 1.
The technical scheme provided by the invention has the beneficial effects that:
according to the sampling voltage values of the external switch SW in different states for detecting the on and off states of the MOS tube Q1, the judgment of the state of the switch SW is completed by referring to the mode that the current flowing through the Q1 of the SW in different states changes to cause the change of the sampling voltage value.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a switch detection method provided by the present invention;
FIG. 2 is a schematic diagram of the overall circuit structure including the switch detection circuit provided by the present invention;
fig. 3 is a schematic structural diagram of a switch detection circuit provided in the present invention.
Detailed Description
To make the structure and advantages of the present invention clearer, the structure of the present invention will be further described with reference to the accompanying drawings.
Example one
The invention provides a switch detection method for detecting the open-close state of a switch SW arranged on one side of a direct current motor through a control chip MCU (microprogrammed control Unit), as shown in figure 1, the switch detection method comprises the following steps:
11. after the control chip MCU is powered on, the control chip MCU is enabled to output a voltage value for conducting the MOS tube Q1, a current value which flows through the MOS tube Q1 in a switch detection circuit connected to the control chip MCU is obtained, and a control instruction corresponding to the current value is generated;
12. when a first control instruction indicating that the current value is smaller than a preset threshold value is received, enabling the control chip MCU to output a voltage value for closing the MOS tube Q1, and obtaining a sampling voltage value at an AD sampling end in the switch detection circuit after the MOS tube Q1 is disconnected;
13. if the sampling voltage value is greater than the standard voltage value, judging that the switch SW is in a closed state;
14. if the sampled voltage value is zero, SW is determined to be off.
In the implementation, in order to detect the state of the switch for controlling the operation of the direct current motor, the application provides a switch detection method,
the purpose of step 11 is to determine whether the battery pack is in a normally discharged state based on the current conditions in the current loop.
The preset threshold corresponding to the current value in step 12 is a current value that the voltage drop of the current flowing through the MOS transistor Q1 on the Q1 can be detected by the control chip MCU via the detection point CURT when the circuit in fig. 2 is turned on. Therefore, the loop current of the direct current motor is judged by the preset threshold value, and the state detection of the switch SW can be completed. The first control instruction and the second control instruction are essentially information generated by the control chip MCU according to different levels of current values for executing different subsequent steps.
When the current value flowing through the Q1 is detected to be less than the preset threshold value, the voltage is detected at preset time intervals, and when the voltage is very high, the default SW is closed. When the current is small, the current in the current loop cannot be judged according to the voltage drop on the internal resistance due to the limitation of the reference detection threshold of the control chip MCU.
In step 13, if the sampling voltage value is significantly greater than the standard voltage value, which indicates that there is current in the current switch detection circuit, so that a resistance voltage division is generated at the MOS transistor Q1 at the AD sampling end, the MOS transistor Q1 is necessarily turned on, and this situation can only occur in a state where the switch SW is closed, so that it can be determined that the switch SW is in a closed state in a reverse pushing manner.
In step 14, when the sampling voltage value is zero, the MOS transistor Q1 is disconnected, it is determined that the current SW is in the off state, and at this time, the on-off state detection is not needed, so that the power-off operation is performed on the control chip MCU.
Detecting the switch in this way has the advantage of low hardware costs (hardware costs on the board). The requirement on the switch is low, only the on-off function is required, and other signals are not required to be output for detection of the MCU, so that the cost of the switch is reduced. The judgment precision is high, and the misjudgment caused by small passing current and noise in the current can be avoided.
According to the switch detection method, the sampling voltage values of the MOS transistor Q1 in the on and off states are detected according to the external switch SW in different states, the judgment on the state of the switch SW is completed by referring to the mode that the current flowing through the Q1 in different states changes so as to change the sampling voltage value, compared with the implementation mode in the prior art, the switch state detection can be completed without expensive electric appliance elements, and the cost of manufacturers is reduced.
Optionally, the switch detection method includes:
and when the current value is larger than the preset threshold value, enabling the control chip MCU to generate a second control instruction for maintaining the current state of the switch SW, and judging that the switch SW is in the closed state based on the second control instruction.
In implementation, unlike the first control command, the second control command represents a step of determining whether the switch SW is turned on or off without using the on/off state of the MOS transistor Q1, because when the current is greater than the standard voltage value, it can be determined that the current value of the circuit formed by the battery pack, the dc motor and the MOS transistor Q1 is sufficient only in the closed state of the switch SW, and therefore, the current state of the switch SW does not need to be determined according to the on/off state of the MOS transistor Q1. When the switch SW is closed, the voltage of the CURT approaches the voltage of the battery pack, and when the switch SW is open, the voltage of the CURT is zero.
Optionally, when receiving a first control instruction indicating that the current value is smaller than the preset threshold, the control chip MCU is enabled to output a voltage value for turning off the MOS transistor Q1, and obtain a sampling voltage value at the AD sampling terminal in the switch detection circuit after the MOS transistor Q1 is turned off, including:
and when the first control instruction is received, acquiring a sampling voltage value at an AD sampling end in the switch detection circuit after a preset time interval.
In implementation, the preset duration is set in consideration of the fact that the MCU in the switch detection circuit can complete a power-off and power-on process, and detection abnormality caused by the fact that the MCU does not enter a working state due to too short time interval cannot occur. The usual preset time period is 10 s.
The switch detection method provided in the application includes, in addition to the detection steps provided in the foregoing, detecting a voltage value of the current battery pack through a voltage detection loop in fig. 2 after the MCU is powered on, if the voltage value is within a rated discharge interval, performing the detection steps from step 12 to step 14, and if the voltage is too low, directly outputting a low level to disconnect the MOS transistor Q1 by the control chip MCU, so as to avoid over-discharge of the battery pack and avoid no switching detection operation.
Optionally, the switch detection circuit is configured to detect a switch state installed on one side of the dc motor, an input end of the switch detection circuit is connected to a negative electrode of the battery pack, an output end of the switch detection circuit is connected to a negative electrode of the dc motor, and a positive electrode of the dc motor is connected to a positive electrode of the battery pack through a switch SW;
the AD sampling end of the switch detection circuit is also connected with a control chip MCU, a first detection end of the MCU is connected with a voltage stabilizing circuit, a second detection end of the MCU is connected with a voltage detection loop, the other end of the voltage stabilizing circuit is connected to the anode of the battery pack, and the other end of the voltage detection loop is connected to the anode of each battery in the battery pack;
the switch detection circuit is provided with a MOS tube Q1 arranged between the input end and the output end of the switch detection circuit. The grid of Q1 is connected with detection point DOC in the AD sampling end through resistance R1, the source of Q1 is ground, be equipped with resistance R22 between the grid of Q1 and source, be connected with resistance R3 between the source and the drain-source resistance of Q1, the drain-source resistance of MOS pipe Q1 is connected with detection point CUTT in the AD sampling end through resistance R23, detection point CUTT is ground connection through electric capacity C1, at the both ends of electric capacity C25 parallel connection have zener diode DZ 1.
In implementation, when the MCU is controlled to output a high level through the detection point DOC, the voltage division of the resistor R22 in the series resistors R1 and R22 is higher than the on-state voltage of Q1, at this time, the circuit formed by the battery pack and the dc motor M is turned on when the switch SW is closed, and the dc motor is turned on, whereas when the MCU outputs a low level through the detection point DOC, the voltage division of the resistor R22 in the series resistors R1 and R22 is lower than the on-state voltage of Q1, and Q1 is turned off, so that the dc motor is stopped.
The invention provides a switch detection method, which comprises the steps of enabling a control chip MCU to output a voltage value for switching on an MOS tube Q1, and obtaining the current value flowing through an MOS tube Q1 in a switch detection circuit connected to the control chip MCU; when a first control instruction indicating that the current value is smaller than a preset threshold value is received, enabling the control chip MCU to output a voltage value for closing the MOS tube Q1, and obtaining a sampling voltage value at an AD sampling end in the switch detection circuit after the MOS tube Q1 is disconnected; if the sampling voltage value is greater than the standard voltage value, judging that the switch SW is in a closed state; if the sampled voltage value is zero, SW is determined to be off. According to the sampling voltage values of the external switch SW in different states, the MOS tube Q1 is detected in the on and off states, the judgment of the state of the switch SW is completed in a mode that the current flowing through the Q1 in different states of the SW is changed so as to cause the change of the sampling voltage value, compared with the prior art, the detection of the state of the switch can be completed without adopting expensive electric elements, and the cost of manufacturers is reduced.
The sequence numbers in the above embodiments are merely for description, and do not represent the sequence of the assembly or the use of the components.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (4)
1. The switch detection method is used for detecting the opening and closing states of a switch SW installed on one side of a direct current motor through a control chip MCU, and is characterized by comprising the following steps:
after the control chip MCU is powered on, the control chip MCU is enabled to output a voltage value for conducting the MOS tube Q1, a current value which flows through the MOS tube Q1 in a switch detection circuit connected to the control chip MCU is obtained, and a control instruction corresponding to the current value is generated;
when a first control instruction indicating that the current value is smaller than a preset threshold value is received, enabling the control chip MCU to output a voltage value for closing the MOS tube Q1, and obtaining a sampling voltage value at an AD sampling end in the switch detection circuit after the MOS tube Q1 is disconnected;
if the sampling voltage value is greater than the standard voltage value, judging that the switch SW is in a closed state;
if the sampling voltage value is zero, the SW is judged to be disconnected;
the switch detection circuit is used for detecting the switch state arranged on one side of the direct current motor, the input end of the switch detection circuit is connected with the cathode of the battery pack, the output end of the switch detection circuit is connected with the cathode of the direct current motor, and the anode of the direct current motor is connected with the anode of the battery pack through a switch SW;
the AD sampling end of the switch detection circuit is also connected with a control chip MCU, a first detection end of the MCU is connected with a voltage stabilizing circuit, a second detection end of the MCU is connected with a voltage detection loop, the other end of the voltage stabilizing circuit is connected to the anode of the battery pack, and the other end of the voltage detection loop is connected to the anode of each battery in the battery pack;
the switch detection circuit is provided with a MOS tube Q1 arranged between the input end and the output end of the switch detection circuit;
the switch detection circuit includes:
the grid of Q1 is connected with detection point DOC in the AD sampling end through resistance R1, the source of Q1 is ground, be equipped with resistance R22 between the grid of Q1 and source, be connected with resistance R3 between the source and the drain-source resistance of Q1, the drain-source resistance of MOS pipe Q1 is connected with detection point CUTT in the AD sampling end through resistance R23, detection point CUTT is ground connection through electric capacity C1, at the both ends of electric capacity C25 parallel connection have zener diode DZ 1.
2. The switch detection method according to claim 1, characterized in that the switch detection method comprises:
and when the current value is larger than the preset threshold value, enabling the control chip MCU to generate a second control instruction for maintaining the current state of the switch SW, and judging that the switch SW is in the closed state based on the second control instruction.
3. The switch detection method according to claim 1, wherein when receiving a first control command indicating that the current value is smaller than a preset threshold, the method for making the control chip MCU output a voltage value for turning off the MOS transistor Q1 to obtain the sampled voltage value at the AD sampling terminal of the switch detection circuit after the MOS transistor Q1 is turned off includes:
and when the first control instruction is received, acquiring a sampling voltage value at an AD sampling end in the switch detection circuit after a preset time interval.
4. The switch detection method according to claim 3, wherein the preset time period is 10 s.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811496371.8A CN109633426B (en) | 2018-12-07 | 2018-12-07 | Switch detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811496371.8A CN109633426B (en) | 2018-12-07 | 2018-12-07 | Switch detection method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109633426A CN109633426A (en) | 2019-04-16 |
CN109633426B true CN109633426B (en) | 2021-06-08 |
Family
ID=66072021
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811496371.8A Active CN109633426B (en) | 2018-12-07 | 2018-12-07 | Switch detection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109633426B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110554336B (en) * | 2019-09-04 | 2021-09-10 | 上海东软医疗科技有限公司 | State detection device and method, and transceiving state control system and method |
CN113390452B (en) * | 2021-06-16 | 2023-08-18 | 北京康斯特仪表科技股份有限公司 | Method and device for calibrating switch type instrument |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5545930A (en) * | 1993-08-30 | 1996-08-13 | Hitachi, Ltd. | Generated-voltage regulator for automobile ensuring correct key switch on-state determination |
CN203595790U (en) * | 2013-12-16 | 2014-05-14 | 四川升华电源科技有限公司 | Passive switch isolation detection apparatus |
CN205067692U (en) * | 2015-10-29 | 2016-03-02 | 江苏省电力公司电力科学研究院 | Testing arrangement suitable for thyristor the bypass switch |
CN205646779U (en) * | 2016-05-25 | 2016-10-12 | 象山赛柏斯智能科技有限公司 | Intelligent security on -off controller |
CN107783031A (en) * | 2016-08-30 | 2018-03-09 | 比亚迪股份有限公司 | The failure detector and method of high-pressure system and its power switching modules |
CN108107357A (en) * | 2017-12-27 | 2018-06-01 | 金卡智能集团股份有限公司 | Switching signal detection circuit with self-diagnostic function |
CN108693467A (en) * | 2017-04-10 | 2018-10-23 | Bsh家用电器有限公司 | Switching device for checking switch element |
-
2018
- 2018-12-07 CN CN201811496371.8A patent/CN109633426B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5545930A (en) * | 1993-08-30 | 1996-08-13 | Hitachi, Ltd. | Generated-voltage regulator for automobile ensuring correct key switch on-state determination |
CN203595790U (en) * | 2013-12-16 | 2014-05-14 | 四川升华电源科技有限公司 | Passive switch isolation detection apparatus |
CN205067692U (en) * | 2015-10-29 | 2016-03-02 | 江苏省电力公司电力科学研究院 | Testing arrangement suitable for thyristor the bypass switch |
CN205646779U (en) * | 2016-05-25 | 2016-10-12 | 象山赛柏斯智能科技有限公司 | Intelligent security on -off controller |
CN107783031A (en) * | 2016-08-30 | 2018-03-09 | 比亚迪股份有限公司 | The failure detector and method of high-pressure system and its power switching modules |
CN108693467A (en) * | 2017-04-10 | 2018-10-23 | Bsh家用电器有限公司 | Switching device for checking switch element |
CN108107357A (en) * | 2017-12-27 | 2018-06-01 | 金卡智能集团股份有限公司 | Switching signal detection circuit with self-diagnostic function |
Non-Patent Citations (1)
Title |
---|
多路开关检测接口电路MC33993的原理及应用;曾洁;《国外电子元器件》;20041030(第10期);69-70 * |
Also Published As
Publication number | Publication date |
---|---|
CN109633426A (en) | 2019-04-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109067353B (en) | Active bypass control device and method for photovoltaic module | |
CN204243730U (en) | The current foldback circuit of Intelligent Power Module and air conditioner | |
CN109633426B (en) | Switch detection method | |
CN103036196B (en) | Over-pressure safety device and method | |
CN204287446U (en) | A kind of power-fail detection circuit | |
CN111193296B (en) | Pre-charging control device and method | |
CN108152589B (en) | Direct-current power supply insulation resistance detection circuit and method | |
CN111146928A (en) | Regulating circuit and BUCK circuit | |
CN112904212A (en) | Short circuit detection method and device and electrical equipment | |
CN208421767U (en) | Electronic equipment and its consumable can control circuit | |
CN205248853U (en) | Power supply circuit | |
CN205231727U (en) | Switching power supply output connects battery to join conversely protection automatic control circuit | |
CN203759177U (en) | UPS battery un-connection or anomaly detector | |
CN103826363B (en) | For the hot plug holding circuit of LED luminaire | |
CN109787596A (en) | Current foldback circuit, switch tube driving circuit and electrical equipment | |
CN104242252B (en) | Battery over-discharge protection circuit | |
CN106370922B (en) | solid-state power controller and fault current recording method thereof | |
CN210982594U (en) | Control circuit for monitoring current threshold | |
CN102967788B (en) | Line broken detection circuit of battery and detection method thereof | |
CN201788261U (en) | Switching value detection circuit | |
CN208707379U (en) | A kind of electric energy meter battery powered managing system | |
CN106841966B (en) | Method and system for detecting switching tube fault of electric vehicle controller | |
JP2001245438A (en) | Battery charger | |
CN104121215A (en) | Intelligent exhaust fan | |
CN108896902B (en) | BMS single acquisition circuit fault diagnosis circuit, system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Switch detection method Effective date of registration: 20220809 Granted publication date: 20210608 Pledgee: Agricultural Bank of China Limited by Share Ltd. Jiaxing branch Pledgor: ZHEJIANG TEKANG ELECTRONIC TECHNOLOGY Co.,Ltd. Registration number: Y2022980012195 |
|
PE01 | Entry into force of the registration of the contract for pledge of patent right |