An ac power-off memory circuit based on a single-chip microcomputer and an electronic device

By combining the AC zero-crossing detection module and the power-off delay module, the problem of microcontroller reset due to brief power outages is solved, and the automatic recovery mode is realized when the voltage is restored, which facilitates user operation and reduces production costs.

CN225032431UActive Publication Date: 2026-11-27SHENZHEN LONGTECH SMART CONTROL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202522495765.3
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-11-27
Estimated Expiration
2035-11-25

AI Technical Summary

Technical Problem

Existing microcontrollers are prone to automatic reset due to brief power outages, making it difficult to remember their operating state, which requires users to reset them, resulting in inconvenience.

Method used

It employs an AC zero-crossing detection module, an AC/DC voltage regulation module, and a power-off delay module to detect the AC voltage zero-crossing signal and output a delayed voltage when interrupted, preventing the microcontroller power supply voltage from falling below the reset voltage, maintaining the working mode, and memorizing the working mode information in sleep mode.

Benefits of technology

When the AC voltage is restored, the microcontroller can synchronously restore the working mode, avoiding reset phenomenon, making it easier for users to operate, reducing power consumption, and reducing the cost of using additional memory chips or batteries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN225032431U_ABST
    Figure CN225032431U_ABST
Patent Text Reader

Abstract

The utility model provides an alternating current power-off memory circuit and electronic equipment based on singlechip, alternating current power-off memory circuit based on singlechip, wherein, alternating current zero -cross detection module is used to detect whether the alternating voltage exists zero -cross signal, and when zero -cross signal interruption, the interrupt signal is exported to singlechip, AC -DC voltage stabilizing module is used to convert alternating voltage into working voltage and power supply for singlechip, power -off delay module is used to when zero -cross signal interruption, in the first memory time, the interrupt delay voltage is exported to the power end of singlechip, and singlechip is closed power load when gathering interrupt signal, and enters the hibernate state from working mode. The power voltage of singlechip can not be immediately less than its reset voltage through power -off delay module, and singlechip closes all loads simultaneously. The power end of singlechip can not produce reset phenomenon in a certain time, so that it can restore to working mode when voltage recovers, and it is convenient for user operation after power -off.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This utility model relates to the field of circuit technology, and in particular to an AC power-off memory circuit based on a microcontroller and an electronic device. Background Technology

[0002] With the development of electronic equipment technology, there are many products on the market that require AC power. Existing electronic equipment usually uses microcontrollers to achieve various intelligent controls. After normal power-on initialization, it enters low-power modes such as standby or sleep. After reading user operation signals, it enters working mode, thereby reducing the overall power consumption of the microcontroller.

[0003] However, after electronic devices enter the working mode, due to unstable power grid voltage in some areas, or a sudden power outage followed by immediate restoration of normal power supply, the microcontroller's operating voltage is pulled down to below the reset voltage due to the self-regulation of the switching power supply. The microcontroller then resets and exits the working mode, and the electronic device returns to its initial state. To continue operation, the user needs to reset the settings based on the initial state, which is inconvenient.

[0004] Therefore, existing technologies still need to be improved and developed. Utility Model Content

[0005] In view of the shortcomings of the prior art, the purpose of this utility model is to provide an AC power failure memory circuit and electronic device based on a microcontroller, so as to solve the problem that the existing microcontroller is prone to automatic reset due to brief power failure, has difficulty in remembering the working state, and needs to be woken up from the low power state, which is inconvenient for users to operate.

[0006] The technical solution of this utility model is as follows: In a first aspect, this utility model provides an AC power-off memory circuit based on a microcontroller, comprising: an AC zero-crossing detection module, an AC / DC voltage regulation module, a power-off delay module, and a microcontroller; wherein... The detection terminal of the AC zero-crossing detection module is connected to the AC voltage, and the output terminal of the AC zero-crossing detection module is connected to the power-off detection terminal of the microcontroller. It is used to detect whether there is a zero-crossing signal of AC voltage and output an interrupt signal to the microcontroller when the zero-crossing signal is interrupted. The power supply terminal of the AC / DC voltage regulator module is connected to an AC voltage, and the voltage output terminal of the AC / DC voltage regulator module is connected to the power supply terminal of the microcontroller through the power-off delay module, which is used to convert the AC voltage into the working voltage and power the microcontroller. One end of the power-off delay module is connected to the voltage regulator module, and the other end of the power-off delay module is connected to the common terminal of the microcontroller. It is used to output an interrupt delay voltage to the power supply terminal of the microcontroller within the first memory time when the zero-crossing signal is interrupted. At least one connection terminal of the microcontroller is connected to a power load, which is used to turn off the power load and enter a sleep state from the working mode when an interrupt signal is collected; it is also used to turn on the power load and return to the working mode when the AC zero-crossing detection module outputs a zero-crossing signal during the first memory period of the sleep state.

[0007] In a further embodiment of this invention, the AC / DC voltage regulator module includes an AC / DC conversion unit and a voltage regulator unit; wherein, the input terminal of the AC / DC conversion unit is connected to an AC voltage, and the output terminal of the DC conversion unit is connected to the input terminal of the voltage regulator unit, for converting the AC voltage into a DC voltage and outputting the DC voltage to the voltage regulator unit; The output terminal of the voltage regulator unit is connected to the power supply terminal of the microcontroller, and is used to step down and regulate the DC voltage to obtain the working voltage, and output the working voltage to the microcontroller.

[0008] In a further embodiment of this invention, the power-off delay module is a delayed charging and discharging structure. The delayed charging and discharging structure is charged by the working voltage and outputs an interrupt delay voltage to the power supply terminal of the microcontroller when the zero-crossing signal is interrupted. The power-off delay module outputs the interrupt delay voltage for a period of more than 2 minutes, and the interrupt delay voltage is greater than the reset voltage of the microcontroller.

[0009] In a further embodiment of this invention, the power-off delay module includes a first electrolytic capacitor and a first diode. The anode of the first diode is connected to the AC / DC voltage regulator module, the cathode of the first diode is connected to the power supply terminal of the microcontroller, the positive terminal of the first electrolytic capacitor is connected to the common terminal of the cathode of the first diode and the microcontroller, and the negative terminal of the first electrolytic capacitor is grounded.

[0010] In a further embodiment of this invention, the voltage regulating unit includes: a voltage regulating chip, a first capacitor, a second capacitor, a third capacitor, a first resistor, a first inductor, and a second electrolytic capacitor, wherein; The voltage input terminal of the voltage regulator chip is connected to a DC voltage. The switching terminal of the voltage regulator chip is connected to one end of the first inductor, and the other end of the first inductor is connected to the voltage output terminal of the voltage regulator chip. The voltage output terminal of the voltage regulator chip is connected to the power supply terminal of the microcontroller through the power-off delay module. The ground terminal of the voltage regulator chip is grounded. One end of the first capacitor is connected to the voltage input terminal of the voltage regulator chip. One end of the first resistor, one end of the second capacitor, one end of the second electrolytic capacitor, and one end of the third capacitor are respectively connected to the voltage output terminal of the voltage regulator chip. The other ends of the first capacitor, the first resistor, the second capacitor, the second electrolytic capacitor, and the third capacitor are grounded.

[0011] In a further embodiment of this invention, the AC zero-crossing detection module includes: a second diode, a third diode, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a fourth capacitor, and an optocoupler; wherein, The anode of the second diode is connected to the live wire, the cathode of the second diode is connected to one end of the second resistor, the other end of the second resistor is connected to one end of the third resistor, and the other end of the third resistor is connected to the emitting anode of the optocoupler. The anode of the third diode is connected to the neutral wire, and the cathode of the third diode is connected to the common terminal of the third resistor and the optocoupler; the emitting cathode of the optocoupler is connected. One end of the fourth resistor is connected to the operating voltage, and the other end of the fourth resistor is connected to the receiving and collecting terminal of the optocoupler. The receiving and transmitting terminals of the optocoupler are grounded. One end of the fifth resistor is connected to the common terminal of the fourth resistor and the optocoupler, and the other end of the fifth resistor is connected to one end of the fourth capacitor. The other end of the fourth resistor is grounded. The power-off detection terminal of the microcontroller is connected to the common terminal of the fifth resistor and the optocoupler.

[0012] In a further detail of this invention, the voltage regulator chip is model AP2905-A3.

[0013] In a further embodiment of this invention, the AC / DC conversion unit is a switching power supply. The input terminal of the switching power supply is connected to an AC voltage, and the output terminal of the switching power supply is connected to the input terminal of the voltage regulator unit. This unit is used to convert the AC voltage into a DC voltage. When the switching power supply is operating stably, the output DC voltage is greater than or equal to 9V, and the DC current is greater than 200mA.

[0014] In a further embodiment of this invention, the microcontroller is either SC92F7413 or SC95F8573; when the microcontroller is in sleep mode and the AC zero-crossing detection module detects and outputs a zero-crossing signal, the power load is connected, and the operating mode is restored.

[0015] Secondly, this utility model provides an electronic device with a power-off memory function, which includes the aforementioned microcontroller-based AC power-off memory circuit.

[0016] This invention provides an AC power-off memory circuit and electronic device based on a microcontroller. The AC power-off memory circuit includes: an AC zero-crossing detection module, an AC / DC voltage regulator module, a power-off delay module, and a microcontroller. The detection terminal of the AC zero-crossing detection module is connected to an AC voltage, and its output terminal is connected to the power-off detection terminal of the microcontroller. This module detects the presence of a zero-crossing signal in the AC voltage and outputs an interrupt signal to the microcontroller when the zero-crossing signal is interrupted. The power supply terminal of the AC / DC voltage regulator module is connected to an AC voltage, and its voltage output terminal is connected to the microcontroller via the power-off delay module. The power supply terminal is connected to convert the AC voltage into the working voltage and power the microcontroller. One end of the power-off delay module is connected to the voltage regulator module, and the other end is connected to the common terminal of the microcontroller. This module outputs an interruption delay voltage to the power supply terminal of the microcontroller within a first memory time when the zero-crossing signal is interrupted. At least one connection terminal of the microcontroller is connected to a power load. This load is turned off when an interruption signal is detected, allowing the microcontroller to enter a sleep state from the working mode. Furthermore, during the first memory time of the sleep state, the microcontroller turns on the power load when the AC zero-crossing detection module outputs a zero-crossing signal, returning to the working mode. This application uses the AC zero-crossing detection module to detect whether there is no zero-crossing signal for a certain period. If there is no zero-crossing signal for a certain period, it indicates that the power supply was suddenly interrupted due to unstable AC voltage and working voltage in the working mode. In this case, the power-off delay module ensures that the microcontroller's voltage will not immediately fall below its reset voltage, and simultaneously, the microcontroller shuts off all loads. By using power-off memory, the power supply terminal of the microcontroller will not be reset for a certain period of time, so that it can be synchronously restored to the working mode when the voltage is restored, which is convenient for users to operate after power failure. Attached Figure Description

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

[0018] Figure 1 This is a schematic diagram of the AC power-off memory circuit based on a microcontroller in this utility model.

[0019] Figure 2 This is a circuit diagram of the voltage stabilizing unit and the power-off delay module in this utility model.

[0020] Figure 3 This is a circuit diagram of the AC zero-crossing detection module in a preferred embodiment of this utility model.

[0021] Figure 4 This is a schematic diagram of the voltage curve when the power supply terminal of a microcontroller is de-energized in the existing technology.

[0022] Figure 5 This is a schematic diagram of the voltage curve when the power supply terminal of the microcontroller in this utility model is de-energized.

[0023] The markings in the attached diagram are as follows: 100, AC zero-crossing detection module; 200, AC / DC voltage regulator module; 210, voltage regulator unit; 300, power-off delay module; 400, microcontroller. Detailed Implementation

[0024] This utility model provides an AC power-off memory circuit and electronic device based on a microcontroller. To make the purpose, technical solution, and effects of this utility model clearer and more explicit, the following describes this utility model in further detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for explaining this utility model and are not intended to limit this utility model.

[0025] In the implementation methods and claims, unless otherwise specified in the text, the terms "a," "an," "the," and "the" may also include plural forms. If the embodiments of this utility model involve descriptions of "first," "second," etc., such descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features.

[0026] It should be further understood that the term "comprising" as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, "connected" or "coupled" as used herein can include wireless connections or wireless coupling. The term "and / or" as used herein includes all or any unit and all combinations of one or more associated listed items.

[0027] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0028] Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by this utility model.

[0029] The inventors discovered that, to achieve intelligent control, current electronic devices rely on microcontrollers to continuously record digital information during operation. To maintain operation, existing electronic devices are divided into those with and without batteries. The purpose of batteries is primarily to provide energy to the chip to store operating parameters when power is lost, while battery-free electronic devices are prone to failure due to power outages. Based on this, many intelligent electronic devices on the market currently use AC power. To minimize operational losses in the default state, these devices require an initialization process upon normal power-on, entering standby or sleep modes, not active modes.

[0030] For ease of explanation, the operating mode here refers to the state where the output voltage of the switching power supply in the circuit is above 9V and the current at this output terminal exceeds 200mA. When the user needs to operate the electronic device, such as pressing a button, the electronic device receives the corresponding external operation signal and enters the operating mode to begin normal operation. When the electronic device is running in operating mode, in some areas, the voltage is unstable, or the power supply is suddenly interrupted. In this case, the mains power supply is abruptly interrupted and then immediately restored to normal power supply within less than 0.2 seconds. Because the current at the 9V or higher output terminal of the switching power supply is relatively large, the output voltage will drop sharply after the AC power is interrupted. At this time, the PWM duty cycle frequency of the switching power supply will increase, which may lead to overshoot and trigger the circuit protection. If the AC power is restored within 0.2 seconds, the 5V voltage regulator is not in a normal regulated state, and the operating voltage at the power supply terminal of the microcontroller will drop briefly or spike. This causes the operating voltage of the microcontroller to be pulled down for a period of time due to the switching power supply's own regulation.

[0031] Specifically, please refer to Figure 3 The figure shows the operating voltage of the microcontroller's power supply in working mode. Figure 3The area highlighted in red shows the power supply voltage signal of the microcontroller when the AC power is interrupted. It can be seen that when the AC power is interrupted for a very short time, the operating voltage at the microcontroller's power supply is simultaneously pulled low for a period of time. This lowered voltage is below the microcontroller's reset voltage, causing the microcontroller to reset. The electronic device forcibly exits its operating mode and returns to its state after normal power-on initialization. Consequently, after a user restarts the device, it returns to standby or sleep mode, requiring further operation to enter operating mode. Users do not need the device to retain its operating mode for an extended period during power outages. Instead, they prefer the device to return to its normal standby or sleep mode after power is restored if the AC power outage lasts longer than 2 minutes. To achieve this, current technologies often require a memory chip in the electronic device or an additional battery to power the microcontroller system, resulting in additional production costs and hindering product manufacturing.

[0032] To solve the technical problems existing in the prior art, such as Figure 1 As shown, this utility model provides an AC power-off memory circuit based on a microcontroller, comprising: an AC zero-crossing detection module 100, an AC / DC voltage regulator module 200, a power-off delay module 300, and a microcontroller 400; wherein, the detection terminal of the AC zero-crossing detection module 100 is connected to an AC voltage, and the output terminal of the AC zero-crossing detection module 100 is connected to the power-off detection terminal of the microcontroller 400, used to detect whether there is a zero-crossing signal of the AC voltage, and output an interrupt signal to the microcontroller 400 when the zero-crossing signal is interrupted; the power supply terminal of the AC / DC voltage regulator module 200 is connected to an AC voltage, and the voltage output terminal of the AC / DC voltage regulator module 200 is connected to the power supply terminal of the microcontroller 400 through the power-off delay module 300. The power-off delay module 300 is connected to the voltage regulator module at one end and to the common terminal of the microcontroller 400 at the other end. When the zero-crossing signal is interrupted, it outputs an interruption delay voltage to the power supply terminal of the microcontroller 400 within a first memory time. At least one connection terminal of the microcontroller 400 is connected to a power load. This allows it to shut down the power load and enter a sleep state from the working mode when an interruption signal is detected. Furthermore, during the first memory time of the sleep state, when the AC zero-crossing detection module 100 outputs a zero-crossing signal, the microcontroller 400 turns on the power load and returns to the working mode.

[0033] Specifically, when the AC voltage is operating normally, the AC / DC voltage regulator module 200 is connected to the AC voltage and performs AC / DC conversion and step-down regulation to obtain the operating voltage for the microcontroller 400. When the AC voltage is interrupted, the AC voltage at the power supply terminal of the AC / DC voltage regulator module 200 is interrupted, so the operating voltage output to the power supply terminal of the microcontroller 400 is also pulled down, resulting in an interruption. At this time, in order to ensure that the operating voltage at the power supply terminal of the microcontroller 400 is not lower than the reset voltage of the microcontroller 400, the power-off delay module 300 provides power to the power supply voltage to prevent the microcontroller 400 from resetting in a short time because the operating voltage at the power supply terminal is less than the reset voltage. At the same time, the AC zero-crossing detection module 100 is connected to the mains power grid to provide operating voltage for the microcontroller 400 and the power load. When the mains power grid maintains normal power supply, the AC voltage will pass through the zero point at a predetermined period when the waveform changes from the positive half-cycle to the negative half-cycle or vice versa, due to the continuous changes in the direction and magnitude of the current. Therefore, the AC voltage zero-crossing detection module can detect whether the AC power supply is interrupted by detecting and generating a zero-crossing signal when the AC voltage crosses zero. Specifically, when the zero-crossing signal is continuously present, it proves that the AC voltage in the power grid is continuously outputting normally; when the zero-crossing signal is interrupted, it proves that the AC voltage has been interrupted and changed. The microcontroller 400 has at least one connection terminal, and each connection terminal is connected to several power loads. When the AC voltage connected to the mains power grid is working normally, the microcontroller 400 controls each power load to work normally in the working mode. When the AC voltage is interrupted, the microcontroller 400 uses the absence of the zero-crossing signal as an interruption signal, reduces the overall power loss by turning off the power loads, and enters a sleep state. In the sleep state, the energy consumption of the microcontroller 400 is reduced, and when it resumes operation, it can read the working mode state and information before entering the sleep state, so that no reset phenomenon occurs. The first memory time length is the length of time for the power-off delay module to output the interrupt delay voltage, that is, when the power-off delay module continuously outputs the interrupt delay voltage to power the microcontroller, the microcontroller can remember the working mode.

[0034] In a further embodiment of a preferred embodiment of this application, the AC / DC voltage regulator module 200 includes an AC / DC conversion unit (not shown in the figure) and a voltage regulator unit 210. The input terminal of the AC / DC conversion unit is connected to an AC voltage, and the output terminal of the DC conversion unit is connected to the input terminal of the voltage regulator unit 210, for converting the AC voltage to a DC voltage and outputting the DC voltage to the voltage regulator unit 210. The output terminal of the voltage regulator unit 210 is connected to the power supply terminal of the microcontroller 400, for stepping down and regulating the DC voltage to obtain a working voltage, and outputting the working voltage to the microcontroller 400. Exemplarily, the AC / DC conversion unit is a switching power supply, the input terminal of which is connected to an AC voltage, and the output terminal of which is connected to the input terminal of the voltage regulator unit 210, for converting the AC voltage to a DC voltage. When the switching power supply is operating stably, the output DC voltage is greater than or equal to 9V, and the DC current is greater than 200mA. It should be noted that during the voltage regulation process, the AC / DC voltage regulator module 200 can also use other AC / DC conversion circuits or converters such as transformers or rectifiers. The alternative solutions are existing technologies and will not be described in detail here.

[0035] Furthermore, the power-off delay module 300 is a delayed charging and discharging structure. This structure is charged using the operating voltage and outputs an interrupt delay voltage to the power supply terminal of the microcontroller 400 when the zero-crossing signal is interrupted. The duration for which the power-off delay module 300 outputs the interrupt delay voltage is greater than the first memory time, for example, more than two minutes, and the interrupt delay voltage is greater than the reset voltage of the microcontroller 400. Therefore, the delayed charging and discharging structure only needs to ensure that the interrupt delay voltage remains greater than the reset voltage of the microcontroller 400 within two minutes. If the interruption time is greater than two minutes, for example, if there is a prolonged power outage, it is unnecessary to maintain the pre-interruption operating state. In this case, the delayed charging and discharging structure can be set to gradually decay the interrupt delay voltage to less than the reset voltage after two minutes, or this can be achieved through internal timing within the microcontroller 400. The microcontroller 400 does not need to remember the working mode when the power is off for more than two minutes. If the power off time has exceeded two minutes when the microcontroller 400 detects the zero crossing signal, it can be reset by hardware or software methods. At this time, the microcontroller 400 will return to the standby or sleep mode after the initialization when it is powered on again.

[0036] In a further embodiment of a preferred embodiment of this utility model, the power-off delay module 300 includes a first electrolytic capacitor EC1 and a first diode D1. The anode of the first diode D1 is connected to the AC / DC voltage regulator module 200, and the cathode of the first diode D1 is connected to the power supply terminal of the microcontroller 400. The positive terminal of the first electrolytic capacitor EC1 is connected to the common terminal of the cathode of the first diode D1 and the microcontroller 400, and the negative terminal of the first electrolytic capacitor EC1 is grounded. Specifically, when the AC voltage is normally input from the mains power grid, the microcontroller 400 operates normally, and current flows from the anode of the first diode D1 to the first electrolytic capacitor EC1, charging and storing energy according to the input operating voltage. When the AC voltage is interrupted, causing a drop in the operating voltage at the power supply terminal of the microcontroller 400, the interrupt delay voltage provided by the first electrolytic capacitor EC1 is only supplied to the power supply terminal of the microcontroller 400 due to the unidirectional conduction of the first diode D1. This reduces the energy loss from other branches to the energy stored in the first electrolytic capacitor EC1, extending the time the microcontroller 400 remains in operation. The discharge time of the first electrolytic capacitor EC1 is determined according to the required first memory time. That is, within the first memory time, the interrupt delay voltage provided by the first electrolytic capacitor EC1 is greater than the reset voltage of the microcontroller 400, ensuring that the microcontroller 400 can maintain its operating mode when power is restored if the power outage time is less than or equal to the first memory time.

[0037] In a further embodiment of this invention, the voltage regulator unit 210 includes: a voltage regulator chip U1, a first capacitor C1, a second capacitor C2, a third capacitor C3, a first resistor R1, a first inductor L1, and a second electrolytic capacitor EC2. The voltage input terminal of the voltage regulator chip U1 is connected to a DC voltage greater than 9V. The switching terminal of the voltage regulator chip U1 is connected to one end of the first inductor L1, and the other end of the first inductor L1 is connected to the voltage output terminal of the voltage regulator chip U1. The voltage output terminal of the voltage regulator chip U1 is connected to the power-off delay module 300 and... The power supply terminal of the microcontroller 400 is connected; the ground terminal of the voltage regulator chip U1 is grounded; one end of the first capacitor C1 is connected to the voltage input terminal of the voltage regulator chip U1; one end of the first resistor R1, one end of the second capacitor C2, one end of the second electrolytic capacitor EC2, and one end of the third capacitor C3 are respectively connected to the voltage output terminal of the voltage regulator chip U1; the other ends of the first capacitor C1, the first resistor R1, the second capacitor C2, the second electrolytic capacitor EC2, and the third capacitor C3 are grounded.

[0038] Specifically, please refer to the following: Figure 1 and Figure 2The voltage regulator unit 210 is a DC-DC voltage conversion circuit, which can also be an LDO (low dropout regulator) circuit, or other DC-DC conversion circuits or devices, which will not be elaborated here. The voltage regulator unit 210 achieves DC power supply voltage conversion by controlling the duty cycle through the high-frequency on / off switching of an internal high-speed switch. For example, the voltage regulator chip U1 in this invention is a high-efficiency synchronous buck regulator chip U1 of model AP2905-A3, which integrates a low on-resistance main power transistor and a synchronous power transistor. The built-in compensation architecture does not require the use of an external RC compensation circuit, and its output voltage is fixed at 5V. Furthermore, the operating voltage of the power load may be 12V, 24V, or other voltages greater than 9V. Therefore, the output of the switching power supply is set to be greater than or equal to 9V DC. We will further regulate the output of the switching power supply to 5V. That is, T13 is a constant output of 5V. Then, a first diode D1 is connected in series, and a first electrolytic capacitor EC1 of appropriate capacity is connected in parallel. The output of the first electrolytic capacitor EC1 is to supply power to the power supply terminal of the microcontroller 400.

[0039] Furthermore, please refer to the following: Figure 1 and Figure 3 The AC zero-crossing detection module 100 includes: a second diode D2, a third diode D3, a second resistor R2, a third resistor R3, a fourth resistor R4, a fifth resistor R5, a fourth capacitor C4, and an optocoupler U2; wherein, the anode of the second diode D2 is connected to the live wire, the cathode of the second diode D2 is connected to one end of the second resistor R2, the other end of the second resistor R2 is connected to one end of the third resistor R3, and the other end of the third resistor R3 is connected to the emitting anode of the optocoupler U2; the anode of the third diode D3 is connected to the neutral wire, and the cathode of the third diode D3 is connected to the third resistor R4. 3. The common terminal of the optocoupler U2 is connected; the emitting cathode of the optocoupler U2 is connected; one end of the fourth resistor R4 is connected to the operating voltage, and the other end of the fourth resistor R4 is connected to the receiving collector terminal of the optocoupler U2, and the receiving and emitting terminals of the optocoupler U2 are grounded; one end of the fifth resistor R5 is connected to the common terminal of the fourth resistor R4 and the optocoupler U2, and the other end of the fifth resistor R5 is connected to one end of the fourth capacitor C4, and the other end of the fourth resistor R4 is grounded; the power-off detection terminal of the microcontroller 400 is connected to the common terminal of the fifth resistor R5 and the optocoupler U2. The AC zero-crossing detection module 100 is used for AC 50 / 60Hz detection.

[0040] Specifically, the LED terminal of the optocoupler U2 is driven by an AC voltage signal, and the receiving end is connected to the microcontroller 400 or logic circuit. The second resistor R2 and the third resistor R3 are current-limiting resistors. The AC voltage signal is connected to the LED of the optocoupler through the current-limiting resistors. When the AC voltage approaches zero, the LED current approaches zero, the phototransistor inside the optocoupler turns off, and the receiving collector terminal of the optocoupler U2 is pulled high by the 5V operating voltage. This causes the power-off detection terminal of the microcontroller 400 to switch from low to high level. In the peripheral circuit, the fourth capacitor C4 is a filter capacitor used to eliminate high-frequency noise and prevent false triggering. It should be noted that the AC zero-crossing detection module 100 described in this application can also use other detection circuits with zero-crossing detection functions. All AC zero-crossing detection modules 100 on the market are acceptable, whether isolated or non-isolated, as long as they can detect the zero-crossing point of the AC voltage of the mains power grid and obtain the zero-crossing signal. However, the functionality of this utility model is not elaborated upon here.

[0041] In a further embodiment of this invention, the microcontroller 400 is either an SC92F7413 or an SC95F8573. When the microcontroller 400 is in sleep mode and the AC zero-crossing detection module 100 detects and outputs a zero-crossing signal, it connects to the power load and resumes operation. Alternatively, other microcontroller chips can be used for the microcontroller 400. This chip is used for collecting and recording detection parameters and for triggering an AC power interruption mode via the interrupt signal. It detects fluctuations in the mains power grid connected to the user in the corresponding region through this interruption.

[0042] When an electronic device experiences a sudden interruption of AC power supply due to voltage instability while in operation, the AC zero-crossing detection module 100 detects that no zero-crossing signal has been detected for a certain period of time. Due to the effect of the first diode D1 and the first electrolytic capacitor EC1 in the circuit, the voltage at the power supply terminal of the microcontroller 400 will not immediately fall below its own reset voltage. At this time, the microcontroller 400 shuts down all power loads, including power loads at the output terminal of the switching power supply with a voltage greater than or equal to 9V, putting the MCU into sleep mode with a current less than 30uA, and internally scanning for zero-crossing signals at regular intervals. The minimum time interval for scanning zero-crossing signals is 100ms, the maximum is 1s, and 125ms is preferred. Because the first electrolytic capacitor EC1 continues to discharge, the voltage of the microcontroller 400 will not fall below its own reset voltage within 2 minutes. Once the AC power is restored to normal, it will be within less than 0.2 seconds. The power outage time is within 2 minutes and the microcontroller 400 has detected a zero-crossing signal. The microcontroller 400 delays for at least 0.5 seconds before the electronic device returns to its operating mode. However, it does not immediately power on the 9V output of the switching power supply; instead, it delays for at least 2 seconds before powering on the corresponding output. This avoids a short-term drop or spike in the power supply voltage of the microcontroller 400 that would cause it to reset if the load is directly turned on before the switching power supply is stable. In this invention, when the AC power supply is restored to normal within less than 0.2 seconds, the operating voltage at the power supply terminal of the microcontroller 400 will be interrupted for about 0.5 seconds. Therefore, the power-down memory time is set to be at least 0.5 seconds and less than 2 minutes. This means that if the power outage time falls within this range, the microcontroller 400 will not reset after the power supply is restored within 0.5 seconds to 2 minutes. In other words, if the power outage time falls within this range, the electronic device can return to its operating mode instead of the initialization stage. Meanwhile, the product does not need to retain its state for an extended period during power outages. Therefore, if the AC voltage outage lasts for more than 2 minutes, it will return to the normal power-on initialization standby or sleep mode upon power restoration. The power-off memory circuit of this utility model has a power supply voltage curve for the 400 microcontroller as shown below. Figure 5 As shown, although there is a low pulse at the power supply terminal of the microcontroller 400 when the power is off, the duration is short and the voltage will not be lower than the reset voltage of the microcontroller 400. Therefore, the microcontroller 400 will not be reset within a predetermined time period, and will automatically reset and initialize after a certain period of time.

[0043] Based on the same inventive concept, this utility model provides an electronic device with a power-off memory function, which includes the aforementioned microcontroller-based AC power-off memory circuit. Specific details are as described in the embodiment of the microcontroller-based AC power-off memory circuit, and will not be repeated here.

[0044] This invention provides an AC power-off memory circuit and electronic device based on a microcontroller. The AC power-off memory circuit includes: an AC zero-crossing detection module, an AC / DC voltage regulator module, a power-off delay module, and a microcontroller. The detection terminal of the AC zero-crossing detection module is connected to an AC voltage, and its output terminal is connected to the power-off detection terminal of the microcontroller. This module detects the presence of a zero-crossing signal in the AC voltage and outputs an interrupt signal to the microcontroller when the zero-crossing signal is interrupted. The power supply terminal of the AC / DC voltage regulator module is connected to an AC voltage, and its voltage output terminal is connected to the microcontroller via the power-off delay module. The power supply terminal is connected to convert the AC voltage into the working voltage and power the microcontroller. One end of the power-off delay module is connected to the voltage regulator module, and the other end is connected to the common terminal of the microcontroller. This module outputs an interruption delay voltage to the power supply terminal of the microcontroller within a first memory time when the zero-crossing signal is interrupted. At least one connection terminal of the microcontroller is connected to a power load. This load is turned off when an interruption signal is detected, allowing the microcontroller to enter a sleep state from the working mode. Furthermore, during the first memory time of the sleep state, the microcontroller turns on the power load when the AC zero-crossing detection module outputs a zero-crossing signal, returning to the working mode. This application uses the AC zero-crossing detection module to detect whether there is no zero-crossing signal for a certain period. If there is no zero-crossing signal for a certain period, it indicates that the power supply was suddenly interrupted due to unstable AC voltage and working voltage in the working mode. In this case, the power-off delay module ensures that the microcontroller's voltage will not immediately fall below its reset voltage, and simultaneously, the microcontroller shuts off all loads. By using power-off memory, the power supply terminal of the microcontroller will not be reset for a certain period of time, so that it can be synchronously restored to the working mode when the voltage is restored, which is convenient for users to operate after power failure.

[0045] It should be understood that the application of this utility model is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.

Claims

1. A microcontroller-based AC power-off memory circuit, characterized in that, include: The system includes an AC zero-crossing detection module, an AC / DC voltage regulator module, a power-off delay module, and a microcontroller; among these components... The detection terminal of the AC zero-crossing detection module is connected to the AC voltage, and the output terminal of the AC zero-crossing detection module is connected to the power-off detection terminal of the microcontroller. It is used to detect whether there is a zero-crossing signal of AC voltage and output an interrupt signal to the microcontroller when the zero-crossing signal is interrupted. The power supply terminal of the AC / DC voltage regulator module is connected to an AC voltage, and the voltage output terminal of the AC / DC voltage regulator module is connected to the power supply terminal of the microcontroller through the power-off delay module, which is used to convert the AC voltage into the working voltage and power the microcontroller. One end of the power-off delay module is connected to the voltage regulator module, and the other end of the power-off delay module is connected to the common terminal of the microcontroller. It is used to output an interrupt delay voltage to the power supply terminal of the microcontroller within the first memory time when the zero-crossing signal is interrupted. At least one connection terminal of the microcontroller is connected to a power load, which is used to turn off the power load and enter a sleep state from the working mode when an interrupt signal is collected; it is also used to turn on the power load and return to the working mode when the AC zero-crossing detection module outputs a zero-crossing signal during the first memory period of the sleep state.

2. The AC power-off memory circuit based on a microcontroller according to claim 1, characterized in that, The AC / DC voltage regulator module includes an AC / DC conversion unit and a voltage regulator unit; wherein, the input terminal of the AC / DC conversion unit is connected to an AC voltage, and the output terminal of the DC conversion unit is connected to the input terminal of the voltage regulator unit, for converting the AC voltage into a DC voltage and outputting the DC voltage to the voltage regulator unit; The output terminal of the voltage regulator unit is connected to the power supply terminal of the microcontroller, and is used to step down and regulate the DC voltage to obtain the working voltage, and output the working voltage to the microcontroller.

3. The AC power-off memory circuit based on a microcontroller according to claim 1, characterized in that, The power-off delay module is a delayed charging and discharging structure. The delayed charging and discharging structure is charged by the working voltage and outputs an interrupt delay voltage to the power supply terminal of the microcontroller when the zero-crossing signal is interrupted. The power-off delay module outputs the interrupt delay voltage for more than 2 minutes, and the interrupt delay voltage is greater than the reset voltage of the microcontroller.

4. The AC power-off memory circuit based on a microcontroller according to claim 3, characterized in that, The power-off delay module includes a first electrolytic capacitor and a first diode. The anode of the first diode is connected to the AC / DC voltage regulator module, the cathode of the first diode is connected to the power supply terminal of the microcontroller, the positive terminal of the first electrolytic capacitor is connected to the common terminal of the cathode of the first diode and the microcontroller, and the negative terminal of the first electrolytic capacitor is grounded.

5. The AC power-off memory circuit based on a microcontroller according to claim 2, characterized in that, The voltage regulation unit includes: a voltage regulator chip, a first capacitor, a second capacitor, a third capacitor, a first resistor, a first inductor, and a second electrolytic capacitor, wherein; The voltage input terminal of the voltage regulator chip is connected to a DC voltage. The switching terminal of the voltage regulator chip is connected to one end of the first inductor, and the other end of the first inductor is connected to the voltage output terminal of the voltage regulator chip. The voltage output terminal of the voltage regulator chip is connected to the power supply terminal of the microcontroller through the power-off delay module. The ground terminal of the voltage regulator chip is grounded. One end of the first capacitor is connected to the voltage input terminal of the voltage regulator chip. One end of the first resistor, one end of the second capacitor, one end of the second electrolytic capacitor, and one end of the third capacitor are respectively connected to the voltage output terminal of the voltage regulator chip. The other ends of the first capacitor, the first resistor, the second capacitor, the second electrolytic capacitor, and the third capacitor are grounded.

6. The AC power-off memory circuit based on a microcontroller according to claim 1, characterized in that, The AC zero-crossing detection module includes: a second diode, a third diode, a second resistor, a third resistor, a fourth resistor, a fifth resistor, a fourth capacitor, and an optocoupler; wherein, The anode of the second diode is connected to the live wire, the cathode of the second diode is connected to one end of the second resistor, the other end of the second resistor is connected to one end of the third resistor, and the other end of the third resistor is connected to the emitting anode of the optocoupler. The anode of the third diode is connected to the neutral wire, and the cathode of the third diode is connected to the common terminal of the third resistor and the optocoupler; the emitting cathode of the optocoupler is connected. One end of the fourth resistor is connected to the operating voltage, and the other end of the fourth resistor is connected to the receiving and collecting terminal of the optocoupler. The receiving and transmitting terminals of the optocoupler are grounded. One end of the fifth resistor is connected to the common terminal of the fourth resistor and the optocoupler, and the other end of the fifth resistor is connected to one end of the fourth capacitor. The other end of the fourth resistor is grounded. The power-off detection terminal of the microcontroller is connected to the common terminal of the fifth resistor and the optocoupler.

7. The AC power-off memory circuit based on a microcontroller according to claim 5, characterized in that, The voltage regulator chip is model AP2905-A3.

8. The AC power-off memory circuit based on a microcontroller according to claim 2, characterized in that, The AC / DC conversion unit is a switching power supply. The input terminal of the switching power supply is connected to an AC voltage, and the output terminal of the switching power supply is connected to the input terminal of the voltage regulator unit. It is used to convert the AC voltage into a DC voltage. When the switching power supply is working stably, the output DC voltage is greater than or equal to 9V and the DC current is greater than 200mA.

9. The AC power-off memory circuit based on a microcontroller according to claim 1, characterized in that, The microcontroller is model SC92F7413 or SC95F8573; when the microcontroller is in sleep mode and the AC zero-crossing detection module detects and outputs a zero-crossing signal, the power load is connected and the working mode is restored.

10. An electronic device with power-off memory function, characterized in that, Includes the microcontroller-based AC power-off memory circuit as described in any one of claims 1-9.