Flash state detection circuit, method, device, and electronic equipment

By introducing an on-off detection circuit and a target controller in the smart home circuit, the rising or falling edge of the electrical signal is captured by using a timer, the problem of low accuracy of flash interrupt detection is solved, and accurate detection of the circuit and synchronization of multi-device control is achieved.

CN115453415BActive Publication Date: 2025-08-19QINGDAO YEELINK INFORMATION TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211145128.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-20
Publication Date
2025-08-19
Estimated Expiration
2042-09-20

AI Technical Summary

Technical Problem

In the prior art, flash break detection has low detection accuracy in smart home circuits, resulting in high probability of flash break failure, especially when multiple devices are connected in parallel, the problem of inconsistent equipment status is likely to occur.

Method used

By introducing an on-off detection circuit and a target controller in the detection circuit, the rising or falling edge of the electrical signal is captured using a timer, and the count value is stored in the target memory, combining the processor and the control unit to determine whether the power supply has flashed, and sending a control signal to the load unit to adjust its state.

Benefits of technology

Improve the accuracy of flash detection, reduce flash detection failure situation, ensure the synchronization of multi-device control, and avoid missed flash detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115453415B_ABST
    Figure CN115453415B_ABST
Patent Text Reader

Abstract

The present invention discloses a detection circuit, method, device, and electronic device for a flash-off state. The detection circuit includes: an on-off detection circuit and a target controller; the on-off detection circuit is connected to a flash-off switch and a power supply, and is used to detect the on-off state of the power supply connected in series with the flash-off switch and output a detection signal; the target controller is connected to the on-off detection circuit and is used to obtain the detection signal output by the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; the target controller includes at least a sub-controller, and the sub-controller is connected to a timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer. The present invention solves the problems in the related art that the detection accuracy of flashes in the circuit cannot be effectively improved and the flashes have a probability of failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart home technology, and in particular to a flash-off state detection circuit, method, device, and electronic equipment. Background Art

[0002] With the development of the smart home industry, the variety of smart appliances is increasing. When a traditional local power switch is closed, these appliances will also go offline, making them unavailable for remote control by the terminal. In related art, smart home devices are controlled by using a flash switch. Specifically, in normal operation, the flash switch maintains the power supply and the electrical load connected. When pressed by an external force, the flash switch disconnects the power supply and the electrical load. After the external force is removed, the flash switch quickly returns to normal operation. Furthermore, a detection circuit detects the flash signal emitted by the flash switch to control the operating state of the electrical device. However, the flash detection occasionally fails, meaning that the electrical device's state does not reverse after pressing the flash switch. When a flash switch controls a single electrical device, the probability of failure is less than 1%. However, in actual use, a flash switch typically controls multiple electrical devices connected in parallel. If the flash detection fails for even one device, the device state will be inconsistent, thus being considered a failure. This significantly increases the probability of flash detection failure. How to improve the detection accuracy of flash failures in circuits and reduce the probability of failures caused by flash failures has become an urgent problem to be solved.

[0003] Regarding the related technologies, there is no way to effectively improve the detection accuracy of flash failures in circuits, and there is a probability that flash failures will cause failures. No effective solution has yet been proposed. Summary of the Invention

[0004] The embodiments of the present invention provide a flash-off detection circuit, method, device, and electronic device to at least solve the problems in the related art such as the inability to effectively improve the detection accuracy of flash-off in the circuit and the probability of failure caused by flash-off.

[0005] According to one embodiment of the present invention, a flash-off state detection circuit is provided, including: an on-off detection circuit and a target controller; the on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply connected in series with the flash switch, and output a detection signal; the target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output from the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; wherein the target controller includes at least a sub-controller, and the sub-controller is connected to the timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer.

[0006] Optionally, the above-mentioned target controller includes: a general input / output port, a timer; the general input / output port is used to obtain the detection signal output by the on-off detection circuit and send the detection signal to the timer; the timer is connected to the general input / output port, and is used to perform a capture operation on the detection signal and generate a capture event, wherein the capture operation is used to identify the rising edge or falling edge appearing in the detection signal through the timer.

[0007] Optionally, the above-mentioned target controller also includes: a target memory, a processor; the target memory is connected to the sub-controller, and is used to receive the count value sent by the sub-controller within a preset period, and save the count value in the order of reception; the processor is respectively connected to the timer and the target memory, and is used to determine whether the power supply has a flash failure based on a preset logical function combined with the count value and the capture event.

[0008] Optionally, the target controller further includes: a control unit; the control unit is connected to the processor and is configured to send a control signal to a load unit connected to the target controller when the processor determines that a power outage occurs.

[0009] According to another embodiment of the present invention, an electronic device is also provided, including: an on-off detection circuit and a target controller; the on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply connected in series with the flash switch, and output a detection signal; the target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output from the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; wherein the target controller includes at least a sub-controller, and the sub-controller is connected to the timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer.

[0010] Optionally, the electronic device further includes: a load unit, wherein the load unit is configured to receive a control signal sent by the control unit and adjust an operating state of the load unit based on the control signal.

[0011] According to another embodiment of the present invention, a control system for an electronic device is also provided, including: an on-off detection circuit and a target controller; the on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply connected in series with the flash switch, and output a detection signal; the target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output from the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; wherein the target controller includes at least a sub-controller, and the sub-controller is connected to the timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer; the above-mentioned control system also includes: a load unit, wherein the load unit is used to receive the control signal sent by the control unit, and adjust the operating state of the load unit based on the control signal.

[0012] Optionally, the above-mentioned control system also includes: a flash switch, wherein the input end of the flash switch is connected in series with the power supply, and the output end of the flash switch is connected in series with the electronic device, which is used to control the on and off of the power supply and the electronic device according to state changes.

[0013] According to another embodiment of the present invention, a method for detecting a flash-off state is also provided, including: determining a detection signal corresponding to a power supply output by an on-off detection circuit, wherein the detection signal is a signal output based on a change in the on-off state by obtaining the on-off state of a power supply connected in series with the on-off detection circuit using a flash switch; determining whether a flash-off occurs in the power supply through the detection signal, and sending a control signal to a load unit corresponding to the detection circuit; wherein determining whether a flash-off occurs in the power supply through the detection signal includes: determining a capture event of the detection signal using a timer, and when it is determined that a capture event exists in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to a target memory.

[0014] According to another embodiment of the present invention, a device for detecting a flash-off state is further provided, comprising: a first determination module for determining a detection signal corresponding to a power supply output by an on-off detection circuit, wherein the detection signal is a signal output based on a change in the on-off state by obtaining the on-off state of a power supply connected in series with the on-off detection circuit using a flash switch; a second determination module for determining whether a flash-off occurs in the power supply through the detection signal, and sending a control signal to a load unit corresponding to the detection circuit; wherein determining whether a flash-off occurs in the power supply through the detection signal comprises: determining a capture event of the detection signal using a timer, and when it is determined that a capture event exists in the timer, transferring the count value corresponding to the occurrence of a rising edge or a falling edge stored in the timer to a target memory.

[0015] In an embodiment of the present invention, there are an on-off detection circuit and a target controller; the on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply with the flash switch in series, and output a detection signal; the target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output from the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; the target controller includes at least a sub-controller, and the sub-controller is connected to the timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer. That is, through the above-mentioned flash-off state detection circuit, the flash-off situation of the AC power supply is detected in real time, and the control signal to be executed by the load unit connected to the detection circuit is determined, and the occurrence of the flash-off state is used to realize the change control of the operating state of the load unit. The above-mentioned technical solution solves the problems in the related technology that the accuracy of flash-off detection in the circuit cannot be effectively improved, and the flash-off has a probability of failure. The embodiment of the present invention can achieve the accuracy of the flash-off detection of the circuit, reduce the occurrence of flash-off detection failure, and completely avoid the situation of missed detection of the flash-off state. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0017] Figure 1 1 is a structural block diagram of a detection circuit for a flash state according to an embodiment of the present invention;

[0018] Figure 2 1 is a structural block diagram of another flash state detection circuit according to an embodiment of the present invention;

[0019] Figure 3 This is a working diagram of a flash detection circuit in related art;

[0020] Figure 4 1 is a waveform diagram of a flashing on / off detection circuit in an optional embodiment of the present invention;

[0021] Figure 5 This is a schematic structural diagram of a single-device control system according to an optional embodiment of the present invention;

[0022] Figure 6 This is a schematic structural diagram of a multi-device control system according to an optional embodiment of the present invention;

[0023] Figure 7 is a control flow chart corresponding to a control system of an optional embodiment of the present invention;

[0024] Figure 8 is a flow chart of a method for detecting a flash-off state according to an embodiment of the present invention;

[0025] Figure 9 The present invention provides a control device for flash detection according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] To facilitate understanding of the present invention, the present invention will be described more fully below with reference to the accompanying drawings. The accompanying drawings illustrate preferred embodiments of the present invention. However, the present invention may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the present disclosure.

[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] The embodiment of the present application provides a detection circuit for a flash state. Figure 1 This is a block diagram of a flash detection circuit according to an embodiment of the present invention. The circuit includes: a flash detection circuit 12, a target controller 14;

[0030] The on-off detection circuit 12 is used to connect with the flash switch and the power supply, and is used to detect the on-off state of the power supply connected in series with the flash switch and output a detection signal;

[0031] Optionally, the on-off detection circuit obtains a first waveform of an AC power source connected to a corresponding input terminal of the circuit, converts the first waveform into a second waveform, and generates a detection signal to be outputted by a corresponding output terminal of the on-off detection circuit based on the second waveform;

[0032] Optionally, the first waveform is a sine wave corresponding to the AC power supply, and the second waveform is a square wave with the same variation period as the first waveform. For example, taking 50 Hz mains as an example, the sine wave of a single-phase 220 V AC power is converted into a corresponding 50 Hz square wave with an amplitude of 3.3 V after passing through the on-off detection circuit, thereby outputting a detection signal with an amplitude of 3.3 V and 50 Hz;

[0033] The target controller 14 is connected to the on-off detection circuit, and is used to obtain the detection signal output by the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit.

[0034] It should be noted that the above-mentioned target controller can also be uniformly integrated on a chip corresponding to a microcontroller unit. After the detection circuit of the flash-off state obtains the detection signal corresponding to the AC power supply, the rising edge or falling edge appearing in the detection signal is identified through the target controller or the microcontroller unit including the target controller, and when the voltage square wave appearing in the detection signal disappears first and then appears within a predetermined time, that is, when the disappearance time of the voltage square wave is greater than the preset square wave change time, it indicates that the AC power supply has a flash-off state during the period, and then the target controller sends a control signal to the load unit connected to the detection circuit. Optionally, the above-mentioned control signal is used to instruct the load unit to reverse the state.

[0035] The detection circuit for the above-mentioned flash-off state includes an on-off detection circuit and a target controller; the on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply with the flash switch in series, and output a detection signal; the target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output from the output end of the on-off detection circuit, determine whether the power supply flashes according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; the target controller includes at least a sub-controller, and the sub-controller is connected to the timer in the target controller, and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory when it is determined that there is a capture event in the timer. That is, through the above-mentioned flash-off state detection circuit, the flash-off situation of the AC power supply is detected in real time, and the control signal to be executed by the load unit connected to the detection circuit is determined, and the occurrence of the flash-off state is used to realize the change control of the operating state of the load unit. The above-mentioned technical solution solves the problems in the related technology that the accuracy of flash-off detection in the circuit cannot be effectively improved, and the flash-off has a probability of failure. The embodiment of the present invention can achieve the accuracy of the flash-off detection of the circuit, reduce the occurrence of flash-off detection failure, and completely avoid the situation of missed detection of the flash-off state.

[0036] Optionally, the above-mentioned AC power supply is any power supply that can provide AC power to electrical appliances, including mains power, uninterruptible power supply, AC regulated power supply and its accessories, the accessories being switches, sockets, etc. In addition, when the power supply type of the above-mentioned power supply is a DC power supply, the above-mentioned detection method is still valid, but the circuit needs to be adaptively fine-tuned, and this application does not impose too many restrictions on this.

[0037] Figure 2 It is a structural block diagram of another flash state detection circuit according to an embodiment of the present invention.

[0038] Optionally, the target controller 14 further includes: a general input / output port 1402, a sub-controller 1406, and a timer 1404;

[0039] The general input / output port 1402 is used to obtain the detection signal output by the on / off detection circuit and send the detection signal to the timer;

[0040] The timer 1404 is connected to the general input / output port, and is used to perform a capture operation on the detection signal and generate a capture event, wherein the capture operation is used to identify a rising edge or a falling edge appearing in the detection signal through the timer;

[0041] The sub-controller 1406 is connected to the timer and is used to transfer the count value corresponding to the rising edge or falling edge stored in the timer to the target memory corresponding to the target controller when it is determined that there is a capture event in the timer.

[0042] Optionally, the above-mentioned target controller 14 also includes: a target memory 1408 and a processor 1410; the target memory 1408 is connected to the sub-controller, and is used to receive the count value sent by the sub-controller within a preset period, and save the count value in the order of reception; the processor 1410 is respectively connected to the timer and the target memory, and is used to determine whether a power outage occurs based on a preset logical function combined with the count value and the capture event.

[0043] It should be noted that the specific logic of the above-mentioned target controller for judging the occurrence of a flash is: the target controller receives the detection signal of the on-off detection circuit, and when the processor in the target controller determines that the voltage square wave of the detection signal disappears first and then appears within a predetermined time, it is judged that a flash occurs, and then a state reversal signal is sent to the load unit (such as: electrical equipment) connected to the detection circuit of the flash state.

[0044] For example, the working process of the above-mentioned target controller is as follows: when there is a detection signal output by the on-off detection circuit at the general input / output port (GPIO) of the target controller, the timer is used to capture the rising edge or falling edge appearing in the detection signal. When the capture is triggered, the sub-controller (DMA) is used to move the count value in the timer register to a global cache area (equivalent to the above-mentioned target memory); and the target controller is allowed to process the value in the global cache area at fixed intervals. If it is determined that a flash disconnection occurs, the target controller sends a state reversal signal to the electrical equipment.

[0045] As an optional embodiment, the target controller further includes: a control unit 1412; the control unit is connected to the processor and is configured to send a control signal to a load unit connected to the target controller when the processor determines that a power outage has occurred.

[0046] Simply put, when the processor in the target controller determines that the AC power supply has been interrupted, in order to achieve effective control of the load unit, the control unit generates a corresponding control signal for controlling the state according to the time point when the AC power supply has been interrupted, and uses the control signal to achieve effective control of the load unit.

[0047] For example, when the processor determines that the detection signal output by the on-off detection circuit is a high or low level with the same frequency as the mains power, it indicates that the power supply is normal; when the processor determines that the voltage signal is a continuous high or low level, and the duration exceeds a preset time, it indicates that the power supply has flashed. That is, because the circuit is connected to the commonly used mains voltage, the frequency of the level signal output by the flash state detection circuit when the circuit is normal is the same as the mains power frequency. Then, when the AC power supply is abnormally disconnected, the flash state detection circuit will detect that the AC power is disconnected, and the output level signal is a stable high or low level. When the processor finds that the high or low level carried in the detection signal exceeds the preset time, it indicates that the AC power has flashed. Furthermore, the control unit in the processor generates a control signal according to the occurrence of the flash, so as to control the state of the load.

[0048] Optionally, the target controller also includes: a communication circuit, which is connected in series with the processor and is used to establish a communication channel between the control unit and the load unit according to a preset communication method, so as to send the control signal in the control unit to the load unit through the communication channel.

[0049] As an optional embodiment, the present invention further provides an electronic device, wherein the electronic device is composed of the above-mentioned flash-off state detection circuit and a load unit, and the operating state of the load unit is controlled by the control signal output by the flash-off state detection circuit, thereby ultimately realizing the change of the operating state of the electronic device.

[0050] Optionally, the load unit in the present invention may be a lamp or other device that consumes electrical energy, and the present invention does not impose any further limitations on this.

[0051] Optionally, the electronic device further includes a load unit, wherein the load unit is configured to receive a control signal sent by the control unit and adjust an operating state of the load unit based on the control signal. It should be noted that the load unit includes but is not limited to a motor and an LED, and the electronic device includes but is not limited to a lamp, a fan, a bathroom heater, etc.

[0052] As an optional embodiment, the present invention also provides a control system for an electronic device, which, in addition to the above-mentioned electronic device, also includes: a flash switch, wherein the input end of the flash switch is connected in series with a power supply, and the output end of the flash switch is connected in series with the electronic device, for controlling the on and off of the power supply and the electronic device according to state changes.

[0053] For example, the input end of the flash switch is connected in series to an AC power source, and the output end of the flash switch is connected in series to the electronic device, and then the AC power source and the electronic device can be controlled to be on and off according to the state change of the flash switch.

[0054] Optionally, the flash switch can be a self-rebound switch; the connection of the AC power supply in the circuit is controlled by the switch. The flash switch is closed under normal conditions. When the AC power supply is abnormal or the switch is actuated by external force, the target power supply disconnects the input of the flash state detection circuit, and the AC power is disconnected (i.e., flashing). It should be noted that the flash switch can be used to implement any model of similar components that meet the functional requirements of the present invention. The model of the flash switch is selected according to actual production needs and can be flexibly adjusted according to the actual application of the flash state detection circuit. The present invention does not impose too many restrictions on this.

[0055] In order to better understand the principle of the above-mentioned detection circuit for the flash state, the implementation of the above-mentioned detection circuit for the flash state is described below in combination with optional embodiments, but it is not intended to limit the technical solution of the embodiment of the present invention.

[0056] It should be noted that Figure 3This is a working diagram of a related art flash detection circuit. The power failure detection circuit detects the flash signal emitted by the flash switch to control the operating state of the electrical equipment. When the flash switch 1 is pressed by an external force and disconnects from the external power source 4, causing the external power source 4 to lose connection with the electrical load 5, the power failure detection circuit 2 performs a flash failure detection on the current circuit and synchronizes the detection results to the controller 3, which then controls the operating state of the electrical equipment (i.e., the electrical load 5).

[0057] However, the aforementioned flash detection may occasionally fail, meaning that the state of the electrical device does not reverse after pressing the flash switch. When the flash switch controls a single electrical device, the probability of failure is less than 1%. However, in practice, a flash switch typically controls multiple electrical devices connected in parallel. If the flash detection fails for even one device, the device state will be inconsistent and considered a failure, significantly increasing the probability of flash detection failure.

[0058] Alternatively, multiple experiments and verifications have revealed that the current flash detection solution fails because the flash detection logic requires the controller to accurately identify the falling and rising edge interrupts of the detection signal. However, when the MCU inside the controller processes a special task, it shields global interrupts and enters a critical section to protect some code. When the MCU enters the critical section to disable global interrupts and the detection signal triggers an interrupt, the controller will miss the falling or rising edge, and will not detect the switch press or release event at the scheduled time, causing the flash detection to fail.

[0059] To address the above technical problems, the present invention proposes a flash detection circuit comprising a power-off detection circuit (equivalent to the on-off detection circuit in the above-mentioned embodiment) and a controller. The controller includes a GPIO (General-Purpose Input / Output) and a DMA (Direct Memory Access) controller, as well as a timer. The timer captures the rising or falling edge of the GPIO. When the capture is triggered, the count value in the timer register is transferred to a global buffer using DMA. The MCU processes the value in the DMA global buffer at regular intervals. If a flash is detected, the MCU sends a state reversal signal to the power-consuming device. It should be noted that by capturing the GPIO signal through the timer and transferring the data using the DMA controller, this method is not affected by global CPU interrupts. Theoretically, this method will not miss flash detection signals, significantly improving the accuracy of flash detection. Laboratory testing simulated a flash switch, running for 64 hours, with 11,520 on-off cycles, and 100% synchronization across 13 devices.

[0060] Figure 4 1 is a waveform diagram of a flashing on / off detection circuit in an optional embodiment of the present invention;

[0061] Taking 50Hz mains electricity as an example, the sine wave of single-phase 220V AC power is converted into a corresponding 50Hz square wave with an amplitude of 3.3V after passing through the on-off detection circuit; by configuring the GPIO (equivalent to the general input / output port in the above embodiment) pin of the MCU (equivalent to the target controller in the above embodiment) to capture the rising and falling edges of the square wave, and updating the system timestamp at the same time, the time period when the square wave disappears can be calculated, thereby determining the pressing and releasing events of the flash switch, and completing the state control of the electrical equipment. Among them, the above-mentioned sine wave is: the AC waveform corresponding to the input end of the on-off detection circuit; the above-mentioned square wave is: the corresponding waveform of the detection signal output by the on-off detection circuit in the detection circuit of the flash state; it should be noted that the above-mentioned on-off detection circuit is connected to the flash switch and the power supply, and the flash switch is normally closed. Therefore, the on-off detection circuit can detect a square wave signal with the same frequency as the AC power.

[0062] It should be noted that the above is only one possible output signal of the on-off detection circuit; in fact, the form of the on-off detection signal may include other forms, for example, determining whether to trigger a flash disconnection by means of zero-crossing detection. When the sinusoidal waveform corresponding to the AC power supply reaches the zero point, an extremely narrow low-level pulse will appear, which will not be described in detail in this application.

[0063] In order to reduce component costs and power consumption, the present invention proposes a single-device control system. Figure 5 : is a schematic structural diagram of a single-device control system according to an optional embodiment of the present invention. Specifically, in an actual application scenario, the single-device control system may include: a power supply device (equivalent to the AC power supply in the above embodiment), a power failure detection circuit (equivalent to the on / off detection circuit in the above embodiment), a controller (equivalent to the target controller in the above embodiment), and a controlled device (equivalent to the load unit in the above embodiment).

[0064] Optional, Figure 6 It is a structural diagram of a multi-device control system of an optional embodiment of the present invention; specifically, it includes: a power supply device and multiple control modules, wherein each control module includes: a flash detection circuit, a controller, and a controlled device.

[0065] Optionally, when the controller determines that it is a flash switch action, it will output a control signal to the electrical load to reverse the state of the electrical load; for example: when the electrical load in the circuit is a lamp, the lamp is on before the switch action in the AC power supply, and the flash operation after the switch action is determined by the power off detection circuit, and a detection signal of the corresponding waveform is output, and then the controller outputs a control signal for controlling the electrical load according to the detection signal, and uses the control signal to control the display of the lamp. When the lamp is on before the flash operation, the lamp will turn from on to off after the flash operation occurs; vice versa, when the lamp is off before the switch action, the lamp will turn from off to on when a flash operation occurs after the switch action.

[0066] It's important to note that to ensure the controller can 100% detect the rising and falling edges of the flash circuit, accurately trigger the flash event by calculating the waveform's disappearance time, and avoid state desynchronization of the controlled devices due to flash detection failure, the following prerequisites must be met when building this control system: 1. The flash circuit must convert the AC sine wave into a stable square wave. 2. The controller must support a timer input capture function and a DMA controller.

[0067] As an optional implementation, Figure 7 This is a control flow chart corresponding to the control system of an optional embodiment of the present invention. The control system process is as follows:

[0068] Step 1: Configure the MCU's GPIO to input mode through software and connect the signal converted by the flash circuit to the GPIO. Configure the MCU's timer to capture mode to capture the "rising or falling edge" event of the GPIO, that is, to capture the GPIO level change.

[0069] Step 2: Configure the DMA controller, clear the DMA array buffer, configure DMA, and when a GPIO event is captured, transfer the current timer count value to the DMA array buffer;

[0070] For example, when the Timer generates a capture event, DMA is used to transfer the count value in the current Timer to an array buffer. That is, each time a GPIO event is captured, the count value in the current Timer is stored in the array buffer in sequence.

[0071] Step 3: Periodically process the data in the DMA array buffer, specifically including: starting the flash detection task, periodically processing the data in the DMA array buffer, and when the preset processing cycle is executed every 30ms, determining whether the current processing time has timed out. If the current processing time has not timed out, determining whether it is a valid flash event, and if it is determined to be a valid flash event, sending a flash signal to control the status of the electrical equipment; if the current processing time has timed out, taking out new data from the DMA array buffer for processing, and determining whether the DMA needs to be reconfigured.

[0072] It should be noted that the MCU implements a periodic task, such as one every 30ms. This task cyclically processes the data in the array buffer, periodically clears the buffer, and reconfigures the DMA to ensure the validity of the data in the buffer. The MCU interrupt operation is not used in the process of capturing and processing flash signals, thus ensuring that every flash signal is captured and processed.

[0073] Through the above embodiment, through the flash detection circuit, in conjunction with the above control scheme, the GPIO signal is captured by the Timer and the data is transferred using the DMA controller. This method is not affected by the CPU global interrupt, and theoretically there will be no missed detection of the flash signal. It can greatly ensure the synchronization of multiple devices using the flash switch control, accurately trigger the flash event, and avoid the state of the controlled device being out of sync due to the failure of the flash detection.

[0074] Figure 8 FIG. 1 is a flow chart of a method for detecting a flash-off state according to an embodiment of the present invention; FIG. Figure 8 Shown, including:

[0075] Step S802: determining a detection signal corresponding to the power supply output by the on / off detection circuit, wherein the detection signal is a signal output based on a change in the on / off state of a power supply connected in series with the on / off detection circuit via a flash switch;

[0076] It can be understood that the detection signal corresponding to the AC power output by the on / off detection circuit is determined, wherein the detection signal is obtained by converting a first waveform of the AC power connected to the corresponding input terminal of the on / off detection circuit into a second waveform, and generating a signal based on the second waveform;

[0077] Step S804: determine whether the power supply has a flash interruption through the detection signal, and send a control signal to the load unit corresponding to the detection circuit; wherein, determining whether the power supply has a flash interruption through the detection signal includes: using a timer to determine a capture event of the detection signal, and when it is determined that there is a capture event in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to the target memory.

[0078] Through the above steps, the detection signal corresponding to the power supply output by the on-off detection circuit is determined, wherein the detection signal is a signal output based on the change of the on-off state by obtaining the on-off state of the power supply connected in series with the on-off detection circuit using a flash switch; the detection signal is used to determine whether the AC power supply flashes, and a control signal is sent to the load unit corresponding to the detection circuit; wherein, the determination of whether the power supply flashes through the detection signal includes: using a timer to determine a capture event of the detection signal, and when it is determined that a capture event exists in the timer, the count value corresponding to the rising edge or falling edge stored in the timer is transferred to the target memory. That is, through the above-mentioned flash-off state detection circuit, the flash-off situation of the AC power supply is detected in real time, and the control signal to be executed by the load unit connected to the detection circuit is determined, and the occurrence of the flash-off state is used to realize the change control of the operating state of the load unit. The above-mentioned technical solution solves the problems in the related technology that the accuracy of flash-off detection in the circuit cannot be effectively improved, and the flash-off has a probability of failure. The embodiment of the present invention can achieve the accuracy of the flash-off detection of the circuit, reduce the occurrence of flash-off detection failure, and completely avoid the situation of missed detection of the flash-off state.

[0079] As an optional embodiment, determining whether the power supply has a flash failure through the detection signal also includes: determining a preset processing cycle corresponding to the count value in the target memory; when the current processing cycle is less than the preset processing cycle, determining that the processing of the detection signal has not timed out, and determining the size of the count value and the preset threshold; when the current processing cycle is greater than or equal to the preset processing cycle, determining that the processing of the detection signal has timed out, and re-acquiring the detection signal output by the on-off detection circuit.

[0080] Simply put, the count value stored in the target memory will be processed by the controller in a preset processing cycle, the flash in the detection signal will be identified, and the flash state will be used to control the electronic device.

[0081] Optionally, when the current processing cycle is less than the preset processing cycle, it is determined that the processing of the detection signal has not timed out, and the size of the count value and the preset threshold is determined, including: when the count value is less than the preset threshold, determining that the detection signal corresponding to the count value has not currently flashed; when the count value is greater than or equal to the preset threshold, determining that the detection signal corresponding to the count value has currently flashed.

[0082] For example, taking 50Hz mains electricity as an example, the sine wave of single-phase 220V AC power is converted into a corresponding 50Hz square wave with an amplitude of 3.3V after passing through the flash detection circuit; by configuring the MCU's GPIO pin to capture the rising and falling edges of the square wave and updating the system timestamp at the same time, the time period when the square wave disappears can be calculated (equivalent to the above count value) and compared with the preset time period when the square wave disappears to determine whether the current flash is a valid flash, thereby determining the pressing and releasing events of the flash switch and completing the status control of the electrical equipment.

[0083] Optionally, after sending a control signal to the load unit corresponding to the detection circuit, the above method also includes: obtaining a first operating state and a second operating state of the load unit; wherein, the first operating state is the state of the load unit before receiving the control signal, and the second operating state is the state of the load unit after executing the control signal; based on the first operating state and the second operating state, determining whether the load unit effectively responds to changes in the flash state.

[0084] For example, after the load unit receives the control signal, when the control signal is a signal corresponding to the flash-off state, the operating state of the load unit can be reversed based on the control signal. For example, when the load unit in the circuit is a lamp, the lamp is on before the switch in the AC power supply is activated. The flash-off operation after the switch is activated is determined by the power-off detection circuit, and a detection signal of a corresponding waveform diagram is output. Then, the controller outputs a control signal for controlling the electrical load according to the detection signal, and the lamp turns from on to off according to the control signal.

[0085] Figure 9 is a control device for flash detection according to an embodiment of the present invention; Figure 9 Shown, including:

[0086] A first determining module 92 is configured to determine a detection signal corresponding to a power supply output by an on / off detection circuit, wherein the detection signal is a signal output based on a change in the on / off state of a power supply connected in series with the on / off detection circuit via a flash switch;

[0087] The second determination module 94 is used to determine whether the power supply has a flash interruption through the detection signal and send a control signal to the load unit corresponding to the detection circuit; wherein, determining whether the power supply has a flash interruption through the detection signal includes: using a timer to determine a capture event of the detection signal, and when it is determined that there is a capture event in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to the target memory.

[0088] The above-mentioned device is used to determine a detection signal corresponding to the power supply output by the on-off detection circuit, wherein the detection signal is a signal output based on the change of the on-off state by obtaining the on-off state of the power supply connected in series with the on-off detection circuit using a flash switch; the detection signal is used to determine whether the AC power supply flashes, and a control signal is sent to the load unit corresponding to the detection circuit; wherein, the determination of whether the power supply flashes by the detection signal includes: determining a capture event of the detection signal by using a timer, and when it is determined that a capture event exists in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to the target memory. That is, through the above-mentioned flash-off state detection circuit, the flash-off situation of the AC power supply is detected in real time, and the control signal to be executed by the load unit connected to the detection circuit is determined, and the occurrence of the flash-off state is used to realize the change control of the operating state of the load unit. The above-mentioned technical solution solves the problems in the related technology that the accuracy of flash-off detection in the circuit cannot be effectively improved, and the flash-off has a probability of failure. The embodiment of the present invention can achieve the accuracy of the flash-off detection of the circuit, reduce the occurrence of flash-off detection failure, and completely avoid the situation of missed detection of the flash-off state.

[0089] As an optional embodiment, the above-mentioned second determination module is also used to determine the preset processing cycle corresponding to the count value in the target memory; when the current processing cycle is less than the preset processing cycle, it is determined that the processing of the detection signal has not timed out, and the size of the count value and the preset threshold is determined; when the current processing cycle is greater than or equal to the preset processing cycle, it is determined that the processing of the detection signal has timed out, and the detection signal output by the on-off detection circuit is re-acquired.

[0090] Optionally, the above-mentioned second determination module also includes: a determination unit, which is used to determine that the detection signal corresponding to the count value is not currently flashing when the count value is less than the preset threshold; and to determine that the detection signal corresponding to the count value is currently flashing when the count value is greater than or equal to the preset threshold.

[0091] Optionally, the above-mentioned device also includes: an acquisition module, used to obtain the first operating state and the second operating state of the load unit; wherein, the first operating state is the state of the load unit before receiving the control signal, and the second operating state is the state of the load unit after executing the control signal; based on the first operating state and the second operating state, it is determined whether the load unit effectively responds to the change of the flash state.

[0092] In the description of the present invention, it should be understood that the terms "center," "upper," "lower," "front," "back," "left," and "right" and the like, indicating positions or relationships, are based on the positions or relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limiting the present invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0093] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be a communication between the two components. When a component is referred to as being "fixed to" or "set on" another element, it can be directly on the other component or there can also be a central component. When a component is considered to be "connected" to another element, it can be directly connected to the other element or there can be a central element at the same time. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0094] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0095] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0096] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A flash detection circuit, characterized in that: include: On / off detection circuit, target controller; The on-off detection circuit is connected to the flash switch and the power supply, and is used to detect the on-off state of the power supply connected in series with the flash switch and output a detection signal; The target controller is connected to the on-off detection circuit, and is used to obtain the detection signal output by the output end of the on-off detection circuit, determine whether the power supply has a flash interruption according to the detection signal, and send a control signal to the load unit corresponding to the detection circuit; The target controller includes at least a sub-controller, which is connected to a timer in the target controller and is configured to transfer a count value corresponding to a rising edge or a falling edge stored in the timer to a target memory when a capture event is determined to exist in the timer; The target controller processes the data in the target memory every preset processing cycle.

2. The flash detection circuit according to claim 1, characterized in that: The target controller also includes: a general input / output port and a timer; The universal input / output port is used to obtain the detection signal output by the on / off detection circuit and send the detection signal to the timer; The timer is connected to the general input / output port, and is used to perform a capture operation on the detection signal and generate a capture event, wherein the capture operation is used to identify a rising edge or a falling edge appearing in the detection signal through the timer.

3. The flash detection circuit according to claim 2, characterized in that: The target controller also includes: a target memory and a processor; The target memory is connected to the sub-controller and is used to receive the count values sent by the sub-controller within a preset period and save the count values in the order of receipt; The processor is connected to the timer and the target memory respectively, and is used to determine whether the power supply has a flash failure based on a preset logic function in combination with the count value and the capture event.

4. The flash detection circuit according to claim 3, characterized in that: The target controller further includes: a control unit; The control unit is connected to the processor and is configured to send a control signal to a load unit connected to the target controller when the processor determines that a flash interruption occurs in the power supply.

5. An electronic device, characterized in that: A detection circuit for a flash state comprising the circuit described in any one of claims 1 to 4.

6. The electronic device according to claim 5, characterized in that The electronic device further includes a load unit, wherein the load unit is configured to receive a control signal sent by the control unit and adjust an operating state of the load unit based on the control signal.

7. A method for controlling an electronic device, characterized in that: A flash state detection circuit comprising the flash state detection circuit according to any one of claims 1 to 4, used for adjusting the working state of the electronic device according to the flash detection signal.

8. A control system for an electronic device, characterized in that: The electronic device comprises the electronic device according to any one of claims 5 to 6.

9. The control system for electronic equipment according to claim 8, characterized in that: The control system further includes a flash switch, wherein the input end of the flash switch is connected in series with a power supply, and the output end of the flash switch is connected in series with the electronic device, for controlling the on and off of the power supply and the electronic device according to state changes.

10. A method for detecting a flash-off state, characterized in that: include: Determine a detection signal corresponding to a power supply output by an on / off detection circuit, wherein the detection signal is a signal output based on a change in the on / off state of a power supply connected in series with the on / off detection circuit via a flash switch; Determine whether the power supply has a flash interruption based on the detection signal, and send a control signal to the load unit corresponding to the detection circuit; Among them, determining whether the power supply has a flash interruption through the detection signal includes: using a timer to determine a capture event of the detection signal, and when it is determined that there is a capture event in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to the target memory, and processing the data in the target memory every preset processing cycle.

11. The method for detecting a flash off state according to claim 10, wherein: Determining whether the power supply has a flash interruption by using the detection signal further includes: Determining a preset processing period corresponding to the count value in the target memory; When the current processing cycle is less than the preset processing cycle, determining that the processing of the detection signal has not timed out, and determining the difference between the count value and the preset threshold; When the current processing cycle is greater than or equal to the preset processing cycle, it is determined that the processing of the detection signal has timed out, and the detection signal output by the on-off detection circuit is reacquired.

12. The method for detecting a flash state according to claim 11, wherein: In a case where the current processing cycle is less than the preset processing cycle, determining that the processing of the detection signal has not timed out, and determining a difference between the count value and a preset threshold value, includes: When the count value is less than the preset threshold, determining that the detection signal corresponding to the count value is not currently flashing; When the count value is greater than or equal to the preset threshold, it is determined that the detection signal corresponding to the count value is currently flashing off.

13. The method for detecting a flash state according to claim 11, wherein: After sending a control signal to a load unit corresponding to the detection circuit, the method further includes: Acquire a first operating state and a second operating state of the load unit; wherein the first operating state is a state of the load unit before receiving a control signal, and the second operating state is a state of the load unit after executing the control signal; Whether the load unit effectively responds to a change in the flash state is determined based on the first operating state and the second operating state.

14. A device for detecting flash failure, characterized in that: include: a first determining module, configured to determine a detection signal corresponding to a power supply output by an on / off detection circuit, wherein the detection signal is a signal output based on a change in the on / off state of a power supply connected in series with the on / off detection circuit via a flash switch; The second determination module is used to determine whether the power supply has a flash interruption through the detection signal and send a control signal to the load unit corresponding to the detection circuit; wherein, determining whether the power supply has a flash interruption through the detection signal includes: using a timer to determine a capture event of the detection signal, and when it is determined that there is a capture event in the timer, transferring the count value corresponding to the rising edge or falling edge stored in the timer to the target memory, and processing the data in the target memory every preset processing cycle.

Citation Information

Patent Citations

  • Flash state detection circuit and detection method, electronic equipment and control method

    CN114966311A