A method, system and device for collecting multi-channel lightning current based on single chip microcomputer

By setting thresholds in the microcontroller and using the analog watchdog function to generate interrupts, the problem of high pressure processing of microcontrollers in the prior art during high-speed sampling is solved, and the effect of efficiently collecting multi-channel lightning current data is achieved.

CN119757847APending Publication Date: 2025-04-04MIANYANG WEIBO ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510008928.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art puts a large processing pressure on the microcontroller during high-speed sampling, and usually can only achieve the acquisition of lightning strike signals, which is inefficient.

Method used

By setting a threshold for judging the starting position of the lightning strike current, the analog watchdog function of the microcontroller module generates an interrupt and starts the timer. After the timer reaches the preset time threshold, the timer interrupt is generated. You only need to judge the lightning strike current data before and within the two interrupts to record the complete lightning strike current waveform.

Benefits of technology

Improve data processing efficiency, allowing multiple lightning strike current data to be processed within the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119757847A_ABST
    Figure CN119757847A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-channel lightning current acquisition method, system and equipment based on a single-chip microcomputer, and specifically relates to the technical field of lightning current acquisition. The technical key points are: judging whether lightning current data is greater than a preset first current threshold value, and when the lightning current data is greater than the first current threshold value, generating a first analog watchdog interrupt and starting a first timer; judging whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold value, and obtaining a lightning current data point reaching the second current threshold value as the starting position of a lightning current waveform; when the first timer reaches a preset time threshold value, generating a timer interrupt, and judging whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches the preset second current threshold value, obtaining the end position of the lightning current waveform, extracting the lightning current data between the starting position of the lightning current waveform and the end position of the lightning current waveform, and obtaining the lightning current waveform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of lightning current collection, and in particular to a method, system and equipment for collecting multi-channel lightning current based on a single chip microcomputer. Background Art

[0002] Lightning current is the manifestation of electric current in the lightning discharge phenomenon. It has extremely high voltage and current intensity, and can release huge energy in a very short time, causing serious damage to humans and property. The formation of lightning current is closely related to the accumulation and discharge process of charges in the cloud. The duration of lightning current is usually only a few microseconds to hundreds of microseconds, which makes it extremely destructive when releasing energy. Lightning current monitoring equipment can monitor and record lightning activities in real time to prevent or reduce the hazards caused by lightning activities. Due to the wide spectrum and short duration of lightning current, it is difficult to sample its waveform.

[0003] At present, the waveform of lightning current is collected by single-chip microcomputer mainly through the high-speed sampling of single-chip microcomputer ADC to analyze the sampled data in real time. When the lightning current arrives, the starting position of the lightning current is recorded. When the lightning current ends, the ending position of the lightning current is recorded, thereby recording the entire lightning current waveform. The disadvantage of this method is that the pressure on the single-chip microcomputer while collecting and processing data under high-speed sampling is very high, and usually only one lightning signal can be collected.

[0004] Therefore, the present invention aims to provide a method, system and device for collecting multi-channel lightning current based on a single-chip microcomputer to solve the above-mentioned related problems. Summary of the invention

[0005] The technical problem to be solved by the present invention is that the prior art collects and processes data at the same time under high-speed sampling, which causes great processing pressure on the single-chip microcomputer, and usually can only realize the collection of one lightning signal, resulting in low efficiency. The present invention provides a multi-channel lightning current collection method, system and equipment based on a single-chip microcomputer, by setting a threshold for judging the starting position of the lightning current, and then using the analog watchdog function of the single-chip microcomputer module to generate an analog watchdog interrupt, and start the timer, and generate a timer interrupt after the timer reaches a preset time threshold. It only needs to judge the lightning current data before the first analog watchdog interrupt and the lightning current data within the two interrupts to record a complete lightning current waveform, thereby improving data processing efficiency; at the same time, due to the increase in data processing efficiency, the technical solution can process multi-channel lightning current data compared with the prior art in the same time.

[0006] The present invention is achieved through the following technical solutions:

[0007] A multi-channel lightning current acquisition method based on a single-chip microcomputer, the method is applied to a multi-channel lightning current acquisition device, the device includes a single-chip microcomputer module, the single-chip microcomputer module is provided with multiple ADC current acquisition ports, the multiple ADC current acquisition ports are used to collect multi-channel lightning current data, the method includes:

[0008] Determine whether the lightning current data is greater than a preset first current threshold, and when the lightning current data is greater than the first current threshold, generate a first analog watchdog interrupt, start a first timer in the first analog watchdog interrupt, and turn off the analog watchdog interrupt;

[0009] Determine whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain a lightning current data point that reaches the second current threshold as a starting position of a lightning current waveform;

[0010] When the first timer reaches a preset time threshold, a timer interrupt is generated, and it is determined whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and the lightning current data point that reaches the second current threshold is obtained as the end position of the lightning current waveform, and the lightning current data between the starting position of the lightning current waveform and the end position of the lightning current waveform are extracted to obtain the lightning current waveform, and the analog watchdog interrupt is turned on.

[0011] Furthermore, the single-chip microcomputer module adopts a single-chip microcomputer module with a simulated watchdog function.

[0012] Furthermore, the preset first current threshold is 150A.

[0013] Furthermore, the preset time threshold is 2 ms.

[0014] Furthermore, the preset second current threshold is 0A.

[0015] Furthermore, the lightning current data acquisition frequency is 2 MHz.

[0016] The present invention also provides a multi-channel lightning current acquisition system based on a single-chip microcomputer, which is used in any one of the above-mentioned lightning current acquisition methods based on a single-chip microcomputer, and the system comprises:

[0017] A first judgment module is used to judge whether the lightning current data is greater than a preset first current threshold value, and when the lightning current data is greater than the first current threshold value, a first analog watchdog interrupt is generated, a first timer is started in the first analog watchdog interrupt, and the analog watchdog interrupt is turned off;

[0018] The second judgment module is used to judge whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain the data point where the lightning current data reaches the second current threshold as the starting position of the lightning current waveform;

[0019] A third judgment module is used to generate a timer interrupt when the first timer reaches a preset time threshold, and judge whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and obtain a data point at which the lightning current data reaches the second current threshold as the end position of the lightning current waveform;

[0020] The lightning current waveform acquisition module is used to extract the lightning current data between the starting position and the ending position of the lightning current waveform, obtain the lightning current waveform, and turn on the analog watchdog interrupt.

[0021] The present invention also provides a computer device, comprising a system memory and a processor, wherein the system memory stores a computer program, and the processor implements the steps of any one of the above-mentioned methods when executing the computer program.

[0022] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any one of the methods described above are implemented.

[0023] The present invention also provides a computer program product comprising instructions, and when the instructions are executed by a computer device cluster, the computer device cluster executes any of the above methods.

[0024] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0025] In the present invention, by setting a threshold value for judging the starting position of the lightning current, and then using the analog watchdog function of the single-chip microcomputer module to generate an analog watchdog interrupt, and starting the timer, a timer interrupt is generated after the timer reaches a preset time threshold, and only the lightning current data before the first analog watchdog interrupt and the lightning current data within the two interrupts need to be judged to record a complete lightning current waveform, thereby improving data processing efficiency; at the same time, due to the increase in data processing efficiency, the present technical solution can process multiple lightning current data under the same time compared with the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without creative work. In the drawings:

[0027] Figure 1 This is a method flow chart of a multi-channel lightning current collection method based on a single chip microcomputer in this embodiment;

[0028] Figure 2 Schematic diagram of a lightning current waveform of a multi-channel lightning current acquisition method based on a single chip microcomputer in this embodiment;

[0029] Figure 3 This is a schematic diagram of module connection of a multi-channel lightning current acquisition system based on a single-chip microcomputer in this embodiment;

[0030] Figure 4 It is a structural schematic diagram of a computer device in this embodiment. DETAILED DESCRIPTION

[0031] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0032] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0033] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0034] Example 1

[0035] See also Figure 1-Figure 2As shown, this embodiment also provides a multi-channel lightning current acquisition method based on a single-chip microcomputer. The method is applied to a multi-channel lightning current acquisition device. The device includes a single-chip microcomputer module. The single-chip microcomputer module uses a single-chip microcomputer module with an analog watchdog function. The single-chip microcomputer module is provided with multiple ADC current acquisition ports. The multiple ADC current acquisition ports are used to collect multi-channel lightning current data. It should be noted that in this embodiment, the single-chip microcomputer module uses an STM32 single-chip microcomputer. In other embodiments, other single-chip microcomputer modules with analog watchdog functions can also be used. The method includes:

[0036] S1: determining whether the lightning current data is greater than a preset first current threshold value, and when the lightning current data is greater than the first current threshold value, generating a first analog watchdog interrupt, starting a first timer in the first analog watchdog interrupt, and disabling the analog watchdog interrupt;

[0037] It should be noted that, in this embodiment, the first current threshold is 150A, and in other embodiments it can also be set to 100A, 120A or 180A, without too many restrictions here; the lightning current data acquisition frequency is 2MHz, and in other embodiments it can be set according to actual conditions; at the same time, it should be noted that in order to prevent the interrupt from continuing to be generated after the first analog watchdog interrupt is generated when the lightning current data is greater than the first current threshold, the analog watchdog interrupt needs to be turned off.

[0038] Specifically, in this embodiment, the ADC analog watchdog of the STM32 microcontroller is used to set the first current threshold value to determine the starting threshold value of the lightning current. When the lightning current exceeds the starting threshold value, a first analog watchdog interrupt will be generated, and the collected lightning current data will be stored in a buffer area. The data position in the buffer area when the lightning current is triggered is determined according to the position of the first analog watchdog interrupt, that is, the starting position of the lightning current waveform is obtained.

[0039] S2: Determine whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain a lightning current data point that reaches the second current threshold as a starting position of the lightning current waveform;

[0040] It should be noted that, in this embodiment, the preset second current threshold is 0A.

[0041] Specifically, in this embodiment, the location point where the first simulated watchdog interrupt arrives is not the real starting position. The first starting threshold is 150A. Then the value of the starting point when the simulated watchdog interrupt arrives must be greater than 150A. Therefore, it is necessary to simulate the starting point recorded in the watchdog interrupt and then find a point near 0A as the real starting point.

[0042] S3: When the first timer reaches a preset time threshold, a timer interrupt is generated, and it is determined whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and the lightning current data point that reaches the second current threshold is obtained as the end position of the lightning current waveform, and the lightning current data between the starting position of the lightning current waveform and the end position of the lightning current waveform are extracted to obtain the lightning current waveform, and the analog watchdog interrupt is turned on.

[0043] It should be noted that in this embodiment, the preset time threshold is 2ms, and in other embodiments it can also be set to 1.5ms, 2.5ms or 3ms, without making too many restrictions here; at the same time, it should be noted that after obtaining the lightning current waveform, the analog watchdog interrupt needs to be turned on to perform lightning current judgment and record a lightning current waveform.

[0044] Specifically, in this embodiment, since the duration of the lightning current is very short, generally at the us level, a time threshold of 2ms is set, and a timer interrupt is generated after the first timer reaches 2ms. When the second analog watchdog interrupt is generated, it indicates that the lightning strike is over and the lightning current has been completely cached in the cache area.

[0045] At the same time, in this embodiment, when the lightning current data returns to 0, it can be determined that the waveform of the lightning current has ended; at the same time, in this embodiment, in order to record a more complete lightning current waveform, it can be advanced a little from the starting position of the lightning current to make the waveform more complete; the end position of the lightning current can be found from the starting position of the curve, and the end of the curve can be determined by finding a point near 0, or it can be pushed back a certain length after the end of the curve to make the curve waveform more complete.

[0046] Specifically, in this embodiment, by setting a threshold for determining the starting position of the lightning current, an analog watchdog function of the single-chip microcomputer module is used to generate an analog watchdog interrupt, and a timer is started. After the timer reaches a preset time threshold, a timer interrupt is generated. It is only necessary to determine the lightning current data before the first analog watchdog interrupt and the lightning current data within the two interrupts to record a complete lightning current waveform, thereby improving data processing efficiency.

[0047] At the same time, the existing technology uses a solution of collecting and processing at the same time to collect waveforms. If the sampling rate of the ADC is 2MHz, and it is assumed that a lightning waveform arrives within ten seconds, the most extreme case requires judging 2x10 7points are needed to record a complete lightning current waveform; if the present technical solution, i.e., the solution of first collecting and then processing, is adopted to collect the waveform, if a 2ms timer is used, then only about 2000 points at most need to be judged to record a complete lightning current waveform. Therefore, due to the increase in data processing efficiency, compared with the prior art, the present technical solution can process multiple lightning current data in the same time.

[0048] Example 2

[0049] See also Figure 3 As shown, this embodiment also provides a multi-channel lightning current collection system based on a single-chip microcomputer, which is used in any one of the above-mentioned lightning current collection methods based on a single-chip microcomputer, and the system includes:

[0050] A first judgment module 100 is used to judge whether the lightning current data is greater than a preset first current threshold value, and when the lightning current data is greater than the first current threshold value, a first analog watchdog interrupt is generated, a first timer is started in the first analog watchdog interrupt, and the analog watchdog interrupt is turned off;

[0051] The second judgment module 200 is used to judge whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain the data point where the lightning current data reaches the second current threshold as the starting position of the lightning current waveform;

[0052] The third judgment module 300 is used to generate a timer interrupt when the first timer reaches a preset time threshold, and judge whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and obtain the data point where the lightning current data reaches the second current threshold as the end position of the lightning current waveform;

[0053] The lightning current waveform acquisition module 400 is used to extract the lightning current data between the starting position and the ending position of the lightning current waveform, obtain the lightning current waveform, and enable the analog watchdog interrupt.

[0054] It should be noted that the modules in the system of Example 2 correspond to the steps in the method of Example 1. The steps in the method of Example 1 have been described in detail in Example 1. In this Example 2, the contents of the modules in the system will not be described in detail.

[0055] Example 3

[0056] See also Figure 4 As shown, this embodiment further provides a computer device, including a system memory 1005 and a processor 1001, wherein the system memory 1005 stores a computer program, and the processor 1001 implements the steps of any of the above methods when executing the computer program.

[0057] It should be noted that the processor 1001 is used to execute the steps in the above method embodiments according to the instructions in the program code. Alternatively, the processor 1001 implements the functions of each module / unit in the above system / device embodiments when executing the computer program.

[0058] Specifically, in this embodiment, the computer program may be divided into one or more modules / units, one or more modules / units are stored in the system memory 1005, and are executed by the processor 1001 to complete the present application. One or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.

[0059] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor 1001 and a system memory 1005. Those skilled in the art will appreciate that this does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include an input / output device 1003, a network access device 1002, a bus 1006, etc.

[0060] The processor 1001 may be a central processing unit (CPU), or other general-purpose processors 1001, digital signal processors 1001 (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor 1001 may be a microprocessor or any conventional processor, etc.

[0061] The system memory 1005 may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. The system memory 1005 may also be a storage device 1004 of the terminal device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the terminal device. Further, the system memory 1005 may also include both the internal storage unit of the terminal device and the storage device 1004. The system memory 1005 is used to store computer programs and other programs and data required by the terminal device. The system memory 1005 may also be used to temporarily store data that has been output or is to be output.

[0062] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0063] Example 4

[0064] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above methods are implemented.

[0065] Among them, the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, system or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk. Random Access Memory (RAM), Read-Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM), registers, hard disks, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above, or any other form of computer-readable storage medium known in the art.

[0066] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (ASIC). In an embodiment of the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system, or device.

[0067] Example 5

[0068] This embodiment also provides a computer program product including instructions. When the instructions are executed by a computer device cluster, the computer device cluster executes the method described in Embodiment 1.

[0069] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A multi-channel lightning current acquisition method based on a single chip microcomputer, characterized in that: The method is applied to a multi-channel lightning current acquisition device, the device includes a single-chip microcomputer module, the single-chip microcomputer module is provided with multiple ADC current acquisition ports, the multiple ADC current acquisition ports are used to collect multi-channel lightning current data, the method includes: Determine whether the lightning current data is greater than a preset first current threshold, and when the lightning current data is greater than the first current threshold, generate a first analog watchdog interrupt, start a first timer in the first analog watchdog interrupt, and turn off the analog watchdog interrupt; Determine whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain a lightning current data point that reaches the second current threshold as a starting position of a lightning current waveform; When the first timer reaches a preset time threshold, a timer interrupt is generated, and it is determined whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and the lightning current data point that reaches the second current threshold is obtained as the end position of the lightning current waveform, and the lightning current data between the starting position of the lightning current waveform and the end position of the lightning current waveform are extracted to obtain the lightning current waveform, and the analog watchdog interrupt is turned on.

2. The method for collecting multi-channel lightning current based on a single chip microcomputer according to claim 1 is characterized in that: The single-chip microcomputer module adopts a single-chip microcomputer module with an analog watchdog function.

3. The method for collecting multi-channel lightning current based on a single chip microcomputer according to claim 1 is characterized in that: The preset first current threshold is 150A.

4. The method for collecting multi-channel lightning current based on a single chip microcomputer according to claim 1 is characterized in that: The preset time threshold is 2ms.

5. The method for collecting multi-channel lightning current based on a single chip microcomputer according to claim 1, characterized in that: The preset second current threshold is 0A.

6. The method for collecting multi-channel lightning current based on a single chip microcomputer according to claim 1, characterized in that: The lightning current data acquisition frequency is 2MHz.

7. A multi-channel lightning current acquisition system based on a single-chip microcomputer, characterized in that: The system is used in a single-chip microcomputer-based lightning current collection method as described in any one of claims 1 to 6, and the system comprises: A first judgment module is used to judge whether the lightning current data is greater than a preset first current threshold value, and when the lightning current data is greater than the first current threshold value, a first analog watchdog interrupt is generated, a first timer is started in the first analog watchdog interrupt, and the analog watchdog interrupt is turned off; A second judgment module is used to judge whether the lightning current data before the first analog watchdog interrupt is generated reaches a preset second current threshold, and obtain the lightning current data point that reaches the second current threshold as the starting position of the lightning current waveform; A third judgment module is used to generate a timer interrupt when the first timer reaches a preset time threshold, and judge whether the lightning current data between the first analog watchdog interrupt and the timer interrupt reaches a preset second current threshold, and obtain the lightning current data point that reaches the second current threshold as the end position of the lightning current waveform; The lightning current waveform acquisition module is used to extract the lightning current data between the starting position and the ending position of the lightning current waveform, obtain the lightning current waveform, and turn on the analog watchdog interrupt.

8. A computer device comprising a system memory and a processor, wherein the system memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising instructions, characterized in that When the instructions are executed by a computer device cluster, the computer device cluster executes the method according to any one of claims 1 to 6.