An electric energy meter and method for calibrating an internal clock source of a chip using a grid frequency

By detecting the power grid frequency and using it to calibrate the chip's internal clock source, the problem of timing errors in the energy meter caused by crystal oscillator failure was solved, enabling the energy meter to operate normally and have its lifespan extended without increasing hardware costs.

CN116184015BActive Publication Date: 2026-01-09JIANGSU LINYANG ENERGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211648190.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2026-01-09
Estimated Expiration
2042-12-21

AI Technical Summary

Technical Problem

When the crystal oscillator stops oscillating, the energy meter cannot operate normally, resulting in excessive timing errors, affecting electricity bill calculation and communication. Moreover, existing technology cannot solve this problem without increasing hardware costs.

Method used

By detecting the power grid frequency and using it to calibrate the chip's internal clock source, the power grid frequency is monitored in real time, and the internal clock source of the CPU unit is calibrated to ensure the normal operation of the energy meter when the crystal oscillator stops oscillating.

Benefits of technology

When the crystal oscillator stops oscillating, the internal clock source of the chip is calibrated using the power grid frequency to correct clock errors, ensure the correct operation of the electricity meter, extend the meter's lifespan, and reduce timing errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116184015B_ABST
    Figure CN116184015B_ABST
Patent Text Reader

Abstract

The utility model provides an electric energy meter and method for calibrating internal clock source of chip using power grid frequency, the electric energy meter includes the measurement unit, the measurement unit is connected to the power grid, is used for detecting the voltage of power grid and the zero-crossing signal of power grid, the measurement unit is connected to CPU unit, sends the zero-crossing interrupt signal of power grid and power grid instantaneous data, CPU unit, receives the zero-crossing interrupt signal of measurement unit transmission, and carries out counting and obtains frequency, according to the frequency deviation of zero-crossing interrupt signal of power grid obtained when the normal work and the stop working of the crystal oscillator in CPU unit, the internal clock source of chip of CPU unit is calibrated, the utility model solves the problem that the crystal oscillator stops in the absence of any hardware cost under the condition of increasing, has good application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of electric energy meter, in particular to a method for correct operation of electric energy meter when the crystal oscillator stops. BACKGROUND

[0002] With the rapid development of smart grid, the smart electric energy meter needs to have a built-in clock reference to perform time-sharing billing on electric energy, record events, load curve and settlement data according to time for future query and statistics. The clock on the smart electric energy meter needs to meet the IEC62054-21 standard. The clock source of most electric energy meters is an internal crystal oscillator, and the electric energy meter clock is realized by sampling the frequency of the crystal oscillator.

[0003] At present, the crystal oscillator of the electric energy meter on the market is easily affected by humidity, which causes the crystal oscillator to stop for a short time. When the humidity decreases, the electric energy meter can work normally. When the crystal oscillator stops, most electric energy meters do not work, or some electric energy meters use the internal high-speed clock to run. When the internal high-speed clock is used to run, there is a ±5% error under high and low temperature, which can cause the electric energy meter to be unable to communicate, the RTC clock to have a large deviation, and the rate of the electric energy meter to be abnormal according to the calculation of 5% accuracy for one day (24H*0.05=1.2H). SUMMARY

[0004] The present application aims to solve the problem that the electric energy meter cannot work normally after the crystal oscillator stops, and proposes an electric energy meter and method for calibrating the internal clock source of the chip using the grid frequency. The grid frequency is monitored in real time when the crystal oscillator does not stop, and the internal clock source of the chip is calibrated using the grid frequency after the crystal oscillator stops. The problem of crystal oscillator stop is solved without increasing any hardware cost, and the method has good application prospect.

[0005] The technical scheme of the present application is as follows:

[0006] An electric energy meter for calibrating the internal clock source of the chip using the grid frequency, comprising:

[0007] A metering unit connected to the grid for detecting the voltage of the grid and the zero-crossing signal of the grid; the metering unit is connected to the CPU unit and sends the zero-crossing interrupt signal and the grid instantaneous data of the grid;

[0008] A CPU unit receiving the zero-crossing interrupt signal sent by the metering unit and counting to obtain the frequency;

[0009] According to the frequency deviation of the grid zero-crossing interrupt signal obtained when the crystal oscillator in the CPU unit works normally and stops working, the internal clock source of the CPU unit is calibrated.

[0010] Further, the metering unit comprises a metering chip U1;

[0011] The first and second pins of the metering chip U1 are connected to the power grid through resistance voltage division, for detecting the voltage of the power grid and the zero-crossing signal of the power grid;

[0012] The thirteenth and fourteenth pins of the metering chip U1 are connected to the ninety-third and ninety-second pins of the MCU chip U2 in the CPU unit, for UART communication;

[0013] The twelfth pin of the metering chip U1 is connected to the ninety-sixth pin of the MCU chip U2 in the CPU unit, for sending the zero-crossing signal of the power grid to the CPU unit as an interrupt signal.

[0014] Further, the CPU unit comprises the MCU chip U2 and a crystal oscillator X1;

[0015] The tenth pin of the MCU chip U2 is connected to the first pin of the crystal oscillator X1 and one end of the capacitor C2, and the eleventh pin of the MCU chip U2 is connected to the second pin of the crystal oscillator X1 and one end of the capacitor C1, the other end of the capacitor C1 is connected to the ground, and the other end of the capacitor C2 is also connected to the ground;

[0016] The ninety-second and ninety-third pins of the MCU chip U2 are connected to the fourteenth and thirteenth pins of the metering chip U1, respectively, for UART communication;

[0017] The ninety-sixth pin of the MCU chip U2 is connected to the twelfth pin of the metering chip U1, for receiving the zero-crossing interrupt signal of the power grid.

[0018] Further, the zero-crossing signal of the power grid adopts a positive zero-crossing signal and / or a negative zero-crossing signal.

[0019] Further, the frequency of the crystal oscillator X1 is 32.768 KHz.

[0020] A method for calibrating the internal clock source of a chip using the frequency of a power grid, based on the electric energy meter, comprising the following steps:

[0021] S1, the CPU unit receives the zero-crossing interrupt signal sent by the metering unit, and counts according to the preset time window t, to obtain the frequency;

[0022] S2, step S1 is repeatedly executed n times, and the frequency average in the n time windows t is calculated as the current power grid frequency F;

[0023] S3, when the internal crystal oscillator X1 of the CPU unit stops working, the CPU unit uses the high-speed clock HRC inside the MCU chip U2 to collect the power grid frequency again according to step S1, which is recorded as F HRC ;

[0024] The deviation of the power grid frequency F from F HRC The deviation of the power grid frequency F from F

[0025] Further, the time window t is 2 minutes.

[0026] Further, the number n is greater than 20.

[0027] Further, the calculation of the frequency average in the time window t for n times is specifically:

[0028] The frequency in a single time window t is calculated respectively, when the frequency deviation collected for n times continuously is less than 5%, the frequency average is calculated, otherwise, the collection is continued.

[0029] Further, based on the actual deviation, the internal peripherals of the CPU unit are calibrated; the peripherals include serial ports, timers and RTC.

[0030] The beneficial effects of the present application are:

[0031] The electric energy meter of the present application calibrates the chip internal clock source of the CPU unit according to the frequency deviation of the power grid zero-crossing interrupt signal obtained when the crystal oscillator in the CPU unit works normally and stops working; can realize the correction of data based on the frequency deviation when the crystal oscillator is abnormal, ensures the correct operation of the electric energy meter, delays the service life of the electric meter and has good application prospect. BRIEF DESCRIPTION OF DRAWINGS

[0032] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which like reference characters refer to like parts throughout the figures, and wherein exemplary embodiments of the application are shown.

[0033] Figure 1 is the principle diagram of the metering unit of the present application

[0034] Figure 2 is the principle diagram of the CPU unit of the present application DETAILED DESCRIPTION

[0035] Embodiments of the present application will be described in more detail by referring to the attached drawings. Although the embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein.

[0036] An electric energy meter for calibrating the chip internal clock source using the power grid frequency, comprising:

[0037] A metering unit is connected to the power grid for detecting the voltage and zero-crossing signal of the power grid (positive or negative zero-crossing signal can be collected, or both positive and negative zero-crossing signals can be collected); the metering unit is connected to the CPU unit for sending the zero-crossing interrupt signal and the instantaneous data of the power grid; the metering unit comprises a metering chip U1;

[0038] The first and second pins of the metering chip U1 are connected to the power grid through resistance voltage division for detecting the voltage and zero-crossing signal of the power grid;

[0039] The thirteenth and fourteenth pins of the metering chip U1 are connected to the ninety-third and ninety-second pins of the MCU chip U2 in the CPU unit for UART communication;

[0040] The twelfth pin of the metering chip U1 is connected to the ninety-sixth pin of the MCU chip U2 in the CPU unit for sending the zero-crossing signal of the power grid as an interrupt signal to the CPU unit.

[0041] The CPU unit receives the zero-crossing interrupt signal sent by the metering unit and counts to obtain the frequency;

[0042] The frequency deviation of the zero-crossing interrupt signal obtained when the crystal oscillator in the CPU unit is normally working and stopped working is used to calibrate the chip internal clock source of the CPU unit, and the CPU unit comprises the MCU chip U2 and the crystal oscillator X1;

[0043] The tenth pin of the MCU chip U2 is connected to the first pin of the crystal oscillator X1 and one end of the capacitor C2, the eleventh pin of the MCU chip U2 is connected to the second pin of the crystal oscillator X1 and one end of the capacitor C1, the other end of the capacitor C1 is connected to the ground, and the other end of the capacitor C2 is also connected to the ground;

[0044] The ninety-second and ninety-third pins of the MCU chip U2 are connected to the fourteenth and thirteenth pins of the metering chip U1, respectively, for UART communication;

[0045] The ninety-sixth pin of the MCU chip U2 is connected to the twelfth pin of the metering chip U1 for receiving the zero-crossing interrupt signal of the power grid.

[0046] A method for calibrating the chip internal clock source using the frequency of the power grid, based on the electric energy meter, comprising the following steps:

[0047] S1, the CPU unit receives the zero-crossing interrupt signal sent by the metering unit, and counts according to the preset time window t and the number n, calculates the frequency average in n time windows t as the current power grid frequency F, t is 2 minutes;

[0048] S2, repeating step S1 for n times, for example 20 times, calculating the frequency average in 20 time windows t as the current power grid frequency F;

[0049] S3, when the CPU unit internal crystal X1 stops working, the CPU unit uses the high-speed clock HRC inside the MCU chip U2 to collect the power grid frequency again according to step S1, denoted as F HRC ;

[0050] Calculate the deviation of the power grid frequency F and F HRC as the actual deviation of the high-speed clock HRC inside the CPU unit.

[0051] Further, the calculation of the frequency average in n time windows t is specifically:

[0052] Calculate the frequency in a single time window t, when the frequency deviation collected for n consecutive times is less than 5%, calculate the frequency average, otherwise, continue to collect.

[0053] In specific implementation:

[0054] When the external crystal is normal: the CPU collects the level of pin 12 in Figure 1 , 6000 rising edges are continuously collected for 2 minutes, and then the power grid frequency at that time is calculated by taking the average. The maximum value and the minimum value of the data of 20 consecutive times are compared, if the deviation exceeds a certain threshold, the data is invalid, the power grid frequency F is not updated, and the collection continues.

[0055] When the external crystal does not work: the CPU switches to the internal high-speed clock HRC, at this time, the level of pin 12 in Figure 1 is also collected, 6000 rising edges are continuously collected for 2 minutes, and then the power grid frequency F at that time is calculated by taking the average HRC , and then the proportional coefficient is obtained by using F / F HRC , and then the clock source of the chip's uart, timer and RTC is multiplied by the coefficient to ensure the normal work of the uart, timer and RTC.

[0056] The parts not involved in the application are the same as or can be realized by using the prior art.

Claims

1. An electric energy meter calibrating an internal clock source of a chip using a grid frequency, characterized by: It comprises: a metering unit connected to the power grid for detecting the voltage of the power grid and the zero-crossing signal of the power grid; the metering unit is connected to the CPU unit and sends the zero-crossing interrupt signal and the instantaneous data of the power grid; the CPU unit comprises an MCU chip U2 and a crystal oscillator X1, the MCU chip U2 has a high-speed clock HRC inside; the CPU unit receives the zero-crossing interrupt signal sent by the metering unit and counts to obtain the frequency; measuring and storing a current grid frequency F based on the grid zero-crossing interrupt signal when the crystal X1 is working normally; and switching to an internal high-speed clock HRC as a working clock when the crystal X1 stops working, and measuring the frequency of the grid zero-crossing interrupt signal using the internal high-speed clock HRC to obtain a measured frequency F HRC , calculating an actual deviation of the internal high-speed clock HRC by comparing the measured frequency F HRC with the current grid frequency F, and calibrating a chip internal clock source of the CPU unit based on the actual deviation; the metering unit comprises a metering chip U1; the first and second pins of the metering chip U1 are connected to the power grid through resistance division for detecting the voltage of the power grid and the zero-crossing signal of the power grid; the thirteenth and fourteenth pins of the metering chip U1 are connected to the ninety-third and ninety-second pins of the MCU chip U2 in the CPU unit for UART communication; the twelfth pin of the metering chip U1 is connected to the ninety-sixth pin of the MCU chip U2 in the CPU unit for sending the zero-crossing signal of the power grid to the CPU unit as an interrupt signal; the tenth pin of the MCU chip U2 is connected to the first pin of the crystal oscillator X1 and one end of the capacitor C2, the eleventh pin of the MCU chip U2 is connected to the second pin of the crystal oscillator X1 and one end of the capacitor C1, the other end of the capacitor C1 is connected to the ground, and the other end of the capacitor C2 is also connected to the ground; the ninety-second and ninety-third pins of the MCU chip U2 are connected to the fourteenth and thirteenth pins of the metering chip U1 respectively for UART communication; the ninety-sixth pin of the MCU chip U2 is connected to the twelfth pin of the metering chip U1 for receiving the zero-crossing interrupt signal of the power grid.

2. The electric energy meter calibrating a chip internal clock source using grid frequency as claimed in claim 1, wherein: The zero-crossing signal of the power grid adopts a positive zero-crossing signal and / or a negative zero-crossing signal.

3. The electric energy meter calibrating a chip internal clock source using grid frequency as claimed in claim 1, wherein: The frequency of the crystal oscillator X1 is 32.768 KHz.

4. A method of calibrating an internal clock source of a chip using a grid frequency, the electric energy meter according to any one of claims 1-3, characterized in that: It comprises the following steps: S1, the CPU unit receives the zero-crossing interrupt signal sent by the metering unit and counts according to a preset time window t to obtain the frequency; S2, step S1 is repeatedly executed n times, and the frequency average in the n time windows t is calculated as the current power grid frequency F; S3, when the CPU unit internal crystal oscillator X1 stops working, the CPU unit uses the high-speed clock HRC inside the MCU chip U2 to collect the power grid frequency again according to step S1, denoted as F HRC ; The deviation of the grid frequency F from F HRC is calculated as the actual deviation of the high-speed clock HRC within the CPU unit.

5. The method of calibrating an on-chip clock source using the grid frequency as recited in claim 4, wherein: The time window t is 2 minutes.

6. The method of calibrating an on-chip clock source using the grid frequency as recited in claim 4, wherein: The number n is greater than 20.

7. The method of calibrating an on-chip clock source using the grid frequency as recited in claim 4, wherein: The calculation of the frequency average in the n time windows t is as follows: The frequency in a single time window t is calculated respectively, and when the frequency deviation of continuous n times of collection is less than 5%, the frequency average is calculated, otherwise, the collection is continued.

8. The method of calibrating an on-chip clock source using the grid frequency as recited in claim 4, wherein: Based on the actual deviation, the internal peripherals of the CPU unit are calibrated; the peripherals include a serial port, a timer and an RTC.

Citation Information

Patent Citations

  • Electric energy meter

    CN202502152U

  • Doubleclocking source sampling device for intelligent ammeter

    CN206311665U

  • Electric energy meter using power grid frequency to calibrate chip internal clock source

    CN220105153U