A negative pressure detection circuit for direct detection by single chip microcomputer
By using a resistor network and voltage detection circuit, combined with a rail-to-rail amplifier and a reference voltage adjustment circuit, the problem that the microcontroller cannot directly detect negative voltage is solved, the range adjustment and detection process are simplified, and the hardware cost and detection error are reduced.
Patent Information
- Application Number
- CN202510805098.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-06-17
AI Technical Summary
Existing single-chip microcomputers cannot directly detect negative voltages, and existing circuits have limitations in range adjustment and calculation, which increases hardware and design costs.
A resistor network and a voltage detection circuit are used, combined with a rail-to-rail amplifier and a reference voltage adjustment circuit. Feedback control is used to make the reference voltage follow the changes and adjust the range. The reference voltage is directly detected and taken as the output voltage, simplifying the detection process.
The detection range is expanded, the current consumption of the detected end is reduced, the detection error is reduced, and the calculation requirements inside the microcontroller are simplified.
Smart Images

Figure CN120314632B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of voltage detection, in particular to a negative voltage detection circuit for direct detection by a single chip computer. Background Art
[0002] In existing power supply systems, single-chip microcomputers are often used to directly detect voltage. Since most single-chip microcomputers operate at a voltage of 0-5V, they can only detect positive voltages but not negative voltages. Therefore, when a single-chip microcomputer needs to be used to directly detect negative voltages, the negative voltage needs to be converted to a positive voltage before detection.
[0003] The applicant disclosed a negative voltage to positive voltage conversion circuit in the Chinese utility model patent application number CN201820474004.7. The circuit uses a resistor network to convert the voltage of the detected end, which may have negative voltage, into a positive voltage and then outputs it to the detection end for detection. However, the circuit disclosed in the patent has the following defects: once the resistance of the resistor network is selected, the range cannot be changed when the external reference voltage remains unchanged, and the output voltage that varies over a large range cannot be adjusted; at the same time, addition and multiplication operations need to be used simultaneously when the measured value is converted into the measured voltage, and the measured voltage cannot be obtained quickly and easily from the measured value. For single-chip microcomputer measurement, software programming must be performed in advance during design, and the measurement also requires the use of memory and processor resources in the single-chip microcomputer, which increases the hardware cost and design cost of the single-chip microcomputer, causing great limitations in actual use. Summary of the Invention
[0004] In order to overcome the defects of the prior art, the present invention discloses a negative pressure detection circuit for direct detection by a single chip microcomputer.
[0005] The negative voltage detection circuit for direct detection of a single-chip microcomputer described in the present invention includes a resistor network, which includes a first resistor, a second resistor, and a third resistor connected in series between a reference voltage terminal and a detected terminal. The common terminal of the second resistor and the third resistor is also connected to a fourth resistor, and the other end of the fourth resistor is grounded. The circuit also includes a voltage detection circuit for detecting the voltage at the common terminal of the second resistor and the fourth resistor. The output terminal of the voltage detection circuit is connected to a reference voltage adjustment circuit. The function of the reference voltage adjustment circuit is to adjust the voltage of the reference voltage terminal according to the output signal of the voltage detection circuit so that the voltage at the common terminal of the second resistor and the fourth resistor is stabilized at a set operating voltage value.
[0006] Preferably, the voltage detection circuit is a rail-to-rail amplifier, the inverting input terminal of the rail-to-rail amplifier is grounded, the non-inverting input terminal is connected to the common terminal of the second and fourth resistors, and the output terminal is connected to the reference voltage regulation circuit.
[0007] Preferably, the voltage detection circuit includes a linear Hall sensor connected in series with a fourth resistor, the Hall voltage output end of the linear Hall sensor is connected to the non-inverting input end of the rail-to-rail amplifier, the inverting input end of the rail-to-rail amplifier is grounded, and the output end is connected to the reference voltage regulation circuit.
[0008] Preferably, the reference voltage regulation circuit includes a first-stage amplifier, which includes a PMOS tube and an NMOS tube connected in the form of an inverter, the gates of the two MOS tubes are connected to the output end of the rail-to-rail amplifier, the source of the PMOS tube is connected to the external voltage, the drains of the two MOS tubes are connected to the non-inverting input end of the operational amplifier, the output end of the operational amplifier is connected to the reference voltage end, and the inverting input end of the operational amplifier is connected to the output end.
[0009] Preferably, the operating voltage value is zero.
[0010] Preferably, the first resistor has a value of zero, and the reference voltage terminal serves as a detection terminal.
[0011] Preferably, the third resistor and the fourth resistor have equal resistance values, the resistance value of the second resistor is K times that of the third resistor, and K is greater than or equal to 1.
[0012] Preferably, the negative pressure detection circuit also includes a positive pressure detection circuit, which includes an enable tube connected between the detection end and the detected end, a linear Hall sensor connected in series to the third resistor, the Hall voltage output end of the linear Hall sensor is connected to the voltage amplifier stage, the output end of the voltage amplifier stage is connected to the enable tube and the enable end of the operational amplifier, and the operational amplifier is selected such that when there is no correct enable signal input, the output end is left floating.
[0013] Preferably, the voltage amplification stage comprises a buffer and an inverter connected in series.
[0014] Preferably, a light emitting diode is connected between the output end of the voltage amplifier stage and the ground.
[0015] The present invention has the following beneficial effects:
[0016] 1. By using the feedback voltage to make the reference voltage follow the changes, the range can be adjusted and the detection application range can be expanded.
[0017] 2. Feedback control reduces the current drawn from the detected end, reduces the current consumption of the detected end, and can reduce the error during detection.
[0018] 3. The use of feedback makes it possible to directly detect the reference voltage and take the opposite as the output voltage, eliminating the need for programming and calculation within the microcontroller, thus simplifying the detection process. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of a specific embodiment of the negative pressure detection circuit of the present invention;
[0020] Figure 2 A schematic diagram of a specific embodiment of the voltage detection circuit of the present invention;
[0021] Figure 3 Schematic diagram of another specific embodiment of the negative pressure detection circuit of the present invention;
[0022] Figure 4 This is a schematic diagram of another specific embodiment of the positive pressure detection circuit of the present invention;
[0023] Figure 5 This is a simulation diagram of a specific embodiment of the negative pressure detection circuit of the present invention;
[0024] Figure 6 This is a simulation diagram of a specific embodiment of the positive pressure detection circuit of the present invention;
[0025] The reference numerals in the figure are: VT-detection terminal, VIN-detected terminal, VREF-reference voltage terminal, COMP-rail-to-rail amplifier, M1-PMOS tube, M2-NMOS tube, M3-enable tube, R1-first resistor, R2-second resistor, R3-third resistor, R4-fourth resistor, R5-fifth resistor, C1-first capacitor, C2-second capacitor, AMP-operational amplifier, HE-linear Hall sensor, BUF-buffer, INV-inverter, EN-enable signal, D-light-emitting diode. DETAILED DESCRIPTION
[0026] The present invention will be further described in detail below with reference to the embodiments, but the present invention is not limited to the following embodiments:
[0027] The negative pressure detection circuit of the present invention is as follows: Figure 1 As shown, it includes a resistor network, which includes a first resistor, a second resistor and a third resistor connected in series between the reference voltage terminal and the detected terminal, and a fourth resistor is further connected to the common end of the second resistor and the third resistor, and the other end of the fourth resistor is grounded.
[0028] Assume that the common terminal of the first resistor and the second resistor is used as the detection terminal. For the convenience of calculation, the resistance values of the first to fourth resistors are equal to R. Let the currents in the first resistor R1, the third resistor R3 and the fourth resistor R4 be I, I1 and I2 respectively. According to Kirchhoff's law,
[0029] (R1+R2)*I+R3*I1+V1=U1
[0030] R4*I2=V1+R3*I1, where U1 and V1 are the reference voltage terminal and the detected terminal voltage respectively;
[0031] And I=I1+I2 then
[0032] 2R(I1+I2)+R*I1+V1=U1
[0033] Simplified, we can get
[0034] 3R*I1+2R*I2=U1-V1 Formula 1
[0035] V1=R(I2-I1) Formula 2
[0036] According to formula 2, we can get
[0037] I2=V1 / R+I1
[0038] Bring-in 1
[0039] 3R*I1+2R(V1 / R+I1)=U1-V1
[0040] Simplifying, we can get I1=(U1-3V1) / 5R Equation 3
[0041] The detection terminal voltage VT=U1-R1*(I1+I2) Formula 4
[0042] Substituting Equation 3 and Equation 2 into Equation 4 yields
[0043] VT=U1-R*(2*(U1-3V1) / 5R +V1 / R )
[0044] After simplification, VT=0.6*U1+0.2*V1 Equation 5
[0045] It is a common choice in this field that each resistor has equal value, which can save procurement and installation management costs. When each resistor is equal, Formula 5 is obtained. Analysis of Formula 5 shows that when the negative value of V1 is greater than 3 times U1, VT is less than zero. At this time, it cannot be directly detected by the single-chip microcomputer. Analysis of the resistor network composed of the first to fourth resistors can easily show that when the voltage at the common end of the second and fourth resistors is greater than zero, the voltage at the detected end must be greater than zero. In the present invention, a voltage detection circuit is provided to detect the common end X of the second and fourth resistors.
[0046] Since the microcontroller directly detects positive voltage, the lower limit of some microcontrollers is not zero, but a lower positive voltage such as 0.3-0.5V. The detection accuracy is higher at the positive voltage farther away from zero. By controlling the voltage at point X at zero, the voltage at the detection end must be greater than zero, and a positive voltage higher than a certain value of zero can be obtained at the detection end, which is convenient for improving the detection accuracy of the microcontroller.
[0047] At the same time, since the voltage at point X is controlled to be approximately 0 and the other end of the fourth resistor is grounded, the voltage drop across the fourth resistor is extremely small and the current is close to zero. This reduces the current across the fourth resistor, thereby reducing the current drawn from the detected terminal VIN and the power consumption of the load on VIN, thereby preventing the VIN voltage from being unstable due to the current draw.
[0048] like Figure 1 As shown, the voltage detection circuit is a rail-to-rail amplifier COMP, the rail-to-rail amplifier inverting input terminal is grounded, the non-inverting input terminal is connected to the common terminal X of the second and fourth resistors, and the output terminal is connected to the reference voltage regulation circuit.
[0049] When the voltage VX at point X is lower than zero, the rail-to-rail amplifier output voltage decreases, and the reference voltage adjustment circuit is controlled to adjust the reference voltage to increase. From formula 5 and VT=(VREF+VX) / 2, we can get that the voltage at terminal X VX=0.2U1+0.4V1. After the reference voltage increases, the common terminal X of the second and fourth resistors also increases. When the voltage VX at point X increases to greater than zero, the rail-to-rail amplifier output voltage increases, and the reference voltage adjustment circuit is controlled to adjust the reference voltage to decrease, so that the voltage VX at point X decreases to zero, maintaining dynamic balance. Figure 2 As shown, the voltage detection circuit may also use a linear Hall sensor connected in series with the fourth resistor to detect the output Hall voltage of the linear Hall sensor. In the operating state where the voltage at point X is controlled at zero volts, when the voltage at point X is below zero, the current flows from ground to point X, and when the voltage at point X is greater than zero, the current flows from point X to ground. Therefore, when the voltage at point X is above and below zero, the current flowing through the linear Hall sensor has different directions, and the output Hall voltage may have opposite values. This voltage is input into a rail-to-rail amplifier to detect the voltage at point X. Using a linear Hall sensor prevents the rail-to-rail amplifier from being directly connected to an external detected terminal, thereby preventing abnormally high voltages, such as electrostatic voltage, at the detected terminal from damaging the input of the rail-to-rail amplifier. The linear Hall sensor may use the CC6900SO-30A.
[0050] like Figure 1In the specific embodiment shown, the reference voltage regulation circuit includes a first-stage amplifier, which includes a PMOS transistor M1 and an NMOS transistor M2 connected in an inverter form. The gates of the two MOS transistors are both connected to the output of the rail-to-rail amplifier, the source of the PMOS transistor is connected to a higher external voltage VCC for discharge, and the drains of the two MOS transistors are connected to the non-inverting input of the operational amplifier AMP2. The output of the operational amplifier is connected to the reference voltage terminal. The operational amplifier is connected in a follower form, that is, the inverting input is connected to the output terminal. When the output voltage of the rail-to-rail amplifier decreases, the output current of the PMOS transistor increases and the output current of the NMOS transistor decreases, causing the input voltage of the operational amplifier to increase, and the voltage of the reference voltage terminal to increase accordingly with the change in the output voltage of the operational amplifier. When the output voltage of the rail-to-rail amplifier increases, the output current of the PMOS transistor decreases and the output current of the NMOS transistor increases, causing the input voltage of the operational amplifier to decrease and the voltage of the reference voltage terminal to decrease accordingly with the change in the output voltage of the operational amplifier. Figure 1 In the embodiment, a first capacitor and a second capacitor can be connected to the output terminals of the operational amplifier and the first-stage amplifier, respectively, to stabilize the output voltage. A fifth resistor R5 is connected between the drains of the two MOS tubes of the first-stage amplifier as a current-limiting resistor. Both the operational amplifier and the rail-to-rail amplifier are powered by a higher external power supply VCC. Obviously, the maximum value of the reference voltage terminal is VCC.
[0051] The reference voltage regulation circuit can also be used in conjunction with other circuits such as LDO and a boost circuit to increase the power supply voltage and then use the LDO to reduce the voltage to the required value. The boost circuit can use a charge pump or an external switching power supply component.
[0052] Through a first-stage amplifier, the output voltage of the rail-to-rail amplifier can be first increased to the input voltage range where the operational amplifier can work normally, and then the operational amplifier performs follow-up amplification. The strong driving capability of the operational amplifier allows the reference voltage to be adjusted quickly.
[0053] By means of the voltage detection circuit and the reference voltage adjustment circuit, the voltage at the reference voltage terminal follows the changes in the voltage at the detected terminal, so that the voltage at the common terminal X of the second resistor and the fourth resistor is dynamically stabilized at approximately zero. This ensures that the voltage at the detection terminal is always above zero by a certain value. Even when the voltage at the detected terminal changes, positive voltage detection can be achieved, and the current in the fourth resistor R4 is significantly reduced, thereby reducing the current draw load on the detected terminal VIN.
[0054] Furthermore, when a voltage detection circuit and a reference voltage adjustment circuit are added so that the reference voltage changes with the voltage of the detected terminal, the resistance of the first resistor can be set to zero, and the negative voltage detection of the detected terminal can be achieved by directly detecting the reference voltage.
[0055] When the first resistor R1 is zero, and the resistance values of the second, third, and fourth resistors are all R, according to Kirchhoff's law,
[0056] R2*I+R3*I1+V1=U1
[0057] R4*I2=V1+R3*I1
[0058] I=I1+I2
[0059] Simplifying, we can get: I1*3R=U1-2V1 Equation 6
[0060] Since the voltage at the common terminal of the second resistor and the fourth resistor is dynamically stable at zero, the current I2 is close to zero, so I1=I=(U1-VX) / R, and VX=0;
[0061] Substituting into formula 6, we can get: U1-2V1=3R*U1 / R
[0062] Simplifying, we can get: U1=-V1;
[0063] That is, when the voltage at the reference voltage terminal is dynamically stable at the common terminal of the second resistor and the fourth resistor and is zero, the voltage value at the detected terminal is positive, such as Figure 3 As shown, when R1 is equal to zero, the detection terminal VT is directly connected to the reference voltage terminal VREF, and the voltage of the detected terminal can be obtained by detecting the reference voltage.
[0064] like Figure 5 The figure shows a simulation diagram when the voltage VX at the common terminal of the second resistor and the fourth resistor, i.e., the X terminal, is set to be dynamically stable at zero. When the voltage VIN at the detected terminal changes from -3V to -1V, VX remains near 0V, and the voltage at the reference voltage terminal VREF changes from 3V to 1V.
[0065] To expand the detection range, the resistance of the second resistor can also be adjusted. For example, when the resistance of the second resistor is KR, which is K times the resistance of the third and fourth resistors, repeat the previous calculation and you can get:
[0066] V1=-U1 / K.
[0067] It can be seen that when the voltage at the common terminal of the second resistor and the fourth resistor is dynamically stabilized to zero through feedback adjustment, the detection range can be adjusted by adjusting the resistor ratio, and the reference voltage value is proportional to the absolute value of the voltage at the detected terminal. Compared with Formula 5, the calculation is simplified, and addition and subtraction operations are no longer required. The memory and processor resources in the microcontroller can no longer be used to construct an adder for processing. When K=1, the measured value can be directly negated to obtain the detected voltage. When K is greater than 1, a larger negative detected voltage can be measured using a lower positive reference voltage.
[0068] To avoid mistakenly connecting positive voltage to the detected terminal VIN, Figure 4 The present invention is shown in a specific embodiment, in which the negative pressure detection circuit also includes a positive pressure detection circuit, the positive pressure detection circuit includes an enable tube connected between the detection end and the detected end, a linear Hall sensor connected in series to a third resistor, the Hall voltage output end of the linear Hall sensor is connected to a voltage amplifier stage, the output end of the voltage amplifier stage is connected to the enable tube and the enable end of the operational amplifier, and the operational amplifier selects an operational amplifier whose output end is left floating when an enable signal is not input.
[0069] For the entire circuit, when the voltage VIN of the detected terminal is negative, the current direction of the third resistor is from the X terminal to the VIN terminal. The Hall device is set so that the Hall voltage output by the Hall device is negative at this time. After amplification by the voltage amplifier stage, a logic signal that can be used by the subsequent circuit is obtained, so that the enable tube is disconnected at this time, and the operational amplifier AMP works normally. For example, the enable tube M3 is an NMOS tube, and the operational amplifier is enabled at a high level, such as Figure 4 As shown, the voltage amplifier stage includes a buffer BUF and an inverter INV. The buffer BUF converts the negative voltage into a low level and connects the gate of the enable tube M3 to disconnect it. It is then converted into a high level enable signal EN through the inverter and connected to the enable terminal of the operational amplifier AMP. The circuit performs negative voltage detection normally.
[0070] like Figure 6 The figure shows a specific simulation curve. When the voltage at the detected terminal VIN rises from a negative voltage of -3 volts to a positive voltage of 1V, the enable signal EN of the operational amplifier AMP decreases from a high level to a low level when the voltage at the detected terminal VIN begins to be greater than zero, and the voltage at the reference voltage terminal VREF gradually decreases from 3V to 0V. When the enable signal EN causes the operational amplifier to stop working, the voltage at the reference voltage terminal VREF changes to 1V following the voltage at the detected terminal VIN.
[0071] When the voltage at the detected terminal VIN is positive, the feedback circuit causes the voltage at terminal X to be lower than the voltage at the detected terminal. The current in the third resistor reverses, and the output Hall voltage becomes positive, turning on the enable transistor M3. The detection terminal VT is directly connected to the detected terminal VIN for detection. Simultaneously, the high-level signal output by the buffer is converted to a low level by the inverter, disabling the operational amplifier AMP. The operational amplifier's output is left floating without affecting the voltage at the detection terminal. At this point, the detection terminal is directly connected to the positive voltage at the detected terminal for detection. When the voltage at the detected terminal VIN turns negative, the current in the third resistor reverses, the Hall voltage becomes negative again, the enable transistor turns off, the operational amplifier operates normally, and the negative voltage detection state is restored.
[0072] To alert the inspector, a light-emitting diode (LED) can be connected between the buffer output of the voltage amplifier stage and ground. When the buffer BUF outputs a positive voltage, it illuminates to indicate to the user that the voltage at the inspected end is positive, prompting the user to check whether the circuit is connected correctly. The voltage amplifier stage circuit can use a level shift circuit to adjust the voltage value, or a rail-to-rail amplifier to convert the lower Hall voltage into a higher analog voltage.
[0073] Based on the above description, those skilled in the art can select different devices and connection methods, output opposite logic signals, and perform control similar to the above method. For example, when the enabling tube M3 is a PMOS, the connection direction of the Hall device is changed so that when the voltage of the detected end VIN is negative, the output Hall voltage is positive, and the enabling tube is turned off.
[0074] At this time, the reference voltage value can be directly detected, and the voltage at the detected end can be obtained by negating the measured positive voltage. There is no need to perform the addition and multiplication operations shown in Formula 5, which simplifies the storage space occupied by the adder and multiplier required for internal programming of the microcontroller, and no additional programming design is required.
[0075] The present invention has the following beneficial effects:
[0076] 1. By using the feedback voltage to make the reference voltage follow the changes, the range can be adjusted and the detection application range can be expanded.
[0077] 2. Feedback control reduces the current drawn from the detected end, reduces the current consumption of the detected end, and can reduce the error during detection.
[0078] 3. The use of feedback makes it possible to directly detect the reference voltage and take the opposite as the output voltage, eliminating the need for programming and calculation within the microcontroller, thus simplifying the detection process.
[0079] The above content is a further detailed description of the present invention in conjunction with specific preferred embodiments, and the specific embodiments of the present invention cannot be considered to be limited to these descriptions. For those skilled in the art to which the present invention belongs, other embodiments derived without departing from the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A negative voltage detection circuit for direct detection by a single-chip microcomputer, comprising a resistor network, wherein the resistor network includes a first resistor, a second resistor, and a third resistor connected in series between a reference voltage terminal and a detected terminal, a fourth resistor being connected to a common terminal of the second and third resistors, and the other end of the fourth resistor being grounded, characterized in that: It also includes a voltage detection circuit for detecting the voltage at the common end of the second resistor and the fourth resistor. The output end of the voltage detection circuit is connected to a reference voltage adjustment circuit. The function of the reference voltage adjustment circuit is: according to the output signal of the voltage detection circuit, adjust the voltage of the reference voltage end so that the voltage at the common end of the second resistor and the fourth resistor is stabilized at a set operating voltage value; the operating voltage value is zero, and the negative voltage detection circuit uses the common end of the first resistor and the second resistor as the detection end.
2. The negative pressure detection circuit according to claim 1, characterized in that: The voltage detection circuit is a rail-to-rail amplifier, the inverting input terminal of the rail-to-rail amplifier is grounded, the non-inverting input terminal is connected to the common terminal of the second and fourth resistors, and the output terminal is connected to the reference voltage regulation circuit.
3. The negative pressure detection circuit according to claim 1, wherein: The voltage detection circuit includes a linear Hall sensor connected in series with a fourth resistor, a Hall voltage output end of the linear Hall sensor is connected to a non-inverting input end of a rail-to-rail amplifier, an inverting input end of the rail-to-rail amplifier is grounded, and an output end is connected to a reference voltage regulation circuit.
4. The negative pressure detection circuit according to claim 1, wherein: The reference voltage regulation circuit includes a first-stage amplifier, which includes a PMOS tube and an NMOS tube connected in the form of an inverter. The gates of the two MOS tubes are connected to the output end of the rail-to-rail amplifier, the source of the PMOS tube is connected to an external voltage, the drains of the two MOS tubes are connected to the non-inverting input end of the operational amplifier, the output end of the operational amplifier is connected to the reference voltage end, and the inverting input end of the operational amplifier is connected to the output end.
5. The negative pressure detection circuit according to claim 4, characterized in that: The first resistor has a value of zero, and the reference voltage terminal serves as a detection terminal.
6. The negative pressure detection circuit according to claim 5, characterized in that: The third resistor and the fourth resistor have equal resistance values, the second resistor has a resistance value K times that of the third resistor, and K is greater than or equal to 1.
7. The negative pressure detection circuit according to claim 5, characterized in that: The negative pressure detection circuit also includes a positive pressure detection circuit, which includes an enable tube connected between the detection end and the detected end, a linear Hall sensor connected in series to a third resistor, a Hall voltage output end of the linear Hall sensor connected to a voltage amplifier stage, an output end of the voltage amplifier stage connected to the enable tube and an enable end of an operational amplifier, and the operational amplifier is selected such that when no correct enable signal is input, the output end is left floating.
8. The negative pressure detection circuit according to claim 7, characterized in that: The voltage amplification stage includes a buffer and an inverter connected in series.
9. The negative pressure detection circuit according to claim 7, characterized in that: A light emitting diode is connected between the output end of the voltage amplifying stage and the ground.
Citation Information
Patent Citations
Positive voltage circuit of burden voltage conversion
CN208112608U
Single feedback loop with positive output voltage and negative output voltage used for voltage converter
CN107831820A
Voltage detection and control circuit
CN108270402A