CN112180284A - Power failure detection method and device for alternating current power supply of electric equipment and related equipment - Google Patents

Power failure detection method and device for alternating current power supply of electric equipment and related equipment Download PDF

Info

Publication number
CN112180284A
CN112180284A CN202011008886.6A CN202011008886A CN112180284A CN 112180284 A CN112180284 A CN 112180284A CN 202011008886 A CN202011008886 A CN 202011008886A CN 112180284 A CN112180284 A CN 112180284A
Authority
CN
China
Prior art keywords
alternating current
sampling
power supply
voltage
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011008886.6A
Other languages
Chinese (zh)
Inventor
夏铮
刘靖扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goertek Techology Co Ltd
Original Assignee
Goertek Techology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Goertek Techology Co Ltd filed Critical Goertek Techology Co Ltd
Priority to CN202011008886.6A priority Critical patent/CN112180284A/en
Publication of CN112180284A publication Critical patent/CN112180284A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R31/00Arrangements for testing electric properties; Arrangements for locating electric faults; Arrangements for electrical testing characterised by what is being tested not provided for elsewhere
    • G01R31/40Testing power supplies
    • G01R31/42AC power supplies
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R19/00Arrangements for measuring currents or voltages or for indicating presence or sign thereof
    • G01R19/02Measuring effective values, i.e. root-mean-square values
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R19/00Arrangements for measuring currents or voltages or for indicating presence or sign thereof
    • G01R19/25Arrangements for measuring currents or voltages or for indicating presence or sign thereof using digital measurement techniques
    • G01R19/2503Arrangements for measuring currents or voltages or for indicating presence or sign thereof using digital measurement techniques for measuring voltage only, e.g. digital volt meters (DVM's)

Abstract

The application discloses a power failure detection method, a power failure detection device, a power failure detection system, a microcontroller and a computer readable storage medium for an alternating current power supply of electric equipment, wherein the method is applied to the microcontroller, an ADC (analog to digital converter) sampling pin of the microcontroller is used for sampling the output voltage of the alternating current power supply, and the method comprises the following steps: acquiring a sampling value of the output voltage of the alternating current power supply; calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period; judging whether the effective voltage value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the AC power supply has no power failure fault. According to the method and the device, the microcontroller is used for carrying out alternating voltage sampling detection on the alternating current power supply, whether the power failure fault occurs or not is judged according to the calculated voltage effective value, the detection result is accurate, the real-time performance is strong, the delay time is short, and the power failure fault warning can be timely carried out, so that the normal operation of the equipment is guaranteed.

Description

Power failure detection method and device for alternating current power supply of electric equipment and related equipment
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a method, an apparatus, a system, a microcontroller, and a computer-readable storage medium for detecting a power failure of an ac power supply of a power consumption device.
Background
In the conventional power failure detection, an alternating current power supply to be detected is generally converted into a direct current power supply, and then a comparator pin or an ADC (analog to digital converter) sampling pin of a single chip microcomputer is connected to detect the change of voltage of the related direct current power supply, and when the voltage of the direct current power supply is low enough to trigger the interruption of the comparator or a certain set threshold value, the system judges that the external power failure occurs. The power failure detection time delay is a key parameter of the power failure detection technology, and the shorter the delay time is, the better the product application is expected to be. However, the conventional power failure detection method has poor real-time performance, and generally has a time delay of about 200 milliseconds for detecting power failure.
In view of the above, it is an important need for those skilled in the art to provide a solution to the above technical problems.
Disclosure of Invention
The application aims to provide a power failure detection method, a power failure detection device, a power failure detection system, a microcontroller and a computer readable storage medium for an alternating current power supply of power equipment, so that the real-time performance of power failure detection is effectively improved, and the normal operation of the equipment is guaranteed.
In order to solve the technical problem, in a first aspect, the present application discloses a power failure detection method for an ac power supply of an electrical device, which is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling an output voltage of the ac power supply, and the method includes:
acquiring a sampling value of the output voltage of the alternating current power supply;
calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
judging whether the voltage effective value is smaller than a preset threshold value or not;
if so, judging that the alternating current power supply has a power failure fault;
if not, judging that the alternating current power supply has no power failure fault.
Optionally, the calculating a voltage effective value of the output voltage according to the sampling value of each sampling point in one ac cycle includes:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle, calculating the effective voltage value of the output voltage in the alternating current period;
the number of the whole-cycle sampling points is the ratio of the ADC sampling frequency of the microcontroller to the alternating current frequency of the alternating current power supply.
Optionally, the calculating the effective voltage value of the output voltage in the present ac cycle includes:
calculating the effective voltage value of the output voltage in the alternating current period according to a preset formula, wherein the preset formula is as follows:
Figure BDA0002696910340000021
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
Optionally, the calibration process of the preset gain includes:
acquiring a sampling value of a standard voltage output by the metering table body; the output end of the metering table body is connected with an ADC sampling pin of the microcontroller through the voltage division circuit;
calculating the voltage effective value of the standard voltage based on the preset formula according to the sampling value of each sampling point in an alternating current period;
and adjusting the magnitude of the preset gain in the preset formula until the updated and calculated voltage effective value of the standard voltage is consistent with the set value of the output voltage of the metering table body.
Optionally, the output terminal of the ac power supply is connected to the ADC sampling pin of the microcontroller after passing through the voltage divider circuit and the filter circuit in sequence, and the obtaining of the sampling value of the output voltage of the ac power supply includes:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
In a second aspect, the application discloses power down detection device for an ac power supply of a power consumption device, which is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling an output voltage of the ac power supply, the device includes:
the acquisition module is used for acquiring a sampling value of the output voltage of the alternating current power supply;
the calculating module is used for calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
the judging module is used for judging whether the effective voltage value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
Optionally, the calculation module is specifically configured to:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle, calculating the effective voltage value of the output voltage in the alternating current period;
the number of the whole-cycle sampling points is the ratio of the ADC sampling frequency of the microcontroller to the alternating current frequency of the alternating current power supply.
Optionally, the calculation module is specifically configured to:
calculating the effective voltage value of the output voltage in the alternating current period according to a preset formula, wherein the preset formula is as follows:
Figure BDA0002696910340000031
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
Optionally, the apparatus further includes a calibration module for calibrating the preset gain in advance;
the acquisition module is also used for acquiring a sampling value of the standard voltage output by the metering table body; the output end of the metering table body is connected with an ADC sampling pin of the microcontroller through the voltage division circuit;
the calculation module is also used for calculating the voltage effective value of the standard voltage based on the preset formula according to the sampling value of each sampling point in an alternating current period;
the calibration module is specifically configured to: and adjusting the magnitude of the preset gain in the preset formula until the updated and calculated voltage effective value of the standard voltage is consistent with the set value of the output voltage of the metering table body.
Optionally, the output end of the ac power supply is connected to the ADC sampling pin of the microcontroller after passing through the voltage divider circuit and the filter circuit in sequence, and the acquisition module is specifically configured to:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
In a third aspect, the application further discloses an alternating current power supply power failure detection system of the electric equipment, which comprises a voltage division circuit and a microcontroller; the ADC sampling pin of the microcontroller is used for sampling the output voltage of the alternating current power supply;
the microcontroller is used for obtaining a sampling value of the output voltage of the alternating current power supply, calculating a voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period, and judging whether the voltage effective value is smaller than a preset threshold value, if so, judging that the alternating current power supply has a power failure fault, and if not, judging that the alternating current power supply does not have the power failure fault.
Optionally, the system further comprises:
and the voltage division circuit and the filter circuit are connected between the output end of the alternating current power supply and the ADC sampling pin, so that the microcontroller can acquire a sampling value of the output voltage after proportional conditioning and filtering.
Optionally, the filtering circuit is an anti-aliasing filtering circuit.
In a fourth aspect, the present application further discloses a microcontroller comprising:
a storage unit for storing a computer program;
a processing unit for executing the computer program to implement the steps of any of the ac power supply power down detection methods described above.
In a fifth aspect, the present application further discloses a computer-readable storage medium, in which a computer program is stored, and the computer program is used to implement the steps of the ac power failure detection method for any electric device as described above when being executed by a processing unit.
The power failure detection method for the alternating current power supply of the electric equipment is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling the output voltage of the alternating current power supply, and the method comprises the following steps: acquiring a sampling value of the output voltage of the alternating current power supply; calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period; judging whether the voltage effective value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
The power failure detection method, the power failure detection device, the power failure detection system, the microcontroller and the computer readable storage medium of the power utilization equipment have the advantages that: according to the method and the device, the microcontroller is used for carrying out alternating voltage sampling detection on the alternating current power supply, whether the power failure fault occurs or not is judged according to the calculated voltage effective value, the detection result is accurate, the real-time performance is strong, the delay time is short, and the power failure fault warning can be timely carried out, so that the normal operation of the equipment is guaranteed.
Drawings
In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings that are needed to be used in the description of the prior art and the embodiments of the present application will be briefly described below. Of course, the following description of the drawings related to the embodiments of the present application is only a part of the embodiments of the present application, and it will be obvious to those skilled in the art that other drawings can be obtained from the provided drawings without any creative effort, and the obtained other drawings also belong to the protection scope of the present application.
Fig. 1 is a flowchart of an ac power failure detection method for a power consumption device according to an embodiment of the present application;
fig. 2 is a block diagram of an ac power failure detection apparatus for an electrical device according to an embodiment of the present disclosure;
fig. 3 is a circuit structure diagram of a filter circuit and a voltage divider circuit according to an embodiment of the disclosure;
fig. 4 is a block diagram of a microcontroller according to an embodiment of the present application.
Detailed Description
The core of the application is to provide a method, a device, a system, a microcontroller and a computer readable storage medium for detecting the power failure of an alternating current power supply of electric equipment, so that the real-time performance of power failure detection is effectively improved, and the normal operation of the equipment is guaranteed.
In order to more clearly and completely describe the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, in the conventional power failure detection, after an alternating current power supply to be detected is generally converted into a direct current power supply, a comparator pin or an ADC sampling pin of a single chip microcomputer is accessed to detect the change of voltage of the related direct current power supply, and when the voltage of the direct current power supply is low enough to trigger the interruption of the comparator or a certain set threshold, the system determines that the external power failure occurs. The power failure detection time delay is a key parameter of the power failure detection technology, and the shorter the delay time is, the better the product application is expected to be. However, the conventional power failure detection method has poor real-time performance, and generally has a time delay of about 200 milliseconds for detecting power failure. In view of this, the present application provides a power failure detection scheme for an ac power supply of an electrical device, which can effectively solve the above-mentioned problems.
Referring to fig. 1, an embodiment of the present application discloses a power failure detection method for an ac power supply of an electrical device, which is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling an output voltage of the ac power supply, and the method mainly includes:
s101: and acquiring a sampling value of the output voltage of the alternating current power supply.
S102: and calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period.
S103: judging whether the effective voltage value is smaller than a preset threshold value or not; if yes, entering S104; if not, the process proceeds to S105.
S104: and judging that the alternating current power supply has a power failure fault.
S105: and judging that the AC power supply has no power failure fault.
Specifically, it should be noted that, the ac power failure detection method provided by the present application does not access the microcontroller to perform dc voltage sampling detection after ac power is rectified into dc power as in the prior art, but performs ac voltage sampling detection on ac power by using the ADC function of the microcontroller.
It is understood that the microcontroller may be generally implemented by a logic device such as a single chip, a DSP (Digital Signal Processor), and the like. For the microcontroller, the ADC sampling function usually has certain restriction requirements, such as voltage range requirements, on the signal to be sampled, so that a person skilled in the art can set a certain signal conditioning circuit between the output terminal of the ac power supply and the ADC sampling pin of the microcontroller, so as to successfully complete sampling detection of the ac power supply output voltage of the power consumption device.
In addition, it should be noted that the processing clock frequency of a general microcontroller is much higher than the frequency of a common ac (for example, the commercial power frequency is 50Hz), and can even reach kHz and MHz levels. Therefore, the ADC of the microcontroller will be able to perform a number of AD samples during one ac cycle. Therefore, the microprocessor can calculate the voltage effective value of the output voltage of the alternating current power supply according to a plurality of sampling values in one alternating current period.
Furthermore, the microprocessor can compare the voltage effective value obtained by actual detection and calculation with a preset threshold value, so as to judge whether the alternating current power supply has a power failure fault. It is easy to understand that when the calculated effective value of the voltage is lower than the preset threshold value, that is, after the power failure fault exists in the alternating current power supply of the electric device, the power failure warning information can be further generated so that the user can maintain and process in time.
The voltage effective value can be calculated in real time based on the sampling value in the latest alternating current period, and then whether a power failure fault occurs is judged, so that the real-time performance of the method is high, and the power failure detection time delay of the method is not more than one alternating current period to the maximum extent. Therefore, for most of electric equipment powered by mains supply, the alternating current power supply power failure detection method provided by the application can detect the power failure fault within 20ms after the alternating current power supply is completely closed, and the real-time performance of fault detection is high.
The power failure detection method for the alternating current power supply of the electric equipment is applied to the microcontroller, the output end of the alternating current power supply is connected with an ADC (analog to digital converter) sampling pin of the microcontroller through a voltage division circuit, and the method comprises the following steps: acquiring a sampling value of the output voltage of the alternating current power supply; calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period; judging whether the effective voltage value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the AC power supply has no power failure fault.
Therefore, according to the alternating current power supply power failure detection method of the power consumption equipment, the microcontroller carries out alternating voltage sampling detection on the alternating current power supply, whether power failure fault occurs or not is judged according to the calculated voltage effective value, the detection result is accurate, the real-time performance is strong, the delay time is short, and power failure fault warning can be timely carried out so as to guarantee normal operation of the equipment.
As a specific embodiment, the method for detecting power down of an ac power supply of an electrical device according to the embodiment of the present application calculates a voltage effective value of an output voltage according to a sampling value of each sampling point in an ac cycle based on the above contents, and includes:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle wave, calculating the voltage effective value of the output voltage in the alternating current period;
the number of sampling points of the whole cycle is the ratio of the ADC sampling frequency of the microcontroller to the AC frequency of the AC power supply.
Specifically, the whole cycle is represented by NNumber of sampling points, fADCRepresenting ADC sampling frequency, f, of the microcontrollerACIndicating the AC frequency, T, of the AC power supplyADCIndicating ADC sampling period, T, of the microcontrollerACRepresenting the ac cycle of the ac power source, there are:
N=fADC/fAC=TAC/TADC
as a specific embodiment, the method for detecting power failure of an ac power supply of an electrical device according to the embodiment of the present application calculates an effective voltage value of an output voltage in the ac cycle based on the above contents, and includes:
calculating the voltage effective value of the output voltage in the alternating current period according to a preset formula, wherein the preset formula is as follows:
Figure BDA0002696910340000071
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
Specifically, in the present embodiment, two interrupts may be specifically set to complete the calculation of the voltage effective value. The first interrupt occurs after each sample is completed, and each time a sample is taken, the interrupt is raised and accumulated to update the sum of the squares of the samples. When the number N of sampling points in the AC cycle reaches the number N of sampling points in the whole cycle, the timer is interrupted, and when the second interruption is triggered, the microcontroller calculates the effective voltage value in the AC cycle according to the preset formula.
In the microcontroller, the priority of the first interrupt after the ADC sampling is set to be higher than that of the second interrupt, namely the timer interrupt, so that interrupt nesting can be started in the timer interrupt, the first interrupt can interrupt the timer interrupt, and the complete acquisition of a sampling value is ensured.
As a specific embodiment, in the ac power failure detection method for an electrical device according to the embodiment of the present application, on the basis of the foregoing, a calibration process of a preset gain includes:
acquiring a sampling value of a standard voltage output by the metering table body; the output end of the metering table body is connected with an ADC sampling pin of the microcontroller through a voltage division circuit;
calculating a voltage effective value of the standard voltage based on a preset formula according to the sampling value of each sampling point in an alternating current period;
and adjusting the magnitude of the preset gain in the preset formula until the voltage effective value of the standard voltage obtained by updating calculation is consistent with the output voltage set value of the metering table body.
It should be noted that the magnitude of the preset gain is related to the calculation of the voltage effective value, and the calculation of the voltage effective value is directly related to the determination result of the power failure detection, so that the reasonability of the value of the preset gain is related to the accuracy of the power failure detection. Therefore, the value calibration is carried out on the preset gain in advance.
The metering table body is a device capable of accurately outputting set voltage, current or power, and the accuracy can reach two parts per million. Thus, the voltage output by the measuring table body can be regarded as the standard voltage corresponding to the set voltage value. According to the method and the device, the preset gain is adjusted, so that the voltage effective value of the standard voltage obtained by calculation based on the preset gain and the output voltage set value of the metering table body (the common alternating current set value refers to the effective value) can be ensured, the value correctness of the preset gain can be ensured, and the calculation accuracy of the voltage effective value is further ensured.
As a specific embodiment, the method for detecting power failure of an ac power supply of an electrical device according to the embodiment of the present application is based on the above, where an output terminal of the ac power supply sequentially passes through a voltage divider circuit and a filter circuit, and then is connected to an ADC sampling pin of a microcontroller, so as to obtain a sampling value of an output voltage of the ac power supply, and the method includes:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
Specifically, in order to improve the precision of the sampling value, a voltage division circuit and a filter circuit are further arranged. Generally, the voltage of the ac power supply of the electrical device is relatively large (the effective value of the voltage is 220V), so that the voltage of the output voltage of the ac power supply is reduced by using the voltage dividing circuit connected to the output end of the ac power supply, so that the value of the voltage sampling value after the proportional adjustment can be within the voltage range that the microcontroller can bear. And furthermore, after the voltage division circuit proportionally adjusts the regulated output voltage, the filter circuit continuously regulates the sampling voltage.
Referring to fig. 2, an embodiment of the present application discloses an ac power supply power-down detection apparatus for an electrical device, which is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling an output voltage of the ac power supply, and the apparatus includes:
an obtaining module 201, configured to obtain a sampling value of an output voltage of an ac power supply;
the calculating module 202 is configured to calculate a voltage effective value of the output voltage according to a sampling value of each sampling point in an ac cycle;
the judging module 203 is configured to judge whether the effective value of the voltage is smaller than a preset threshold; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the AC power supply has no power failure fault.
Therefore, according to the alternating current power supply power failure detection device of the power consumption equipment disclosed by the embodiment of the application, the microcontroller is used for sampling and detecting the alternating voltage of the alternating current power supply, and whether the power failure fault occurs or not is judged according to the calculated voltage effective value, so that the detection result is accurate, the real-time performance is strong, the delay time is short, and the power failure fault warning can be timely carried out, so that the normal operation of the equipment is ensured.
As a specific embodiment, on the basis of the foregoing content, the computing module 202 of the apparatus for detecting power failure of an ac power supply of an electrical device disclosed in the embodiment of the present application is specifically configured to:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle wave, calculating the voltage effective value of the output voltage in the alternating current period;
the number of sampling points of the whole cycle is the ratio of the ADC sampling frequency of the microcontroller to the AC frequency of the AC power supply.
As a specific embodiment, on the basis of the foregoing content, the computing module 202 of the apparatus for detecting power failure of an ac power supply of an electrical device disclosed in the embodiment of the present application is specifically configured to:
calculating the voltage effective value of the output voltage in the alternating current period according to a preset formula, wherein the preset formula is as follows:
Figure BDA0002696910340000091
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
As a specific embodiment, the ac power supply failure detection apparatus for an electrical device disclosed in the embodiment of the present application further includes, on the basis of the foregoing, a calibration module for calibrating a preset gain in advance;
the obtaining module 201 is further configured to obtain a sampling value of the standard voltage output by the metering stage; the output end of the metering table body is connected with an ADC sampling pin of the microcontroller through a voltage division circuit;
the calculating module 202 is further configured to calculate a voltage effective value of the standard voltage based on a preset formula according to a sampling value of each sampling point in an ac cycle;
the calibration module is specifically configured to: and adjusting the magnitude of the preset gain in the preset formula until the voltage effective value of the standard voltage obtained by updating calculation is consistent with the output voltage set value of the metering table body.
As a specific embodiment, the ac power supply power-down detection apparatus for an electrical device disclosed in the embodiment of the present application is based on the above contents, an output terminal of the ac power supply sequentially passes through a voltage dividing circuit and a filter circuit, and then is connected to an ADC sampling pin of the microcontroller, and the obtaining module 201 is specifically configured to:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
For the specific content of the ac power failure detection apparatus of the electrical device, reference may be made to the foregoing detailed description of the ac power failure detection method of the electrical device, and details thereof are not repeated here.
The application also discloses an alternating current power supply power failure detection system of the electric equipment, which comprises a voltage division circuit and a microcontroller; the ADC sampling pin of the microcontroller is used for sampling the output voltage of the alternating current power supply;
the microcontroller is used for obtaining a sampling value of the output voltage of the alternating current power supply, calculating a voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period, and judging whether the voltage effective value is smaller than a preset threshold value, if so, judging that the alternating current power supply has a power failure fault, and if not, judging that the alternating current power supply does not have the power failure fault.
As a specific embodiment, the ac power supply power-down detection system for an electrical device disclosed in the embodiment of the present application further includes, on the basis of the foregoing contents:
and the voltage division circuit and the filter circuit are connected between the output end of the alternating current power supply and the ADC sampling pin, so that the microcontroller can obtain a sampling value after the output voltage is subjected to proportional conditioning and filtering processing.
As a specific embodiment, the ac power supply power-down detection system of the electrical equipment disclosed in the embodiment of the present application is based on the above contents, and the filter circuit is an anti-aliasing filter circuit.
Referring to fig. 3, fig. 3 is a schematic circuit structure diagram of an anti-aliasing filter circuit and a voltage divider circuit provided in the present application. The resistors Rs and R11 form a voltage dividing circuit, and the capacitors C1, C2 and C3 and the resistors R12 and R13 form an anti-aliasing filter circuit. The Vin end is used for being connected with the output end of the alternating current power supply; the output terminals V + and V-are used for connecting with an ADC sampling pin of the microcontroller.
Referring to fig. 4, an embodiment of the present application discloses a microcontroller, including:
a storage unit 301 for storing a computer program;
a processing unit 302 for executing the computer program to implement the steps of the ac power supply power down detection method of any of the electric devices as described above.
Further, the embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored, and the computer program is used for implementing the steps of the ac power failure detection method for any electric device as described above when being executed by a processing unit.
For the details of the microcontroller and the computer-readable storage medium, reference may be made to the foregoing detailed description of the method for detecting a power failure of an ac power source of a power consuming device, and details thereof are not repeated here.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the equipment disclosed by the embodiment, the description is relatively simple because the equipment corresponds to the method disclosed by the embodiment, and the relevant parts can be referred to the method part for description.
It is further noted that, throughout this document, relational terms such as "first" and "second" are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The technical solutions provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall into the protection scope of the present application.

Claims (10)

1. An alternating current power supply power-down detection method of electric equipment is applied to a microcontroller, an ADC sampling pin of the microcontroller is used for sampling an output voltage of an alternating current power supply, and the method comprises the following steps:
acquiring a sampling value of the output voltage of the alternating current power supply;
calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
judging whether the voltage effective value is smaller than a preset threshold value or not;
if so, judging that the alternating current power supply has a power failure fault;
if not, judging that the alternating current power supply has no power failure fault.
2. The method for detecting power failure of an ac power supply according to claim 1, wherein said calculating the effective voltage value of the output voltage according to the sampling value of each sampling point in an ac cycle comprises:
when the number of the accumulated sampling points in the alternating current period reaches the number of the sampling points of the whole cycle, calculating the effective voltage value of the output voltage in the alternating current period;
the number of the whole-cycle sampling points is the ratio of the ADC sampling frequency of the microcontroller to the alternating current frequency of the alternating current power supply.
3. The method for detecting power failure of an ac power supply according to claim 2, wherein said calculating the effective value of the voltage of the output voltage in the present ac cycle includes:
calculating the effective voltage value of the output voltage in the alternating current period according to a preset formula, wherein the preset formula is as follows:
Figure FDA0002696910330000011
wherein, U is the effective value of voltage, k is the preset gain, N is the number of sampling points of the whole cycle, and U (N) is the sampling value of the nth sampling point in the current alternating current period.
4. The method according to claim 3, wherein the calibration process of the preset gain comprises:
acquiring a sampling value of a standard voltage output by the metering table body; the output end of the metering table body is connected with an ADC sampling pin of the microcontroller through the voltage division circuit;
calculating the voltage effective value of the standard voltage based on the preset formula according to the sampling value of each sampling point in an alternating current period;
and adjusting the magnitude of the preset gain in the preset formula until the updated and calculated voltage effective value of the standard voltage is consistent with the set value of the output voltage of the metering table body.
5. The method for detecting power failure of an alternating current power supply according to any one of claims 1 to 4, wherein an output end of the alternating current power supply is connected with an ADC (analog to digital converter) sampling pin of the microcontroller after sequentially passing through a voltage division circuit and a filter circuit, and the obtaining of the sampling value of the output voltage of the alternating current power supply comprises:
and acquiring a sampling value of the output voltage after proportional conditioning and filtering.
6. The utility model provides a power failure detection device of alternating current power supply of consumer, its characterized in that is applied to microcontroller, microcontroller's ADC sampling pin is used for sampling alternating current power supply's output voltage, the device includes:
the acquisition module is used for acquiring a sampling value of the output voltage of the alternating current power supply;
the calculating module is used for calculating the voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period;
the judging module is used for judging whether the effective voltage value is smaller than a preset threshold value or not; if so, judging that the alternating current power supply has a power failure fault; if not, judging that the alternating current power supply has no power failure fault.
7. The alternating current power supply power failure detection system of the electric equipment is characterized by comprising a voltage division circuit and a microcontroller; the ADC sampling pin of the microcontroller is used for sampling the output voltage of the alternating current power supply;
the microcontroller is used for obtaining a sampling value of the output voltage of the alternating current power supply, calculating a voltage effective value of the output voltage according to the sampling value of each sampling point in an alternating current period, and judging whether the voltage effective value is smaller than a preset threshold value, if so, judging that the alternating current power supply has a power failure fault, and if not, judging that the alternating current power supply does not have the power failure fault.
8. The system for detecting loss of ac power as claimed in claim 7, further comprising:
and the voltage division circuit and the filter circuit are connected between the output end of the alternating current power supply and the ADC sampling pin, so that the microcontroller can acquire a sampling value of the output voltage after proportional conditioning and filtering.
9. The system of claim 8, wherein the filter circuit is an anti-aliasing filter circuit.
10. A microcontroller, comprising:
a storage unit for storing a computer program;
processing unit for executing said computer program for implementing the steps of the method for detecting a power failure of an alternating current power supply according to any one of claims 1 to 5.
CN202011008886.6A 2020-09-23 2020-09-23 Power failure detection method and device for alternating current power supply of electric equipment and related equipment Pending CN112180284A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011008886.6A CN112180284A (en) 2020-09-23 2020-09-23 Power failure detection method and device for alternating current power supply of electric equipment and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011008886.6A CN112180284A (en) 2020-09-23 2020-09-23 Power failure detection method and device for alternating current power supply of electric equipment and related equipment

Publications (1)

Publication Number Publication Date
CN112180284A true CN112180284A (en) 2021-01-05

Family

ID=73955321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011008886.6A Pending CN112180284A (en) 2020-09-23 2020-09-23 Power failure detection method and device for alternating current power supply of electric equipment and related equipment

Country Status (1)

Country Link
CN (1) CN112180284A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835511A (en) * 2021-09-27 2021-12-24 重庆邮电大学 Method, system and computer equipment for power failure protection of cache data
CN113899963A (en) * 2021-08-30 2022-01-07 科华数据股份有限公司 Alternating current system interference electricity detection method and device and terminal equipment
CN114295887A (en) * 2021-12-22 2022-04-08 科德数控股份有限公司 Power failure detection method
CN114563753A (en) * 2021-04-12 2022-05-31 正泰集团研发中心(上海)有限公司 Power failure detection method, device and equipment for electric energy meter and computer readable storage medium
CN115765118A (en) * 2023-01-03 2023-03-07 华立科技股份有限公司 Power supply processing method, system, device and medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102207518A (en) * 2011-03-11 2011-10-05 华为技术有限公司 Method and device for detecting effective value of alternating current (AC) voltage
CN102510284A (en) * 2011-09-23 2012-06-20 中达电通股份有限公司 Methods and devices for calibrating alternating-current voltage signal and alternating current signal
CN103176036A (en) * 2011-12-20 2013-06-26 首瑞(北京)投资管理集团有限公司 Device and method for monitoring alternating current entering direct current system
CN103607037A (en) * 2013-11-01 2014-02-26 恒动能源(深圳)有限公司 Switching apparatus of UPS power supply
CN104167811A (en) * 2014-08-23 2014-11-26 成都四威航空电源有限公司 Alternating-current power supply switching method and circuit used during power failure
CN105425171A (en) * 2015-12-18 2016-03-23 南京南瑞继保电气有限公司 Method for detecting voltage drop of low voltage ride-through power source of frequency converter
CN108508380A (en) * 2018-04-23 2018-09-07 深圳市高斯宝电气技术有限公司 A kind of rapid detection method of AC voltages power down
CN109061362A (en) * 2018-07-24 2018-12-21 许继电源有限公司 A kind of electric network power-fail detection circuit
CN109084447A (en) * 2018-08-23 2018-12-25 奥克斯空调股份有限公司 A kind of air conditioning control method, device and air conditioner
CN109975724A (en) * 2019-04-19 2019-07-05 科华恒盛股份有限公司 AC power source method for detecting abnormality and device
CN210894671U (en) * 2019-10-29 2020-06-30 华立科技股份有限公司 Power failure detection circuit, power failure detection system and ammeter

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102207518A (en) * 2011-03-11 2011-10-05 华为技术有限公司 Method and device for detecting effective value of alternating current (AC) voltage
CN102510284A (en) * 2011-09-23 2012-06-20 中达电通股份有限公司 Methods and devices for calibrating alternating-current voltage signal and alternating current signal
CN103176036A (en) * 2011-12-20 2013-06-26 首瑞(北京)投资管理集团有限公司 Device and method for monitoring alternating current entering direct current system
CN103607037A (en) * 2013-11-01 2014-02-26 恒动能源(深圳)有限公司 Switching apparatus of UPS power supply
CN104167811A (en) * 2014-08-23 2014-11-26 成都四威航空电源有限公司 Alternating-current power supply switching method and circuit used during power failure
CN105425171A (en) * 2015-12-18 2016-03-23 南京南瑞继保电气有限公司 Method for detecting voltage drop of low voltage ride-through power source of frequency converter
CN108508380A (en) * 2018-04-23 2018-09-07 深圳市高斯宝电气技术有限公司 A kind of rapid detection method of AC voltages power down
CN109061362A (en) * 2018-07-24 2018-12-21 许继电源有限公司 A kind of electric network power-fail detection circuit
CN109084447A (en) * 2018-08-23 2018-12-25 奥克斯空调股份有限公司 A kind of air conditioning control method, device and air conditioner
CN109975724A (en) * 2019-04-19 2019-07-05 科华恒盛股份有限公司 AC power source method for detecting abnormality and device
CN210894671U (en) * 2019-10-29 2020-06-30 华立科技股份有限公司 Power failure detection circuit, power failure detection system and ammeter

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114563753A (en) * 2021-04-12 2022-05-31 正泰集团研发中心(上海)有限公司 Power failure detection method, device and equipment for electric energy meter and computer readable storage medium
CN114563753B (en) * 2021-04-12 2023-09-22 正泰集团研发中心(上海)有限公司 Method, device, equipment and computer readable storage medium for detecting power failure of electric energy meter
CN113899963A (en) * 2021-08-30 2022-01-07 科华数据股份有限公司 Alternating current system interference electricity detection method and device and terminal equipment
CN113835511A (en) * 2021-09-27 2021-12-24 重庆邮电大学 Method, system and computer equipment for power failure protection of cache data
CN114295887A (en) * 2021-12-22 2022-04-08 科德数控股份有限公司 Power failure detection method
CN114295887B (en) * 2021-12-22 2023-07-18 科德数控股份有限公司 Power failure detection method
CN115765118A (en) * 2023-01-03 2023-03-07 华立科技股份有限公司 Power supply processing method, system, device and medium

Similar Documents

Publication Publication Date Title
CN112180284A (en) Power failure detection method and device for alternating current power supply of electric equipment and related equipment
JP5751872B2 (en) Device state detection device and device state detection system
CN108303651B (en) Battery electric quantity measuring method and terminal
CN109447473B (en) Power load monitoring method, device, equipment and readable storage medium
CN111130074B (en) Direct-current transmission line ultra-high-speed protection system and method based on voltage first extreme value time
CN114563753B (en) Method, device, equipment and computer readable storage medium for detecting power failure of electric energy meter
CN102095935B (en) Method for measuring instantaneous phase of alternating current electrical signal
CN108765747B (en) Metering method for super power factor electric quantity
CN112582978A (en) Leakage protection method and device and charging pile
CN107024611B (en) Electromagnetic heating device and current sampling method and current sampling module thereof
CN103576098B (en) A kind of power source life on-line monitoring method, system and power supply
CN107656213B (en) Intelligent test method and system for battery core
CN110763942B (en) Method and device for detecting residual life of dry-type transformer
CN109103904B (en) Frequency stability determination method and device and electronic equipment
CN109379479B (en) Performance test method and device for built-in sensor of mobile terminal
CN116966419A (en) Control method and device of electronic mask, wearable equipment and beauty and protection system
CN113422432B (en) Electrical fire prevention and control system based on non-invasive load monitoring
CN115932355A (en) Self-adaptive signal processing system and method of clamp-on ammeter
CN115575880A (en) Online detection method for metering error state of power transformer
EP3951409A1 (en) Secondary cell inspection method and secondary cell inspection device
CN110763915B (en) Method for calculating voltage included angle and zero line current and three-phase electric energy meter
CN108918982B (en) Method for acquiring signal peak value
CN110888100A (en) Single-phase intelligent electric energy meter online on-load detection system and method
JPH1010163A (en) Effective voltage value measuring apparatus
CN219842502U (en) Line state monitoring device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210105

RJ01 Rejection of invention patent application after publication