Input voltage detection circuit, input voltage detection method and charger
By introducing transformer windings and voltage sampling circuits into the switching power supply, the input voltage is calculated in real time, solving the problem of inaccurate input voltage detection under load, realizing real-time adjustment of output power, and improving the safety of the charger.
Patent Information
- Application Number
- CN202511602274.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-04
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technology cannot accurately detect the input voltage under load, causing the charger to continue to output the high power of the high-voltage input when switching from high voltage to low voltage, which may damage the charger.
By introducing the primary and secondary windings of the transformer and a voltage sampling circuit into the switching power supply, the input voltage is calculated in real time. The input voltage is then calculated using the transformer turns ratio, the sampled voltage, and the output voltage, and the output power is adjusted to match the input voltage.
It enables real-time detection of input voltage, avoids mismatch between output power and input voltage, improves the safety of switching power supply, and prevents charger damage.
Smart Images

Figure CN121577947A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of switching power supply technology, and in particular to an input voltage detection circuit, input voltage detection method and charger for a switching power supply. Background Technology
[0002] In related technologies, many chargers adjust their output power based on the input voltage. When the protocol IC detects a low-voltage input, it reduces the output power; when it detects a high-voltage input, it increases the output power. However, current high / low voltage detection methods can only perform detection during power-on. Because the output power is very low during power-on, the voltage across the input electrolytic capacitor is essentially stable, making it relatively easy for the protocol IC to calculate the input voltage using the transformer turns ratio. However, under load, the voltage across the electrolytic capacitor fluctuates, making it impossible for the protocol IC to accurately detect the input voltage.
[0003] Therefore, current high / low voltage detection methods cannot determine the input voltage level under load. When the input is high voltage and then switches to low voltage after startup, the charger will still output high power as it did with the high voltage input, which can easily damage the charger. Summary of the Invention
[0004] This application provides an input voltage detection circuit, an input voltage detection method, and a charger for a switching power supply. These methods can detect the input voltage of the switching power supply in real time, preventing damage caused by a mismatch between the output power and the input voltage, and improving the safety of the switching power supply.
[0005] This application provides an input voltage detection circuit for a switching power supply, including: A transformer includes a primary winding and a secondary winding coupled to each other. The primary winding is connected to an input circuit, and the secondary winding is connected to an output circuit. The input circuit is used to input voltage and includes an input electrolytic capacitor. The output circuit includes an output electrolytic capacitor for output voltage. A voltage sampling circuit, connected to the secondary winding, is used to obtain the sampling voltage and the output voltage of the output electrolytic capacitor, wherein the sampling voltage is the sum of the voltage of the secondary winding and the output voltage; A voltage calculation module, connected to the voltage sampling circuit, is used to calculate the input voltage of the input circuit based on the sampled voltage, the output voltage, and the turns ratio of the transformer.
[0006] In some embodiments, when the output power of the switching power supply is less than a preset power threshold, the voltage calculation module calculates the input voltage according to the following formula: Where Vac is the input voltage, Vds_SR is the sampling voltage, Vout is the output voltage, and n is the transformer turns ratio.
[0007] In some embodiments, when the output power of the switching power supply is greater than or equal to a preset power threshold, the voltage calculation module calculates the input voltage according to the following formula: Where Vac is the input voltage, Vds_SR1, Vds_SR2, and Vds_SR3 are three consecutive sampled voltages, Vout is the output voltage, and n is the transformer turns ratio.
[0008] In some embodiments, the sampling voltage is n, and m consecutively increasing sampling voltages are determined from the n sampling voltages as valid data, and the three sampling voltages at the middle position are selected from the m sampling voltages as Vds_SR1, Vds_SR2, and Vds_SR3, where n and m are both integers, and n≥m>3.
[0009] In some embodiments, the n sampled voltages include multiple valid data segments, each of which includes multiple continuously increasing sampled voltages, and the data segment with the most data among the multiple valid data segments is determined as the m sampled voltages.
[0010] In some embodiments, the positive terminal of the output electrolytic capacitor is connected to the first terminal of the secondary winding, and the negative terminal of the output electrolytic capacitor is grounded and connected to the second terminal of the secondary winding through a second switching unit; The voltage sampling circuit includes a protocol chip, a second switching unit, and a second controller. The protocol chip includes a first sampling port and a second sampling port. The first sampling port is connected to the second end of the secondary winding to obtain the sampled voltage. The second sampling port is connected to the positive terminal of the output electrolytic capacitor to obtain the output voltage. The second controller is connected to the control terminal of the second switching unit to control the second switching unit to be turned on or off.
[0011] In some embodiments, the second controller controls the second switching unit to periodically turn on and off with a period T, the period T including the on-time Ton and the off-time Toff. The first sampling port starts to collect the sampling voltage at time Ton / 2 within each period T for a duration of Δt, where Δt=T.
[0012] In some embodiments, the first end of the primary winding is connected to the positive terminal of the input electrolytic capacitor, the positive terminal of the input electrolytic capacitor is connected to an AC power supply through a rectifier circuit, and the negative terminal of the input electrolytic capacitor is connected to the rectifier circuit and grounded. The input voltage detection circuit further includes a first switching unit and a first controller. The first end of the first switching unit is connected to the second end of the primary winding, and the second end of the first switching unit is grounded. The first controller is connected to the control end of the first switching unit to control the first switching unit to turn on or off.
[0013] This application also provides an input voltage detection method for a switching power supply, applied to the input voltage detection circuit of any of the above embodiments, the input voltage detection method comprising: The sampling voltage and the output voltage of the output electrolytic capacitor are obtained, wherein the sampling voltage is the sum of the voltage of the secondary winding of the transformer and the output voltage; The input voltage of the input circuit is calculated based on the sampled voltage, the output voltage, and the turns ratio of the transformer.
[0014] This application also provides a charger, including the input voltage detection circuit of any of the above embodiments.
[0015] The input voltage detection circuit of this application embodiment can calculate the input voltage of the input circuit based on the detected sampling voltage, output voltage, and transformer turns ratio. Therefore, it can realize real-time detection of input voltage. The detection of input voltage is no longer limited to when the power is turned on. Based on the real-time detected input voltage, the output power of the switching power supply can be adjusted to avoid damage to the switching power supply due to mismatch between output power and input voltage, thereby improving the safety of the switching power supply. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the input voltage detection circuit according to an embodiment of this application.
[0018] Figure 2 This is a voltage waveform diagram of the input electrolytic capacitor in an embodiment of this application.
[0019] Figure 3 This is a circuit example diagram of an input voltage detection circuit according to an embodiment of this application.
[0020] Figure 4 This is a waveform diagram of the driving voltage of the second switching unit in an embodiment of this application.
[0021] Figure 5This is a timing diagram of the sampling voltage collected in an embodiment of this application.
[0022] Figure 6 This is a schematic flowchart of the input voltage detection method according to an embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0024] This application provides an input voltage detection circuit for a switching power supply, which can detect the input voltage of the switching power supply in real time and adjust the output power of the switching power supply according to the detected input voltage. This avoids damage to the switching power supply caused by a mismatch between the output power and the input voltage, thereby improving the safety of the switching power supply. In one application example, the switching power supply can be a charger.
[0025] refer to Figure 1 , Figure 1 This is a schematic diagram of the input voltage detection circuit according to an embodiment of this application. The input voltage detection circuit 100 includes an input circuit 10, a transformer T, an output circuit 20, a voltage sampling circuit 30, and a voltage calculation module 40.
[0026] Input circuit 10 is used to input voltage Vac. For example, in practical applications, input circuit 10 can be connected to an external AC power source to input an external AC voltage Vac, such as a 220V AC voltage. The input circuit includes an input electrolytic capacitor, the voltage of which can be expressed as Vdc. In practical applications, the voltage Vdc of the input electrolytic capacitor can be obtained by rectifying the input voltage Vac.
[0027] Please refer to the above. Figure 2 , Figure 2 This is a voltage waveform diagram of the input electrolytic capacitor in an embodiment of this application. A complete voltage input cycle includes time periods T1 and T2. During time period T1, the voltage Vdc input to the electrolytic capacitor gradually increases, and the waveform conforms to a sine function, satisfying the relationship Vdc = ... *Vac*sin θ, where θ is the phase angle of the input voltage Vac. During the time interval T2, the voltage across the input electrolytic capacitor gradually decreases, and the waveform is a straight line.
[0028] Transformer T includes a primary winding NP and a secondary winding NS coupled together. The turns ratio of the primary winding NP to the secondary winding NS is n, for example, n = 9.5 in one example. The primary winding NP is connected to input circuit 10, for example, to an input electrolytic capacitor, whose voltage Vdc is input to the primary winding NP. The secondary winding NS is connected to output circuit 20 for outputting voltage Vout. The output circuit includes an output electrolytic capacitor, from which the voltage Vout is output.
[0029] The voltage sampling circuit 30 is connected to the secondary winding NS. The voltage sampling circuit 30 is used to acquire the sampling voltage Vds_SR and the output voltage Vout of the output electrolytic capacitor. The sampling voltage Vds_SR is the sum of the voltage of the secondary winding NS and the output voltage Vout. It can be understood that the voltage of the secondary winding NS is obtained from the voltage of the primary winding NP (the voltage of the primary winding NP is the voltage Vdc of the input electrolytic capacitor), which can be expressed as Vdc / n. Therefore, the sampling voltage Vds_SR can be expressed as: Vds_SR = Vdc / n + Vout.
[0030] The voltage calculation module 40 is connected to the voltage sampling circuit 30. The voltage calculation module 40 is used to calculate the input voltage Vac of the input circuit 10 based on the sampled voltage Vds_SR, the output voltage Vout, and the turns ratio n of the transformer T. In some embodiments, the voltage calculation module 40 can be integrated into a processor, such as an MCU (Micro Control Unit).
[0031] In some embodiments, reference Figure 3 , Figure 3 This is a circuit example diagram of an input voltage detection circuit according to an embodiment of this application.
[0032] The input circuit 10 includes a rectifier circuit BD1 and an input electrolytic capacitor EC1. The rectifier circuit BD1 can be a bridge rectifier circuit composed of four diodes. The rectifier circuit BD1 includes four terminals 1, 2, 3, and 4. Terminal 1 is connected to the L (live) wire of the external AC power supply; terminal 2 is connected to the positive (+) terminal of the input electrolytic capacitor EC1; terminal 3 is connected to the N (neutral) wire of the external AC power supply; and terminal 4 is connected to the negative terminal of the input electrolytic capacitor EC1 and then connected to the ground terminal GND to achieve grounding.
[0033] The first terminal of the primary winding NP is connected to the positive (+) terminal of the input electrolytic capacitor EC1. As mentioned above, the positive (+) terminal of the input electrolytic capacitor EC1 is connected to the AC power supply through the rectifier circuit BD1, and the negative terminal of the input electrolytic capacitor EC1 is connected to the rectifier circuit BD1 and grounded.
[0034] The output circuit 20 includes an output electrolytic capacitor EC2. The positive (+) terminal of the output electrolytic capacitor EC2 is connected to the first terminal of the secondary winding NS. The negative terminal of the output electrolytic capacitor EC2 is grounded and connected to the second terminal of the secondary winding NS. The output electrolytic capacitor EC2 is also connected to the output port of the switching power supply. The output port includes a voltage terminal V+ and a ground terminal GND. The voltage terminal V+ is connected to the positive (+) terminal of the output electrolytic capacitor EC2, and the ground terminal GND is connected to the negative terminal of the output electrolytic capacitor EC2. The voltage terminal V+ and the ground terminal GND of the output port are used to provide the output voltage Vout.
[0035] In some embodiments, the voltage sampling circuit 30 includes a protocol chip, a second switching unit Q2, and a second controller.
[0036] The protocol chip includes a first sampling port GPIO and a second sampling port VDD. The first sampling port GPIO is connected to the second terminal of the secondary winding NS to obtain the aforementioned sampling voltage Vds_SR. The second sampling port VDD is connected to the positive (+) terminal of the output electrolytic capacitor EC2 to obtain the aforementioned output voltage Vout.
[0037] The negative terminal of the output electrolytic capacitor EC2 is connected to the second terminal of the secondary winding NS via the second switching unit Q2. The second controller is connected to the control terminal of the second switching unit Q2 to control the second switching unit Q2 to turn on or off.
[0038] In some embodiments, the second switching unit Q2 is a MOSFET. In this case, the gate of the second switching unit Q2 is the control terminal. The gate of the second switching unit Q2 is connected to the second controller, the source of the second switching unit Q2 is connected to the negative terminal of the output electrolytic capacitor EC2, and the drain of the second switching unit Q2 is connected to the second terminal of the secondary winding NS.
[0039] In some embodiments, a sampling resistor R2 is connected between the ground terminal GND of the output port of the switching power supply and the negative terminal of the output electrolytic capacitor EC2. The protocol chip also includes voltage sampling ports CS- and CS+. The voltage sampling port CS- is connected to one end of the sampling resistor R2, for example, between the sampling resistor R2 and the negative terminal of the output electrolytic capacitor EC2. The voltage sampling port CS+ is connected to the other end of the sampling resistor R2, for example, between the sampling resistor R2 and the ground terminal GND of the output port. The protocol chip can detect the voltage value of the sampling resistor R2 through the voltage sampling ports CS- and CS+, thereby obtaining the magnitude of the current in the sampling resistor R2, and thus the magnitude of the output current Iout.
[0040] Understandably, the protocol chip obtains the output voltage Vout through the second sampling port VDD and the output current Iout through the voltage sampling ports CS- and CS+. Therefore, the output power P of the switching power supply can be calculated based on the output voltage Vout and the output current Iout. Where P = Vout * Iout.
[0041] In some embodiments, the input voltage detection circuit further includes a third switching unit Q3. The positive (+) terminal of the output electrolytic capacitor EC2 is connected to the voltage terminal V+ of the output port through the third switching unit Q3. The protocol chip also includes a first control port Gate. The first control port Gate is connected to the control terminal of the third switching unit Q3 and is used to control the third switching unit Q3 to turn on or off. For example, in practical applications, if the output power of the switching power supply is detected to exceed a power threshold, or if a mismatch is detected between the output power and the input voltage, the third switching unit Q3 can be controlled to turn off, thereby disconnecting the output of the switching power supply and protecting it from damage.
[0042] In some embodiments, the third switching unit Q3 is a MOSFET. In this case, the gate of the third switching unit Q3 is the control terminal. The gate of the third switching unit Q3 is connected to the first control port Gate of the protocol chip, the source of the third switching unit Q3 is connected to the voltage terminal V+ of the output port, and the drain of the third switching unit Q3 is connected to the positive (+) terminal of the output electrolytic capacitor EC2.
[0043] In some embodiments, the protocol chip further includes a power port VBUS, data ports D- and D+, and a ground port GND. The power port VBUS is connected to the source of the third switching unit (e.g., a MOSFET) Q3, providing voltage Vout to the protocol chip. The ground port GND is grounded. The output port of the switching power supply has corresponding data ports D- and D+. The protocol chip's data port D- is connected to the output port's data port D-, and the protocol chip's data port D+ is connected to the output port's data port D+, enabling communication between the protocol chip and the switching power supply's output port.
[0044] In some embodiments, the input voltage detection circuit further includes a first switching unit Q1 and a first controller. The first terminal of the first switching unit Q1 is connected to the second terminal of the primary winding NP. The second terminal of the first switching unit Q1 is grounded, for example, through a resistor R1. The first controller is connected to the control terminal of the first switching unit Q1 to control the first switching unit Q1 to turn on or off. In practical applications, the first controller can be a PWM controller, used to control the first switching unit Q1 to turn on or off via a PWM signal.
[0045] In practical applications, the first switching unit Q1 is the main switch of transformer T, used to control the input power or stop the input power of the primary winding NP of transformer T. Specifically, when the first controller controls the first switching unit Q1 to be turned on, the primary winding NP of transformer T is grounded, forming a circuit. Therefore, the primary winding NP can input power, and the secondary winding NS can output power. When the first controller controls the first switching unit Q1 to be turned off, the primary winding NP of transformer T is disconnected from ground. Therefore, the primary winding NP stops inputting power, and the secondary winding NS also stops outputting power. The first controller can control the input power of the primary winding NP by adjusting the duty cycle of the PWM signal, thereby controlling the output power of the secondary winding NS.
[0046] In some embodiments, the first switching unit Q1 is a MOSFET. In this case, the gate of the first switching unit Q1 is the control terminal. The gate of the first switching unit Q1 is connected to the first controller. The drain of the first switching unit Q1 is connected to the second terminal of the primary winding NP. The source of the first switching unit Q1 is grounded, for example, through a resistor R1.
[0047] In some embodiments, the input voltage detection circuit further includes an optocoupler, wherein the optocoupler includes a light-emitting diode U4A and a phototransistor U4B coupled to each other. The protocol chip also includes a second control port OPTO, which is connected to the positive terminal of the light-emitting diode U4A, and the negative terminal of the light-emitting diode U4A is grounded. The emitter of the phototransistor U4B is grounded, and the collector is connected to the first controller. The protocol chip can control the optocoupler to turn on or off through the second control port OPTO, thereby adjusting the PWM signal output by the first controller and thus controlling the first switching unit Q1. For example, in practical applications, when the output power of the switching power supply exceeds a power threshold, or when a mismatch between the output power and the input voltage is detected, the duty cycle of the PWM signal output by the first controller can be adjusted to adjust the input power of the transformer T, thereby adjusting the output power.
[0048] In terms of specific control methods, when the second control port OPTO controls the LED U4A to conduct, the phototransistor U4B also conducts, grounding the port where the first controller is connected to the collector of the phototransistor U4B; when the second control port OPTO controls the LED U4A to turn off, the phototransistor U4B also turns off, disconnecting the port where the first controller is connected to the collector of the phototransistor U4B from ground. Therefore, the first controller can adjust the output PWM signal.
[0049] The following explains the principle by which the voltage calculation module calculates the input voltage of the input circuit in the embodiments of this application. In practical applications, when the output power of the switching power supply is low, the voltage Vdc of the input electrolytic capacitor EC1 is a stable value, which is the maximum voltage Vdcmax of the input electrolytic capacitor EC1 (at this time, sin θ=1, Vdcmax= *Vac). When the output power of the switching power supply is high, the voltage Vdc of the input electrolytic capacitor EC1 changes dynamically, and its voltage waveform is shown in the figure. Figure 2 As shown, during the T1 time period of each voltage input cycle, the voltage Vdc gradually increases, and the waveform conforms to a sine function. During the T2 time period of each voltage input cycle, the voltage Vdc gradually decreases, and the waveform is linear. Therefore, the input voltage can be calculated using different methods depending on the output power of the switching power supply.
[0050] In some embodiments, a preset power threshold P0 is pre-set in the switching power supply. The preset power threshold P0 can be set empirically or based on experimental test data. The preset power threshold P0 is set to satisfy the following conditions: when the output power P of the switching power supply is less than the preset power threshold P0, the voltage Vdc of the input electrolytic capacitor EC1 is a stable value Vdcmax; when the output power P of the switching power supply is greater than or equal to the preset power threshold P0, the voltage Vdc of the input electrolytic capacitor EC1 exhibits the following characteristics: Figure 2 The dynamically changing waveform is shown. The output power P of the switching power supply can be calculated based on the output voltage Vout and output current Iout obtained from the sampling above, i.e., P = Vout * Iout.
[0051] The voltage calculation module can first compare the output power P of the switching power supply with the preset power threshold P0 to determine the relationship between the output power P of the switching power supply and the preset power threshold P0.
[0052] In some embodiments, when the output power P of the switching power supply is less than a preset power threshold P0, the voltage calculation module calculates the input voltage of the input circuit 10 according to the following formula: Where Vac is the input voltage of input circuit 10, Vds_SR is the sampling voltage obtained by voltage sampling circuit 30, Vout is the output voltage of output electrolytic capacitor EC2, and n is the turns ratio of transformer T.
[0053] The above calculation formula can be obtained from the following formula: Vdc= *Vac Vds_SR = Vdc / n + Vout Where Vdc is the voltage across the input electrolytic capacitor EC1, which is also the voltage across the primary winding NP of transformer T. Vdc / n gives the voltage across the secondary winding NS of transformer T. It is understandable that when the output power P of the switching power supply is less than the preset power threshold P0, i.e., when the output power of the switching power supply is low, the voltage Vdc across the input electrolytic capacitor EC1 is a stable value Vdcmax, thus satisfying the relationship Vdc = *Vac.
[0054] In some embodiments, when the output power P of the switching power supply is greater than or equal to a preset power threshold P0, the voltage calculation module calculates the input voltage of the input circuit 10 according to the following formula: Where Vac is the input voltage of input circuit 10, Vds_SR1, Vds_SR2, and Vds_SR3 are three consecutive sampled voltages obtained by voltage sampling circuit 30, Vout is the output voltage of output electrolytic capacitor EC2, and n is the turns ratio of transformer T.
[0055] Please refer to the above. Figure 3 , Figure 4 and Figure 5 , Figure 4 This is a waveform diagram of the driving voltage of the second switching unit in an embodiment of this application. Figure 5 This is a timing diagram of the sampling voltage collected in an embodiment of this application.
[0056] The second controller controls the second switching unit Q2 to periodically turn on and off with a period T. Period T includes the on-time Ton and the off-time Toff. The first sampling port GPIO of the protocol chip begins to sample the voltage Vds_SR at time Ton / 2 within each period T, as shown below. Figure 4 As shown, the duration is Δt, where Δt = T, meaning the duration Δt of each sampling is one period T. Therefore, the three consecutive sampled voltages Vds_SR1, Vds_SR2, and Vds_SR3 can be obtained, as shown above. Figure 5 As shown.
[0057] According to the formula Vds_SR = Vdc / n + Vout, we can calculate Vdc = (Vds_SR - Vout) * n. Where Vdc is the voltage across the input electrolytic capacitor EC1, which is also the voltage across the primary winding NP of transformer T, and n is the turns ratio of transformer T. Therefore, the three voltages Vdc (denoted as Vdc1, Vdc2, and Vdc3) corresponding to the three sampled voltages Vds_SR1, Vds_SR2, and Vds_SR3 are calculated as follows: Vdc1 = (Vds_SR1 - Vout) * n = *Vac*sin θ1 Vdc2 = (Vds_SR2 - Vout) * n = *Vac*sin θ2 Vdc3 = (Vds_SR3 - Vout) * n = *Vac*sin θ3 Where θ1, θ2, and θ3 are the phase angles of the input voltage Vac corresponding to the three sampled voltages Vds_SR1, Vds_SR2, and Vds_SR3, respectively. From the above formula, we can calculate: θ1=arc sin(Vds_SR1-Vout)*n / ( *Vac) θ2=arc sin(Vds_SR2-Vout)*n / ( *Vac) θ3=arc sin(Vds_SR3-Vout)*n / ( *Vac) Since the time intervals between the three sampled voltages Vds_SR1, Vds_SR2, and Vds_SR3 are all Δt, they satisfy the relationship 2*θ2=θ1+θ3. Therefore, we can calculate: 2* arc sin(Vds_SR2-Vout)*n / ( *Vac)= arc sin(Vds_SR1-Vout)*n / ( *Vac)+ arc sin (Vds_SR3-Vout)*n / ( *Vac) Further calculations based on the above formula will yield the following: In practical applications, a complete detection cycle of the sampled voltage Vds_SR includes multiple cycles T, such as... Figure 4 As shown, multiple corresponding sampling voltages are obtained. In some embodiments, a complete detection cycle includes n sampling voltages Vds_SR. When calculating the input voltage Vac, m consecutively increasing sampling voltages are determined from the n sampling voltages Vds_SR as valid data, and the three sampling voltages at the middle position are selected from the m sampling voltages as the three sampling voltages Vds_SR1, Vds_SR2, and Vds_SR3. Here, n and m are both integers, and n ≥ m > 3.
[0058] For example, in one example, n=100, m=21. That is, from 100 original sampled voltages, 21 continuously increasing sampled voltages are determined as valid data, and the three sampled voltages in the middle position are selected from the 21 sampled voltages as Vds_SR1, Vds_SR2, and Vds_SR3.
[0059] In some embodiments, the n raw sampled voltages obtained in a complete detection cycle may include multiple segments of continuously increasing data. In this application embodiment, three sampled voltages are determined as Vds_SR1, Vds_SR2, and Vds_SR3 according to the following method: Among them, the above n sampled voltages include multiple valid data segments, and each valid data segment includes multiple continuously increasing sampled voltages. The data segment with the most data among the multiple valid data segments is determined as the above m sampled voltages.
[0060] For example, in one instance, the transformer has a turns ratio n=9.5, an output voltage Vout of 11V, and the collected sampling voltage includes 100 voltage data points. The table below shows the voltage data points and their serial numbers (where the unit of voltage is V): As shown in the table above, among the 100 sampled voltage data points, there are three segments where the values increase continuously, constituting three valid data segments: the first segment consists of the 1st to 4th voltage samples, comprising four consecutively increasing sampled voltages; the second segment consists of the 34th to 54th voltage samples, comprising 21 consecutively increasing sampled voltages; and the third segment consists of the 84th to 100th voltage samples, comprising 17 consecutively increasing sampled voltages. Clearly, the second segment has the most data points. Therefore, the 21 sampled voltage data points in the second segment are designated as the m sampled voltages mentioned above, where n=100 and m=21.
[0061] Subsequently, among the 21 sampled voltage data points in the second segment, the three sampled voltages located in the middle are designated as Vds_SR1, Vds_SR2, and Vds_SR3. These three sampled voltages in the middle position are the 43rd, 44th, and 45th, with corresponding sampled voltage values of 37.38, 38.70, and 39.90, respectively. This completes the determination of the three sampled voltages Vds_SR1, Vds_SR2, and Vds_SR3. Substituting n=9.5, Vout=11, Vds_SR1=37.38, Vds_SR2=38.70, and Vds_SR3=39.90 into the above calculation formula, the input voltage Vac=229.97V can be calculated.
[0062] The input voltage detection circuit of this application embodiment can calculate the input voltage of the input circuit based on the detected sampling voltage, output voltage, and transformer turns ratio. Therefore, it can realize real-time detection of input voltage. The detection of input voltage is no longer limited to when the power is turned on. Based on the real-time detected input voltage, the output power of the switching power supply can be adjusted to avoid damage to the switching power supply due to mismatch between output power and input voltage, thereby improving the safety of the switching power supply.
[0063] This application also provides an input voltage detection method for a switching power supply, applicable to the input voltage detection circuit of any of the above embodiments. (See reference...) Figure 6 , Figure 6 This is a schematic flowchart of the input voltage detection method according to an embodiment of this application. The input voltage detection method includes the following steps: 210. Obtain the sampling voltage and the output voltage of the output electrolytic capacitor. The sampling voltage is the sum of the voltage of the secondary winding of the transformer and the output voltage. 220. Calculate the input voltage of the input circuit based on the sampling voltage, output voltage, and transformer turns ratio.
[0064] In some embodiments, when the output power P of the switching power supply is less than a preset power threshold P0, the input voltage of the input circuit 10 is calculated according to the following formula: Where Vac is the input voltage of input circuit 10, Vds_SR is the sampling voltage obtained by voltage sampling circuit 30, Vout is the output voltage of output electrolytic capacitor EC2, and n is the turns ratio of transformer T.
[0065] In some embodiments, when the output power P of the switching power supply is greater than or equal to a preset power threshold P0, the input voltage of the input circuit 10 is calculated according to the following formula: Where Vac is the input voltage of input circuit 10, Vds_SR1, Vds_SR2, and Vds_SR3 are three consecutive sampled voltages obtained by voltage sampling circuit 30, Vout is the output voltage of output electrolytic capacitor EC2, and n is the turns ratio of transformer T.
[0066] It should be noted that the specific implementation methods of each step and embodiment of the input voltage detection method can be found in the descriptions of the various embodiments of the input voltage detection method described above, and will not be repeated here.
[0067] This application also provides a charger, including the input voltage detection circuit of any of the above embodiments.
[0068] In the description of this application, it should be understood that terms such as “first” and “second” are used only to distinguish similar objects and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.
[0069] It should be noted that in the embodiments of this application, "connection" can be understood as electrical connection. The connection between two electrical components can be a direct or indirect connection between the two electrical components. For example, the connection between A and B can be a direct connection between A and B, or an indirect connection between A and B through one or more other electrical components.
[0070] The input voltage detection circuit, input voltage detection method, and charger of the switching power supply provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application, and the descriptions of the embodiments above are only for the purpose of helping to understand this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An input voltage detection circuit for a switching power supply, characterized in that, include: A transformer includes a primary winding and a secondary winding coupled to each other. The primary winding is connected to an input circuit, and the secondary winding is connected to an output circuit. The input circuit is used to input voltage and includes an input electrolytic capacitor. The output circuit includes an output electrolytic capacitor for output voltage. A voltage sampling circuit, connected to the secondary winding, is used to obtain the sampling voltage and the output voltage of the output electrolytic capacitor, wherein the sampling voltage is the sum of the voltage of the secondary winding and the output voltage; A voltage calculation module, connected to the voltage sampling circuit, is used to calculate the input voltage of the input circuit based on the sampled voltage, the output voltage, and the turns ratio of the transformer.
2. The input voltage detection circuit according to claim 1, characterized in that, When the output power of the switching power supply is less than a preset power threshold, the voltage calculation module calculates the input voltage according to the following formula: Where Vac is the input voltage, Vds_SR is the sampling voltage, Vout is the output voltage, and n is the transformer turns ratio.
3. The input voltage detection circuit according to claim 1, characterized in that, When the output power of the switching power supply is greater than or equal to a preset power threshold, the voltage calculation module calculates the input voltage according to the following formula: Where Vac is the input voltage, Vds_SR1, Vds_SR2, and Vds_SR3 are three consecutive sampled voltages, Vout is the output voltage, and n is the transformer turns ratio.
4. The input voltage detection circuit according to claim 3, characterized in that, The sampling voltage is n. From the n sampling voltages, m consecutively increasing sampling voltages are determined as valid data. From the m sampling voltages, the three sampling voltages at the middle position are selected as Vds_SR1, Vds_SR2, and Vds_SR3, where n and m are integers, and n ≥ m > 3.
5. The input voltage detection circuit according to claim 4, characterized in that, The n sampled voltages include multiple valid data segments, and each valid data segment includes multiple continuously increasing sampled voltages. The data segment with the most data among the multiple valid data segments is determined as the m sampled voltages.
6. The input voltage detection circuit according to any one of claims 1 to 5, characterized in that, The positive terminal of the output electrolytic capacitor is connected to the first terminal of the secondary winding, and the negative terminal of the output electrolytic capacitor is grounded and connected to the second terminal of the secondary winding through the second switching unit. The voltage sampling circuit includes a protocol chip, a second switching unit, and a second controller. The protocol chip includes a first sampling port and a second sampling port. The first sampling port is connected to the second end of the secondary winding to obtain the sampled voltage. The second sampling port is connected to the positive terminal of the output electrolytic capacitor to obtain the output voltage. The second controller is connected to the control terminal of the second switching unit to control the second switching unit to be turned on or off.
7. The input voltage detection circuit according to claim 6, characterized in that, The second controller controls the second switching unit to periodically turn on and off with a period T, the period T including the on-time Ton and the off-time Toff. The first sampling port starts to collect the sampling voltage at time Ton / 2 in each period T for a duration of Δt, where Δt=T.
8. The input voltage detection circuit according to any one of claims 1 to 5, characterized in that: The first end of the primary winding is connected to the positive terminal of the input electrolytic capacitor. The positive terminal of the input electrolytic capacitor is connected to the AC power supply through a rectifier circuit. The negative terminal of the input electrolytic capacitor is connected to the rectifier circuit and grounded. The input voltage detection circuit further includes a first switching unit and a first controller. The first end of the first switching unit is connected to the second end of the primary winding, and the second end of the first switching unit is grounded. The first controller is connected to the control end of the first switching unit to control the first switching unit to turn on or off.
9. A method for detecting the input voltage of a switching power supply, characterized in that, The input voltage detection method, applied to the input voltage detection circuit according to any one of claims 1 to 8, comprises: The sampling voltage and the output voltage of the output electrolytic capacitor are obtained, wherein the sampling voltage is the sum of the voltage of the secondary winding of the transformer and the output voltage; The input voltage of the input circuit is calculated based on the sampled voltage, the output voltage, and the turns ratio of the transformer.
10. A charger, characterized in that, Includes the input voltage detection circuit as described in any one of claims 1 to 8.