Power supply control circuit and method based on single key
By controlling the capacitor charging drive switch to turn on and off with a single button, combined with MCU control, the voltage surge and MCU standby issues in mechanical switch power supply control are solved, achieving power supply stability and safety, extending the MCU's lifespan, and reducing the failure rate and maintenance costs.
Patent Information
- Application Number
- CN202511477791.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2026-01-13
AI Technical Summary
In existing electronic products, the power supply controlled by mechanical switches suffers from voltage surges and accidental electric shocks. Furthermore, the long standby time of the MCU affects its lifespan, and users lack a way to reset it by powering off, which causes the electronic products to malfunction and fail to work properly when abnormal.
A power supply control circuit based on a single button is adopted. The button controls the capacitor charging to drive the switching transistor to turn on and off. Combined with the MCU IO port and timer, the power supply control is realized, which isolates the direct contact between the power supply system and the electronic system, avoids voltage surges and electrostatic interference, and automatically shuts down the MCU when power is not needed.
It achieves stable and safe power supply control, avoids voltage surges and accidental electric shocks, extends the lifespan of the MCU, simplifies user operation, and reduces the failure rate and maintenance costs of electronic products.
Smart Images

Figure CN121333283A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power supply control, in particular to a power supply control circuit and method based on a single button. BACKGROUND
[0002] With the rapid development of electronic technology, the design diversity of electronic product circuits is also increasing, especially the functions of intelligent attendance machines, intelligent door locks, intelligent safes and other intelligent electronic products are also increasing. Among these product functions, the power-on and power-off functions are indispensable.
[0003] In order to realize the power supply control of the product, mechanical switches are currently used to control power-on and power-off. However, this control method has the following two problems: First, voltage surges will occur, damaging electronic devices and affecting the service life of electronic product circuits, so the performance requirements of electronic components are high, resulting in high costs. Secondly, in some high-humidity environments or special operating environments, there is a risk of electric shock when operating mechanical switches manually.
[0004] In addition, the existing functions of electronic products are mostly realized by MCU control. At this time, the MCU needs to be powered all the time, and the power supply of electronic products is mostly realized by batteries. In order to realize low loss, the electronic product is in a sleep standby state when it does not need to work, and the MCU can be awakened when it needs to work. For this use scenario, the following problems exist in actual use: Firstly, for the MCU, its long-term standby state will affect the service life, and if the power supply fails or there is external interference, the MCU will work abnormally, causing the electronic product to not work normally. Secondly, the electronic product circuit with MCU is mostly assembled inside the product, and the user cannot easily access it. When the electronic system works abnormally, especially for products like smart locks or smart safes, if the electronic system is abnormal, the user cannot normally open the room or safe to hire a professional locksmith to handle the lock opening, or even violently break the lock to open the door lock to handle the abnormality. This not only delays the user's normal life, but also causes economic losses. SUMMARY
[0005] In view of the deficiencies of the background art, the present application provides a power supply control circuit and method based on a single button, which solves the technical problem that if a mechanical switch is used to control the power supply of the existing electronic product circuit, there will be voltage surges and the risk of electric shock, and if the MCU is always powered, the user lacks a way to reset the MCU when it works abnormally, affecting the use of the electronic product.
[0006] To solve the above technical problems, in a first aspect, the application provides a single-key-based power supply control circuit, which comprises a switching tube Q1, a driving unit, an initial potential setting unit, a key S1, a capacitor C1 and a resistor R3 connected in sequence at one end of the key S1. The other end of the key S1 is grounded, and the end of the resistor R3 not connected with the capacitor C1 and the input end of the switching tube Q1 are used for inputting a power supply voltage. The initial potential setting unit comprises an initial potential connection point, and the driving unit is electrically connected with the initial potential connection point and the capacitor C1 respectively, and the switching tube Q1 is controlled to be turned on or turned off based on the voltage on the capacitor C1 and the voltage of the initial potential connection point.
[0007] In some embodiments of the first aspect, the end of the resistor R3 connected with the capacitor C1 is electrically connected with the anode of a diode D1, and the end of the resistor R3 not connected with the capacitor C1 is electrically connected with the cathode of the diode D1.
[0008] In some embodiments of the first aspect, the one end of the key S1 is further electrically connected with a filtering unit; the filtering unit comprises a resistor R2 and a capacitor C2, the one end of the resistor R2 is used for inputting the power supply voltage, the other end of the resistor R2 is electrically connected with the one end of the key S1, and is grounded through the capacitor C2.
[0009] In some embodiments of the first aspect, the control end of the switching tube is turned on when a low-level driving signal is inputted, and is turned off when a high-level driving signal is inputted.
[0010] In some embodiments of the first aspect, the driving unit comprises an NAND gate U1A, an NAND gate U1B, an NAND gate U1C, a resistor R4 and a resistor R5. The first input end of the NAND gate U1A is electrically connected with the capacitor C1, the second input end of the NAND gate U1A is electrically connected with the output end of the NAND gate U1B and the one end of the resistor R5 respectively; the other end of the resistor R5 is electrically connected with the control end of the switching tube Q1 and the one end of the resistor R4 respectively, and the other end of the resistor R4 is electrically connected with the input end of the switching tube Q1. The first input end of the NAND gate U1B is electrically connected with the output end of the NAND gate U1A, the second input end of the NAND gate U1B is electrically connected with the output end of the NAND gate U1C, and the first input end and the second input end of the NAND gate U1C are both electrically connected with the initial potential connection point.
[0011] In some embodiments of the first aspect, the initial potential setting unit comprises a resistor R7, the one end of the resistor R7 is the initial potential connection point, and the other end of the resistor R7 is grounded.
[0012] In some embodiments of the first aspect, the MCU further comprises an IO interface connected to one end of resistor R1 and anode of diode D2, the other end of resistor R1 is connected to a pull-up voltage, and the cathode of diode D2 is connected to one end of button S1. The other IO interface of the MCU is connected to one end of resistor R6 and one end of capacitor C3, the other end of resistor R6 is connected to ground, and the other end of capacitor C3 is connected to the cathode of diode D3 and the initial potential connection point, and the anode of diode D3 is connected to ground.
[0013] In some embodiments of the first aspect, when the level state of the IO interface of the MCU changes from high level state to low level state, the MCU controls the other IO interface to output a high level signal.
[0014] In some embodiments of the first aspect, the MCU is timed by a timer, and after the timing time, the MCU controls the other IO interface to output a high level signal.
[0015] In the second aspect, the application further provides a power supply control method, which is realized by the above-mentioned single-button power supply control circuit and specifically as follows. When power supply is needed, the button S1 is continuously pressed for a first time, the power supply voltage charges the capacitor C1, the voltage on the capacitor C1 changes, and the driving unit drives the switch tube Q1 to turn on based on the voltage on the capacitor C1 and the voltage of the initial potential connection point. In the power supply process, when power supply is needed, the button S1 is pressed, at this time, the level state of one IO port of the MCU changes, the MCU controls the other IO port to output a high level signal to charge the capacitor C3, thereby changing the level state of the initial potential connection point, and the driving unit turns off the switch tube Q1; or the MCU controls the other IO port to output a high level signal to charge the capacitor C3 after timing by a timer, thereby changing the level state of the initial potential connection point, and the driving unit turns off the switch tube Q1.
[0016] Compared with the prior art, the application has the following beneficial effects: 1. The capacitor C1 is charged by operating the button S1, thereby the driving unit controls the on-off of the switch tube Q1, the switch tube Q1 performs power supply control isolation, which can isolate the interference caused by the direct contact of the power supply system and the electronic system, and can also avoid the damage of electronic components of the electronic system caused by voltage impact or static electricity, and the operation is controlled by the button, which can avoid electric shock; 2. When power supply is not needed, the switch tube Q1 is turned off, and the power supply voltage is disconnected, at this time, the MCU does not need to work all the time, that is, the MCU does not need to be in standby state for a long time, thereby the service life of the MCU is not affected. Attached Figure Description
[0017] Figure 1 This is a circuit diagram of the power supply control circuit in Example 1. Detailed Implementation
[0018] The illustrative embodiments of this application include, but are not limited to, a power supply control circuit and method based on a single button.
[0019] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0020] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items. Words such as “comprising” or “including” mean that the element or object preceding “comprising” or “including” covers the element or object listed following “comprising” or “including” and its equivalents, and does not exclude other elements or objects. Words such as “connected” or “linked” are not limited to physical or mechanical connections and can include electrical connections, whether direct or indirect.
[0021] Example 1 like Figure 1 As shown, this embodiment provides a power supply control circuit based on a single button, including a switching transistor Q1, a driving unit 1, an initial potential setting unit 3, a button S1, a capacitor C1 and a resistor R3 connected in sequence to one end of the button S1; the button S1, the capacitor C1 and the resistor R3 form a charging branch 2. The other end of button S1 is grounded, and the end of resistor R3 that is not electrically connected to capacitor C1 and the input terminal of switch Q1 are used to input the power supply voltage VIN. The initial potential setting unit 3 includes an initial potential connection point. The driving unit 1 is electrically connected to the initial potential connection point and the capacitor C1 respectively. The switching transistor Q1 is controlled to turn on and off based on the voltage on the capacitor C1 and the voltage at the initial potential connection point.
[0022] In practical use, the present invention charges capacitor C1 by operating button S1, thereby enabling drive unit 1 to control the switching transistor Q1 to turn on and off, thereby enabling power supply isolation control of switch transistor Q1. This can isolate interference caused by direct contact between the power supply system and the electronic system, and also prevent voltage surges or static electricity from damaging the electronic components of the electronic system. Moreover, since the drive unit achieves isolation between high voltage and low voltage, it can prevent the operation from touching high voltage. In addition, when no power supply is needed, the switching transistor Q1 is turned off, and the power supply voltage is disconnected. At this time, the MCU does not need to work continuously, that is, the MCU does not need to be in standby mode for a long time, thus not affecting the lifespan of the MCU.
[0023] Specifically, in this embodiment, in Figure 1 In the circuit, one end of resistor R3 connected to capacitor C1 is connected to the anode of diode D1, and the other end of resistor R3 not connected to capacitor C1 is connected to the cathode of diode D1. Additionally, one end of button S1 is also connected to filter unit 4. Filter unit 4 includes resistor R2 and capacitor C2. One end of resistor R2 is used to input the power supply voltage VIN, and the other end of resistor R2 is connected to one end of button S1 and grounded through capacitor C2.
[0024] for Figure 1 In the circuit shown, capacitor C2 in filter unit 4 is used not only for filtering but also for debouncing button S1. This can prevent external interference from accidentally triggering button S1 and improve the stability of the circuit. In addition, when the power supply voltage VIN is disconnected, diode D1, resistor R2 and capacitor C1 form a discharge circuit, which can release the charge of capacitor C1 completely, thereby protecting the electronic components of the electronic system from damage caused by the discharge of C1.
[0025] In this embodiment, the control terminal of the switch Q1 is turned on when a low-level drive signal is input and turned off when a high-level drive signal is input; wherein the switch Q1 can be a PMOS transistor.
[0026] exist Figure 1 In the middle, the driving unit 1 includes NAND gate U1A, NAND gate U1B, NAND gate U1C, resistor R4 and resistor R5; The first input terminal of NAND gate U1A is electrically connected to capacitor C1. The second input terminal of NAND gate U1A is electrically connected to the output terminal of NAND gate U1B and one end of resistor R5, respectively. The other end of resistor R5 is electrically connected to the control terminal of switch Q1 and one end of resistor R4, and the other end of resistor R4 is electrically connected to the input terminal of switch Q1. The first input terminal of NAND gate U1B and the output terminal of NAND gate U1A are electrically connected, the second input terminal of NAND gate U1B and the output terminal of NAND gate U1C are electrically connected, and the first and second input terminals of NAND gate U1C are both electrically connected to the initial potential connection point.
[0027] exist Figure 1 In the initial potential setting unit 3, there is a resistor R7. One end of the resistor R7 is the initial potential connection point, and the other end of the resistor R7 is grounded.
[0028] for Figure 1 The circuit shown illustrates the process of activating switch Q1 by pressing button S1 as follows: The first input terminal A of the NAND gate U1A is connected to the power supply voltage VIN through resistor R3, and the second input terminal B of the NAND gate U1A is connected to the power supply voltage VIN through resistors R5 and R4. Therefore, the first input terminal A and the second input terminal B of the NAND gate U1A are both at high level, and the output terminal Y of the NAND gate U1A outputs a low level. The first input terminal A and the second input terminal B of NAND gate U1C are grounded through resistor R7, meaning that both input terminals A and B of NAND gate U1C are at low level. Therefore, the output terminal Y of NAND gate U1C outputs a high level. Combining the above logic, the first input terminal A of NAND gate U1B is at a high level, and NAND gate U1A outputs a low level. Therefore, NAND gate U1B outputs a high level. At this time, the switching transistor Q1 is in the off state, so the electronic system controlled by this circuit is in a power-off state. The electronic system is connected at the VOUT node.
[0029] When the electronic system is powered off: pressing button S1 powers on the system. Resistor R3, capacitor C1, and S1 form a charging circuit. Capacitor C1 is charging, and due to its characteristics, it conducts. The first input A of NAND gate U1A is low, so the output Y of NAND gate U1A outputs a high level. Therefore, the first input A of logic NAND gate U1B is high. At this time, the inputs A and B of logic NAND gate U1C are low, and the output Y of NAND gate U1C outputs a high level. Then, the second input B of logic NAND gate U1B is high. Since the first input A and the second input B of logic NAND gate U1B are both high, the output Y of NAND gate U1B outputs a low level. At this time, the control terminal of switch Q1 is low, and then switch Q1 conducts. When switch Q1 is turned on, the output voltage of node VOUT supplies the electronic system. When capacitor C1 is fully charged and turned off, the first input terminal A of NAND gate U1A is high and the second input terminal B is low. Therefore, the output terminal Y of NAND gate U1A outputs a high level, while the first input terminal A of NAND gate U1B outputs a high level. Ultimately, the output terminal Y of NAND gate U1B remains low, and the output voltage of node VOUT supplies the entire electronic system, enabling the electronic system to operate normally.
[0030] In this embodiment, Figure 1 In addition, the present invention also includes an MCU, wherein one of the MCU’s IO interfaces GPIOA is electrically connected to one end of resistor R1 and the anode of diode D2, the other end of resistor R1 is used to connect a pull-up voltage, wherein the pull-up voltage is a DC voltage of 3.3V and is less than the power supply voltage VIN, and the cathode of diode D2 is electrically connected to one end of button S1. The MCU's other IO interface, GPIOB, is electrically connected to one end of resistor R6 and one end of capacitor C3, respectively. The other end of resistor R6 is grounded, and the other end of capacitor C3 is electrically connected to the cathode of diode D3 and the initial potential connection point. The anode of diode D3 is grounded.
[0031] When the electronic system is powered on: At this time, the MCU's IO interface GPIOA is pulled up to +3.3V through resistor R1 and is in a high level state. Since the power supply voltage VIN is greater than +3.3V, diode D2 is cut off; the MCU's GPIOB function pin CTRL2 is pulled down to ground through resistor R6, which grounds the two terminals of electrolytic capacitor C3. At this time, the MCU detects that the state of GPIOA is high level and the state of GPIOB is low level.
[0032] When it is necessary to turn off the power supply by turning off the switch Q1, the button S1 can be pressed again. Since the diode D2 is unidirectionally conducting, the MCU's IO interface GPIOA is connected to GND through the diode D2 and the button S1. At this time, the MCU detects a low level through the IO interface GPIOA, and then the MCU makes the IO interface GPIOB output a high level. At this time, the MCU's IO interface GPIOB, electrolytic capacitor C3, and resistor R7 form a circuit, thereby charging capacitor C3. During the charging process, it conducts. At this time, the input terminals A and B of the NAND gate U1C are both input to a high level, so the output terminal Y of the NAND gate U1C outputs a low level. Similarly, the second input terminal B of the NAND gate U1B is input to a low level, so the output terminal Y of the NAND gate U1B outputs a high level. Thus, the control terminal of the switch Q1 is input to a high level, and then the switch Q1 is turned off. When the switch Q1 is turned off, the VOUT node is de-energized and no longer outputs voltage. In other words, during the process after the switching transistor Q1 is turned on and powered on, when the level of the MCU's IO interface GPIOA changes from a high level to a low level, the MCU controls another IO interface GPIOB to output a high level signal.
[0033] In addition, in actual implementation, the MCU can also use a timer to time the process. When the timer expires, the MCU controls another IO interface, GPIOB, to output a high-level signal, thereby charging capacitor C3 and turning off the switching transistor Q1.
[0034] Based on the above, the circuit in this embodiment has the following advantages: First, power supply can be made public through a single button S1, and due to the NAND gate setting, high voltage is isolated, which can avoid the risk of accidental electric shock. In addition, combined with the MCU, automatic shutdown can be set. Furthermore, when the present invention provides an operation method, the connected electronic system can be restarted by powering off, so that the product can be protected from damage in some application scenarios. Second: The entire circuit structure is simple, low-cost, has minimal impact, and is easily integrated; 3. After the power off button S1 or the timed power off action is activated, the charge in capacitor C3 forms a discharge circuit through C3, R6, and D3, releasing the charge in C3 completely, thereby protecting the electronic components of the electronic system from damage caused by the discharge of C3. Similarly, the charge in C1 forms a discharge circuit through C1, D1, and R2, releasing the charge in C1 completely, thereby protecting the electronic components of the electronic system from damage caused by the discharge of C1. Fourth: It realizes the reuse of components. Capacitor C2 can not only be used for filtering, but also for debouncing button S1 to avoid accidental operation of automatic power-on.
[0035] Example 2 This embodiment provides a power supply control method, implemented through a single-button-based power supply control circuit as described in Embodiment 1, as follows: When power is needed, press button S1 continuously for the first time to charge capacitor C1 with power supply voltage VIN, thereby changing the voltage on capacitor C1. Drive unit 1 drives switch Q1 to conduct based on the voltage on capacitor C1 and the voltage at the initial potential connection point. During power supply, when power needs to be cut off, press button S1. At this time, the level state of one IO port of the MCU changes, and the MCU controls another IO port to output a high-level signal to charge capacitor C3, thereby changing the level state of the initial potential connection point and causing the drive unit 1 to turn off the switch Q1; or after the timer expires, the MCU controls another IO port to output a high-level signal to charge capacitor C3, thereby changing the level state of the initial potential connection point and causing the drive unit to turn off the switch Q1.
[0036] Based on the above description, those skilled in the art can make various changes and modifications without departing from the technical concept of this invention. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. A power supply control circuit based on a single button, characterized in that, It includes a switching transistor Q1, a driving unit, an initial potential setting unit, a button S1, a capacitor C1 and a resistor R3 that are sequentially connected to one end of the button S1; The other end of the button S1 is grounded, and the end of the resistor R3 that is not electrically connected to the capacitor C1 and the input terminal of the switch Q1 are used to input the power supply voltage. The initial potential setting unit includes an initial potential connection point. The driving unit is electrically connected to the initial potential connection point and the capacitor C1 respectively, and controls the switching on and off of the switching transistor Q1 based on the voltage on the capacitor C1 and the voltage at the initial potential connection point.
2. The power supply control circuit based on a single button according to claim 1, characterized in that, One end of the resistor R3, which is electrically connected to the capacitor C1, is electrically connected to the anode of the diode D1, and the other end of the resistor R3, which is not electrically connected to the capacitor C1, is electrically connected to the cathode of the diode D1.
3. The power supply control circuit based on a single button according to claim 1, characterized in that, One end of the button S1 is also electrically connected to a filter unit; the filter unit includes a resistor R2 and a capacitor C2. One end of the resistor R2 is used to input the power supply voltage, and the other end of the resistor R2 is electrically connected to one end of the button S1 and grounded through the capacitor C2.
4. The power supply control circuit based on a single button according to claim 1, characterized in that, The control terminal of the switching transistor is turned on when a low-level drive signal is input and turned off when a high-level drive signal is input.
5. A power supply control circuit based on a single button according to any one of claims 1-4, characterized in that, The driving unit includes NAND gate U1A, NAND gate U1B, NAND gate U1C, resistor R4, and resistor R5; The first input terminal of the NAND gate U1A is electrically connected to the capacitor C1. The second input terminal of the NAND gate U1A is electrically connected to the output terminal of the NAND gate U1B and one end of the resistor R5. The other end of the resistor R5 is electrically connected to the control terminal of the switch Q1 and one end of the resistor R4. The other end of the resistor R4 is electrically connected to the input terminal of the switch Q1. The first input terminal of NAND gate U1B and the output terminal of NAND gate U1A are electrically connected, the second input terminal of NAND gate U1B and the output terminal of NAND gate U1C are electrically connected, and the first input terminal and the second input terminal of NAND gate U1C are both electrically connected to the initial potential connection point.
6. The power supply control circuit based on a single button according to claim 5, characterized in that, The initial potential setting unit includes a resistor R7, one end of which is the initial potential connection point, and the other end of which is grounded.
7. A power supply control circuit based on a single button according to claim 6, characterized in that, It also includes an MCU, one of the MCU's I / O interfaces is electrically connected to one end of resistor R1 and the anode of diode D2, the other end of resistor R1 is used to connect to the pull-up voltage, and the cathode of diode D2 is electrically connected to one end of button S1. The other IO interface of the MCU is electrically connected to one end of resistor R6 and one end of capacitor C3 respectively. The other end of resistor R6 is grounded, and the other end of capacitor C3 is electrically connected to the cathode of diode D3 and the initial potential connection point. The anode of diode D3 is grounded.
8. A power supply control circuit based on a single button according to claim 7, characterized in that, When the level transition of one IO interface of the MCU changes from a high level to a low level, the MCU controls the other IO interface to output a high level signal.
9. A power supply control circuit based on a single button according to claim 7, characterized in that, The MCU uses a timer to time the output. When the timer expires, the MCU controls the other I / O interface to output a high-level signal.
10. A power supply control method, characterized in that, This is achieved through a power supply control circuit based on a single button, as described in any one of claims 7-9, specifically as follows: When power is needed, press and hold button S1 for the first time to charge capacitor C1 with the power supply voltage, thereby changing the voltage on capacitor C1. The drive unit drives switch Q1 to turn on based on the voltage on capacitor C1 and the voltage at the initial potential connection point. During power supply, when power needs to be cut off, press button S1. At this time, the level state of one IO port of the MCU changes, and the MCU controls another IO port to output a high-level signal to charge capacitor C3, thereby changing the level state of the initial potential connection point and causing the drive unit to turn off the switch Q1; or after the timer expires, the MCU controls another IO port to output a high-level signal to charge capacitor C3, thereby changing the level state of the initial potential connection point and causing the drive unit to turn off the switch Q1.