Voltage detection method, device, system, electronic device, readable storage medium and chip

By integrating microcontroller circuits and other related circuits in the voltage detection system, combining voltage sampling, temperature detection and time parameters, the problems of low accuracy and high development costs in detecting multiple isolated power supply voltages are solved, achieving higher detection accuracy and lower development costs.

CN119757846APending Publication Date: 2025-04-04CENT CHINA OPTOELECTRONICS TECH RES INST (CHINA STATE SHIPBUILDING CORP 717TH RES INST)
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411963321.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

Traditional voltage detection systems have low accuracy and high development costs when detecting the voltage of multiple isolated power supplies. Especially in airborne photoelectric pods, maintenance and upgrade difficulties are difficult due to reliance on imported chips.

Method used

A voltage detection method and system is designed, using a microcontroller circuit, a voltage sampling unit, a temperature sensor circuit and a level conversion circuit, integrating an analog-to-digital converter and a real-time clock, and combining voltage sampling, temperature detection and time parameters to achieve accurate detection of the voltage of multiple isolated power supplies.

Benefits of technology

It improves the accuracy of voltage detection of multiple isolated power supply, reduces development costs, reduces dependence on imported chips, and enhances the reliability and maintenance convenience of equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119757846A_ABST
    Figure CN119757846A_ABST
Patent Text Reader

Abstract

The present invention provides a voltage detection method, device, system, electronic device, readable storage medium and chip. The voltage detection method is used in a voltage detection system. The voltage detection system includes a voltage sampling unit, a single-chip circuit, a temperature sensor circuit and a level conversion circuit. The voltage detection method includes: obtaining multi-channel isolated power supply voltage; determining at least one voltage parameter through a voltage sampling unit and an analog-to-digital converter; determining at least one time parameter according to a real-time clock; determining at least one temperature parameter according to a temperature sensor; determining a voltage detection result according to a time parameter, a temperature parameter and a voltage parameter; and transmitting the voltage detection result to a host computer through a level conversion circuit. Through the scheme of the present invention, the accuracy of multi-channel isolated power supply voltage detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of isolated power supply voltage detection, and in particular to a voltage detection method, device, system, electronic equipment, readable storage medium and chip. Background Art

[0002] At present, the voltage detection system in the airborne optoelectronic pod often relies on imported chips. The voltage detection of the airborne optoelectronic pod integrated with a variety of advanced optoelectronic sensors is performed by assembling imported chips, which faces many difficulties in maintenance and upgrading. Once the imported chip fails, it will affect the normal operation of the entire optoelectronic pod. The traditional voltage detection system facilitated by imported chips can only be used for the detection of multiple non-isolated voltages. For multiple isolated power supply voltages, different reference grounds will lead to the existence of common-mode voltage. If the common-mode voltage exceeds the common-mode input range of the analog-to-digital converter, the comparator and other circuits inside the analog-to-digital converter will operate in the nonlinear region, resulting in erroneous conversion results, thereby affecting the accuracy of voltage detection and increasing the development cost of the voltage detection system. Summary of the invention

[0003] In view of this, the present invention aims to solve the problem of low accuracy and high development cost in detecting multi-channel isolated power supply voltages in a traditional voltage detection system facilitated by imported chips.

[0004] Specifically, the present invention is achieved through the following technical solutions:

[0005] A first aspect of the present invention provides a voltage detection method.

[0006] A second aspect of the present invention provides a voltage detection device.

[0007] A third aspect of the present invention provides a voltage detection system.

[0008] A fourth aspect of the present invention provides an electronic device.

[0009] A fifth aspect of the present invention provides a readable storage medium.

[0010] A sixth aspect of the present invention provides a chip.

[0011] The voltage detection method provided by the present invention is used in a voltage detection system. The voltage detection system includes a voltage sampling unit, a single-chip computer circuit, a temperature sensor circuit and a level conversion circuit. The single-chip computer circuit includes a single-chip computer. The voltage sampling unit, the temperature sensor and the level conversion circuit are electrically connected to the single-chip computer respectively. The single-chip computer integrates at least one analog-to-digital converter and at least one real-time clock. The temperature sensor circuit includes a temperature sensor. The voltage detection method includes: obtaining multiple isolated power supply voltages; determining at least one voltage parameter corresponding to the multiple isolated power supply voltages through the voltage sampling unit and the analog-to-digital converter; determining at least one time parameter according to the real-time clock; determining at least one temperature parameter according to the temperature sensor; determining a voltage detection result according to the time parameter, the temperature parameter and the voltage parameter; and transmitting the voltage detection result to a host computer through the level conversion circuit.

[0012] In some technical solutions, optionally, at least one voltage parameter corresponding to multiple isolated power supply voltages is determined through a voltage sampling unit and an analog-to-digital converter, including: collecting at least one isolated power supply voltage according to the voltage sampling unit to determine a non-isolated voltage parameter; initializing the analog-to-digital converter; configuring a preset value to determine that the analog-to-digital converter is in a calibration completion state; transmitting the non-isolated voltage parameter to the analog-to-digital converter for analog-to-digital conversion to determine the voltage parameter corresponding to the non-isolated voltage parameter.

[0013] In some technical solutions, optionally, at least one temperature parameter is determined based on a temperature sensor, including: determining that the configuration state of a general input / output pin connecting the temperature sensor to a single-chip microcomputer is a first mode; initializing the temperature sensor; determining that the configuration state of the general input / output pin is a second mode; in the second mode, the single-chip microcomputer obtains at least one temperature byte and converts the temperature byte into a temperature parameter.

[0014] In some technical schemes, optionally, the level conversion circuit determines the voltage detection result based on the time parameter, temperature parameter and voltage parameter, including: setting a voltage threshold; determining a voltage-temperature variation curve graph based on the time parameter, temperature parameter and voltage parameter; determining at least one time-voltage parameter based on the voltage-temperature variation curve graph; determining the voltage detection result based on at least one time-voltage parameter and the voltage threshold.

[0015] In some technical schemes, optionally, determining a voltage detection result based on at least one time voltage parameter and a voltage threshold includes: determining a first voltage parameter and a second voltage parameter based on the voltage threshold; when the time voltage parameter is less than the first voltage parameter or greater than the second voltage parameter, determining the first voltage detection result; when the time voltage parameter is less than the second voltage parameter and greater than the first voltage parameter, determining the second voltage detection result.

[0016] The second aspect of the present invention provides a voltage detection device, which includes: an acquisition module for acquiring multiple isolated power supply voltages; a voltage determination module for determining at least one voltage parameter corresponding to the multiple isolated power supply voltages through a voltage sampling unit and an analog-to-digital converter; a time determination module for determining at least one time parameter based on a real-time clock; a temperature determination module for determining at least one temperature parameter based on a temperature sensor; a result determination module for determining a voltage detection result based on a time parameter, a temperature parameter and a voltage parameter; and a result transmission module for transmitting the voltage detection result to a host computer through a level conversion circuit.

[0017] The third aspect of the present invention provides a voltage detection system, which includes a voltage sampling unit, a single-chip microcomputer circuit, a temperature sensor circuit and a level conversion circuit. The single-chip microcomputer circuit includes a single-chip microcomputer, and the voltage sampling unit, the temperature sensor and the level conversion circuit are electrically connected to the single-chip microcomputer respectively. The single-chip microcomputer integrates at least one analog-to-digital converter and at least one real-time clock. The temperature sensor circuit includes a temperature sensor; the voltage sampling unit includes at least one voltage divider circuit and an isolation sampling circuit corresponding to the voltage divider circuit; the single-chip microcomputer circuit also includes a power supply circuit, a crystal oscillator circuit, a reset circuit, a startup mode configuration circuit, a debugging circuit and a filtering circuit; the single-chip microcomputer circuit is connected to a host computer through a level conversion circuit; and a voltage detection device as in the second aspect.

[0018] In some technical schemes, optionally, the voltage detection system also includes: an indicator light circuit, an enable control circuit, a power supply circuit and a storage circuit; the indicator light circuit, the enable control circuit and the storage circuit are electrically connected to the single-chip computer respectively, and the display state of the indicator light circuit corresponds to the voltage detection result; the power supply circuit includes a first isolated power supply and a second isolated power supply, the first isolated power supply is connected to the input end of the isolation sampling circuit, and the second isolated power supply is connected to the output end of the isolation sampling circuit, the input end of the single-chip computer circuit, the input end of the level conversion circuit, the input end of the temperature sensor circuit, the input end of the indicator light circuit, the enable control circuit input end and the storage circuit input end.

[0019] An embodiment of the fourth aspect of the present invention provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction implements the steps in the first aspect when executed by the processor.

[0020] An embodiment of the fifth aspect of the present invention provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps in the first aspect are implemented.

[0021] An embodiment of the sixth aspect of the present invention provides a chip, the chip includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps in the first aspect.

[0022] The technical solution provided by the present invention brings at least the following beneficial effects:

[0023] The present invention proposes a voltage detection method, device, system, electronic device, readable storage medium and chip. According to the scheme of the present invention, a user can intuitively detect the voltage data of each channel in real time, discover voltage anomalies in time, prevent equipment damage due to overvoltage, undervoltage, overtemperature and other problems, and improve the reliability of the equipment and the accuracy of multi-channel isolated power supply voltage detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0026] Figure 1 A schematic diagram of a flow chart of a voltage detection method provided by an embodiment of the present invention;

[0027] Figure 2 A schematic diagram of a portion of the flow chart of a voltage detection method provided by an embodiment of the present invention;

[0028] Figure 3 A schematic diagram of a portion of the flow chart of a voltage detection method provided by an embodiment of the present invention;

[0029] Figure 4 A schematic diagram of a portion of the flow chart of a voltage detection method provided by an embodiment of the present invention;

[0030] Figure 5 A schematic diagram of a portion of the flow chart of a voltage detection method provided by an embodiment of the present invention;

[0031] Figure 6 A schematic block diagram of the structure of a voltage detection device provided by an embodiment of the present invention;

[0032] Figure 7 A schematic block diagram of the structure of an electronic device provided by an embodiment of the present invention;

[0033] Figure 8 A schematic block diagram of the structure of a voltage detection system provided by an embodiment of the present invention;

[0034] Fig. 9 A schematic block diagram of the structure of a voltage detection system provided by an embodiment of the present invention;

[0035] Fig.10 A topological diagram of a voltage detection system provided by an embodiment of the present invention;

[0036] Fig.11 A schematic diagram of a portion of the flow chart of a voltage detection method provided by an embodiment of the present invention;

[0037] Fig.12 A topological diagram of a single chip microcomputer circuit provided by an embodiment of the present invention

[0038] in, Figures 6 to 9 The corresponding relationship between the component names and numbers in is as follows:

[0039] 900: voltage detection device; 902: acquisition module; 904: voltage determination module; 906: time determination module; 908: temperature determination module; 910: result determination module; 912: result transmission module; 1000: electronic device; 1109: memory; 1110: processor; 3000: voltage detection system; 3002: single chip circuit; single chip 30022; 3004: voltage sampling unit; 3006: temperature sensor circuit; 3008: crystal oscillator circuit; 301 0: level conversion circuit; 3012: power supply circuit; 3014: indicator light circuit; 3016: enable control circuit; 3018: storage circuit; 4000: host computer; 4002: power supply circuit; 4004: reset circuit; 4006: filter circuit; 4008: startup mode configuration circuit; 4010: first isolated power supply; 4012: second isolated power supply; 4014: voltage divider circuit; 4016: isolated sampling circuit; 5000: analog-to-digital converter; 5002: real-time clock. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] See also Figure 1In a first aspect, the present invention provides a voltage detection method for a voltage detection system, wherein the voltage detection system comprises a voltage sampling unit, a single-chip circuit, a temperature sensor circuit and a level conversion circuit, wherein the single-chip circuit comprises a single-chip, the voltage sampling unit, the temperature sensor and the level conversion circuit are electrically connected to the single-chip respectively, the single-chip integrates at least one analog-to-digital converter and at least one real-time clock, the temperature sensor circuit comprises a temperature sensor, and the voltage detection method comprises the following steps:

[0042] Step S100: obtaining multiple isolated power supply voltages;

[0043] Step S102: determining at least one voltage parameter corresponding to the multi-channel isolated power supply voltage through a voltage sampling unit and an analog-to-digital converter;

[0044] Step S104: determining at least one time parameter according to the real-time clock;

[0045] Step S106: determining at least one temperature parameter according to the temperature sensor;

[0046] Step S108: determining a voltage detection result according to a time parameter, a temperature parameter and a voltage parameter;

[0047] Step S110: transmitting the voltage detection result to the host computer through the level conversion circuit.

[0048] According to the voltage detection method provided by the present invention, an airborne optoelectronic pod is connected through a voltage detection system, and real-time voltage detection is performed on the optoelectronic sensor device in the airborne optoelectronic pod. The optoelectronic sensor device is, for example, an infrared thermal imager, a visible light camera, a laser rangefinder, and other high-precision identification or detection devices. The voltage detection method is implemented through the voltage detection system to realize real-time detection of multiple isolated voltages, and monitor the change trend of each voltage with temperature and time, and warn of abnormal conditions, so that users or operators can timely understand the abnormal voltage conditions in the airborne optoelectronic pod. Specifically, at least one isolated power supply voltage in the airborne optoelectronic pod is determined by a voltage sampling unit, and the collected isolated voltage is converted into a non-isolated voltage within a reference voltage range that can be recognized by a single-chip microcomputer, such as 0.1V, 1V, and 3.3V, and the reference voltage range is 0V to 3.3V. When the single-chip microcomputer receives the analog sampling voltage, the analog voltage is converted into a digital voltage by an analog-to-digital converter (ADC) integrated in the single-chip microcomputer, and the digital voltage data is calculated and processed to obtain the actual voltage value. The real-time clock (RTC) integrated in the microcontroller is controlled to obtain time data, and the actual time is obtained by calculating and processing the time data. The microcontroller collects two bytes of temperature data through an external temperature sensor, and calculates and processes the temperature data to obtain the actual temperature. After collecting at least one voltage parameter, time parameter and temperature parameter, the data is sent to the SerialPlot software on the PC through the serial port (USART) of the microcontroller and the external level conversion circuit to convert it into a visual curve chart of voltage corresponding to time and temperature, realizing real-time monitoring of voltage-temperature-time.

[0049] It can be understood that through the voltage detection method, users can intuitively monitor the voltage data of each line in real time, promptly detect voltage anomalies, cut off the faulty power output, prevent equipment damage due to overvoltage, undervoltage, overtemperature and other problems, and improve the reliability of the equipment.

[0050] In some embodiments, optionally, Figure 2 As shown, at least one voltage parameter corresponding to the multi-channel isolated power supply voltage is determined by a voltage sampling unit and an analog-to-digital converter, including:

[0051] Step S1024: collecting at least one isolated power supply voltage according to the voltage sampling unit to determine a non-isolated voltage parameter;

[0052] Step S1026: Initialize the analog-to-digital converter;

[0053] Step S1028: configuring a preset value and determining that the analog-to-digital converter is in a calibration completion state;

[0054] Step S1030: transmitting the non-isolated voltage parameter to an analog-to-digital converter for analog-to-digital conversion to determine a voltage parameter corresponding to the non-isolated voltage parameter.

[0055] In this embodiment, the voltage sampling unit collects voltage from the photoelectric sensor device in the airborne photoelectric pod, determines at least one non-isolated voltage parameter, and converts the non-isolated voltage parameter into a measured voltage value through an analog-to-digital converter, specifically including: converting the front-end multi-channel isolated power supply voltage into the back-end non-isolated sampling voltage through the voltage sampling unit. Because the single-chip microcomputer needs to have a consistent signal reference point when measuring multi-channel voltages. If the reference ground of the multi-channel voltage signal is different, the analog-to-digital converter (ADC) in the single-chip microcomputer cannot correctly judge the size of each signal relative to the same reference potential, and the voltage cannot be accurately measured. The chip can realize the common ground of the back-end multi-channel sampling voltage without affecting the isolation of each power supply at the front end. The main chip model in the voltage sampling unit used in the voltage detection system in this application is NSI1312S of Nanochip Micro, which is an isolated voltage sampling amplifier that uses capacitive isolation technology to achieve electrical isolation of input and output. The sampling voltage does not need to be converted into differential input and output, and then converted into a single-ended signal through an operational amplifier, which saves cost and space for circuit design. The process of the ADC in the single-chip microcomputer converting at least one non-isolated voltage into an actual voltage includes: initializing GPIO and configuring the corresponding I / O pin to analog input mode. Initializing the ADC, it is necessary to enable the ADC clock, configure ADC parameters, configure the ADC channel and calibrate the ADC; the ADC parameters include: resolution, conversion mode, scanning mode and sampling time. After completing the initialization of the ADC and making the ADC reach the calibration completion state, start the ADC conversion, read the ADC data register to obtain the converted voltage digital quantity, and calculate the measured voltage value according to the reference voltage and resolution of the ADC, that is, at least one voltage parameter.

[0056] In some embodiments, optionally, Figure 3 As shown, determining at least one temperature parameter according to a temperature sensor includes:

[0057] Step S1062: Determine that the configuration state of the general input / output pins connecting the temperature sensor and the single-chip microcomputer is the first mode;

[0058] Step S1064: Initialize the temperature sensor;

[0059] Step S1066: Determine that the configuration state of the general input and output pin is the second mode;

[0060] Step S1068: In the second mode, the single chip microcomputer obtains at least one temperature byte and converts the temperature byte into a temperature parameter.

[0061] In this embodiment, temperature sampling through the temperature sensor specifically includes: initializing the general input and output (GPIO) pin of the single-chip microcomputer corresponding to the temperature sensor, configuring the single-chip microcomputer I / O pin connected to the temperature sensor data pin to a push-pull output mode (i.e., the first mode); initializing the temperature sensor, sending a reset signal to the temperature sensor through the single-chip microcomputer; when a temperature conversion command is sent to the temperature sensor, the temperature sensor starts to perform temperature conversion, and the single-chip microcomputer I / O pin connected to the temperature sensor data pin is configured to a pull-up input mode (i.e., the second mode) for reading the 2-byte temperature data sent by the temperature sensor; converting the read two-byte temperature data into an actual temperature value through calculation and processing inside the single-chip microcomputer. Specifically, the single-chip microcomputer I / O pin connected to the temperature sensor data pin is configured to a push-pull output mode for sending a reset signal to the temperature sensor. The single-chip microcomputer pulls down the data pin for at least 480us, then releases the pin and waits for the temperature sensor to respond. If the temperature sensor pulls down the pin as a response within 15 to 60us, it indicates that the reset is successful. After the reset is successful, the single-chip microcomputer sends a temperature conversion command to the temperature sensor, and the temperature sensor starts to perform temperature conversion. After waiting for the temperature conversion to be completed, configure the MCU I / O pin connected to the temperature sensor data pin to the pull-up input mode to read the two bytes of temperature data sent by the temperature sensor. The temperature data is stored in the form of 16-bit binary complement, where the first 5 bits of the high byte are the sign bit and the low byte is the data bit. If the temperature value read is positive, the two bytes are directly combined to obtain the digital value of the actual temperature; if it is negative, a complement operation is required to obtain the digital value of the actual temperature. Finally, the read digital value is converted to obtain the actual temperature value.

[0062] In some embodiments, optionally, Figure 4 As shown, the level conversion circuit determines the voltage detection result according to the time parameter, the temperature parameter and the voltage parameter, including:

[0063] Step S1082: setting a voltage threshold;

[0064] Step S1084: determining a voltage-temperature variation curve according to the time parameter, the temperature parameter and the voltage parameter;

[0065] Step S1086: determining at least one time voltage parameter according to the voltage-temperature variation curve diagram;

[0066] Step S1086: Determine a voltage detection result according to at least one time voltage parameter and a voltage threshold.

[0067] In this embodiment, the level conversion circuit determines the voltage detection result according to the time parameter, temperature parameter and voltage parameter as follows: the voltage threshold set by the operator is obtained, the voltage threshold corresponds to the normal operating voltage range of each optoelectronic sensor device in the airborne optoelectronic pod, the voltage value sampled by the ADC, the temperature value obtained by the temperature sensor and the real-time time collected by the real-time clock (i.e., the RTC clock module) are converted into actual temperature, time and voltage values ​​after data processing, and sent out through the serial port, transmitted to the host computer or PC via the level conversion circuit, and the real-time data visualization tool (SerialPlot) is configured to draw these data into a curve chart of voltage changes with time and temperature, and the user or operator can intuitively monitor the change trend of voltage with time and temperature through the host computer PC. And the voltage on each circuit is monitored according to the time voltage parameter and the voltage threshold set by the operator to determine the voltage detection result, which includes normal voltage and abnormal voltage, and the system will automatically warn according to the voltage detection result.

[0068] In some embodiments, optionally, Figure 5 As shown, determining the voltage detection result according to at least one time voltage parameter and a voltage threshold comprises:

[0069] Step S10862: determining a first voltage parameter and a second voltage parameter according to a voltage threshold;

[0070] Step S10864: when the time voltage parameter is less than the first voltage parameter or greater than the second voltage parameter, determining the first voltage detection result;

[0071] Step S10866: When the time voltage parameter is less than the second voltage parameter and greater than the first voltage parameter, determine the second voltage detection result.

[0072] In this embodiment, the normal operating voltage range corresponding to each photoelectric sensing device is determined, and the minimum voltage within the range and the maximum voltage within the range are determined through the normal operating voltage range. The minimum voltage within the normal operating voltage range is the first voltage parameter, and the maximum voltage within the normal operating range is the second voltage parameter. When the time voltage parameter in the curve graph is less than the first voltage parameter or greater than the second voltage parameter, it is determined that the voltage state corresponding to the circuit at this time is an abnormal situation; when the time voltage parameter in the curve graph is less than the second voltage parameter and greater than the first voltage parameter, that is, the voltage is within the normal operating range, it is determined that the voltage state corresponding to the circuit at this time is a normal situation, and the time parameters and voltage parameters corresponding to the abnormal situation are uploaded to the host computer or PC.

[0073] like Figure 6As shown, the second aspect of the present invention provides a voltage detection device 900, which includes: an acquisition module 902, used to acquire multiple isolated power supply voltages; a voltage determination module 904, used to determine at least one voltage parameter corresponding to the multiple isolated power supply voltages through a voltage sampling unit and an analog-to-digital converter; a time determination module 906, used to determine at least one time parameter according to a real-time clock; a temperature determination module 908, used to determine at least one temperature parameter according to a temperature sensor; a result determination module 910, used to determine a voltage detection result according to a time parameter, a temperature parameter and a voltage parameter; a result transmission module 912, used to transmit the voltage detection result to a host computer through a level conversion circuit.

[0074] like Figure 8 As shown, the third aspect of the present invention provides a voltage detection system 3000, the voltage detection system 3000 includes a voltage sampling unit 3004, a single-chip circuit 3002, a temperature sensor circuit 3006 and a level conversion circuit 3010, the single-chip circuit 3002 includes a single-chip 30022, the voltage sampling unit 3004, the temperature sensor circuit 3006 and the level conversion circuit 3010 are respectively electrically connected to the single-chip circuit 3002, and the single-chip 30022 integrates at least one analog-to-digital converter 5000 and at least one Real-time clock 5002, temperature sensor circuit 3006 includes a temperature sensor; voltage sampling unit 3004 includes at least one voltage divider circuit 4014 and an isolation sampling circuit 4016 corresponding to the voltage divider circuit; single-chip circuit 3002 also includes a power supply circuit 4002, a reset circuit 4004, a filter circuit 4006, a crystal oscillator circuit 3008 and a startup mode configuration circuit 4008; single-chip circuit 3002 is connected to the host computer 4000 through a level conversion circuit 3010; and a voltage detection device as in the second aspect.

[0075] In this technical solution, the single-chip microcomputer circuit 3002 serves as the core of the entire system, and internally inherits the analog-to-digital converter (ADC), general purpose input output interface (GPIO), timer (TIM), real-time clock (RTC), universal synchronous / asynchronous receiver / transmitter (USART), serial peripheral interface (SPI), etc. To achieve the above-mentioned purpose, the single-chip microcomputer model of the single-chip microcomputer circuit 3002 used in this application is QJ32F103CBT6 of China Electronics 58 Institute. The ADC detects multiple non-isolated voltage data, the temperature sensor circuit 3006 detects real-time temperature data, and the real-time clock 5002 in the single-chip circuit 3002 collects time data. The data is processed inside the single-chip circuit and converted into actual temperature, time, and voltage values. Finally, the collected temperature, time, and voltage are transmitted to the host computer 4000 after level conversion through the level conversion circuit 3010. The host computer 4000 can be a PC terminal for operators to perform visual observation. In this application, the temperature sensor circuit 3006 uses the domestically produced temperature sensor CS18B20S (W) of China Electronics 58 Institute. The digital conversion accuracy and temperature measurement speed can be set by configuring the register. In the initial stage of the communication between the single-chip microcomputer 30022 and the CS18B20S (W), including the reset operation and the command sending stage, the I / O pin of the single-chip microcomputer 30022 is configured as a push-pull output mode. When the temperature sensor 3006 sends data to the single-chip microcomputer 30022, the I / O pin is configured as a pull-up input mode. According to the data format of the temperature sensor, the two bytes received are combined and converted into the actual temperature. By converting the above temperature, time, and voltage values ​​into a curve chart corresponding to the change of temperature and voltage over time, the user or operator can intuitively detect the change trend of voltage over time and temperature through the PC end. Among them, the voltage sampling unit 3004 includes an isolated sampling chip, and the main function of the isolated sampling chip is to convert the front-end multi-channel isolated power supply voltage into the back-end non-isolated sampling voltage, and the front end and the back end are completely electrically isolated. When the single-chip microcomputer measures multi-channel voltage, a consistent signal reference point is required. If the reference grounds of multiple voltage signals are different, the ADC (analog-to-digital converter) in the microcontroller cannot correctly determine the size of each signal relative to the same reference potential, and the voltage cannot be accurately measured. This chip can realize the common ground of multiple sampling voltages at the back end without affecting the isolation of each power supply at the front end. The isolation sampling chip model used in this application is the NSI1312S isolation sampling chip of Nanochip Micro.

[0076] It can be understood that by using the single-chip microcomputer QJ32F103CBT6 of China Electronics 58 Institute and the isolated sampling chip NSI1312S of Nanochip to form the core components of the voltage detection system, combined with the domestically produced temperature sensor CS18B20S(W) of China Electronics 58 Institute to realize a domestically produced multi-channel isolated power supply voltage detection system, miniaturized device packaging, so that the design size of the entire board reaches 70mm×70mm×10.8mm, reducing the design cost caused by imported chips and improving the reliability and stability of the voltage detection system.

[0077] Among them, the single-chip microcomputer QJ32F103CBT6 and the chip NSI1312S are more affordable than some high-end foreign voltage detection circuits while meeting performance requirements, which can reduce the overall solution cost; the ADC accuracy of the single-chip microcomputer QJ32F103CBT6 can reach 12 bits, and the chip NSI1312S can improve the accuracy of isolated voltage detection; the single-chip microcomputer QJ32F103CBT6 has 16 ADC channels, and the chip NSI1312S can provide multiple isolated voltage detection channels, which is suitable for multi-voltage monitoring scenarios, and can effectively isolate circuits of different voltage levels to ensure system stability and safety.

[0078] In some technical solutions, optionally, as Fig. 9 As shown, the voltage detection system 3000 also includes: an indicator light circuit 3014, an enable control circuit 3016, a power supply circuit 3012 and a storage circuit 3018; the indicator light circuit 3014, the enable control circuit 3016 and the storage circuit 3018 are electrically connected to the single-chip computer 30022 respectively, and the display state of the indicator light circuit 3014 corresponds to the voltage detection result in the voltage detection method of the first aspect; the power supply circuit 3012 includes a first isolated power supply 4010 and a second isolated power supply 4012, the first isolated power supply 4010 is connected to the input end of the isolation sampling circuit 4016, and the second isolated power supply 4012 is connected to the output end of the isolation sampling circuit 4016, the input end of the single-chip computer circuit 3002, the input end of the level conversion circuit 3010, the input end of the temperature sensor circuit 3006, the input end of the indicator light circuit 3014, the input end of the enable control circuit 3016 and the input end of the storage circuit 3018.

[0079] In this embodiment, the indicator light circuit 3014 , the enable control circuit 3016 and the storage circuit 3018 are respectively connected to the single chip computer 30022 , and the abnormal voltage detected by the detection system is visually displayed through the indicator light circuit 3014 . Specifically, an I / O control circuit is composed of an indicator light circuit 3014 and an enable control circuit 3016. The indicator light circuit 3014 connects the negative poles of the four LEDs to the four I / O pins of the microcontroller respectively, and the pins are configured as a push-pull output mode. When the actual voltage value obtained by the ADC is within the set normal voltage threshold range, the I / O pin is controlled to output a low level, and the LED is always on. The time voltage parameter in the corresponding curve diagram is less than the second voltage parameter and greater than the first voltage parameter, that is, the voltage is within the normal operating range, and it is determined that the voltage state corresponding to the circuit at this time is normal; when the actual voltage value obtained by the ADC is lower than or higher than the threshold voltage, the timer is set to output a PWM wave so that the LED presents the effect of a breathing light, thereby giving an early warning, and the result of the circuit detecting the voltage is visualized. When the time voltage parameter in the corresponding curve diagram is less than the first voltage parameter or greater than the second voltage parameter, it is determined that the voltage state corresponding to the circuit at this time is abnormal. The enable control circuit 3016 connects the optocoupler control end of each isolated power supply to the four I / O pins of the microcontroller respectively, and configures the pins to push-pull output mode. When the actual voltage value obtained from the ADC is not within the normal threshold range, the corresponding I / O pin outputs a low level, the primary side of the optocoupler is turned on, and the secondary side enable signal and ground are turned on, so that the output of the corresponding power supply can be turned off. In this way, the power supply is cut off in time to avoid the equipment being in an abnormal voltage state for a long time, which may cause damage to the subsequent board or sensor. The power supply models selected for the power supply circuit 3012 are the Hongda isolation power supply modules CMJB1-5S3R3SXM and CMR3-5S3R3SXM. The first isolation power supply 4010 supplies power to the input end of the isolation sampling chip through the Hongda isolation power supply module CMJB1-5S3R3SXM. The second isolation power supply 4012 supplies power to the output end of the isolation sampling chip, the single-chip computer 30022, the storage circuit 3018 and the level conversion circuit 3010 through the Hongda isolation power supply module CMR3-5S3R3SXM. By supplying power separately from the first isolation power supply 4010 and the second isolation power supply 4012, the front-end multi-channel isolation voltage is converted into the back-end non-isolated sampling voltage, and the front end and the back end are completely electrically isolated. The voltage, temperature and time data are stored in real time through the storage circuit 3018, which is convenient for users or operators to read and analyze later. The main chip of the storage circuit 3018 in this application adopts Shenzhen Guowei's domestically produced chip SM25QH256MX, and the storage circuit 3018 is connected to the I / O pin of the microcontroller with SPI communication interface function.

[0080] It can be understood that the power supply circuit 3012 and the storage circuit 3018 in the voltage detection system 3000 are also domestic products, which can reduce development costs and improve the adaptability of the system and the reliability of the equipment.

[0081] In a specific embodiment, the voltage detection system is as follows: Fig.10 As shown in the figure, the circuit consists of a power supply circuit, a voltage divider circuit, an isolation sampling circuit, a single-chip microcomputer circuit, an I / O control circuit, a temperature sensor circuit, a storage circuit and a level conversion circuit, wherein the I / O control circuit includes an indicator light circuit and an enable control circuit. The core components of the circuit are the isolation sampling chip NSI1312S of Nanochip Micro and the single-chip microcomputer QJ32F103CBT6 of China Electronics 58 Institute.

[0082] The main function of the isolated sampling chip is to convert the front-end multi-channel isolated power supply voltage into the back-end non-isolated sampling voltage, and the front-end and the back-end are completely electrically isolated. When the ADC in the microcontroller measures multi-channel voltages, a consistent signal reference point is required. If the reference grounds of the multi-channel voltage signals are different, the ADC in the microcontroller cannot correctly judge the size of each signal relative to the same reference potential, and the voltage cannot be accurately measured. This chip can realize the common ground of the back-end multi-channel sampling voltage without affecting the isolation of the front-end power supplies.

[0083] As the core of the whole system, the microcontroller integrates many peripherals such as ADC, GPIO, TIM, RTC, USATR, SPI, etc. In this design, ADC (analog-to-digital converter) is used to detect multiple non-isolated voltage data; GPIO (general I / O port) is used for LED display and control of the on and off of each power supply; TIM (timer) is used for timing interrupt trigger and PWM signal generation, which determines the acquisition of data, transmission of data, control of indicator light breathing time, etc.; RTC real-time clock is mainly used to provide accurate time information and realize timestamp recording function; USATR (universal synchronous asynchronous serial port) can send processed data to realize communication function with external devices. SPI (serial communication interface) transfers voltage, temperature, time and other data in the microcontroller to external FLASH for storage, which is convenient for subsequent faster fault location and repair.

[0084] Specifically, the total input power of the power supply circuit is +5V. Four Hongda isolated power modules CMJB1-5S3R3SXM are selected to power the input ends of the four isolated sampling chips respectively. The input voltage range of this isolated power module is 4.5~5.5V, the output voltage is 3.3V, the output current is 20~300mA, the operating temperature is -55~+125℃, and the size is 11.6×6.0×10.0mm. One Hongda isolated power module CMR3-5S3R3SXM is selected to power the output ends of the four isolated sampling chips, the single-chip microcomputer, the Flash memory and the level conversion chip. The input voltage range of this isolated power module is 4.5~9.0V, the output voltage is 3.3V, the output current is 910mA, the operating temperature is -55~+105℃, and the size is 12.7×12.7×10.8mm. The use of separate power supply can ensure the electrical isolation of the input and output ends of the isolated sampling chip without affecting the isolation of the front-end power supplies under test.

[0085] The voltage divider circuit is mainly used to proportionally reduce the larger input voltage such as ±28V, ±15V, ±5V to the measurable range of the microcontroller ADC (0-3.3V). The voltage divider circuit is usually composed of two or more resistors. According to Ohm's law, in a series circuit, the voltage is distributed according to the resistance ratio. By selecting the appropriate resistance value, the input voltage is divided to the required size. The voltage divider resistors of this circuit use the fixed resistor RMK1608KB1002FMT of Zhenhua Yunke and the potentiometer TC163-W-10K of Sichuan Yongxing. By adjusting the potentiometer knob, the measured voltage value can be divided to the range of 0-3.3V. If the input voltage fluctuates, it may exceed the maximum allowable input voltage of the ADC. Connecting a Hongda voltage regulator diode BZT52B3V6 in parallel at both ends of the potentiometer can play a protective role. When the input voltage exceeds the voltage regulator value of the voltage regulator diode of 3.6V, the voltage regulator diode is turned on and the excess voltage is shunted, thereby limiting the voltage input to the ADC and preventing the ADC from being damaged due to overvoltage.

[0086] The isolated sampling circuit uses the NSI1312S main chip of Nanochip Microelectronics and peripheral circuits to implement it. This chip is an isolated voltage sampling amplifier that uses capacitive isolation technology to achieve electrical isolation of input and output. It supports positive and negative voltage inputs and can be used for AC and DC voltage detection. It has a high input impedance characteristic and is suitable for connecting to a high-voltage voltage divider or other voltage signal source with high output impedance. While sampling high-voltage signals, it can also reduce the impact on the signal source. In addition, general isolation chips can only output differential signals, and the differential signals need to be converted into single-ended signals through op amps and then transmitted to the microcontroller. This chip can directly output single-ended voltage signals to the ADC I / O port of the microcontroller, without the need for additional op amps as intermediaries, saving cost and space for circuit design. It is widely used in automotive, industrial control, high-power power supply and other fields, such as automotive battery management systems, voltage detection of industrial automation equipment, output voltage detection of high-power power supplies and other scenarios.

[0087] The voltage sampling unit obtains at least one isolated power supply voltage, for example, isolated power supply voltage 1, isolated power supply voltage 2, isolated power supply voltage 3 and isolated power supply voltage 4, converts it into a non-isolated voltage and inputs it into the I / O pin corresponding to the ADC of the microcontroller, and configures the pins to analog input mode. The output pin of the isolated sampling circuit is connected to the I / O pin of the microcontroller, such as Fig.12 As shown, the corresponding four I / O pins of the microcontroller are PA3, PA4, PA5 and PA6, corresponding to the network labels ADC1_IN1, ADC1_IN2, ADC1_IN3 and ADC1_IN3 respectively;

[0088] Among them, most traditional voltage acquisition chips do not have electrical isolation functions, while NSI1312S, based on Nanochip's capacitive isolation technology, can achieve electrical isolation capabilities of up to 5000Vrms, which can effectively isolate the high voltage on the input side from the low voltage circuit on the output side, improve system reliability, and reduce the risk of interference and damage to the low voltage circuit caused by high voltage; NSI1312S supports a bidirectional linear input voltage range of ±1.2V, which can collect both DC voltage and AC voltage, and can also realize the phase loss detection function, broadening the application scenarios. Compared with some chips with lower input impedance, the high input impedance characteristics of NSI1312S make it suitable for connecting to high-voltage resistor dividers or other voltage signal sources with high output impedance, which can reduce the load effect on the signal source; the low offset and gain drift characteristics of NSI1312S ensure the measurement accuracy over the entire temperature range, and its typical SNR is 78dB, which can meet the needs of high-precision voltage acquisition and is better than some ordinary voltage acquisition chips. The chip has a high common-mode transient immunity (CMTI) of up to 150kV / us, which can provide accurate and reliable measurement results and improve measurement accuracy in harsh environments with noise interference such as high-power switches.

[0089] The single-chip microcomputer circuit is the core circuit of the multi-channel isolated power supply voltage detection and control system. The main chip selected is the domestically produced MCU QJ32F103CBT6 of China Electronics 58 Institute, with a maximum frequency of 72MHZ, including 37 fast I / O ports, 2 12-bit ADCs (ADC1 and ADC2), 3 general 16-bit timers and 1 PWM timer, and many standard communication interfaces: 2 I2C and 2 SPI interfaces, 3 UART interfaces, and 1 CAN interface. The operating temperature is -40~+85℃, and the power supply voltage is 2.0~3.6V. This design uses a 3.3V power supply voltage. In addition to the power supply circuit, it also includes a crystal oscillator circuit, a reset circuit, a startup mode configuration circuit, a debugging circuit, and a filter circuit. The main crystal oscillator of the crystal oscillator circuit provides the basic clock signal for the single-chip microcomputer, and the real-time clock crystal oscillator provides the clock signal for the RTC module to realize the functions of real-time clock and timestamp; the reset circuit is composed of RC circuit and button, which can realize automatic reset at power-on and manual reset, ensuring the normal operation of the system; the startup mode configuration circuit can select the startup mode of the single-chip microcomputer through the dip switch. This design pulls up the relevant configuration pins of the single-chip microcomputer and chooses to start from the internal FLASH; the debugging circuit uses the SW interface, and uses the PH2.54 connector to lead the SWDIO and SWCLK pins from the single-chip microcomputer and connect them to the STLink debugger to debug the program and burn the code; the filter circuit can filter out the noise on the power supply and signal lines, and provide the single-chip microcomputer with a relatively stable power supply and pure signal.

[0090] The I / O control circuit is mainly divided into Fig.10 The indicator light circuit and the enable control circuit in the system are respectively connected. For the indicator light circuit, the negative poles of the four LEDs are connected to the four I / O pins of the microcontroller, and these I / O pins are configured as push-pull output mode. When the actual voltage value obtained from the ADC is within the set normal voltage threshold range, the corresponding I / O pin is controlled to output a low level, and the LED is always on. When the actual voltage value obtained from the ADC is lower than or higher than the normal threshold voltage, the timer is set to output a PWM wave so that the LED presents a breathing light effect, which is used as an early warning; for the enable control circuit, the optocoupler control pins of each isolated power module are connected to the four I / O pins of the microcontroller, and these I / O pins are configured as push-pull output mode. When the actual voltage value obtained from the ADC is not within the normal voltage threshold range, the corresponding I / O pin is controlled to output a low level, the primary side of the optocoupler is turned on, and the secondary side enable signal and ground are turned on, and the output of the corresponding power supply can be turned off. In this way, timely cutting off the power supply can prevent the equipment from being in an abnormal voltage state for a long time, which may cause damage to the subsequent board or sensor. Among them, the negative pin of the indicator light circuit LED is connected to the I / O pin of the microcontroller, such as Fig.12As shown, the corresponding four I / O pins of the microcontroller are PB4, PB3, PA15 and PA14, corresponding to network labels IO1, IO2, IO3 and IO4 respectively; the control pin of the enable control circuit is connected to the I / O pin of the microcontroller, such as Fig.12 As shown, the corresponding four I / O pins of the microcontroller are PA7, PB0, PB1 and PB10, corresponding to network labels ENA1, ENA2, ENA3 and ENA4 respectively.

[0091] The main chip of the temperature sensor circuit uses the domestically produced temperature sensor CS18B20S (W) from China Electronics 58 Institute. It is a high-precision single-bus temperature measurement chip with an operating voltage of 3.3V and a temperature measurement range of -55℃ to +125℃. The digital conversion accuracy and temperature measurement speed can be set by configuring the register. The 4-channel temperature sensors are placed next to each isolated power module. Through the communication between the microcontroller and the temperature sensor, the change of voltage with temperature can be monitored in real time to determine whether the voltage abnormality is caused by the over-temperature protection of the module. In the initial stage of communication between the microcontroller and CS18B20S (W), including the reset operation and the command sending stage, the corresponding I / O pins of the microcontroller are configured to push-pull output mode. When the temperature sensor sends data to the microcontroller, the corresponding I / O pins of the microcontroller are configured to pull-up input mode. According to the data format of the temperature sensor, the two bytes of temperature data received are merged and converted into the actual temperature. Among them, the data bus pin of the temperature sensor is connected to the I / O pin of the microcontroller, such as Fig.12 As shown, the corresponding four I / O pins of the microcontroller are PB8, PB7, PB6 and PB5, corresponding to network labels DQ1, DQ2, DQ3 and DQ4 respectively.

[0092] The main chip of the storage circuit uses Shenzhen Guowei's domestically produced FLASH SM25QH256MX. It has a storage capacity of 32MB, a voltage range of 2.7V to 3.6V, an operating temperature range of -55℃ to +125℃, and is connected to the I / O pin of the microcontroller with SPI communication interface function. The main function of this circuit is to store multiple time data, temperature data and voltage data. When the device is powered off unexpectedly, the programs and data in the SM25QH256MX storage chip will not be lost and can be saved for a long time. The next time the power is turned on, by reading the corresponding data of the storage chip, it can be determined whether the equipment failure is caused by abnormal power supply voltage. Among them, the chip select pin, clock pin, data input pin and output pin of the storage chip are connected to the I / O pin of the microcontroller, such as Fig.12 As shown, the corresponding four I / O pins of the microcontroller are PB12, PB13, PB15 and PB14, which correspond to network labels SPI1_CS, SPI1_SCK, SPI1_MOSI and SPI1_MISO respectively.

[0093] The main chip of the level conversion circuit uses the domestically produced chip SM3490 produced by Shenzhen Guowei. The main function of this chip is to realize the conversion between TTL level and RS422 level. Connect the transmit pin TX of the microcontroller serial port USART to the receive pin RXD of the SM3490 chip, and connect the receive pin RX of USART1 to the transmit pin TXD of the SM3490 chip, so that the microcontroller and the host computer or PC can communicate with each other. The function of this circuit is to convert the time, temperature, voltage and other data sent by the microcontroller through the serial port from the TTL level standard to the RS422 level standard, and connect it to the host computer (or PC) through the RS422T+, RS422T-, RS422R+ and RS422R- interfaces to realize the communication between the microcontroller and the PC. The transmit and receive pins of the level conversion chip are respectively connected to the I / O pins of the microcontroller with serial port function, such as Fig.12 As shown, the corresponding two I / O pins of the microcontroller are PA10 and PA9, corresponding to the network labels USART1_RX and USART1_TX respectively.

[0094] In a specific embodiment, converting the time value, temperature value and voltage value into the corresponding curve graph through the serial port includes the following steps: Step 1: Installation and startup: Download the SerialPlot version of the corresponding system from the official website and install it. After the installation is complete, double-click the icon to open it; Step 2: Serial port settings: In the "Port" option of the SerialPlot main interface, select the serial port number according to the actual situation, and set the baud rate, parity, data bit, stop bit and other parameters. After the setting is completed, click the "OPEN" button on the right to open the serial port; Step 3: Data format setting: In the "Data Format" option, set the received data frame format. The voltage, temperature and time data of this voltage detection system are data streams composed of multiple different types of data, and each data is separated by a comma. Select "comma" as the delimiter to correctly parse the data received from the serial port; Step 4: Drawing settings: In the "Plot" option, there are multiple data stream channels (Channel0, Channel1, Channel2, etc.). For voltage data, select the first channel (Channel 0), rename it to "Voltage", and set the appropriate color to distinguish different data curves; for temperature data, select the second channel (Channel 1), rename it to "Temperature", and set the color as well; for time data, select the third channel (Channel 2), rename the channel name to "Time", and set the color and other display properties. Finally, according to the range of the data, adjust the horizontal and vertical axis range of each channel so that the curve can be fully displayed in the drawing area. For example, if the temperature range is 0-100℃, set the Y-axis range of the temperature channel to 0–100; Step 5: Start data acquisition and drawing: Start the data acquisition device so that it starts sending data including voltage, temperature, and time through the serial port. SerialPlot will automatically receive and parse these data, and then draw the voltage-temperature curves in the same coordinate system with time as the horizontal axis according to the set parameters such as channel and color, so that the relationship and change trend between the three can be observed intuitively; Step 6: Data recording and exporting: Click "Export CSV" in the "File" menu to export the waveform data into a CSV format file, which is convenient for further analysis and processing using Excel and other spreadsheet software.

[0095] In a specific embodiment, Fig.11 As shown, the voltage detection method includes:

[0096] Step S300: obtain voltage value; Step S302: obtain temperature value; Step S3042: timer interrupt; Step S3044: PWM waveform output; Step S306: obtain time value; Step S308: send data; Step S310: store data.

[0097] Among them, obtaining the voltage value includes: initializing GPIO, initializing ADC, starting ADC conversion, obtaining conversion results, and calculating voltage values. Initializing ADC includes: enabling ADC clock, configuring ADC parameters, configuring ADC channels, and calibrating ADC. Configuring ADC parameters also includes: setting resolution, setting conversion mode, setting scan mode, and configuring sampling time. Specifically, first enable the clock of the corresponding GPIO port and configure the selected GPIO pin to analog input mode. Then enable the ADC clock and configure the ADC working mode, conversion mode, trigger mode, data alignment and other parameters. Then reset the ADC calibration register, start the calibration and wait for the calibration to be completed to improve the ADC measurement accuracy. After the ADC configuration is completed, call the corresponding function to start the conversion, wait for the conversion to be completed by querying, read the value of the ADC data register, and obtain the conversion result. Finally, according to the reference voltage and resolution of the ADC, the ADC voltage data is converted into the actual voltage value, sent through the serial port, and the TTL level format of the microcontroller is converted into the RS422 level format that can be recognized by the PC through the level conversion chip. Conversion of voltage data For example: if the ADC resolution in the microcontroller is 12 bits, its digital output range is 0-4095 (2 12 ). Actual voltage value = (ADC_value*reference voltage) / ADC maximum digital value. Taking the reference voltage of 3.3V as an example, the actual voltage voltage = (ADC_value*3.3) / 4095.0. The processed voltage value is sent to the PC through the serial port (USART), and the voltage data is transmitted to the external FLASH storage chip through the SPI interface, so that the data will not be lost when the power is off.

[0098] Obtaining the temperature value includes: initializing GPIO, initializing the temperature sensor, sending a temperature conversion command, reading temperature data, and calculating the temperature value. Specifically, the MCU I\O pin connected to the temperature sensor data pin is configured as a push-pull output mode to send a reset signal to the temperature sensor. The MCU pulls down the data pin for at least 480us, then releases the pin and waits for the temperature sensor to respond. If the temperature sensor pulls down the pin in response within 15 to 60us, it indicates a successful reset. After the reset is successful, the MCU sends a temperature conversion command to the temperature sensor, and the temperature sensor starts to convert the temperature. After waiting for the temperature conversion to be completed, the MCU I\O pin connected to the temperature sensor data pin is configured as a pull-up input mode to read the two bytes of temperature data sent by the temperature sensor. The temperature data is stored in the form of a 16-bit binary complement, where the first 5 bits of the high byte are the sign bit and the low byte is the data bit. If the temperature value read is positive, the two bytes are directly combined to obtain the digital value of the actual temperature; if it is negative, a complement operation is required to obtain the digital value of the actual temperature. Finally, the read digital value is converted to obtain the actual temperature value. Conversion of temperature data: For example, the temperature data read by the microcontroller is in 16-bit binary format, including the integer part and the decimal part of the temperature. Positive temperature conversion: The resolution of the temperature sensor is 0.0625°C. For positive temperature, the formula for converting the read 16-bit data to the actual temperature is: actual temperature = (temp*0.0625). For example, if the read temperature data temp is 0x0190 (400 in decimal), the actual temperature is 400*0.0625=25.0°C. Negative temperature conversion: When the highest bit (sign bit) is 1, it means that the temperature is negative. First, the read data must be inverted and added by 1, then multiplied by 0.0625, and a negative sign is added to get the actual temperature. For example, the data read is 0xFF60, the highest bit is 1, first invert it to get 0x009F, add 1 to get 0x00A0 (decimal 160), then the actual temperature is -(160*0.0625) = -10.0℃. The processed temperature value is sent through the serial port (USART) of the microcontroller, and the temperature data is transmitted to the external FLASH storage chip through the SPI interface, so that the data will not be lost when the power is off.

[0099] Obtaining the time value includes: initializing GPIO, initializing RTC, setting the initial time and date, obtaining the real-time time, and processing the time data; specifically, enabling the GPIO port clock of the microcontroller used to connect the external crystal oscillator, and configuring the corresponding I / O pin to input mode. Enable the RTC clock through the RCC register, enable the power supply and backup area clock, allow access to the backup area, and then turn on the external low-speed crystal oscillator (LSE) as the RTC clock source. Before initializing the RTC, you need to wait for the RTC register to be synchronized. After using the flag bit to determine the synchronization, set the RTC pre-division coefficient. For example, if you use a 32.768KHZ LSE as the clock source, if you want the RTC to count once per second, the pre-division coefficient should be 32767. Set the initial time and date according to actual needs, and wait for the RTC time to be updated before reading the real-time time and date. Finally, convert the read time data into a format that is easier to process and display. For example, convert the seconds obtained from the RTC into the form of years, months, days, hours, minutes, and seconds through calculation. By Fig.12 It can be seen that the two I / O pins of the microcontroller connected to the external LSE crystal oscillator are PC14 and PC15, corresponding to the network labels OSC32_IN and OSC32_OUT respectively.

[0100] At least two timers are integrated inside the single-chip microcomputer of the present application, one of which is used for timing, and generates an interrupt at a fixed time to perform a specific task. For example, the single-chip microcomputer is set to send the real-time voltage, temperature, and time values ​​to the upper computer once every 1 second, corresponding to step S3042; the other timer is used to output a PWM waveform so that the indicator light can show the effect of a breathing light, so as to warn of abnormal voltage results, corresponding to step S3044.

[0101] Specifically, using a single-chip microcomputer to send real-time voltage values, temperature values, and time values ​​to the upper computer every 1 second is to generate an interrupt every 1 second through the timer to perform a specific task. The functions include: selecting the general timer TIM2; enabling the timer clock: enabling the clock of timer 2 through the RCC (reset and clock control) related registers; configuring the timer parameters: ① setting the counting mode: selecting the up counting mode. ② calculating and setting the pre-scaling coefficient and the automatic reload value: the system clock frequency is 72MHz. If you want to achieve 1 second of timing, first determine the clock frequency of the timer. If the pre-scaling coefficient is 72-1, the clock frequency of the timer is 72MHz÷72=1MHz, that is, the time for each timer to count is 1us. To achieve 1 second of timing, the automatic reload value should be 1000000-1 (because the count starts from 0); configuring the timer interrupt: ① enabling the timer interrupt: enabling the timer interrupt in the NVIC (nested interrupt vector controller). ②Set the interrupt priority: Set the priority of the timer interrupt according to the interrupt priority requirements of the system; Start the timer: Enable the timer; Write the interrupt service function: ①Define the interrupt service function: Define the interrupt service function for the timer according to the interrupt service function specification of the microcontroller. ②Check the interrupt flag and clear it: In the interrupt service function, first check whether the interrupt flag of the timer is set to determine whether it is a timer interrupt. If so, clear the interrupt flag. ③Execute a specific task: After clearing the interrupt flag, execute the task of sending voltage, temperature, and time values.

[0102] The specific steps of using the timer in the microcontroller to output PWM waveforms with different duty cycles include: selecting the general timer TIM3; enabling the timer clock: enabling the clock of the selected timer 3 through the RCC (reset and clock control) register; configuring the timer parameters: ① setting the counting mode: selecting the up counting mode. ② calculating and setting the pre-scaling coefficient and the automatic reload value: the system clock frequency is 72MHz, if you want to output a PWM with a frequency of 100Hz, the pre-scaling coefficient should be set to 72-1, and the automatic reload value should be set to 10000-1; configuring the PWM mode and channel parameters: ① selecting the PWM mode: for the timer TIM3 channel 1, set the PWM mode in the channel mode register (TIMx_CCMR1) of the timer. ② setting the channel polarity: determining whether the effective level of the output PWM is high or low. ③ enabling the channel output: enabling the channel output in the channel enable register (TIMx_CCER) of the timer; setting the duty cycle: the duty cycle D = CMP / ARR, where CMP is the comparison value and ARR is the automatic reload value. For example, to get a 50% duty cycle, assuming ARR = 1000-1, the comparison value CMP = 500. To change the duty cycle, just change the value of CCR1. By outputting PWM waveforms with different duty cycles, the indicator light circuit can present a breathing light effect.

[0103] Sending data includes: initializing GPIO, initializing USART, data packaging and sending, and level conversion; specifically, configure the I / O (GPIO) pins of the microcontroller with serial port function to multiplexed function mode. Enable the serial port clock, and enable the corresponding clock through the RCC register according to the specific serial port used. Configure the serial port (USART) parameters, and use the structure to set the baud rate, data bit, stop bit, parity and other parameters. After the configuration is complete, enable the serial port. Use the structure to define the data packet format, fill the acquired voltage, temperature, and time values ​​into the data packet structure, and send the data packet through the serial port at fixed time intervals, such as sending real-time voltage, temperature, and time values ​​once a second. Then it is transmitted to the PC or host computer after level conversion. By Fig.12 It can be seen that the sending and receiving pins of the serial port are the I / O pins PA9 and PA10 of the microcontroller, corresponding to the network labels UART1_RX and UART1_TX respectively.

[0104] Storing data includes: initializing GPIO, initializing SPI, initializing FLASH, data writing and data reading; specifically, enabling the clock of the I / O (GPIO) pin connected to the external FLASH and configuring it to multiplexed function mode. Enable the clock of the corresponding SPI, and use the structure to configure the SPI parameters, such as baud rate, data bits, mode, etc. After the configuration is completed, enable the SPI interface. Send an initialization command to the external FLASH storage chip through the SPI interface to configure its operating mode, page size and other parameters. After waiting for the initialization to be completed, start the data storage operation. Before writing data, you need to erase the area to be written. Specify the sector or block address to be erased by sending an erase command. After the erasure is completed, the data is written to the specified address byte by byte or page by page through the SPI interface according to the write format and requirements of the external FLASH storage chip. After writing the data, the data will not be lost when the power is off, which is convenient for subsequent reading of historical data for fault location and repair. By Fig.12 It can be seen that the four I / O pins of the microcontroller connected to the FLASH memory chip are PB12, PB13, PB14 and PB15, corresponding to the network labels SPI1_CS, SPI1_SCK, SPI1_MISO and SPI1_MOSI respectively.

[0105] like Figure 7 As shown, the fourth aspect of the present invention provides an electronic device 1000, including a processor 1110, a memory 1109, and a program or instruction stored in the memory 1109 and executable on the processor 1110. When the program or instruction is executed by the processor 1110, the various processes of the above-mentioned voltage detection method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0106] Among them, the processor 1110 is used to obtain multiple isolated power supply voltages; determine at least one voltage parameter corresponding to the multiple isolated power supply voltages through a voltage sampling unit and an analog-to-digital converter; determine at least one time parameter according to a real-time clock; determine at least one temperature parameter according to a temperature sensor circuit; determine a voltage detection result according to the time parameter, temperature parameter and voltage parameter; and transmit the voltage detection result to a host computer through a level conversion circuit.

[0107] Optionally, the processor 1110 is also used to collect at least one multi-channel isolated power supply voltage according to the voltage sampling unit to determine the non-isolated voltage parameters; initialize the analog-to-digital converter; configure a preset value to determine that the analog-to-digital converter is in a calibration completion state; transmit the non-isolated voltage parameters to the analog-to-digital converter for analog-to-digital conversion, and determine the voltage parameters corresponding to the non-isolated voltage parameters.

[0108] Optionally, the processor 1110 is also used to determine that the configuration state of the general input and output pins connected to the temperature sensor and the single-chip microcomputer is a first mode; initialize the temperature sensor; determine that the configuration state of the general input and output pins is a second mode; the temperature sensor circuit obtains at least one temperature byte, and converts the temperature byte into a temperature parameter in the second mode.

[0109] Optionally, the processor 1110 is further used to set a voltage threshold; determine a voltage-temperature variation curve according to a time parameter, a temperature parameter and a voltage parameter; determine at least one time-voltage parameter according to the voltage-temperature variation curve; and determine a voltage detection result according to at least one time-voltage parameter and a voltage threshold.

[0110] Optionally, the processor 1110 is also used to determine a first voltage parameter and a second voltage parameter based on a voltage threshold; when the time voltage parameter is less than the first voltage parameter or greater than the second voltage parameter, determine a first voltage detection result; when the time voltage parameter is less than the second voltage parameter and greater than the first voltage parameter, determine a second voltage detection result.

[0111] In a fifth aspect, the present invention provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the embodiment of the above-mentioned voltage detection method is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. In addition, the data storage capacity corresponding to the voltage detection method in this application and the data processing speed of each step in the image classification method are increased by a readable storage medium.

[0112] The methods may be implemented in a variety of different ways depending on the specific features and / or example applications. For example, the methods may be implemented by a combination of hardware, firmware, and / or software. For example, in a hardware implementation, the processor may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, electronic devices, other device units for performing the above functions, and / or combinations thereof.

[0113] A computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer readable storage medium may be an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above devices, but is not limited thereto. A non-exhaustive list of more specific examples of computer readable storage media includes: portable computer floppy disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD), memory card, floppy disk, encoding mechanical device (such as a punch card or a groove with a raised structure with instructions recorded) and any suitable combination of the above devices. The computer readable storage medium used herein should not be understood as a transmission signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium, or an electrical signal transmitted through a wire, etc.

[0114] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0115] The sixth aspect of the present invention provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, the processor is used to run a program or instruction, implement the various processes of the above-mentioned voltage detection method embodiment, and can achieve the same technical effect, to avoid repetition, no further description is given here. In addition, the chip is used to improve the data processing speed of each step in the voltage detection method in this application.

[0116] Although this specification includes many specific implementation details, these should not be interpreted as limiting the scope of any invention or the scope of protection claimed, but are mainly used to describe the features of the specific embodiments of specific inventions. Certain features described in multiple embodiments in this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although the features may work as above in certain combinations and even initially claim protection, one or more features from the claimed combination may be removed from the combination in some cases, and the claimed combination may point to a sub-combination or a variation of a sub-combination.

[0117] Similarly, although operations are depicted in a particular order in the accompanying drawings, this should not be understood as requiring that these operations be performed in the particular order shown or performed sequentially, or requiring that all illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product, or packaged into multiple software products.

[0118] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.

[0119] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0120] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A voltage detection method, characterized in that: Used in a voltage detection system, the voltage detection system includes a voltage sampling unit, a single-chip circuit, a temperature sensor circuit and a level conversion circuit, the single-chip circuit includes a single-chip, the voltage sampling unit, the temperature sensor circuit and the level conversion circuit are electrically connected to the single-chip respectively, the single-chip integrates at least one analog-to-digital converter and at least one real-time clock, the temperature sensor circuit includes a temperature sensor, and the voltage detection method includes: Obtain multiple isolated power supply voltages; Determine at least one voltage parameter corresponding to the multi-channel isolated power supply voltage by the voltage sampling unit and the analog-to-digital converter; determining at least one time parameter based on the real-time clock; determining at least one temperature parameter based on the temperature sensor; Determine a voltage detection result according to the time parameter, the temperature parameter and the voltage parameter; The voltage detection result is transmitted to a host computer through the level conversion circuit.

2. The voltage detection method according to claim 1, characterized in that: The determining of at least one voltage parameter corresponding to the multi-channel isolated power supply voltage by the voltage sampling unit and the analog-to-digital converter comprises: Collecting at least one isolated power supply voltage according to the voltage sampling unit to determine a non-isolated voltage parameter; Initializing the analog-to-digital converter; Configure a preset value to determine that the analog-to-digital converter is in a calibration completed state; The non-isolated voltage parameter is transmitted to the analog-to-digital converter for analog-to-digital conversion to determine a voltage parameter corresponding to the non-isolated voltage parameter.

3. The voltage detection method according to claim 1, characterized in that: The determining at least one temperature parameter according to the temperature sensor comprises: Determine that the configuration state of the general input / output pin connecting the temperature sensor to the single-chip microcomputer is a first mode; Initializing the temperature sensor; Determining that the configuration state of the general purpose input and output pin is a second mode; In the second mode, the single chip microcomputer obtains at least one temperature byte and converts the temperature byte into a temperature parameter.

4. The voltage detection method according to claim 1, characterized in that: The determining the voltage detection result according to the time parameter, the temperature parameter and the voltage parameter comprises: Set voltage threshold; Determine a voltage-temperature variation curve graph according to the time parameter, the temperature parameter and the voltage parameter; Determine at least one time voltage parameter according to the voltage-temperature variation curve diagram; A voltage detection result is determined according to at least one of the time voltage parameters and the voltage threshold.

5. The voltage detection method according to claim 4, characterized in that: The determining of the voltage detection result according to at least one of the time voltage parameters and the voltage threshold comprises: determining a first voltage parameter and a second voltage parameter according to the voltage threshold; When the time voltage parameter is less than the first voltage parameter or greater than the second voltage parameter, determining a first voltage detection result; When the time voltage parameter is less than the second voltage parameter and greater than the first voltage parameter, a second voltage detection result is determined.

6. A voltage detection device, characterized in that: include: An acquisition module, used for acquiring multiple isolated power supply voltages; A voltage determination module, used to determine at least one voltage parameter corresponding to the multi-channel isolated power supply voltage through a voltage sampling unit and an analog-to-digital converter; A time determination module, configured to determine at least one time parameter according to a real-time clock; a temperature determination module, configured to determine at least one temperature parameter according to a temperature sensor; A result determination module, used to determine a voltage detection result according to the time parameter, the temperature parameter and the voltage parameter; The result transmission module is used to transmit the voltage detection result to the host computer through the level conversion circuit.

7. A voltage detection system, characterized in that: include: A voltage sampling unit, a single-chip circuit, a temperature sensor circuit and a level conversion circuit, wherein the single-chip circuit includes a single-chip, the voltage sampling unit, the temperature sensor and the level conversion circuit are electrically connected to the single-chip respectively, the single-chip integrates at least one analog-to-digital converter and at least one real-time clock, and the temperature sensor circuit includes a temperature sensor; The voltage sampling unit includes at least one voltage dividing circuit and an isolation sampling circuit corresponding to the voltage dividing circuit; The single chip microcomputer circuit also includes a power supply circuit, a crystal oscillator circuit, a reset circuit, a startup mode configuration circuit, a debugging circuit and a filter circuit; The single chip microcomputer is connected to the host computer via the level conversion circuit; And the voltage detection device as claimed in claim 6.

8. An electronic device, characterized in that: The method comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the voltage detection method according to any one of claims 1 to 5.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the voltage detection method according to any one of claims 1 to 5 are implemented.

10. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or an instruction to implement the steps of the voltage detection method according to any one of claims 1 to 5.

Citation Information

Cited By

  • Line detection system, electronic equipment and method

    CN121596038A