CN114325481B - Power-off duration detection method and device, electronic equipment and storage medium - Google Patents

Power-off duration detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114325481B
CN114325481B CN202111642830.0A CN202111642830A CN114325481B CN 114325481 B CN114325481 B CN 114325481B CN 202111642830 A CN202111642830 A CN 202111642830A CN 114325481 B CN114325481 B CN 114325481B
Authority
CN
China
Prior art keywords
power
duration
output port
iot module
charge
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
Application number
CN202111642830.0A
Other languages
Chinese (zh)
Other versions
CN114325481A (en
Inventor
黄秀峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Oribo Technology Co Ltd
Original Assignee
Shenzhen Oribo Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Oribo Technology Co Ltd filed Critical Shenzhen Oribo Technology Co Ltd
Priority to CN202111642830.0A priority Critical patent/CN114325481B/en
Publication of CN114325481A publication Critical patent/CN114325481A/en
Application granted granted Critical
Publication of CN114325481B publication Critical patent/CN114325481B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Electronic Switches (AREA)
  • Direct Current Feeding And Distribution (AREA)

Abstract

The embodiment of the application provides a power-off duration detection method and device, electronic equipment and a storage medium. The method is applied to an electronic device comprising a power-off time detection circuit, and comprises the following steps: after the IOT module is electrified, reading the level output by at least one output port; determining a time range of the power-off duration based on the level output by the at least one output port; and updating the effective power-off times based on the time range of the power-off duration. The power-off duration detection method provided by the embodiment of the application can accurately determine the time range of the power-off duration according to the level output by the output port, and can accurately determine the effective power-off times subsequently, thereby reducing the occurrence probability of error reset.

Description

Power-off duration detection method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of circuit technologies, and in particular, to a method and apparatus for detecting a power-off duration, an electronic device, and a storage medium.
Background
Along with the rapid development of the internet of things technology, electronic equipment is connected together through the internet of things technology to provide services for users, so that the home comfort of the users is improved.
Taking smart home as an example, in the process of using the smart home device, a user needs to reset the smart home device. In the related art, the reset of the intelligent household equipment is realized by controlling the intelligent household equipment to perform continuous power-on and power-off operations for a plurality of times. Taking the intelligent lamp as an example, the user performs 5 continuous power-on and power-off operations on the intelligent lamp, the intelligent lamp is reset, that is, factory setting is restored, and at the moment, the intelligent lamp disconnects the existing network connection and meanwhile, related configuration data is deleted.
However, the user may perform a power-off operation in order to turn off the power of the electronic device, or an erroneous operation caused by play by a child, in which case the electronic device counts the number of valid power-off times, thereby causing the electronic device to be erroneously reset.
Disclosure of Invention
The embodiment of the application provides a power-off duration detection method and device, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present application provides a method for detecting a power-off duration, where the method is applied to an electronic device including a power-off time detection circuit, and the circuit includes: the device comprises an IOT module, at least one backflow prevention circuit and at least one charge and discharge circuit, wherein the IOT module comprises a power port, at least one output port, a grounding port and a microprocessor unit, the power port is electrically connected with a first end of the backflow prevention circuit, a second end of the backflow prevention circuit, the first end of the charge and discharge circuit and the output port are electrically connected, and a second end of the charge and discharge circuit is electrically connected with the grounding port; the method comprises the following steps: after the IOT module is electrified, reading the level output by at least one output port; determining a time range of the power-off duration based on the level output by the at least one output port; and updating the effective power-off times based on the time range of the power-off duration.
In a second aspect, an embodiment of the present application provides a power-off duration detection apparatus, including: the level reading module is used for reading the level output by at least one output port after the IOT module is electrified; the power-off duration detection module is used for determining a time range in which the power-off duration is positioned based on the level output by the at least one output port; and the effective power-off frequency updating module is used for updating the effective power-off frequency based on the time range of the power-off duration.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a power-off duration detection circuit, and the circuit includes: the device comprises an IOT module, at least one backflow prevention circuit and at least one charge and discharge circuit, wherein the IOT module comprises a power port, at least one output port, a grounding port and a microprocessor unit, the power port is electrically connected with a first end of the backflow prevention circuit, a second end of the backflow prevention circuit, the first end of the charge and discharge circuit and the output port are electrically connected, and a second end of the charge and discharge circuit is electrically connected with the grounding port; the electronic device further comprises a processor and a memory, wherein the memory stores computer program instructions which are called by the processor to execute the power-off duration detection method.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having program code stored therein, the program code being executable by a processor to perform the power-off duration detection method as described above.
The embodiment of the application provides a power-off duration detection method, because a power-off duration detection circuit is arranged in electronic equipment executing the method, the electronic equipment can acquire the mapping relation between the level output by an output port and the time range of the power-off duration based on the working principle of the power-off duration detection circuit, so that the time range of the power-off duration can be accurately determined according to the level output by the output port, the effective power-off times can be accurately determined later, and the occurrence probability of error reset is further reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a block diagram of a circuit for detecting a power-off duration according to an embodiment of the present application.
Fig. 2 is a block diagram of another power-off duration detection circuit according to an embodiment of the present application.
Fig. 3 is a block diagram of another power-off duration detection circuit according to an embodiment of the present application.
Fig. 4 is a flowchart of a method for detecting a power-off duration according to an embodiment of the present application.
Fig. 5 is a block diagram of a power-off duration detection apparatus according to an embodiment of the present application.
Fig. 6 is a block diagram of an electronic device according to an embodiment of the present application.
FIG. 7 is a block diagram of a computer readable storage medium provided by one embodiment of the application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the present application and are not to be construed as limiting the present application.
In order to enable those skilled in the art to better understand the solution of the present application, the following description will make clear and complete descriptions of the technical solution of the present application in the embodiments of the present application with reference to the accompanying drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, a block diagram of a power-off duration detection circuit 100 according to an embodiment of the application is shown. The circuit 100 includes: IOT module 10, at least one backflow prevention circuit 11, at least one charge-discharge circuit 12.
IOT module 10 includes a power port 101, at least one output port 102, a ground port 103, and a microprocessor unit 104.
The power port 101 is electrically connected to a first end of the anti-backflow circuit 11. The second end of the anti-backflow circuit 11, the first end of the charge-discharge circuit 12 and the output port 102 are electrically connected. The second end of the charge-discharge circuit 12 is electrically connected to the ground port 103.
Power port 101 is configured to output an operating voltage, illustratively 3.0V, upon power-up of IOT module 10. Optionally, power port 101 is further configured to output a power-down voltage when IOT module 10 is powered down. Illustratively, the outage voltage is 0V.
The backflow prevention circuit 11 is configured to prevent current from flowing back to the power supply port 101 from the charge-discharge circuit 12. Further, the anti-backflow circuit 11 is configured to prevent current from flowing back to the power supply port 101 from the charge-discharge circuit 12 after the IOT module 10 is powered off. Thus, after IOT module 10 is powered down, current can only flow in a single direction, i.e., the direction from charge-discharge circuit 12 to ground port 103.
The number of the backflow preventing circuits 11 may be one or more. In some embodiments, the number of backflow prevention circuits 11 is the same as the number of charge and discharge circuits 12. In other embodiments, the number of the anti-backflow circuits 11 is smaller than the number of the charge and discharge circuits 12, and there is at least two charge and discharge circuits 12 sharing one anti-backflow circuit 11. In this embodiment, at least two charge and discharge circuits 12 sharing one backflow prevention circuit 11 have a common terminal connected to the backflow prevention circuit 11. In the embodiment of the present application, the description will be given taking the example in which the number of the backflow prevention circuits 11 is the same as the number of the charge/discharge circuits 12. By the above manner, the voltage division phenomenon can be avoided under the condition that at least two charge-discharge circuits 12 have the common terminal, that is, when the charge-discharge speeds of the two charge-discharge circuits 12 are inconsistent, the voltage of one charge-discharge circuit 12 flows into the other charge-discharge circuit 12 through the common terminal, so that the voltage output by the charge-discharge circuit 12 is interfered by the voltage division phenomenon, and further the situation that the time range of the power-off time cannot be accurately determined occurs, and the accuracy of determining the time range of the power-off time is improved.
In a first implementation, the anti-backflow circuit 11 comprises a diode. Since the diode has a unidirectional conduction characteristic, that is, the diode is turned on when a forward voltage is applied to the anode and the cathode of the diode, and is turned off when a reverse voltage is applied to the anode and the cathode of the diode, the diode can be set as the backflow preventing circuit 11.
In the second implementation, the anti-backflow circuit 11 includes a MOS transistor, and the parasitic diode in the MOS transistor also has a unidirectional conduction characteristic, so that the MOS transistor including the parasitic diode may be set as the anti-backflow circuit 11.
In the embodiment of the present application, the first implementation is described as an example, that is, the diode is set as the backflow preventing circuit 11.
Charge and discharge circuit 12 is configured to charge when IOT module 10 is powered up and to discharge when IOT module 10 is powered down. Optionally, the charge-discharge circuit 12 is configured to charge to an operating voltage of the IOT module 10 when the IOT module 10 is powered up, and the operating voltage of the IOT module 10 is greater than or equal to the level judgment voltage. The level determination voltage is a determination voltage at which the output port 102 switches between a high level and a low level, and when the voltage output from the charge and discharge circuit 12 is greater than the level determination voltage, the output port 102 outputs a high level, and when the voltage output from the charge and discharge circuit 12 is less than the level determination voltage, the output port 102 outputs a low level, and the level determination voltage is, for example, 0.2V. Alternatively, the voltage output by the charge-discharge circuit 12 after stopping the discharge is determined according to the discharge duration and the discharge parameters of the charge-discharge circuit 12 (such as the capacitance value of the capacitor in the charge-discharge circuit 12, the resistance value of the resistor in the charge-discharge circuit 12, the discharge current).
Optionally, the time required for the charge-discharge circuit 12 to discharge from the operating voltage of the IOT module 10 to the level determination voltage is preset to divide the time range in which the power-off duration is located. Illustratively, the charge-discharge circuit 12 takes 3 seconds to discharge from the operating voltage of the IOT module 10 to the level-determining voltage.
The number of the charge and discharge circuits 12 may be one or more, which may be specifically set according to the number of time ranges in which the power-off duration is located. Optionally, the number of charge-discharge circuits 12 plus one, i.e., the number of time ranges in which the power-off duration is present, is also increased. For example, when the number of time ranges in which the power-off period is located is 3, the number of charge-discharge circuits 12 is 2. For another example, when the power-off period is in the time range of 2, the number of the charge and discharge circuits 12 is 1. When there are a plurality of charge/discharge circuits 12, the time required for discharging the operating voltage of the IOT module to the level determination voltage is different from each other in different charge/discharge circuits 12.
The charge-discharge circuit 12 includes a first capacitor element, a first resistor element, and a second resistor element, where a first end of the first resistor element is electrically connected to a second end of the backflow preventing circuit 11, a second end of the first resistor element is electrically connected to the first end of the first capacitor element, a first end of the second resistor element, and the output port 103, and a second end of the first capacitor element is electrically connected to a second end of the second resistor element and the ground port 103. That is, the first capacitive element and the second resistive element are connected in parallel, and the first resistive element is connected in series with a specified loop, which is a loop formed by the first capacitive element and the second resistive element. The charging formula of the capacitor is shown below:
Vt=V0+(Vu-V0)*[1-exp(-t/RC)]。
Wherein V0 is an initial voltage value of the capacitor, vu is a final voltage value when the capacitor is full, vt is a voltage value at any time t on the capacitor, R is a resistance value of the first resistive element, C is a capacitance value of the first capacitive element, exp () represents an exponent based on e. The larger the capacitance value of the first capacitance element, the slower the charging speed, and the larger the resistance value of the first resistance element, the slower the charging speed. Therefore, the capacitance value of the first capacitance element and the resistance value of the first resistance element can be reasonably designed according to the time requirement of the charging circuit for charging to the level judgment voltage.
The discharge formula of the capacitor is shown below.
Vt=E*exp(-t/RC))。
Wherein E is the initial voltage value of the capacitor, vt is the voltage value of the capacitor at any time t, R is the resistance value of the second resistance element, and C is the capacitance value of the first capacitance element. As can be seen from the discharge equation of the capacitive element, the larger the capacitance value of the first capacitive element, the slower the discharge speed, and the larger the resistance value of the second resistive element, the slower the discharge speed. Therefore, the capacitance value of the first capacitive element and the resistance value of the second resistive element can be reasonably designed according to the time requirement that the charging circuit discharges the operating voltage of the IOT module 10 to the level judgment voltage.
The output port 102 is configured to switch between a high level and a low level based on the voltage output from the charge-discharge circuit 12. Alternatively, the output port 102 is switched from a low level to a high level in the case where the voltage output from the charge-discharge circuit 12 is greater than the determination voltage, and is switched from a high level to a low level in the case where the voltage output from the charge-discharge circuit 12 is less than the determination voltage. The high/low level determination voltage is less than or equal to the operating voltage of the IOT module 10 and greater than the power-off voltage of the IOT module 10.
The number of output ports 102 may be one or more, which is consistent with the number of charge-discharge circuits.
Ground port 103 is configured to provide ground support for IOT module 10 and charge-discharge circuit 12.
The microprocessor 104 is configured to read the level output by the output port 102 to determine the time range in which the power down duration of the IOT module 10 is located. The time range of the power-off duration of the IOT module 10 is divided based on the end point of the duration required for at least one charge/discharge circuit 12 to discharge the operating voltage of the IOT module 10 to the level judgment voltage. Illustratively, the duration of the first charge-discharge circuit 12 from the operating voltage of the IOT module 10 to the level determination voltage is 3 seconds, and the power-off duration of the IOT module 10 is in a time range of less than 3 seconds and greater than 3 seconds. For another example, the time ranges in which the two charge-discharge circuits 12 discharge from the operating voltage of the IOT module 10 to the level determination voltage are 3 seconds and 10 seconds, respectively, include 3 time ranges, i.e., less than 3 seconds, more than 3 seconds and less than 10 seconds, and more than 10 seconds.
Optionally, the micro processing unit 104 obtains a mapping relationship between the level output by the output port 102 and the time range where the power-off duration is located based on the working principle of the power-off duration detection circuit, and after reading the level output by the output port 102, searches the mapping relationship to determine the time range where the power-off duration is located. The process of the microprocessor 104 obtaining the mapping relationship between the level output by the output port 102 and the time range where the power-off duration is located based on the working principle of the power-off duration detection circuit will be described with reference to the embodiments of fig. 2 and 3.
According to the power-off duration detection circuit provided by the embodiment of the application, the charging and discharging circuit charges when the power supply is electrified and discharges when the power supply is powered off, the output port is switched between high level and low level by the voltage output by the charging and discharging circuit, and the time range of the power-off duration can be accurately determined according to the level output by the output port under the condition that the duration required by the charging and discharging circuit for discharging the working voltage of the IOT module to the level judgment voltage is preset.
Referring to fig. 2, a block diagram of a power-off duration detection circuit 100 according to another embodiment of the application is shown. The power-off duration detection circuit 100 is configured to detect that the time range in which the power-off duration is located is two. Like the power-off duration detection circuit 100 shown in fig. 1, the power-off duration detection circuit 100 also includes the IOT module 10, and the IOT module 10 also includes the power supply port 101, the ground port 103, and the microprocessor unit 104. Unlike the power-off period detection circuit 100 shown in fig. 1, the number of output ports, the backflow prevention circuit, and the charge-discharge circuit is 1.
The at least one anti-reflux circuit comprises a first anti-reflux circuit 21. The at least one output port includes a first output port 2021. The at least one charge-discharge circuit includes a first charge-discharge circuit 22.
The power port 101 is electrically connected to the first end of the first anti-backflow circuit 21, the second end of the first anti-backflow circuit 21, the first output port and the first end of the first charge/discharge circuit 22 are electrically connected, and the second end of the first charge/discharge circuit 22 is electrically connected to the ground port 103.
The first backflow prevention circuit 21 is configured to prevent current from flowing back to the power supply port 101 from the first charge-discharge circuit 22. In some embodiments, the first backflow prevention circuit 21 includes a first diode 211, an anode of the first diode 211 is electrically connected to the power port 101, and a cathode of the first diode 211 is electrically connected to the second end of the first charge/discharge circuit 22. When the IOT module is powered on, the first charge-discharge circuit 22 charges, and at this time, the first diode 211 is turned on, so that current flows from the power port 101 to the first charge-discharge circuit 22, and when the IOT module is powered off, the first charge-discharge circuit 22 discharges, and the first diode 211 is turned off, and at this time, current flows from the first charge-discharge circuit 22 to the ground port 103, but not from the first charge-discharge circuit 22 to the power port 101.
First charge-discharge circuit 22 is configured to charge when the IOT module is powered up and to discharge when the IOT module is powered down. Wherein the first charge-discharge circuit 22 discharges from the operation voltage of the IOT module to
The time required for the level judgment voltage is a first preset time. The first preset duration may be preset. The first preset time period is illustratively 3 seconds.
In some embodiments, the first charge-discharge circuit 22 includes a first capacitor 221, a first resistor 222, and a second resistor 223. The first end of the first resistor 222 is electrically connected to the second end of the first anti-backflow circuit 21. The second end of the first resistor 222, the first end of the first capacitor 221, the first end of the second resistor 223, and the first output port are electrically connected. The second end of the first capacitor 221, the second end of the second resistor 223, and the ground port 103 are electrically connected.
In some embodiments, the resistance value of first resistor 222 is determined based on the duration of time that first charge-discharge circuit 22 charges to the operating voltage of IOT module 10. Alternatively, as can be obtained according to the capacitance charging formula, the resistance value of the first resistor 222 is in positive correlation with the duration of the period of time that the first charge-discharge circuit 22 charges to the operating voltage of the IOT module 10. The smaller the resistance value of the first resistor 222, the faster the charging speed of the first charge-discharge circuit 22, and the smaller the duration of the first charge-discharge circuit 22 charging to the operating voltage of the IOT module 10; the greater the resistance value of the first resistor 222, the slower the charging speed of the first charge-discharge circuit 22, and the greater the duration for which the first charge-discharge circuit 22 charges to the operating voltage of the IOT module 10.
In some embodiments, the capacitance value of the first capacitor 221 and the resistance value of the second resistor 223 are determined according to a first preset time period. As can be obtained from the discharging equation of the capacitor, the capacitance value of the first capacitor 221 is in positive correlation with the first preset duration. The smaller the capacitance value of the first capacitor 221, the faster the first charge-discharge circuit 22 discharges, and the smaller the first preset time period; the larger the capacitance value of the first capacitor 221, the slower the discharge speed of the first charge-discharge circuit 22, the larger the first preset time period. As can be obtained from the discharging equation of the capacitor, the resistance value of the second resistor 223 is in positive correlation with the first preset duration. The smaller the resistance value of the second resistor 223, the slower the discharge speed of the first charge-discharge circuit 22, the smaller the first preset time period; the larger the resistance value of the second resistor 223, the faster the first charge-discharge circuit 22 discharges, and the larger the first preset time period.
The first output port 2021 is configured to switch between a high level and a low level based on the voltage output by the first charge-discharge circuit 22. In some embodiments, the first output port 2021 is configured to: the high level is output when the output voltage of the first charge-discharge circuit 22 is greater than the first level determination voltage, and the low level is output when the output voltage of the first charge-discharge circuit 22 is less than the first level determination voltage. The first level judgment voltage is smaller than or equal to the operating voltage of the IOT module 10 and is larger than the power-off voltage of the IOT module 10.
The microprocessor 104 is configured to read the level output by the first output port 2021 to determine the time range in which the power-down duration of the IOT module 10 is located. In the embodiment of the present application, the time period required for the first charge-discharge circuit 22 to discharge the working voltage of the IOT module 10 to the first level judgment voltage is a first preset time period, after the IOT module 10 is powered on, the first charge-discharge circuit 22 charges, after the IOT module 10 is powered off, the first charge-discharge circuit 22 discharges, if the discharge time is less than the first preset time period, the voltage output by the first charge-discharge circuit 22 is greater than the first level judgment voltage, the first output port 2021 is still at a high level, and if the discharge time is greater than the first preset time period, the voltage output by the first charge-discharge circuit 22 is less than or equal to the first level judgment voltage, and the first output port 2021 is at a low level. Based on the above principle, the micro processing unit may preset a mapping relationship between the level of the first output port 2021 and the time range where the power-off duration is located, and after reading the level output by the first output port 2021, search the mapping relationship to determine the time range where the power-off duration is located. Wherein the mapping relationship is shown in Table-1.
TABLE-1
According to the power-off duration detection circuit provided by the embodiment of the application, the first charge-discharge circuit charges when the power supply is electrified and discharges when the power supply is powered off, so that the first output port is switched between a high level and a low level by the voltage output by the first charge-discharge circuit, and under the condition that the duration required by the working voltage of the first charge-discharge circuit to be discharged to the first level judgment voltage by the IOT module is preset, the time range of the power-off duration can be accurately determined according to the level output by the output port.
Referring to fig. 3, a block diagram of a power-off duration detection circuit 100 according to another embodiment of the application is shown. The power-off duration detection circuit 100 detects two power-off durations in the time range. Like the power-off duration detection circuit 100 shown in fig. 1, the power-off duration detection circuit 100 also includes the IOT module 10, and the IOT module 10 also includes the power supply port 101, the ground port 103, and the microprocessor unit 104. Unlike the power-off period detection circuit 100 shown in fig. 1, the number of output ports, the backflow prevention circuit, and the charge-discharge circuit is 2.
The at least one backflow prevention circuit includes a first backflow prevention circuit 31 and a second backflow prevention circuit 32, the at least one output port includes a first output port 3021 and a second output port 3022, and the at least one charge and discharge circuit includes a first charge and discharge circuit 33 and a second charge and discharge circuit 34.
The power port 101 is electrically connected to the first end of the first anti-backflow circuit 31, the second end of the first anti-backflow circuit 31, the output port and the first end of the first charge/discharge circuit 33 are electrically connected, and the second end of the first charge/discharge circuit 33 is electrically connected to the ground port 103. The power port 101 is electrically connected to the first end of the second anti-backflow circuit 32, the second output port and the first end of the second charge/discharge circuit 34, and the second end of the second charge/discharge circuit 34 is electrically connected to the ground port 103.
The first backflow prevention circuit 31 is configured to prevent current from flowing back to the power supply port 101 from the first charge-discharge circuit 33. In some embodiments, the first anti-backflow circuit 31 includes a first diode 311, an anode of the first diode 311 is electrically connected to the power port 101, and a cathode of the first diode 311 is electrically connected to the second end of the first charge-discharge circuit 33.
The second backflow prevention circuit 32 is configured to prevent current from flowing back to the power supply port 101 from the second charge-discharge circuit 34. In some embodiments, the second reflow circuit includes a second diode 321, an anode of the second diode 321 is electrically connected to the power port 101, and a cathode of the second diode 321 is electrically connected to the second end of the second charge-discharge circuit 34. When the IOT module 10 is powered on, the second charge-discharge circuit 34 charges, at this time, the second diode 321 is turned on, and current flows from the power port 101 to the second charge-discharge circuit 34, when the IOT module 10 is powered off, the second charge-discharge circuit 34 discharges, and the second diode 321 is turned off, at this time, current flows from the second charge-discharge circuit 34 to the ground port 103, but not from the second charge-discharge circuit 34 to the power port 101.
First charge-discharge circuit 33 is configured to power up IOT module 10 and discharge when IOT module 10 is powered down. The time period required for the first charge-discharge circuit 33 to discharge the operating voltage of the IOT module 10 to the first level determination voltage is a first preset time period. In some embodiments, the first charge-discharge circuit 33 includes a first capacitor 331, a first resistor 332, and a second resistor 333. The first end of the first resistor 332 is electrically connected to the second end of the first backflow preventing circuit 31; the second end of the first resistor 332, the first end of the first capacitor 331, the first output port 3021, and the first end of the second resistor 333 are electrically connected; the second end of the first capacitor 331, the second end of the second resistor 333, and the ground port 103 are electrically connected.
The second charge-discharge circuit 34 is configured to charge when the IOT module 10 is powered up and to discharge when the IOT module 10 is powered down. The second charge-discharge circuit 34 discharges the operating voltage of the IOT module 10 to the second level determination voltage for a second preset time period. The first preset time period is different from the second preset time period. Optionally, the first preset duration is smaller than the second preset duration. The second preset time period is, for example, 10 seconds.
In some embodiments, the second charge-discharge circuit 34 includes a second capacitor 341, a third resistor 342, and a fourth resistor 343. The first end of the third resistor 342 is electrically connected to the second end of the second anti-backflow circuit 32; the second end of the third resistor 342, the first end of the second capacitor 341, the first end of the fourth resistor 343, and the second output port 3022 are electrically connected; the second end of the second capacitor 341, the second end of the fourth resistor 343, and the ground port 103 are electrically connected.
In some embodiments, the resistance value of third resistor 342 is determined based on the length of time second charge-discharge circuit 34 is charged to the operating voltage of IOT module 10. Alternatively, as can be obtained according to the capacitance charging formula, the resistance value of the third resistor 342 is in positive correlation with the duration of the period of time that the second charge/discharge circuit 34 charges to the operating voltage of the IOT module 10. The smaller the resistance value of the third resistor 342, the faster the second charge-discharge circuit 34 charges, and the smaller the duration of the second charge-discharge circuit 34 charging to the operating voltage of the IOT module 10; the greater the resistance value of the third resistor 342, the slower the charging speed of the second charge-discharge circuit 34, and the longer the second charge-discharge circuit 34 charges to the operating voltage of the IOT module 10.
In some embodiments, the capacitance value of the second capacitor 341 and the resistance value of the fourth resistor 343 are determined according to the second preset time period. The capacitance value of the second capacitor 341 and the second preset duration are in positive correlation according to the discharging formula of the capacitor. The smaller the capacitance value of the second capacitor 341, the faster the second charge-discharge circuit 34 discharges, and the smaller the second preset time period; the larger the capacitance value of the second capacitor 341, the slower the discharging speed of the second charge-discharge circuit 34, and the larger the second preset time period. The resistance value of the fourth resistor 343 and the second preset duration are in positive correlation according to the discharging formula of the capacitor. The smaller the resistance value of the fourth resistor 343, the slower the discharging speed of the second charge-discharge circuit 34, the smaller the second preset time period; the larger the resistance value of the fourth resistor 343, the faster the second charge-discharge circuit 34 discharges, and the larger the second preset time period.
The first output port 3021 is configured to switch between a high level and a low level based on the voltage output by the first charge and discharge circuit 33. In some embodiments, the first output port 3021 is configured to: the high level is output when the output voltage of the first charge/discharge circuit 33 is greater than the first level determination voltage, and the low level is output when the output voltage of the first charge/discharge circuit 33 is less than the first level determination voltage. The first level judgment voltage is smaller than or equal to the operating voltage of the IOT module 10 and is larger than the power-off voltage of the IOT module 10.
The second output port 3022 is configured to switch between a high level and a low level based on the voltage output by the second charge and discharge circuit 34. In some embodiments, the second output port 3022 is configured to: the high level is output when the output voltage of the second charge-discharge circuit 34 is greater than the second level determination voltage, and the low level is output when the output voltage of the second charge-discharge circuit 34 is less than the second level determination voltage. The second level judgment voltage is smaller than or equal to the operating voltage of the IOT module 10 and is larger than the power-off voltage of the IOT module 10.
The first level judgment voltage and the second level judgment voltage may be the same or different. In the embodiment of the present application, only the first level judgment voltage and the second level judgment voltage are the same as each other.
The microprocessor 104 is configured to read the level output by the first output port and/or the second output port to determine the time range in which the power down duration of the IOT module 10 is located.
In the embodiment of the present application, the time period required for the first charge-discharge circuit 33 to discharge from the IOT module 10 to the first level determination voltage is a first preset time period, after the IOT module 10 is powered on, the first charge-discharge circuit 33 is charged, and after the IOT module 10 is powered off, the first charge-discharge circuit 33 is discharged. The time period required by the second charge-discharge circuit 34 to discharge the working voltage of the IOT module 10 to the second level determination voltage is a second preset time period, after the IOT module 10 is powered on, the second charge-discharge circuit 34 is charged, and after the IOT module 10 is powered off, the second charge-discharge circuit 34 is discharged. If the discharging time is less than the first preset time period, the voltage output by the first charge-discharge circuit 33 is greater than the first level judgment voltage, the first output port 3021 is still at the high level, and the voltage output by the second charge-discharge circuit 34 is greater than the second level judgment voltage, the second output port 3022 is still at the high level. If the discharging time is longer than the first preset time period and shorter than the second preset time period, the voltage output by the first charge-discharge circuit 33 is smaller than or equal to the first level judgment voltage, the first output port 3021 is at a low level, the voltage output by the second charge-discharge circuit 34 is greater than the second level judgment voltage, and the second output port 3022 is still at a high level. If the discharging time is longer than the second preset time period, the voltage output by the first charge-discharge circuit 33 is less than or equal to the first level judgment voltage, at this time, the first output port 3021 is at a low level, and the voltage output by the second charge-discharge circuit 34 is less than or equal to the second level judgment voltage, at this time, the second output port 3022 is at a low level.
Based on the above principle, the micro processing unit 104 may preset a mapping relationship between the levels of the first output port 3021 and the second output port 3022 and the time range where the power-off duration is located, and after reading the levels output by the first output port 3021 and the second output port 3022, look up the mapping relationship to determine the time range where the power-off duration is located. Wherein the mapping is shown in Table-2.
TABLE-2
According to the power-off duration detection circuit provided by the embodiment of the application, as the first charge-discharge circuit and the second charge-discharge circuit charge when the power supply is electrified and discharge when the power supply is powered off, the voltage output by the first charge-discharge circuit enables the first output port to be switched between a high level and a low level, the voltage output by the second charge-discharge circuit enables the second output port to be switched between the high level and the low level, and the time range where the power-off duration is located can be accurately determined according to the level output by the output port under the condition that the duration required by the first charge-discharge circuit to discharge the working voltage of the IOT module to the first level judgment voltage and the duration required by the second charge-discharge circuit to discharge the working voltage of the IOT module to the second level judgment voltage are preset.
Referring to fig. 4, a flowchart of a power-off duration detection method according to an embodiment of the application is shown, and the method is applied to an electronic device, and the electronic device includes a power-off duration detection circuit 100 as shown in any one of fig. 1 to 3. The method comprises the following steps:
step 401, after the IOT module is powered up, reads the level output by at least one output port.
And the electronic equipment immediately reads the level output by at least one output port after the IOT module is electrified, so that the level output by the output port is timely obtained before the level jump of the output port occurs. That is, the time for reading the level output by the output port after the IOT module is powered on is far less than the time for the charge-discharge circuit to charge to the output port after the IOT module is powered on to generate level jump.
Step 402, determining a time range in which the power-off duration is located based on the level output by the at least one output port.
The time range of the power-off duration is determined according to the structure of the power-off duration detection circuit. In some embodiments, the number of time ranges in which the power-off duration is located is actually determined according to the number of charge-discharge circuits in the power-off duration detection circuit, specifically, the number of charge-discharge circuits in the power-off duration detection circuit is increased by one, that is, the number of time ranges in which the power-off duration is located.
The time range of the power-off duration is to detect the working voltage of the charge-discharge circuit in the circuit to discharge to the IOT module by the power-off duration
The duration of the level judgment voltage is divided by the end points. For example, when the charge-discharge circuit is one, the charge-discharge circuit discharges the operating voltage of the IOT module to
The duration of the level judgment voltage is 3 seconds, and the time range of the power-off duration comprises two time ranges which are respectively less than 3 seconds and more than 3 seconds. For example, when there are two charge/discharge circuits, the charge/discharge circuits discharge from the operating voltage of the IOT module to
The duration of the level judgment voltage is 3 seconds and 10 seconds respectively, and the time range of the power-off duration comprises three time ranges which are respectively less than 3 seconds, more than 3 seconds, less than 10 seconds and more than 10 seconds.
In some embodiments, the electronic device determines, in advance, a mapping relationship between a level output by the output port and a time range in which the power-off duration is located based on an operating principle of the power-off duration detection circuit, and after obtaining the level output by the output port, determines the time range in which the power-off duration is located based on the mapping relationship.
When the power-off duration detection circuit in the embodiment of the present application is the power-off duration detection circuit in fig. 2, that is, the output port includes a first output port, the charge-discharge circuit includes a first charge-discharge circuit, and the first charge-discharge circuit discharges the working voltage of the IOT module to
The duration of the level judgment voltage is a first preset duration. After the IOT module is electrified, the charging and discharging circuit charges to the working voltage of the IOT module, the output port is at a high level at the moment, after the IOT module is powered off, the charging and discharging circuit discharges, and if the discharging time is smaller than a first preset duration, the voltage output by the charging and discharging circuit is larger than the first preset duration
The level judges the voltage, the output port is still at high level at this moment, if the discharging time is longer than the first preset time length, the voltage output by the charging and discharging circuit is smaller than or equal to
And the level judges the voltage, and the output port is at a low level at the moment. Based on the above principle, the micro-processing unit can obtain the mapping relation between the level of the output port and the time range of the power-off duration, and the mapping relation is shown in table-3.
The level output by the output port High level Low level
Time range for power-off duration Is less than a first preset time period Is longer than a first preset time period
TABLE-3
Based on the above mapping, step 402 may be implemented as: under the condition that the first output port outputs high level, determining that the power-off duration of the IOT module is smaller than a first preset duration; and under the condition that the first output port outputs low level, determining that the power-off time length of the IOT module is longer than a first preset time length.
When the power-off duration detection circuit in the embodiment of the present application is the power-off duration detection circuit in fig. 3, that is, the output port includes a first output port and a second output port, the charge-discharge circuit includes a first charge-discharge circuit and a second charge-discharge circuit, the duration from the working voltage of the IOT module to the first level judgment voltage of the first charge-discharge circuit is a first preset duration, the duration from the working voltage of the IOT module to the second level judgment voltage of the second charge-discharge circuit is a second preset duration, and the second preset duration is longer than the first preset duration. After the IOT module is powered on, the first charge-discharge circuit and the second charge-discharge circuit are respectively charged to the working voltage of the IOT module, at this time, the first output port and the second output port are both at high level, after the IOT module is powered off, the first charge-discharge circuit and the second charge-discharge circuit are discharged, if the discharge time is less than a first preset duration, the voltage output by the first charge-discharge circuit is greater than the first level judgment voltage, at this time, the first output port is still at high level, and the voltage output by the second charge-discharge circuit is greater than the second level judgment voltage, at this time, the second output port is still at high level. If the discharging time is longer than the first preset time and shorter than the second preset time, the voltage output by the first charging and discharging circuit is smaller than or equal to the first level judging voltage, the first output port is at a low level, the voltage output by the second charging and discharging circuit is greater than the second level judging voltage, and the second output port is still at a high level. If the discharging time is longer than the second preset time length, the voltage output by the first charging and discharging circuit is smaller than or equal to the first level judging voltage, the first output port is at a low level, and the voltage output by the second charging and discharging circuit is smaller than or equal to the second level judging voltage, and the second output port is at a low level. Based on the above principle, the micro-processing unit can obtain the mapping relation between the level of the output port and the time range of the power-off duration, and the mapping relation is shown in table-4.
TABLE-4
Based on the above mapping, step 402 may be implemented as: under the condition that the first output port outputs a high level and the second output port outputs a high level, determining that the power-off duration of the IOT module is smaller than a first preset duration; under the condition that the first output port outputs a low level and the second output port outputs a high level, determining that the power-off time length of the IOT module is longer than a first preset value and shorter than a second preset time length; and under the condition that the first output port outputs a low level and the second output port outputs a low level, determining that the power-off time length of the IOT module is longer than a second preset time length.
Step 403, updating the effective power-off times based on the time range of the power-off duration.
In some embodiments, when the electronic device determines that the time range in which the power-off duration is located is a first preset range, the value of the first counter is increased by a first preset value. And when the time range of the power-off duration is not the first preset range, setting the first preset value as a second preset value.
The first preset range is a time range predetermined among time ranges in which the power-off time is located. For example, in a scenario in which the electronic device is reset, the power-off time is shorter (for example, less than 3 seconds), the power-off time is considered to be the power-off caused by the user's false touch, the power-off time is too long (for example, more than 10 seconds), the user expects the electronic device to stop working, the power-off time is in a suitable range (for example, more than 3 seconds and less than 10 seconds), the power-off time is considered to be the power-off triggered by the user in order to reset the electronic device, and the power-off is considered to be the effective power-off, so the first preset range is more than 3 seconds and less than 10 seconds.
The first preset value needs to be preset, and is exemplified by 1. The second preset value is also preset, and is illustratively 0.
According to the power-off duration detection method provided by the embodiment of the application, the power-off duration detection circuit is arranged in the electronic equipment executing the method, and the electronic equipment acquires the mapping relation between the level output by the output port and the time range where the power-off duration is positioned based on the working principle of the power-off duration detection circuit, so that the time range where the power-off duration is positioned is accurately determined according to the level output by the output port, the effective power-off times can be accurately determined later, and the occurrence probability of error reset is further reduced.
In the case of resetting the electronic device, statistics of the number of valid power-ups is also required. In some embodiments, in an alternative embodiment provided based on the embodiment shown in fig. 4, the method further comprises: when the IOT module powers up, the effective power up times are updated.
Optionally, when the time range of the power-on duration of the IOT module is a second preset range, increasing a value of a second counter by a fifth preset value, where the value of the second counter is used for representing the effective power-on times; and when the time range of the power-off duration of the IOT module is not the second preset range, setting the value of the first counter to be a sixth preset value. The second preset range is also preset based on the need to reset the electronic device, for example, the second preset range is also greater than 3 seconds and less than 10 seconds. The fifth preset value needs to be preset, and is exemplified by the fifth preset value being 1. The sixth preset value is also preset, and is, for example, 0.
In some embodiments, after the IOT module is powered on, the value of the first counter is read first, if the value of the first counter is not the second preset value, the value of the second counter is increased by a fifth preset value, and if the value of the first counter is the second preset value, the second counter is reset first and then updated for the effective power-on times.
Under the scene of resetting the electronic equipment, resetting the electronic equipment after the effective power-on times and the effective power-off times meet the resetting requirements. In some embodiments, in an alternative embodiment provided based on the embodiment shown in fig. 4, the method further comprises: the IOT module is reset when the value of the first counter is greater than a third preset value and the value of the second counter is greater than a fourth preset value. The third preset value and the fourth preset value may be set according to a reset requirement of the electronic device. The third preset value and the fourth preset value may be the same or different. Illustratively, the third preset value and the fourth preset value are both 5.
In other possible scenarios, the electronic device may also execute specific instructions, such as a power-off instruction, a re-networking instruction, a distribution instruction, a binding instruction, a reset instruction, etc., based on the number of active power-ups and the number of active power-downs. In the embodiment of the application, the electronic device executes the reset instruction only when the effective power-on times are larger than the fourth preset value and the effective power-off times are larger than the fifth preset value, which is not limited.
As shown in fig. 5, the example of the present application further provides a power-off duration detection apparatus, which includes: a level reading module 501, a power-off duration detecting module 502 and a valid power-off number updating module 503.
The level reading module 501 is configured to read a level output by at least one output port after the IOT module is powered up.
The power-off duration detection module 502 is configured to determine a time range in which the power-off duration is located based on a level output by at least one of the output ports.
An effective power-off number updating module 503, configured to update the effective power-off number based on a time range in which the power-off duration is located.
The power-off duration detection device provided by the embodiment of the application can accurately determine the time range of the power-off duration according to the level output by the output port, and can accurately determine the effective power-off times subsequently, thereby reducing the occurrence probability of error reset.
In some embodiments, the outage duration detection module 502 is configured to: under the condition that the first output port outputs high level, determining that the power-off duration of the IOT module is smaller than a first preset duration; and under the condition that the first output port outputs low level, determining that the power-off time length of the IOT module is longer than the first preset time length.
In some embodiments, the outage duration detection module 502 is further configured to: under the condition that the first output port outputs a high level and the second output port outputs the high level, determining that the power-off duration of the IOT module is less than the first preset duration; determining that the power-off time period of the IOT module is longer than the first preset time period and shorter than a second preset time period when the first output port outputs a low level and the second output port outputs the high level; and under the condition that the first output port outputs the low level and the second output port outputs the low level, determining that the power-off time length of the IOT module is longer than the second preset time length.
In some embodiments, an effective power-off number updating module 503 is configured to increment a value of a first counter by a first preset value when a time range in which a power-off duration of the IOT module is located is a first preset range, where the value of the first counter is used to characterize the effective power-off number; and when the time range of the power-off duration of the IOT module is not a first preset range, setting the value of the first counter to a second preset value.
In some embodiments, the apparatus further comprises: a reset module (not shown in fig. 5). And the reset module is used for resetting the IOT module when the value of the first counter is larger than a third preset value and the value of the second counter is larger than a fourth preset value, wherein the value of the second counter is used for representing the effective power-on times.
In some embodiments, the apparatus further comprises: the number of active power up updates the module (not shown in fig. 5). And the effective power-on frequency updating module is used for updating the effective power-on frequency based on the power-on time length of the IOT module.
In some embodiments, the effective power up number update module is configured to: when the time range of the power-on duration of the IOT module is a second preset range, increasing the value of a second counter by a fifth preset value, wherein the value of the second counter is used for representing the effective power-on times; and when the time range of the power-off duration of the IOT module is not a second preset range, setting the value of the first counter to be a sixth preset value.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described apparatus and modules may refer to corresponding procedures in the foregoing method examples, and are not repeated herein.
In several examples provided by the present application, the coupling of the modules to each other may be electrical, mechanical, or other.
In addition, each functional module in each example of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
As shown in fig. 6, the present example also provides an electronic device 600, where the electronic device 600 may be an intelligent device, including an intelligent air conditioner, an intelligent refrigerator, an intelligent lamp, an intelligent curtain, an intelligent water dispenser, and the like, and the electronic device 600 includes the power-off duration detection circuit 100 as in any one of fig. 1 to 3, and the circuit 100 includes: IOT module 10, at least one backflow prevention circuit 11, at least one charge-discharge circuit 12. The IOT module 10 includes a power port 101, at least one output port 102, a ground port 103, and a microprocessor 104, where the power port 101 is electrically connected to a first end of the anti-backflow circuit 11, a second end of the anti-backflow circuit 11, a first end of the charge/discharge circuit 12, and the output port 102, and a second end of the charge/discharge circuit 12 is electrically connected to the ground port 13.
In some embodiments, the electronic device 600 further includes a memory 620, where the memory 620 stores computer program instructions that, when invoked by a processor (not shown), perform the power-off duration detection method described above.
The microprocessor unit in the power-off duration detection circuit 100 is a processor in the electronic device 600. The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various portions of the overall battery management system, perform various functions of the battery management system, and process data by executing or executing instructions, programs, code sets, or instruction sets stored in memory 620, and invoking data stored in memory 620. Alternatively, the processor may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor and may be implemented solely by a single communication chip.
The Memory 620 may include a random access Memory 620 (Random Access Memory, RAM) or a Read-Only Memory 620 (Read-Only Memory). Memory 620 may be used to store instructions, programs, code sets, or instruction sets. The memory 620 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method examples described below, and the like. The storage data area may also store data created by the vehicle in use (e.g., phonebook, audio-video data, chat-record data), etc.
As shown in fig. 7, the present example also provides a computer-readable storage medium 700 having stored therein computer program instructions 710, the computer program instructions 710 being callable by a processor to perform the method described in the above example.
The computer readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium comprises a non-volatile computer readable storage medium (non-transitory computer-readable storage medium). The computer readable storage medium 700 has storage space for program code to perform any of the method steps described above. The program code can be read from or written to one or more computer program products. The program code may be compressed, for example, in a suitable form.
The foregoing is merely a preferred embodiment of the present application, and the present application is not limited thereto, but the present application has been described in any form by the preferred embodiment, and it should be understood that it is not limited thereto, and that any modification, equivalent change and variation made by the above-described embodiment can be made by those skilled in the art without departing from the scope of the present application.

Claims (8)

1. A method for detecting a power-off duration, the method being applied to an electronic device comprising a power-off time detection circuit, the circuit comprising: the IOT module comprises a power port, at least one output port, a grounding port and a microprocessor unit, wherein the power port is electrically connected with the first end of the backflow prevention circuit, the second end of the backflow prevention circuit, the first end of the charge and discharge circuit and the output port are electrically connected, and the second end of the charge and discharge circuit is electrically connected with the grounding port; the method comprises the following steps:
After the IOT module is powered on, reading the level output by at least one output port;
determining a time range of the power-off duration based on the level output by at least one output port;
updating the effective power-off times based on the time range of the power-off duration;
in the case that the output ports include the first output port, the determining, based on the level output by at least one of the output ports, a time range in which the power-off duration is located includes: under the condition that the first output port outputs high level, determining that the power-off duration of the IOT module is smaller than a first preset duration; under the condition that the first output port outputs a low level, determining that the power-off time length of the IOT module is longer than the first preset time length;
in the case that the output ports include a first output port and a second output port, the determining, based on the level output by at least one of the output ports, a time range in which the power-off duration is located includes: under the condition that the first output port outputs a high level and the second output port outputs the high level, determining that the power-off duration of the IOT module is less than the first preset duration; determining that the power-off time period of the IOT module is longer than the first preset time period and shorter than a second preset time period when the first output port outputs a low level and the second output port outputs the high level; and under the condition that the first output port outputs the low level and the second output port outputs the low level, determining that the power-off time length of the IOT module is longer than the second preset time length.
2. The method of claim 1, wherein the updating the effective number of power-down times based on the time range in which the power-down duration is located comprises:
when the time range of the power-off duration of the IOT module is a first preset range, increasing the value of a first counter by a first preset value, wherein the value of the first counter is used for representing the effective power-off times;
and when the time range of the power-off duration of the IOT module is not a first preset range, setting the value of the first counter to a second preset value.
3. The method of claim 2, wherein after updating the number of active power outages based on the time range in which the power-down duration is located, the method further comprises:
and when the value of the first counter is larger than a third preset value and the value of the second counter is larger than a fourth preset value, resetting the IOT module, wherein the value of the second counter is used for representing the effective power-on times.
4. A method according to any one of claims 1 to 3, further comprising:
and updating the effective power-on times based on the power-on time of the IOT module.
5. The method of claim 4, wherein the updating the effective power-up times based on the power-up time of the IOT module comprises:
When the time range of the power-on duration of the IOT module is a second preset range, increasing the value of a second counter by a fifth preset value, wherein the value of the second counter is used for representing the effective power-on times;
and when the time range of the power-off duration of the IOT module is not a second preset range, setting the value of the second counter to be a sixth preset value.
6. A power-off duration detection apparatus, characterized by being applied to an electronic device including a power-off time detection circuit, the circuit comprising: the IOT module comprises a power port, at least one output port, a grounding port and a microprocessor unit, wherein the power port is electrically connected with the first end of the backflow prevention circuit, the second end of the backflow prevention circuit, the first end of the charge and discharge circuit and the output port are electrically connected, and the second end of the charge and discharge circuit is electrically connected with the grounding port; the device comprises:
the level reading module is used for reading the level output by at least one output port after the IOT module is electrified;
the power-off duration detection module is used for determining a time range in which the power-off duration is positioned based on the level output by at least one output port;
The effective power-off time updating module is used for updating the effective power-off time based on the time range of the power-off time;
the power-off duration detection module is used for determining that the power-off duration of the IOT module is smaller than a first preset duration under the condition that the output port outputs a high level; under the condition that the first output port outputs a low level, determining that the power-off time length of the IOT module is longer than the first preset time length;
the power-off duration detection module is used for determining that the power-off duration of the IOT module is smaller than the first preset duration when the output port comprises a first output port and a second output port and the first output port outputs a high level; determining that the power-off time period of the IOT module is longer than the first preset time period and shorter than a second preset time period when the first output port outputs a low level and the second output port outputs the high level; and under the condition that the first output port outputs the low level and the second output port outputs the low level, determining that the power-off time length of the IOT module is longer than the second preset time length.
7. An electronic device comprising a power-off duration detection circuit, the circuit comprising: the IOT module comprises a power port, at least one output port, a grounding port and a microprocessor unit, wherein the power port is electrically connected with the first end of the backflow prevention circuit, the second end of the backflow prevention circuit, the first end of the charge and discharge circuit and the output port are electrically connected, and the second end of the charge and discharge circuit is electrically connected with the grounding port; the electronic device further comprises a processor, a memory storing computer program instructions that are invoked by the processor to perform the power-down duration detection method of any one of claims 1-5.
8. A computer readable storage medium having stored therein program code which is callable by a processor to perform the power outage duration detection method according to any one of claims 1 to 5.
CN202111642830.0A 2021-12-29 2021-12-29 Power-off duration detection method and device, electronic equipment and storage medium Active CN114325481B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111642830.0A CN114325481B (en) 2021-12-29 2021-12-29 Power-off duration detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111642830.0A CN114325481B (en) 2021-12-29 2021-12-29 Power-off duration detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114325481A CN114325481A (en) 2022-04-12
CN114325481B true CN114325481B (en) 2023-10-31

Family

ID=81016471

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111642830.0A Active CN114325481B (en) 2021-12-29 2021-12-29 Power-off duration detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114325481B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116560253A (en) * 2023-04-18 2023-08-08 深圳市丰润达科技有限公司 Equipment function setting method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110138380A (en) * 2019-04-01 2019-08-16 山东华翼微电子技术股份有限公司 A kind of power down time observation circuit and method
CN209372947U (en) * 2018-11-29 2019-09-10 深圳和而泰智能控制股份有限公司 A kind of power-fail detection circuit
CN111082497A (en) * 2020-01-09 2020-04-28 惠州拓邦电气技术有限公司 Power failure judgment method for cleaning equipment and cleaning equipment
CN211349056U (en) * 2019-12-31 2020-08-25 黄石市科嘉电子有限责任公司 Compressor abnormal power-off time detection circuit
CN111831498A (en) * 2020-07-17 2020-10-27 浪潮商用机器有限公司 Power failure test method, device and equipment
CN113109738A (en) * 2021-03-15 2021-07-13 苏州汇川技术有限公司 Power-down time detection circuit and power-down time detection system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100640481B1 (en) * 2004-10-21 2006-10-30 삼성전자주식회사 System and method for measuring power off level in a portable terminal unit

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN209372947U (en) * 2018-11-29 2019-09-10 深圳和而泰智能控制股份有限公司 A kind of power-fail detection circuit
CN110138380A (en) * 2019-04-01 2019-08-16 山东华翼微电子技术股份有限公司 A kind of power down time observation circuit and method
CN211349056U (en) * 2019-12-31 2020-08-25 黄石市科嘉电子有限责任公司 Compressor abnormal power-off time detection circuit
CN111082497A (en) * 2020-01-09 2020-04-28 惠州拓邦电气技术有限公司 Power failure judgment method for cleaning equipment and cleaning equipment
CN111831498A (en) * 2020-07-17 2020-10-27 浪潮商用机器有限公司 Power failure test method, device and equipment
CN113109738A (en) * 2021-03-15 2021-07-13 苏州汇川技术有限公司 Power-down time detection circuit and power-down time detection system

Also Published As

Publication number Publication date
CN114325481A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN111352534B (en) Touch key touch threshold correction method, wire controller, electric appliance and computer readable storage medium
US20170034331A1 (en) Method and Device for Switching State of Terminal
JPH0789331B2 (en) Timer circuit
CN114325481B (en) Power-off duration detection method and device, electronic equipment and storage medium
CN107576930B (en) power supply and relay status detection circuit and method
CN112867120B (en) Low power consumption control system, method, computer device and readable storage medium
CN104808766A (en) Terminal
CN110262647B (en) CMOS data clearing circuit and computer equipment
CN109167420B (en) Charging control circuit, charging circuit and charging control method
US20090089596A1 (en) Method and Apparatus for Mitigating Current Drain in a Low-Power Hand-Held Device
CN217282892U (en) Power-off duration detection circuit and electronic equipment
CN113126815A (en) Key response control method and device, terminal equipment and storage medium
CN110417389B (en) Power-on reset circuit
US8495394B2 (en) Timing control circuit and power supply using the same
CN107340846B (en) Power-down prevention logic circuit and notebook computer
CN116088362A (en) Device micro-power consumption intelligent control device, method, system and medium
CN114137881A (en) Chip awakening device, method and medium thereof
CN210157163U (en) Starting circuit
CN211742096U (en) Electrifying delay circuit, mainboard battery voltage detection circuit, server mainboard and CPLD
CN110196625B (en) USB reset circuit
CN109831714B (en) Method and device for identifying earphone keys and electronic equipment
CN107295175B (en) Display control method and device for electric quantity of mobile terminal, storage medium and mobile terminal
CN108468189B (en) Touch screen control method and intelligent device
CN217063689U (en) Reset circuit, reset device and electronic equipment
CN105204403A (en) Clock circuit, power supply control method based on clock circuit and air conditioner

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