Device and method for automatically capturing liquid crystal communication abnormity of electric energy meter
By automatically capturing the device and method for energy meter liquid crystal communication anomalies, combined with a logic analyzer, camera and Python monitoring program, the problem of difficult troubleshooting of energy meter liquid crystal abnormalities is solved, 24-hour uninterrupted monitoring and rapid location of abnormal causes are achieved, improving efficiency Stability of electricity consumption and accuracy of electricity bill collection.
Patent Information
- Application Number
- CN202411442173.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-21
AI Technical Summary
During the long-term operation of the electric meter LCD, the white screen and the screen may have abnormal phenomena such as scattered screens, and the screen is still and not refreshed. Due to the extremely low probability of occurrence, it is difficult to reproduce and check, resulting in abnormal data reading or equipment stopping operation, affecting the stability of power consumption. Sex and electricity charges.
Using a device and method to automatically capture energy meter LCD communication anomalies, combined with a logic analyzer, camera and Python monitoring program, the LCD driver chip communication waveform and LCD screen are collected in real time, and the anomaly is identified and recorded through image similarity comparison and optical character recognition. Communication waveform.
It achieves 24-hour uninterrupted monitoring, saves manpower and material resources, improves investigation efficiency and accuracy, can quickly locate the cause of communication abnormalities, and ensures the stability of electricity consumption and the accuracy of electricity bill collection.
Smart Images

Figure CN119335276A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric energy meters, and in particular provides a device and method for automatically capturing liquid crystal communication anomalies of electric energy meters. Background Art
[0002] During long-term operation, the LCD of the energy meter will occasionally experience abnormal phenomena such as screen distortion, blank screen, and static screen without refresh, and cannot recover by itself. Since the probability of occurrence is extremely low, it is usually difficult to reproduce and capture, making the problem very difficult to troubleshoot and locate. Ultimately, it manifests as abnormal reading of data or equipment stopping operation, which affects the stability of electricity consumption of electricity users and the electricity fee collection of power supply companies.
[0003] Analysis of the possible causes of the energy meter LCD failure is as follows:
[0004] 1) The power supply jitters, causing the LCD driver chip to lose power for a short time and the internal registers to reset;
[0005] 2) The reset pin of the LCD driver chip malfunctions, causing the internal register to reset;
[0006] 3) LCD communication is abnormal, causing various strange phenomena (such as flowery screen, white screen, frozen screen, etc.).
[0007] For the above fault causes, the general troubleshooting ideas are:
[0008] 1) For reasons 1) and 2), you can use an oscilloscope to monitor the power pin and reset pin, set them to level trigger mode, and monitor them for a long time. If this is the cause, it is easy to locate, there is no technical difficulty, and it is easy to operate;
[0009] 2) For reason 3), it is necessary to capture the communication waveform at the moment before the abnormality to make sense. For such a problem with an extremely low probability of occurrence, it is technically difficult to operate.
[0010] If we rely on human eyes to monitor, when we see the LCD screen display abnormality, we will pause the oscilloscope. This requires developers to stay on duty 24 hours a day. Moreover, since the probability of occurrence is extremely low, it may not be captured even after many days of continuous observation. This method is obviously not realistic and has low operability. Therefore, there is an urgent need for a more intelligent automated monitoring method. Summary of the invention
[0011] Analyze the possible causes of abnormal communication of the electric energy meter LCD. The common causes include the following:
[0012] a. Improper timing control (such as delay is too short or too long, or the timing is inconsistent with expectations due to other interruptions);
[0013] b. Multiple threads operating the LCD at the same time causes communication competition, and there is no mutex lock protection in the program;
[0014] c. Memory out of bounds causes display data to be abnormally rewritten.
[0015] If there is no general direction for the above reasons, it will be like looking for a needle in a haystack to troubleshoot them. However, if the communication waveform when the fault occurs can be captured, it will be possible to quickly determine which situation caused it, thereby narrowing the scope of problem investigation.
[0016] For this extremely small probability, it may take many days of continuous monitoring to capture the fault. If it is observed by human eyes, when an abnormality is found, the oscilloscope is manually stopped, which is obviously not smart enough. It is not realistic for personnel to stay on duty 24 hours a day. Therefore, a more intelligent automated monitoring method is urgently needed. The present invention proposes a device and method for automatically capturing abnormalities in the liquid crystal communication of an electric energy meter. The method of this patent is convenient, effective and highly operational.
[0017] Therefore, the present invention provides a device and method for automatically capturing abnormalities in liquid crystal communication of an electric energy meter to solve the above-mentioned problem.
[0018] On one hand, the present invention provides a device for automatically capturing abnormal communication of liquid crystal in an electric energy meter, the device comprising a logic analyzer, a camera, a monitoring system written in Python program, including an image acquisition system and an optical character recognition system, wherein:
[0019] The image acquisition system is responsible for real-time analysis of the image content captured by the camera and for image similarity comparison;
[0020] The optical character recognition system is responsible for performing OCR image text recognition on the images captured by the camera;
[0021] The Python monitoring system also has a logic analyzer recording control function.
[0022] Furthermore, the Python monitoring system is provided with a simulated mouse click program, which simulates the action of manually clicking a button by simulating the mouse click program, automatically stops the logic analyzer from recording the waveform, and thus completely records the communication waveform before the fault occurs.
[0023] On the other hand, the present invention provides a method for automatically capturing liquid crystal communication anomalies of an electric energy meter. The method captures the liquid crystal display screen of the electric energy meter, performs similarity comparison and OCR text recognition on the captured screen, identifies the abnormal situation, and collects the waveform diagram of the abnormal situation through a logic analyzer to determine the cause of the communication anomaly.
[0024] Furthermore, the implementation of the method comprises the following steps:
[0025] Step 1: Use a logic analyzer to collect the waveform of the communication pin of the LCD driver chip in real time;
[0026] Step 2: The monitoring system captures the LCD screen of the electric energy meter in real time through a camera;
[0027] Step 3: The monitoring system runs the Python monitoring program to analyze the image content captured by the camera in real time and compare the image similarity;
[0028] And perform OCR image text recognition through optical character recognition system;
[0029] Among them, Optical Character Recognition (OCR) refers to the process of analyzing and identifying image files containing text information to obtain text. It is a relatively mature technology with many corresponding algorithms. This patent uses the Tesseract engine for text recognition;
[0030] Step 4: When the optical character recognition system fails to recognize text content for N consecutive times, it is considered that the LCD screen has a distorted screen or a blank screen;
[0031] When the image similarity of the images captured by the camera is above M for N consecutive times, it is considered that the LCD screen has a static image without refreshing;
[0032] By simulating mouse clicks in the Python monitoring system, simulating human button clicks, the logic analyzer recording is automatically stopped, and the communication waveform before the fault occurs is fully recorded;
[0033] Step 5: Analyze the communication waveform recorded by the logic analyzer before the fault occurs, determine the cause of the communication anomaly, and query the fault analysis code.
[0034] Furthermore, the monitoring system converts the image read from the camera into a grayscale image, performs binarization on the image, and then performs OCR text recognition or similarity judgment.
[0035] Furthermore, the logic analyzer adopts a looping sampling method: according to a given memory size, the sampled data is continuously cached in the memory, and when the memory size threshold is exceeded, the earlier sampled data is deleted, which is equivalent to a FIFO pipeline.
[0036] Furthermore, the monitoring system extracts the coordinate position (x, y) of the pause button of the logic analyzer through a screen coordinate extraction tool, updates the extracted (x, y) coordinates to the two variables button_x and button_y in the program that simulate the mouse click, and simulates the mouse click when the monitoring program is running and captures the situation.
[0037] Furthermore, the monitoring system sets anti-shake and redundancy processing identification conditions, and only considers it abnormal when an abnormal situation is captured multiple times and meets the identification conditions for multiple times in a row.
[0038] Furthermore, the identification condition is:
[0039] If the text content cannot be recognized for N consecutive times, it is considered that the LCD screen is distorted or blank.
[0040] When the similarity of images captured by the camera for N consecutive times is above M, it is considered that the LCD has a static image and is not refreshed.
[0041] Furthermore, the communication pins of the liquid crystal driver chip include clock CLK, chip select CS, command / data indication A0, and data MOSI.
[0042] Compared with the prior art, the device and method for automatically capturing abnormalities in liquid crystal communication of electric energy meters of the present invention have the following outstanding beneficial effects:
[0043] The present invention combines "logic analyzer + camera + Python monitoring program" to build an automated monitoring system to replace human eye monitoring, which can achieve 7*24 hours of uninterrupted monitoring, save a lot of manpower and material resources, and is stable and reliable. This method provides a technical means for developers to track and troubleshoot hardware interface communication abnormalities. In addition, considering that the liquid crystal of the energy meter will generally cycle continuously (switch the liquid crystal display content every few seconds) under normal circumstances, the content may not be recognized or misidentified at the moment of switching. By introducing anti-shake processing, the accuracy of recognition is ensured. The present invention has the advantages of reasonable design, easy use, and strong operability. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the structural connection of the device of the present invention;
[0045] Figure 2 It is a program flow chart of the present invention for automatically capturing abnormalities of a liquid crystal screen with a flowery screen or a white screen;
[0046] Figure 3 It is a program flow chart of the present invention for automatically capturing abnormal static state of a liquid crystal screen;
[0047] Figure 4This is a schematic diagram of the PC software acquisition screen of the logic analyzer of the present invention;
[0048] Figure 5 It is a schematic diagram of abnormal waveform captured by the logic analyzer of the present invention. DETAILED DESCRIPTION
[0049] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0050] A device for automatically capturing abnormal communication of liquid crystal in electric energy meters, such as Figure 1 As shown, considering that the electric energy meter liquid crystal driver chips on the market are not the same, the corresponding hardware communication interfaces (such as SPI / I2C / UART / parallel port, etc.) are also different. Regardless of which hardware communication interface of the liquid crystal driver chip is used, the technical solution provided by this patent is applicable. The following takes the ST75161 liquid crystal driver chip as an example, which uses the SPI communication interface. The following are the specific implementation steps:
[0051] Step 1. Prepare relevant equipment and software, including:
[0052] A.8-channel Saleae logic analyzer with a maximum sampling frequency of 24MHz
[0053] b.saleae logic analyzer supporting PC software
[0054] c.USB camera
[0055] d.Screen Ruler screen coordinate acquisition tool
[0056] e.PyCharm software (used to run Python programs)
[0057] The above-mentioned related equipment and software are available in multiple options, and you can choose according to your own situation.
[0058] Step 2. Place the camera vertically above the electricity meter's LCD screen, adjust the focal length, and ensure that the camera can only see the characters on the electricity meter's LCD screen and cannot capture the text content around the LCD screen (when capturing a flowery screen or a white screen, this is determined by not being able to recognize characters).
[0059] Step 3. Cover the entire "electricity meter + camera" with opaque paper (actual measurements found that the LCD screen is easily affected by light, causing reflections and affecting recognition) to avoid misidentification.
[0060] Step 4. Connect the SPI communication pins on the LCD driver chip (including: clock CLK, chip select CS, command / data indication A0, data MOSI) to the logic analyzer. Here you need to make corresponding adjustments based on the driver chip you are using.
[0061] Step 5. Open the logic analyzer software, configure the corresponding acquisition channel, SPI working mode, sampling rate, acquisition depth (referring to the maximum computer memory size occupied. When the memory limit is exceeded, the early recording data will be deleted. Since we only need to care about the data of the first few minutes when the problem occurs, the memory does not need to be configured very large), etc. according to the connection situation, click the start button to perform the recording operation, such as Figure 4 The identified storage depth.
[0062] Generally, logic analyzers support three sampling modes:
[0063] 1) Looping sampling (according to a given memory size, the sampled data is continuously cached into the memory. When the memory size threshold is exceeded, the earlier sampled data is deleted, which is equivalent to a FIFO pipeline);
[0064] 2) Timer sampling (only collects data for a given time length, and stops sampling after the time is up);
[0065] 3) Tigger trigger sampling (stop sampling when the level of a configured pin changes, and only sample once);
[0066] The present invention selects the looping sampling mode.
[0067] Step 6. Use the screen coordinate extraction tool to extract the coordinate position (x, y) of the pause button of the logic analyzer, such as Figure 4 The pause button is located at (886,58).
[0068] Step 7. Open PyCharm software, update the (x, y) coordinates extracted above to the location point in the program that simulates the mouse click (such as the two variables button_x and button_y in the program code), and then run the pre-written automated monitoring program that captures certain exceptions (the judgment conditions in the Python program can be flexibly modified according to actual conditions).
[0069] Step 8: Continue monitoring until an exception is detected (such as Figure 2 In the process shown, if the text content cannot be recognized for N consecutive times, it is considered that the LCD screen is distorted or blank. Figure 3In the process shown, when the similarity of the images captured by the camera for N consecutive times is above M, it is considered that the LCD screen is still and not refreshed) and the program automatically stops collecting. In order to increase the accuracy of recognition, the program adds anti-shake and redundancy processing (where N=30, M=95%). It is considered abnormal only when the recognition conditions are met for multiple consecutive times.
[0070] like Figure 5 As shown, this is the abnormal waveform captured by the logic analyzer.
[0071] The source code of the Python program that automatically captures LCD screen distortion or white screen anomalies is as follows:
[0072] import cv2
[0073] importpytesseract
[0074] importpyautogui
[0075] from datetime import datetime
[0076] #Text recognition processing function
[0077] defdetect_text(image):
[0078] #Convert the image to grayscale
[0079] gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
[0080] # Binarize the image
[0081] _,binary=cv2.threshold(gray,170,255,cv2.THRESH_BINARY)
[0082]
[0083]
[0084]
[0085] Common changes and substitutions made within the scope of the scheme should be included in the protection scope of the present invention.
Claims
1. A device for automatically capturing abnormalities in liquid crystal communication of electric energy meters, characterized in that: The device comprises a logic analyzer, a camera, a monitoring system written in Python, including an image acquisition system and an optical character recognition system, wherein: The image acquisition system is responsible for real-time analysis of the image content captured by the camera and for image similarity comparison; The optical character recognition system is responsible for performing OCR image text recognition on the images captured by the camera; The Python monitoring system also has a logic analyzer recording control function.
2. The device for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 1 is characterized in that: The Python monitoring system is provided with a simulated mouse click program, which simulates the action of manually clicking a button and automatically stops the logic analyzer from recording the waveform, thereby completely recording the communication waveform before the fault occurs.
3. A method for automatically capturing abnormalities in liquid crystal communication of electric energy meters, characterized in that: The method captures the liquid crystal display screen of the electric energy meter, performs similarity comparison and OCR text recognition on the captured screen, identifies abnormal situations, and collects waveform diagrams of the abnormal situation through a logic analyzer to determine the cause of the communication abnormality.
4. The device and method for automatically capturing abnormal communication of liquid crystal of electric energy meter according to claim 3, characterized in that: The implementation of the method comprises the following steps: Step 1: Use a logic analyzer to collect the waveform of the communication pin of the LCD driver chip in real time; Step 2: The monitoring system captures the LCD screen of the electric energy meter in real time through a camera; Step 3: The monitoring system runs the Python monitoring program to analyze the image content captured by the camera in real time and compare the image similarity; And perform OCR image text recognition through optical character recognition system; Step 4: When the optical character recognition system fails to recognize text content for N consecutive times, it is considered that the LCD screen has a distorted screen or a blank screen; When the image similarity of the images captured by the camera is above M for N consecutive times, it is considered that the LCD screen has a static image without refreshing; By simulating mouse clicks in the Python monitoring system, simulating human button clicks, the logic analyzer recording is automatically stopped, and the communication waveform before the fault occurs is fully recorded; Step 5: Analyze the communication waveform recorded by the logic analyzer before the fault occurs, determine the cause of the communication anomaly, and query the fault analysis code.
5. The device and method for automatically capturing abnormal communication of liquid crystal of electric energy meter according to claim 4, characterized in that: The monitoring system converts the image read from the camera into a grayscale image, performs binarization on the image, and then performs OCR text recognition or similarity judgment.
6. The method for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 3, characterized in that: The logic analyzer adopts a looping sampling mode: according to a given memory size, the sampled data is continuously cached in the memory, and when the memory size threshold is exceeded, the earlier sampled data is deleted.
7. The method for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 5, characterized in that: The monitoring system extracts the coordinate position (x, y) of the pause button of the logic analyzer through a screen coordinate extraction tool, updates the extracted (x, y) coordinates to the two variables button_x and button_y in the program for simulating mouse clicks, and simulates a mouse click when the monitoring program is running and captures the situation.
8. The method for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 5, characterized in that: The monitoring system sets anti-shake and redundancy processing identification conditions, and only considers it abnormal when an abnormal situation is captured multiple times and meets the identification conditions for multiple consecutive times.
9. The method for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 5, characterized in that: The identification conditions are: If the text content cannot be recognized for N consecutive times, it is considered that the LCD screen is distorted or blank. When the similarity of images captured by the camera for N consecutive times is above M, it is considered that the LCD has a static image and is not refreshed.
10. The method for automatically capturing abnormalities in liquid crystal communication of electric energy meters according to claim 9, characterized in that: The communication pins of the liquid crystal driver chip include clock CLK, chip select CS, command / data indication A0, and data MOSI.