A wide range peak detection circuit and method
By introducing a level shifting circuit into the peak detection circuit, the problem of detection from 0V in the prior art is solved, and a wider and more accurate peak detection is achieved.
Patent Information
- Application Number
- CN202411973946.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
AI Technical Summary
The existing peak detection circuit cannot start detection from 0V due to the offset voltage of the op amp, resulting in a smaller detection range.
By increasing the level shifting circuit, the waveform input at the waveform input end is received, the target voltage is increased to the waveform voltage to amplify, and the amplified waveform is output to the basic peak detection circuit, thereby realizing the peak value of the waveform starting from 0V.
The detection range and detection accuracy of peak detection are improved, so that the circuit can detect the peak value of the waveform starting from 0V.
Smart Images

Figure CN119780506A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of circuit technology, and in particular to a wide range peak detection circuit and method. Background Art
[0002] The peak detection circuit is an electronic circuit used to measure the maximum value (positive peak value) or minimum value (negative peak value) in a signal waveform. The core function of the peak detection circuit is to timely detect the peak value of the detected waveform and output a DC voltage or current signal equal to the peak value, or an instantaneous voltage pulse, so as to facilitate subsequent circuit processing, storage or display.
[0003] At present, the working principle of the existing peak detection circuit is that when the voltage at the waveform input end rises, the voltage at the output pin of the operational amplifier increases, and the capacitor is charged through the diode. When the voltage at the waveform input end decreases, the voltage at the output pin of the operational amplifier decreases. Due to the unidirectional conductivity of the diode, the voltage at the peak detection end is maintained. After several waveform cycles, the capacitor is fully charged, and the voltage at the peak detection end is maintained at the peak value of the input waveform. At this time, the AD pin of the single-chip microcomputer detects this value to realize the peak detection circuit.
[0004] However, the offset voltage of the operational amplifier causes the operational amplifier to be unable to output from 0V, thereby causing the operational amplifier to be unable to detect from 0V and thus reducing the detection range. Summary of the invention
[0005] In view of this, the purpose of the present application is to provide a wide-range peak detection circuit and method, which can detect the peak value of a waveform starting from 0V by adding a level shifting circuit, thereby improving the detection range and detection accuracy of the peak detection.
[0006] In a first aspect, an embodiment of the present application provides a wide range peak detection circuit, the wide range peak detection circuit comprising a level shifting circuit, a basic peak detection circuit and a single chip microcomputer;
[0007] The voltage input terminal of the level shift circuit is connected to the external waveform input terminal, and the voltage output terminal of the level shift circuit is connected to the voltage input terminal of the basic peak detection circuit; the peak detection terminal of the basic peak detection circuit is connected to the analog-to-digital conversion detection pin of the single-chip microcomputer;
[0008] The level shift circuit is used to receive the waveform inputted by the waveform input terminal, increase the voltage of the waveform at the waveform input terminal by a target voltage to amplify the waveform, and output the amplified waveform to the basic peak detection circuit; wherein the waveform and the amplified waveform are pulse signals;
[0009] The basic peak detection circuit is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform;
[0010] The single chip microcomputer is used to detect the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform.
[0011] In a possible implementation, the basic peak detection circuit includes an operational amplifier, a diode, and a capacitor;
[0012] The voltage input terminal of the operational amplifier is connected to the voltage output terminal of the level shift circuit; the voltage output terminal of the operational amplifier is connected to the diode, and is connected to the capacitor through the diode;
[0013] The operational amplifier and the diode are used to output the waveform output by the level shifting circuit to the capacitor to charge the capacitor, and to convert the positive electrode voltage of the capacitor into a DC voltage after the capacitor is fully charged; wherein the positive electrode voltage of the capacitor after being fully charged is the peak voltage of the waveform at the input end of the operational amplifier; the diode is also used to prevent the charge of the capacitor from leaking back to the operational amplifier.
[0014] In a possible implementation manner, the analog-to-digital conversion detection pin of the single-chip microcomputer is connected to the positive electrode of the capacitor; wherein the positive electrode of the capacitor represents the peak detection end;
[0015] The single chip microcomputer is used for detecting the positive electrode voltage of the capacitor through the analog-to-digital conversion detection pin in response to the capacitor being fully charged, so as to obtain the peak voltage of the waveform.
[0016] In a possible implementation manner, before detecting the positive electrode voltage of the capacitor, maintaining the peak voltage of the waveform based on the amplified waveform includes:
[0017] In response to the voltage of the waveform inputted to the waveform input terminal rising, the voltage outputted by the operational amplifier rises, and when the voltage outputted by the operational amplifier is higher than the positive electrode voltage of the capacitor, the capacitor is charged through the diode based on the voltage outputted by the operational amplifier;
[0018] In response to a decrease in the voltage of the waveform input to the waveform input terminal, the voltage output by the operational amplifier decreases, and the voltage output by the operational amplifier is output to the capacitor through the diode.
[0019] In a possible implementation manner, detecting the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform includes:
[0020] The positive electrode voltage of the capacitor is detected through the analog-to-digital conversion detection pin to obtain the corresponding peak voltage of the peak detection end; wherein the peak voltage of the peak detection end represents the voltage value of the peak detection end detected by the single-chip microcomputer; the peak voltage of the peak detection end is the positive electrode voltage of the capacitor after it is fully charged;
[0021] The peak voltage of the waveform input terminal is determined based on the peak voltage of the peak detection terminal and the target voltage.
[0022] In a possible implementation manner, a discharge circuit is further included; one end of the discharge circuit is connected to the positive electrode of the capacitor; one end of the discharge circuit is grounded, and the other end of the discharge circuit is connected to the signal output end of the single chip microcomputer;
[0023] The single chip microcomputer is used for outputting a high level signal to the discharge circuit in response to detecting the peak voltage, so as to turn on the discharge circuit;
[0024] The discharge circuit is used to discharge the electric quantity of the capacitor after being turned on.
[0025] In a possible implementation manner, the discharge circuit includes an NPN transistor;
[0026] One end of the NPN transistor is connected to the positive electrode (peak detection end) of the capacitor, one end of the NPN transistor is grounded, and the other end of the NPN transistor is connected to the signal output end of the single chip microcomputer.
[0027] In a possible implementation manner, the single chip microcomputer is used to output the high level signal to the NPN transistor after detecting the peak voltage, so as to control the NPN transistor to be turned on;
[0028] The NPN transistor is used to discharge the electric quantity of the capacitor after being turned on.
[0029] In a second aspect, an embodiment of the present application further provides a wide range peak detection method, which is applied to a wide range peak detection circuit of an embodiment of the first aspect; the wide range peak detection circuit includes a level shifting circuit, a basic peak detection circuit and a single chip microcomputer; the method includes:
[0030] The level shift circuit receives the waveform inputted from the waveform input terminal, increases the voltage of the waveform at the waveform input terminal by a target voltage to amplify the waveform, and outputs the amplified waveform to the basic peak detection circuit; wherein the waveform and the amplified waveform are pulse signals;
[0031] The basic peak detection circuit receives the amplified waveform and maintains the peak voltage of the waveform based on the amplified waveform;
[0032] The single chip microcomputer detects the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform.
[0033] In a possible implementation, the basic peak detection circuit includes an operational amplifier, a diode, and a capacitor; and the method further includes:
[0034] The operational amplifier and the diode output the waveform output by the level shifting circuit to the capacitor to charge the capacitor, and convert the positive electrode voltage of the capacitor into a DC voltage after the capacitor is fully charged; wherein the positive electrode voltage of the capacitor after being fully charged is the peak voltage of the waveform at the input end of the operational amplifier; and the diode prevents the charge of the capacitor from leaking back to the operational amplifier.
[0035] The embodiment of the present application provides a wide-range peak detection circuit and method, the wide-range peak detection circuit includes a level shift circuit, a basic peak detection circuit and a single-chip microcomputer; the level shift circuit is used to receive a waveform input from a waveform input terminal, increase the target voltage of the waveform at the waveform input terminal to amplify the waveform, and output the amplified waveform to the basic peak detection circuit; the basic peak detection circuit is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform; the single-chip microcomputer is used to detect the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform. In the present application, by adding a level shift circuit, the peak value of the waveform can be detected starting from 0V, thereby improving the detection range and detection accuracy of the peak detection.
[0036] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 is a structural block diagram of a wide range peak detection circuit according to an embodiment of the present application;
[0039] Figure 2 It is a schematic diagram of the overall architecture of the wide range peak detection circuit;
[0040] Figure 3is a flow chart of a wide range peak detection method according to another embodiment of the present application. DETAILED DESCRIPTION
[0041] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0042] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0043] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0044] Considering the peak detection circuit, it is an electronic circuit used to measure the maximum value (positive peak) or minimum value (negative peak) in the signal waveform. The core function of the peak detection circuit is to timely detect the peak value of the detected waveform and output a DC voltage or current signal equal to the peak value, or a transient voltage pulse, so as to facilitate the subsequent circuit processing, storage or display.
[0045] At present, the working principle of the existing peak detection circuit is that when the voltage at the waveform input end rises, the voltage at the output pin of the op amp increases, and the capacitor is charged through the diode. When the voltage at the waveform input end decreases, the voltage at the output pin of the op amp decreases. Due to the unidirectional conductivity of the diode, the voltage at the peak detection end is maintained. After several waveform cycles, the capacitor is fully charged, and the voltage at the peak detection end is maintained at the peak value of the input waveform. At this time, the AD pin of the single-chip microcomputer detects this value to realize the peak detection circuit. However, due to the offset voltage of the op amp, the op amp cannot output from 0V, which makes it impossible to detect from 0V and reduces the detection range.
[0046] In response to this problem, the present application provides a wide-range peak detection circuit and method, the wide-range peak detection circuit comprising a level shifting circuit, a basic peak detection circuit and a single-chip microcomputer; the level shifting circuit is used to receive a waveform input from a waveform input terminal, increase the target voltage of the waveform at the waveform input terminal to amplify the waveform, and output the amplified waveform to the basic peak detection circuit; the basic peak detection circuit is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform; the single-chip microcomputer is used to detect the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform. In the present application, by adding a level shifting circuit, the peak value of the waveform can be detected starting from 0V, thereby improving the detection range and detection accuracy of the peak detection.
[0047] Figure 1 1 is a structural block diagram of a wide range peak detection circuit according to an embodiment of the present application. The wide range peak detection circuit 100 includes a level shifting circuit 1, a basic peak detection circuit 2 and a single chip microcomputer 3.
[0048] Among them, the voltage input end of the level shifting circuit 1 is connected to the external waveform input end, and the voltage output end of the level shifting circuit 1 is connected to the voltage input end of the basic peak detection circuit 2; the peak detection end of the basic peak detection circuit 2 is connected to the analog-to-digital conversion detection pin of the microcontroller 3 (that is, the voltage input end).
[0049] For example, Figure 2 This is the overall schematic diagram of the wide range peak detection circuit. Figure 2 As shown, U2A / R1 / R2 / R3 / R4 constitute the level shift circuit 1 of this application, U1A / D1 / C1 constitutes the basic peak detection circuit 2 of this application, the positive voltage input terminal of the level shift circuit 1 is connected to the waveform input terminal, the voltage output terminal of the level shift circuit 1 is connected to the positive voltage input terminal of the basic peak detection circuit 2; the voltage output terminal of the basic peak detection circuit 2 is connected to the single chip computer 3 ( Figure 2 An analog-to-digital conversion (AD) detection pin (not shown).
[0050] The level shift circuit 1 is used to receive the waveform inputted from the waveform input terminal, increase the target voltage to the voltage of the waveform at the waveform input terminal to amplify the waveform, and output the amplified waveform to the basic peak detection circuit 2. The waveform and the amplified waveform are pulse signals; the target voltage is a voltage set according to the circuit.
[0051] For example, if the target voltage is 2.5V, Figure 2 As shown, it should be noted that the waveform input at the waveform input end is amplified by U2A in the level shift circuit 1, and the output is a DC 2.5V plus the voltage of the input waveform (equivalent to adding a 2.5V DC bias voltage to the input waveform).
[0052] The basic peak detection circuit 2 is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform. Figure 2 As shown, after U2A outputs a DC 2.5V plus the voltage of the input waveform to U1A, U1A receives the waveform amplified by U2A and maintains the peak voltage of the waveform based on the amplified waveform.
[0053] The single chip computer 3 is used to detect the peak voltage of the basic peak detection circuit 2 to obtain the peak voltage of the waveform. The peak voltage of the waveform represents the peak voltage of the waveform inputted at the waveform input terminal. In short, after the basic peak detection circuit 2 maintains the peak voltage, it is detected.
[0054] Therefore, the present application adds a level shift circuit 1 to solve the problem that the peak voltage cannot be detected from 0V and the detection range becomes smaller.
[0055] The wide-range peak detection circuit 100 of the present application includes a level shift circuit 1, a basic peak detection circuit 2 and a single-chip microcomputer 3; the level shift circuit 1 is used to receive a waveform input from a waveform input terminal, increase the target voltage of the waveform at the waveform input terminal to amplify the waveform, and output the amplified waveform to the basic peak detection circuit 2; the basic peak detection circuit 2 is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform; the single-chip microcomputer 3 is used to detect the peak voltage of the basic peak detection circuit 2 to obtain the peak voltage of the waveform. The wide-range peak detection circuit of the present application can detect the peak value of the waveform starting from 0V by adding a level shift circuit, thereby improving the detection range and detection accuracy of the peak detection.
[0056] Furthermore, the basic peak detection circuit 2 includes an operational amplifier, a diode and a capacitor. Figure 2 As shown in FIG. 1 , U1A represents an operational amplifier, D1 represents a diode, and C1 represents a capacitor. Among them, the capacitor is an energy storage capacitor.
[0057] The voltage input terminal of the operational amplifier is connected to the voltage output terminal of the level shift circuit 1; the voltage output terminal of the operational amplifier is connected to a diode, and connected to a capacitor through the diode. Figure 2 As shown, the positive voltage input terminal of U1A is connected to the voltage output terminal of U2A, the voltage output terminal of U1A is connected to D1, and is connected to C1 through D1.
[0058] The operational amplifier and the diode are used to output the waveform output by the level shifting circuit 1 to the capacitor to charge the capacitor, and to convert the positive voltage of the capacitor into a DC voltage after the capacitor is fully charged. The positive voltage of the capacitor after it is fully charged is the peak voltage of the waveform at the input end of the operational amplifier. For example, Figure 2 As shown, U1A converts the pulse signal corresponding to the amplified waveform output by U2A into a DC signal, and outputs the DC voltage corresponding to the DC signal to C1.
[0059] It should be noted that the operational amplifier and the diode together form a voltage follower circuit. If there is no energy storage capacitor, the waveform of the cathode of the diode is the same as the waveform of the input terminal of the operational amplifier, which is a pulse waveform. After adding the energy storage capacitor, the positive electrode of the capacitor becomes a DC voltage after the capacitor is fully charged after several cycles. At this time, the voltage at the positive end of the capacitor is the peak voltage of the waveform at the input terminal of the operational amplifier. It is precisely because of the existence of the capacitor that the cathode of the diode becomes a DC voltage.
[0060] Among them, the capacitor is used to store energy. After a number of cycles, the capacitor is fully charged and the positive electrode of the capacitor becomes a DC voltage. Figure 2 As shown, U1A outputs voltage to C1 to charge C1. After C1 is fully charged, the positive electrode of the capacitor becomes a DC voltage.
[0061] The diode is also used to prevent the capacitor's charge from leaking back to the operational amplifier. Figure 2 As shown, due to the unidirectional conductivity of the diode, the charge of capacitor C1 can be prevented from leaking back to U1A, ensuring that the capacitor can be fully charged.
[0062] Furthermore, the analog-to-digital conversion detection pin of the single-chip microcomputer 3 is connected to the positive electrode of the capacitor. The positive electrode of the capacitor represents the peak detection end. For example, Figure 2 As shown, the analog-to-digital conversion detection pin of the single-chip computer 3 (not shown) is connected to the positive electrode of C1 (ie, the peak detection terminal).
[0063] The single chip computer 3 is used to detect the positive voltage of the capacitor through the analog-to-digital conversion detection pin in response to the capacitor being fully charged to obtain the peak voltage of the waveform. The voltage of the fully charged capacitor is the peak voltage of the positive voltage input terminal of the operational amplifier U1A. It should be noted that after the capacitor is fully charged, the capacitor, i.e., the peak detection terminal, is detected through the analog-to-digital conversion detection pin to obtain the peak voltage of the waveform.
[0064] Optionally, before detecting the positive voltage of the capacitor, while maintaining the peak voltage of the waveform based on the amplified waveform, in response to an increase in the voltage of the waveform input at the waveform input terminal, the voltage output by the operational amplifier increases, and when the voltage output by the operational amplifier is higher than the positive voltage of the capacitor, the capacitor is charged through a diode based on the voltage output by the operational amplifier; in response to a decrease in the voltage of the waveform input at the waveform input terminal, the voltage output by the operational amplifier decreases, and the voltage output by the operational amplifier is output to the capacitor through a diode.
[0065] It should be noted that when the voltage output by the operational amplifier is higher than the positive voltage of the capacitor, the capacitor is charged, and when the voltage output by the operational amplifier is lower than the positive voltage of the capacitor, the capacitor is not charged. Figure 2 As shown, when the voltage at the waveform input end rises, the voltage at the output pin of the operational amplifier U1A rises, and the capacitor C1 is charged through the diode D1. When the voltage at the waveform input end decreases, the voltage at the output pin of the operational amplifier U1A decreases. At this time, if the reduced voltage is greater than the voltage of the capacitor C1, the capacitor C1 can be charged. If the reduced voltage is not greater than the voltage of the capacitor C1, the capacitor C1 will not be charged.
[0066] Continuing, for example, Figure 2 As shown, due to the unidirectional conductivity of the diode, the voltage at the peak detection end is maintained. After at least one waveform cycle (multiple waveform cycles mean that the waveform in one waveform cycle is not enough to fill the capacitor, so multiple waveforms are output), the capacitor C1 is fully charged, and the voltage at the peak detection end is maintained at the peak value of the input waveform. At this time, the AD detection pin of the single-chip computer 3 detects this value to detect the peak voltage of the input signal.
[0067] Optionally, when the peak voltage of the basic peak detection circuit 2 is detected to obtain the peak voltage of the waveform, the positive voltage of the capacitor is detected through the analog-to-digital conversion detection pin to obtain the corresponding peak voltage of the peak detection end; the peak voltage of the waveform input end is determined based on the peak voltage of the peak detection end and the target voltage. It should be noted that the peak voltage of the peak detection end is the positive voltage of the capacitor after it is fully charged; the peak voltage of the peak detection end represents the voltage value of the peak detection end detected by the single-chip microcomputer 3, and the peak voltage of the peak detection end is not the peak voltage of the waveform input by the waveform input end. At this time, the peak voltage of the peak detection end needs to be subtracted from the target voltage to obtain the peak voltage of the waveform input end. For example, when the waveform input end inputs 0V, the peak detection end outputs 2.5V, that is, the peak voltage of the peak detection end is 2.5V, that is, the voltage value of the peak detection end minus the target voltage 2.5V is the peak voltage of the waveform input end, therefore, the wide range peak detection circuit 100 of the present application can detect the peak value of the input waveform from 0V.
[0068] Therefore, it can be seen that the present application can start detection from a 0V waveform, thereby improving the detection range and detection accuracy.
[0069] Furthermore, the wide range peak detection circuit 100 of the present application also includes a discharge circuit. Figure 2 As shown, Q1 / R5 / R6 / R7 form a capacitor discharge circuit, which is also the discharge circuit of the present application.
[0070] One end of the discharge circuit is connected to the positive electrode of the capacitor; one end of the discharge circuit is grounded, and the other end of the discharge circuit is connected to the signal output end of the single chip computer 3. Figure 2 As shown, one end of the discharge circuit is connected to the positive electrode of C1, that is, the peak detection end, one end of the discharge circuit is grounded, and the other end of the discharge circuit is connected to the signal output end of the microcontroller 3, which is also the capacitor circuit discharge control end.
[0071] The single chip computer 3 is used for outputting a high level signal to the discharge circuit in response to detecting the peak voltage, so as to turn on the discharge circuit.
[0072] The discharge circuit is used to discharge the electric quantity of the capacitor after conduction.
[0073] It should be noted that after the peak value is detected, the single chip microcomputer 3 outputs a high level signal for a period of time to turn on the discharge circuit to discharge the electric quantity of the capacitor for the next detection.
[0074] Furthermore, the discharge circuit includes an NPN transistor. Figure 2 As shown, Q1 represents an NPN transistor.
[0075] Among them, one end of the NPN transistor is connected to the positive electrode of the capacitor, one end of the NPN transistor is grounded, and the other end of the NPN transistor is connected to the signal output end of the single chip computer 3. For example, Figure 2 As shown, one end of Q1 is connected to the positive electrode of C1, that is, the peak detection end, one end of Q1 is grounded, and the other end of Q1 is connected to the signal output end of the single chip computer 3, that is, the capacitor circuit discharge control end.
[0076] The single chip computer 3 is used for outputting a high level signal to the NPN transistor after detecting the peak voltage, so as to control the NPN transistor to be turned on.
[0077] NPN transistor, used to discharge the capacitor's charge after conduction.
[0078] It should be noted that, for example, Figure 2 As shown, after the peak value is detected, the single chip microcomputer 3 outputs a high level for a period of time to turn on Q1 to discharge the power of C1 for the next detection.
[0079] Figure 3 1 is a flow chart of a wide range peak detection method provided according to an embodiment of the present application, which is applied to the wide range peak detection circuit 100 described in the above embodiment. The wide range peak detection circuit 100 includes a level shift circuit 1, a basic peak detection circuit 2 and a single chip microcomputer 3.
[0080] S301, a level shift circuit receives a waveform input from a waveform input terminal, increases a target voltage to the voltage of the waveform at the waveform input terminal to amplify the waveform, and outputs the amplified waveform to a basic peak detection circuit.
[0081] In the embodiment of the present application, the waveform and the amplified waveform are pulse signals.
[0082] S302, the basic peak detection circuit receives the amplified waveform and maintains the peak voltage of the waveform based on the amplified waveform.
[0083] S303, the single chip microcomputer detects the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform.
[0084] The wide range peak detection method of the present application comprises a level shift circuit 1, which is used to receive a waveform input from a waveform input terminal, increase a target voltage to the voltage of the waveform at the waveform input terminal to amplify the waveform, and output the amplified waveform to a basic peak detection circuit 2; a basic peak detection circuit 2, which is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform; and a single chip computer, which is used to detect the peak voltage of the basic peak detection circuit 2 to obtain the peak voltage of the waveform. The wide range peak detection method of the present application can detect the peak value of the waveform starting from 0V by adding a level shift circuit, thereby improving the detection range and detection accuracy of the peak detection.
[0085] Furthermore, the basic peak detection circuit 2 includes an operational amplifier, a diode and a capacitor. The method of the present application also includes the following steps:
[0086] Step a: The operational amplifier and the diode output the waveform output by the level shift circuit 1 to the capacitor to charge the capacitor, and after the capacitor is fully charged, the positive electrode voltage of the capacitor becomes a DC voltage.
[0087] In the embodiment of the present application, the positive electrode voltage of the capacitor after being fully charged is the peak voltage of the waveform at the input end of the operational amplifier.
[0088] Step b: The diode prevents the charge of the capacitor from leaking back to the operational amplifier.
[0089] It should be noted here that the explanation of the above embodiment is also applicable to the wide range peak detection method of the embodiment of the present application, and the specific process will not be repeated here.
[0090] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the circuits and devices described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed circuits, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another circuit, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0091] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0093] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the deployment method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0094] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A wide range peak detection circuit, characterized in that: The wide range peak detection circuit comprises a level shift circuit, a basic peak detection circuit and a single chip microcomputer; The voltage input terminal of the level shift circuit is connected to the external waveform input terminal, and the voltage output terminal of the level shift circuit is connected to the voltage input terminal of the basic peak detection circuit; the peak detection terminal of the basic peak detection circuit is connected to the analog-to-digital conversion detection pin of the single-chip microcomputer; The level shift circuit is used to receive the waveform inputted by the waveform input terminal, increase the voltage of the waveform at the waveform input terminal by a target voltage to amplify the waveform, and output the amplified waveform to the basic peak detection circuit; wherein the waveform and the amplified waveform are pulse signals; The basic peak detection circuit is used to receive the amplified waveform and maintain the peak voltage of the waveform based on the amplified waveform; The single chip microcomputer is used to detect the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform.
2. The circuit according to claim 1, characterized in that The basic peak detection circuit includes an operational amplifier, a diode and a capacitor; The voltage input terminal of the operational amplifier is connected to the voltage output terminal of the level shift circuit; the voltage output terminal of the operational amplifier is connected to the diode, and is connected to the capacitor through the diode; The operational amplifier and the diode are used to output the waveform output by the level shifting circuit to the capacitor to charge the capacitor, and to convert the positive electrode voltage of the capacitor into a DC voltage after the capacitor is fully charged; wherein the positive electrode voltage of the capacitor after it is fully charged is the peak voltage of the waveform at the input end of the operational amplifier; The diode is also used to prevent the electric quantity of the capacitor from leaking back to the operational amplifier.
3. The circuit according to claim 2, characterized in that The analog-to-digital conversion detection pin of the single-chip microcomputer is connected to the positive electrode of the capacitor; wherein the positive electrode of the capacitor represents the peak detection end; The single chip microcomputer is used for detecting the positive electrode voltage of the capacitor through the analog-to-digital conversion detection pin in response to the capacitor being fully charged, so as to obtain the peak voltage of the waveform.
4. The circuit according to claim 3, characterized in that Before detecting the positive electrode voltage of the capacitor, maintaining the peak voltage of the waveform based on the amplified waveform includes: In response to the voltage of the waveform inputted to the waveform input terminal rising, the voltage outputted by the operational amplifier rises, and when the voltage outputted by the operational amplifier is higher than the positive electrode voltage of the capacitor, the capacitor is charged through the diode based on the voltage outputted by the operational amplifier; In response to a decrease in the voltage of the waveform input to the waveform input terminal, the voltage output by the operational amplifier decreases, and the voltage output by the operational amplifier is output to the capacitor through the diode.
5. The circuit according to claim 4, characterized in that The detecting the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform includes: The positive electrode voltage of the capacitor is detected through the analog-to-digital conversion detection pin to obtain the corresponding peak voltage of the peak detection end; wherein the peak voltage of the peak detection end represents the voltage value of the peak detection end detected by the single-chip microcomputer; the peak voltage of the peak detection end is the positive electrode voltage of the capacitor after it is fully charged; The peak voltage of the waveform input terminal is determined based on the peak voltage of the peak detection terminal and the target voltage.
6. The circuit according to claim 5, characterized in that It also includes a discharge circuit; one end of the discharge circuit is connected to the positive electrode of the capacitor; one end of the discharge circuit is grounded, and the other end of the discharge circuit is connected to the signal output end of the single chip microcomputer; The single chip microcomputer is used for outputting a high level signal to the discharge circuit in response to detecting the peak voltage, so as to turn on the discharge circuit; The discharge circuit is used to discharge the electric quantity of the capacitor after being turned on.
7. The circuit according to claim 6, characterized in that The discharge circuit includes an NPN transistor; One end of the NPN transistor is connected to the positive electrode of the capacitor, one end of the NPN transistor is grounded, and the other end of the NPN transistor is connected to the signal output end of the single chip microcomputer.
8. The circuit according to claim 7, characterized in that The single chip microcomputer is used to output the high level signal to the NPN transistor after detecting the peak voltage, so as to control the NPN transistor to be turned on; The NPN transistor is used to discharge the electric quantity of the capacitor after being turned on.
9. A wide range peak detection method, characterized in that: A wide range peak detection circuit as claimed in any one of claims 1 to 8; The wide range peak detection circuit comprises a level shift circuit, a basic peak detection circuit and a single chip microcomputer; the method comprises: The level shift circuit receives the waveform inputted from the waveform input terminal, increases the voltage of the waveform at the waveform input terminal by a target voltage to amplify the waveform, and outputs the amplified waveform to the basic peak detection circuit; wherein the waveform and the amplified waveform are pulse signals; The basic peak detection circuit receives the amplified waveform and maintains the peak voltage of the waveform based on the amplified waveform; The single chip microcomputer detects the peak voltage of the basic peak detection circuit to obtain the peak voltage of the waveform.
10. The method according to claim 9, characterized in that The basic peak detection circuit includes an operational amplifier, a diode and a capacitor; the method further includes: The operational amplifier and the diode output the waveform output by the level shifting circuit to the capacitor to charge the capacitor, and after the capacitor is fully charged, the positive electrode voltage of the capacitor becomes a DC voltage; wherein the positive electrode voltage of the capacitor after being fully charged is the peak voltage of the waveform at the input end of the operational amplifier; The diode prevents the charge of the capacitor from leaking back to the operational amplifier.