CN110912224A - Charging device and charging device control method - Google Patents
- ️Tue Mar 24 2020
Disclosure of Invention
The invention provides a charging device, and aims to solve the problem that the charging device in the prior art is low in detection accuracy when a USB interface is plugged into or pulled out of a charging device, and is prone to causing misjudgment.
The present invention is achieved as such, a charging device comprising: the device comprises a power supply, a voltage output circuit connected with the power supply, a control module electrically connected with the power supply, a detection circuit connected with the voltage output circuit and the control module, and a USB interface connected with the detection circuit;
the detection circuit comprises a plug detection circuit connected with the voltage output circuit and the USB interface, and an MOS (metal oxide semiconductor) tube which is connected with the plug detection circuit in parallel and is used for switching on or off the voltage output circuit and the USB interface, the MOS tube is connected with the control module, and the plug detection circuit forms loop current when charging equipment is inserted into the USB interface and generates voltage at two ends of the plug detection circuit;
when the MOS tube is in a disconnected state, when the control module detects that the voltage at two ends of the plugging detection circuit is greater than a first preset value, the control module judges that a charging device is plugged into the USB interface and controls the MOS tube to be conducted so that the USB interface outputs a charging voltage to charge the charging device;
when the MOS tube is in a conducting state, the control module controls the MOS tube to reduce the driving voltage at intervals of preset time and detects the voltage at two ends of the plug detection circuit, and when the control module detects that the voltage at two ends of the plug detection circuit is smaller than a second preset value, the control module judges that the charging equipment is plugged out of the USB interface and controls the MOS tube to be kept disconnected, so that the USB interface stops outputting the charging voltage.
Preferably, the number of the USB interfaces and the number of the detection circuits are at least two, and each USB interface is correspondingly connected with one detection circuit.
Preferably, the charging device further comprises a charging protocol module respectively connected to the voltage output circuit and the control module, and the charging protocol module is simultaneously connected to each USB interface;
when the control module detects that the charging equipment is inserted into one USB interface, the control module sends a first control signal to the charging protocol module, and the charging protocol module receives the first control signal and controls the voltage output circuit to output charging voltage corresponding to the charging equipment to the USB interface according to the charging voltage of the charging equipment;
when the control module detects that two or more than two USB interfaces are inserted into the charging device, the control module sends a second control signal to the charging protocol module, and the charging protocol module receives the second control signal and controls the voltage output circuit to output a preset charging voltage to the USB interfaces.
Preferably, the plug detection circuit comprises a detection resistor connected with the MOS transistor in parallel, one end of the detection resistor is connected with the USB interface and the source electrode of the MOS transistor, the other end of the detection resistor is grounded and connected with the drain electrode of the MOS transistor, and the gate electrode of the MOS transistor is connected with the control module.
Preferably, the voltage output circuit includes a resistor R7 and a resistor R8, one end of the resistor R7 is connected to the power supply, the other end of the resistor R8 is connected to one end of the resistor R8, the other end of the resistor R8 is grounded, and a pin FB of the charging protocol module is connected between the resistor R7 and the resistor R8.
Preferably, the charging device further comprises a voltage stabilizing module, and the control module is connected with the power supply through the voltage stabilizing module.
Preferably, the MOS transistor is connected to the control module through a current limiting resistor.
The invention also provides a charging device control method, which is applied to the charging device and comprises the following steps:
when the MOS tube is in a disconnected state, the control module detects the voltage at two ends of the plugging detection circuit;
the control module judges whether the voltage at two ends of the plugging detection circuit is greater than a first preset value or not; if yes, entering the next step; if not, returning to the previous step;
the control module judges that a charging device is inserted into the USB interface and controls the MOS tube to be conducted so that the USB interface outputs charging voltage to charge the charging device;
when the MOS tube is in a conducting state, the control module controls the MOS tube to reduce the driving voltage and detect the voltage at two ends of the plugging detection circuit at preset time intervals;
the control module judges whether the voltage at the two ends of the plugging detection circuit is smaller than a second preset value; if yes, entering the next step; if not, returning to the previous step;
the control module judges that the charging equipment is pulled out of the USB interface and controls the MOS tube to be kept disconnected so that the USB interface stops outputting the charging voltage.
Preferably, the number of the USB interfaces and the number of the detection circuits are at least two, and each USB interface is correspondingly connected with one detection circuit.
Preferably, the charging device further comprises a charging protocol module respectively connected to the voltage output circuit and the control module, and the charging protocol module is simultaneously connected to each USB interface; the control module judges that a charging device is inserted into the USB interface and controls the MOS tube to be conducted, so that the USB interface outputs charging voltage to charge the charging device, and the control module comprises:
when the control module judges that the charging equipment is inserted into one USB interface, the control module sends a first control signal to the charging protocol module, and the charging protocol module receives the first control signal and controls the voltage output circuit to output charging voltage corresponding to the charging equipment to the USB interface according to the charging voltage of the charging equipment;
when the control module judges that two or more than two USB interfaces are inserted into the charging device, the control module sends a second control signal to the charging protocol module, and the charging protocol module receives the second control signal and controls the voltage output circuit to output a preset charging voltage to the USB interfaces.
According to the charging device, the plug detection circuit connected with the voltage output circuit and the USB interface and the MOS tube connected with the plug detection circuit in parallel and used for conducting or disconnecting the voltage output circuit and the USB interface are arranged, the principle that the plug detection circuit forms loop current when the charging device is plugged into the USB interface and generates voltage at two ends of the plug detection circuit is utilized, the control module detects whether the voltage at two ends of the plug detection circuit is larger than a first preset value when the MOS tube is in a disconnected state, and then whether the charging device is plugged into the USB interface can be judged, so that the situation that only a Lightning data line of a built-in chip is plugged into the USB interface and is judged by mistake as the charging device is plugged into the USB interface is avoided, and the accuracy of detecting whether the charging device is plugged into the USB interface is improved. When the MOS tube is in a conducting state, the control module controls the MOS tube to reduce the driving voltage at preset time intervals so as to generate a voltage difference at two ends of the plug detection circuit, and the control module detects whether the voltage at the two ends of the plug detection circuit is smaller than a second preset value so as to judge whether the charging equipment is pulled out. When the control module detects that the voltage at the two ends of the plugging detection circuit is smaller than the second preset value, the control module judges that the charging equipment is plugged out of the USB interface and drives the MOS tube to be kept disconnected to stop the USB interface from outputting the charging voltage, so that whether the charging equipment is plugged out of the USB interface or not can be accurately detected, the situation that a user is mistakenly judged that the charging equipment is not plugged out when the user only plugs out the apple mobile phone but does not plug out the Lightning data line is avoided, and the charging voltage is timely stopped being output by the USB interface after the charging equipment is plugged out of the USB interface.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
According to the charging device provided by the embodiment of the invention, by arranging the plugging detection circuit for connecting the voltage output circuit and the USB interface and the MOS tube which is connected with the plugging detection circuit in parallel and is used for connecting or disconnecting the voltage output circuit and the USB interface, the principle that the plugging detection circuit forms loop current when the charging equipment is plugged into the USB interface and generates voltage at two ends of the plugging detection circuit is utilized, and the control module detects whether the voltage at two ends of the plugging detection circuit is greater than a first preset value when the MOS tube is in a disconnected state, so that whether the charging equipment is plugged into the USB interface can be judged, and the accuracy for detecting whether the charging equipment is plugged into the USB interface is improved. When the MOS tube is in a conducting state, the driving voltage of the MOS tube is reduced at intervals of preset time through the control module, so that the impedance of the MOS tube is increased, when the control module detects that the voltage at two ends of the plug detection circuit is smaller than a second preset value, the control module judges that the charging equipment extracts the USB interface and controls the MOS tube to be disconnected so as to stop the USB interface from outputting the charging voltage, and therefore whether the charging equipment extracts the USB interface or not can be accurately detected, and the charging equipment can stop the USB interface from outputting the charging voltage in time after the charging equipment extracts the USB interface.
Referring to fig. 1 to fig. 3, an embodiment of the invention provides a charging device, including: the device comprises a
power supply1, a
voltage output circuit2 connected with the
power supply1, a
control module3 electrically connected with the
power supply1, a
detection circuit4 connected with the
voltage output circuit2 and the
control module3, and a
USB interface5 connected with the
detection circuit4.
Referring to fig. 2, the
detection circuit4 includes a
plugging detection circuit41 connecting the
voltage output circuit2 and the
USB interface5, and an
MOS transistor42 connected in parallel with the
plugging detection circuit41 and used for turning on or off the
voltage output circuit2 and the
USB interface5, where the
MOS transistor42 is connected to the
control module3, and the
plugging detection circuit41 forms a loop current when the charging device is plugged into the
USB interface5, and generates a voltage at two ends of the
plugging detection circuit41. The charging device can be a mobile phone, a Bluetooth headset, a tablet computer and the like.
When the
MOS transistor42 is in the off state, when the
control module3 detects that the voltage at the two ends of the
plug detection circuit41 is greater than the first preset value, the
control module3 determines that the charging device is inserted into the
USB interface5 and controls the
MOS transistor42 to be turned on, so that the
USB interface5 outputs the charging voltage to charge the charging device.
When the
MOS transistor42 is in the on state, the
control module3 controls the
MOS transistor42 to reduce the driving voltage at preset intervals, and detects the voltages at the two ends of the
plugging detection circuit41, and when the
control module3 detects that the voltages at the two ends of the
plugging detection circuit41 are smaller than the second preset value, the
control module3 determines that the charging device is plugged out of the
USB interface5 and controls the
MOS transistor42 to be kept off, so that the
USB interface5 stops outputting the charging voltage.
In the embodiment of the present invention, the
control module3 may be a single chip or an analog chip. In this embodiment, the
control module3 is a single chip microcomputer. The
control module3 inputs a low level to the
MOS transistor42 at every predetermined time, so that the
MOS transistor42 is turned off at every predetermined time to reduce the driving voltage of the
MOS transistor42. The characteristic that the driving voltage of the
MOS transistor42 is gradually reduced in the closing process is utilized to reduce the driving voltage of the
MOS transistor42, and during the reduction of the driving voltage of the
MOS transistor42, the impedance of the
MOS transistor42 is gradually increased, so that a voltage difference is generated between two ends of the
plug detection circuit41, if the charging device pulls out the
USB interface5, the voltage between two ends of the
plug detection circuit41 will be smaller than the second preset value, if the charging device does not pull out the
USB interface5, the voltage between two ends of the
plug detection circuit41 will be greater than or equal to the second preset value, and therefore the
control module3 can judge whether the charging device pulls out the
USB interface5 by detecting whether the voltage between two ends of the
plug detection circuit41 is smaller than the second preset value.
The interval time of the
MOS tube42 being closed every time by the
control module3 can be set according to actual needs, so as to ensure that the driving voltage when the
MOS tube42 is closed at every time is not reduced to zero, so that the
MOS tube42 is not completely closed, and it can be ensured that the
control module3 accurately detects the voltages at the two ends of the
plug detection circuit41, thereby accurately judging whether the charging device is pulled out. If the driving voltage of the
MOS transistor42 is not reduced at preset intervals by the
control module3, the voltage at both ends of the
MOS transistor42 approaches zero when the
MOS transistor42 is turned on, and the
plug detection circuit41 is in a short-circuit state, so that the voltage at both ends of the
plug detection circuit41 cannot be detected.
In this embodiment, when the
MOS transistor42 is in the on state, the
control module3 turns off the
MOS transistor42 once every 2 seconds, the power supply voltage of the
power supply1 is 5V, and the initial driving voltage of the
MOS transistor42 is 5V. During the closing process of the
MOS transistor42, the driving voltage of the
MOS transistor42 gradually decreases from 5V, and during this process, the
control module3 detects the voltage across the
plug detection circuit41. When the
control module3 detects that the voltage at the two ends of the
plugging detection circuit41 is smaller than the second preset value, the
control module3 judges that the charging device is plugged out of the
USB interface5, and at this time, the
control module3 continuously outputs a low level to the
MOS transistor42, so as to control the
MOS transistor42 to be disconnected to stop the
USB interface5 from outputting the charging voltage; if the
control module3 detects that the voltages at the two ends of the
plug detection circuit41 are greater than or equal to the second preset value in the closing process of the
MOS transistor42, the
control module3 determines that the charging device is not plugged out of the
USB interface5, and at this time, the
control module3 controls the
MOS transistor42 to be turned on again and closes the
MOS transistor42 once every preset time to reduce the driving voltage of the
MOS transistor42, so as to detect whether the charging device is plugged out of the
USB interface5 in real time.
According to the charging device provided by the embodiment of the invention, by arranging the
plugging detection circuit41 which is connected with the
voltage output circuit2 and the
USB interface5 and the
MOS tube42 which is connected with the
plugging detection circuit41 in parallel and is used for conducting or disconnecting the
voltage output circuit2 and the
USB interface5, the
plugging detection circuit41 forms loop current when the charging device is plugged into the
USB interface5, and voltage is generated at two ends of the
plugging detection circuit41. When the
MOS transistor42 is in the off state, the
control module3 detects whether the voltage at the two ends of the
plug detection circuit41 is greater than the first preset value, so as to determine whether the
USB interface5 is plugged into the charging device, thereby avoiding a situation that only the Lightning data line of the built-in chip is plugged into the
USB interface5 and the charging device is erroneously determined to be plugged into the
USB interface5, and improving the accuracy of detecting whether the charging device is plugged into the
USB interface5; when the
MOS transistor42 is in a conducting state, the driving voltage of the
MOS transistor42 is reduced at preset time intervals by the
control module3 to generate a voltage difference at two ends of the
plug detection circuit41, and whether the voltage at two ends of the
plug detection circuit41 is smaller than a second preset value is detected by the
control module3 to determine whether the charging device is plugged out. When the
control module3 detects that the voltage at the two ends of the
plugging detection circuit41 is smaller than the second preset value, the
control module3 judges that the charging device is plugged out of the
USB interface5 and controls the
MOS tube42 to be disconnected to stop the
USB interface5 from outputting the charging voltage, so that whether the charging device is plugged out of the
USB interface5 can be accurately detected, and it is avoided that a user is mistakenly judged that the charging device is not plugged out when the user only plugs out the iphone but does not plug out the iphone data line, so that the
USB interface5 is timely stopped from outputting the charging voltage after the charging device plugs out the
USB interface5.
In the embodiment of the present invention, the
MOS transistor42 is a PMOS transistor or an NMOS transistor. The
MOS transistor42 is connected to the
control module3 through a current limiting resistor, so as to limit the current passing through the
MOS transistor42 and prevent the
MOS transistor42 from being damaged.
As an embodiment of the present invention, the plugging
detection circuit41 includes a detection resistor R0 connected in parallel with the
MOS transistor42, one end of the detection resistor R0 is connected to the
USB interface5 and the source of the
MOS transistor42, the other end of the detection resistor R0 is grounded and connected to the drain of the
MOS transistor42, and the gate of the
MOS transistor42 is connected to the
control module3. Since the
MOS transistor42 is connected in parallel with the detection resistor R0, the voltage across the
plug detection circuit41 is the voltage across the detection resistor R0. In addition, the plugging
detection circuit41 may be provided with two or more detection resistors connected in series.
In this embodiment, the gate of the
MOS transistor42 is connected to the port GateX of the
control module3, and the
MOS transistor42 is connected to the
voltage output circuit2 and the
USB interface5, so as to control the on/off of the
MOS transistor42, and control the on/off of the output voltage of the
USB interface5. The
MOS tube42 is controlled to be turned on when the port GateX of the
control module3 outputs a high level, and the
MOS tube42 is controlled to be turned off when the port GateX of the
control module3 outputs a low level, so that the
MOS tube42 is turned off. One end of the detection resistor R0 is connected to the pin GND of the
USB interface5 and is connected to the source of the
MOS transistor42 to form a node a, the other end of the detection resistor R0 is connected to the GND end of the
voltage output circuit2 and is connected to the drain of the
MOS transistor42 to form a node b, the pin VCC of the
USB interface5 is connected to the Vbus end of the
voltage output circuit2, and the voltage at the two ends of the plugging/unplugging
detection circuit41 is the voltage Vab between the node a and the node b.
In this embodiment, when the
USB interface5 is not plugged into the charging device, the plugging
detection circuit41 does not form a path, the plugging
detection circuit41 does not form a current, and the voltage Vab across the plugging
detection circuit41 is zero. When a charging device is plugged into the
USB interface5, the plugging
detection circuit41 forms a path with the
USB interface5 via a data line, and a loop current Iab passing through the plugging
detection circuit41 is formed. At this time, since the
MOS transistor42 is not turned on, the current passes through the detection resistors R0, Vab ═ Iab ═ R0 of the
plug detection circuit41, if the lighting data line (the iphone data line) of the built-in chip is inserted into the
USB interface5, the current is drawn less than 1mA, and if the charging device such as a mobile phone/bluetooth headset is inserted into the
USB interface5, the current is drawn at least more than 10 mA. Because the resistance value of the detection resistor R0 is fixed, only the first preset value of Vab needs to be set, whether the
USB interface5 is inserted into the charging equipment can be judged, and therefore whether the charging equipment is inserted into the USB interface can be reliably identified, and misjudgment is avoided.
The first preset value can be set according to the resistance of the detection resistor R0, for example, the resistance of the detection resistor R0 is 200 ohms, and the first preset value is set to 0.3V. When the Lightning data line is plugged into the
USB interface5, the current passing through the detecting resistor R0 is less than 1mA, and therefore the voltage at the two ends of the detecting resistor R0 is less than 0.2V, and therefore when the Lightning data line is plugged into the
USB interface5, the voltage Vab at the two ends of the plugging detecting
circuit41 detected by the
control module3 is less than 0.3V, so that it can be accurately determined that no charging device is plugged into the
USB interface5, the
MOS transistor42 is not turned on at this time, and the
USB interface5 does not output the charging voltage.
In the embodiment of the present invention, after the
control module3 determines that the charging device is plugged into the
USB interface5 and controls the
MOS transistor42 to be turned on to enable the
USB interface5 to output a voltage to charge the charging device, the
MOS transistor42 is turned off at preset intervals by the
control module3, so as to reduce the driving voltage of the
MOS transistor42 to increase the impedance of the
MOS transistor42, so as to generate a voltage difference at two ends of the
plug detection circuit41, and thus, whether the voltage Vab at two ends of the
plug detection circuit41 is smaller than a second preset value can be accurately detected by the
control module3 to determine whether the charging device is plugged out.
As shown in fig. 4, the impedance of the
MOS transistor42 increases with the decrease of the driving voltage VGS of the
MOS transistor42, and the current Ids passing through the
MOS transistor42 decreases, so that a voltage difference is generated between the two ends Vab of the plugging
detection circuit41. In this embodiment, when the
control module3 controls the
MOS transistor42 to be turned off, the driving voltage VGS of the
MOS transistor42 is gradually reduced from 5V, and in this process, the
control module3 detects the voltage Vab at two ends of the plugging
detection circuit41. When the charging device is not unplugged from the
USB interface5, the voltage Vab at two ends of the plugging
detection circuit41 is greater than or equal to the second preset value; when the voltage Vab at the two ends of the plugging
detection circuit41 is smaller than the second preset value, it represents that the charging device plugs out the
USB interface5. If the
control module3 detects that the voltage Vab at the two ends of the plugging
detection circuit41 is greater than or equal to the second preset value, the
control module3 determines that the charging device is not plugged out of the
USB interface5 and keeps the
MOS transistor42 turned on, and reduces the driving voltage of the
MOS transistor42 at preset intervals to detect whether the charging device is plugged out of the
USB interface5 in real time, so that the
control module3 continuously detects whether the charging device is plugged out of the
USB interface5 by controlling the turning-off and turning-on of the
MOS transistor42. When the
control module3 detects that the voltage Vab at the two ends of the plugging
detection circuit41 is smaller than the second preset value, the
control module3 judges that the charging device is plugged out of the
USB interface5 and controls the
MOS tube42 to be disconnected to stop the
USB interface5 from outputting the charging voltage, so that whether the charging device is plugged out of the
USB interface5 can be accurately detected, and it is avoided that a user is mistakenly judged that the charging device is not plugged out when the user only plugs out the apple phone without plugging out the data line of the apple phone, so that the
USB interface5 is timely stopped from outputting the charging voltage after the charging device plugs out the
USB interface5.
The setting value of the second preset value may be the same as or different from the first preset value, and both the second preset value and the first preset value are greater than zero, specifically set according to the resistance value of the plugging
detection circuit41. In this embodiment, the second preset value is also set to 0.3V. When the charging device pulls out the
USB interface5, the current passing through the detection resistor R0 is equal to zero, or only the apple phone is pulled out without pulling out the Lightning data line of the apple phone, and the current passing through the detection resistor R0 is smaller than 1mA, so the voltages at the two ends of the detection resistor R0 are both smaller than 0.2V and smaller than the second preset value of 0.3V, which prevents the apple data line from being pulled out and misjudging that the charging device is in a charging state, thereby accurately judging that the charging device pulls out the
USB interface5, and at this time, the
control module3 controls the
MOS transistor42 to be turned off, so that the
USB interface5 does not output a charging voltage.
In the embodiment of the invention, the charging device further comprises a
voltage stabilizing module6, and the
control module3 is connected with the
power supply1 through the
voltage stabilizing module6. The Vdd terminal of the
control module3 is connected to the
voltage stabilizing module6, the GND terminal of the
control module3 is grounded, and the
voltage stabilizing module6 plays a role in stabilizing, so that the working voltage of the
control module3 is stable.
As an embodiment of the present invention, the number of the
USB interfaces5 and the number of the
detection circuits4 are at least two, and each
USB interface5 is correspondingly connected to one
detection circuit4, so as to facilitate to charge a plurality of charging devices simultaneously. Besides, the number of the
USB interface5 and the
detection circuit4 may be set to only one. In the present embodiment, the number of the
USB interface5 and the
detection circuit4 is three.
In this embodiment, when the
MOS transistor42 corresponding to each
USB interface5 is in the off state, and when the
control module3 detects that the voltage Vab at the two ends of the
plug detection circuit41 is greater than the first preset value, the
control module3 determines that the charging device is inserted into the
USB interface5 and drives the
MOS transistor42 to be turned on, so that the
USB interface5 outputs the charging voltage to charge the charging device.
When the
MOS transistor42 corresponding to each
USB interface5 is in a conducting state, the
control module3 reduces the driving voltage of the
MOS transistor42 at preset time intervals, and detects the voltage Vab at two ends of the plugging
detection circuit41, and when the
control module3 detects that the voltage Vab at two ends of the plugging
detection circuit41 is smaller than a second preset value, the
control module3 determines that the charging device is plugged out of the
USB interface5 and controls the
MOS transistor42 to be disconnected, so as to stop the
USB interface5 from outputting the charging voltage.
As an embodiment of the present invention, the charging device further includes a
charging protocol module7 connected to the
voltage output circuit2 and the
control module3, respectively, and the
charging protocol module7 is simultaneously connected to each
USB interface5. Wherein, the
charging protocol module7 is connected with the port En1 of the
control module3. In this embodiment, the
charging protocol module7 is an identification chip.
When the
control module3 detects that a charging device is inserted into one
USB interface5, the
control module3 sends a first control signal to the
charging protocol module7, and the
charging protocol module7 receives the first control signal and controls the
voltage output circuit2 to output a charging voltage corresponding to the charging device to the
USB interface5 according to the charging voltage of the charging device; when the
control module3 detects that two or
more USB interfaces5 are plugged into the charging device, the
control module3 sends a second control signal to the
charging protocol module7, and the
charging protocol module7 receives the second control signal and controls the
voltage output circuit2 to output a preset charging voltage to the USB interfaces 5. The first control signal is a high level signal, and the second control signal is a low level signal.
In this embodiment, when the
control module3 detects that any one
USB interface5 is inserted into the charging device, the
control module3 drives the
MOS transistor42 corresponding to the
USB interface5 to be turned on, the
control module3 outputs a high level signal to the
charging protocol module7, the
charging protocol module7 identifies the charging voltage of the charging device through a handshake protocol, and controls the
voltage output circuit2 to output the charging voltage corresponding to the charging device to the
USB interface5, so as to realize the quick charging of the charging device.
When the
control module3 detects that the
second USB interface5 is inserted into the charging device, that is, when it detects that the two
USB interfaces5 are inserted into the charging device, the
control module3 drives the
MOS transistors42 corresponding to the
second USB interface5 to be turned on, at this time, the
control module3 outputs a low level signal to the
charging protocol module7, and the
charging protocol module7 receives the low level signal and controls the
voltage output circuit2 to output a preset charging voltage to the
USB interface5. The preset voltage is 5V, so that two or more charging devices can realize common charging. The two charging devices realize that the common charging is not allowed to enter a quick charging mode; similarly, when the
control module3 detects that the
third USB interface5 is inserted into the charging device, that is, when it detects that more than two
USB interfaces5 are inserted into the charging device, the
control module3 drives the
MOS transistor42 corresponding to the
third USB interface5 to be turned on, at this time, the
control module3 outputs a low level signal to the
charging protocol module7, and the
charging protocol module7 receives the low level signal and controls the
voltage output circuit2 to output a preset voltage to the
USB interface5, so that the three charging devices all realize normal charging. When any one
USB interface5 is detected to be inserted into one charging device to realize the quick charging of the charging device, and two or two
USB interfaces5 are detected to be inserted into the charging device to realize the common charging, the requirements of the quick charging and the common charging can be met, the total power is not increased, and the production cost is effectively reduced.
In the embodiment of the present invention, the
voltage output circuit2 includes a resistor R7 and a resistor R8, one end of the resistor R7 is connected to the
power supply1, the other end of the resistor R8 is connected to one end of the resistor R8, the other end of the resistor R8 is grounded, and the pin FB of the
charging protocol module7 is connected between the resistor R7 and the resistor R8. One end of the resistor R7 is connected with the Vout end of the
power supply1, one end of the resistor R8 connected with the resistor R7 is connected with the Vfb end of the
power supply1, and the other end of the resistor R8 is connected with the GND end of the
power supply1.
In the embodiment of the present invention, the
charging protocol module7 precisely controls the output voltage of the
voltage output circuit2 by adjusting the magnitude of the source current or sink current of the pin FB, so as to output a corresponding charging voltage according to the charging voltage of the charging device. For example, when the resistor R7 is 100k ohms and the
USB interface5 needs to output a voltage of 9V, the FB pin of the
charging protocol module7 draws a current of 40uA, so that the voltage of the
USB interface5 can be changed from 5V to a voltage of 9V for output; when the
USB interface5 needs to output 12V voltage, the FB pin of the
charging protocol module7 needs to pull current 70uA, so that the voltage of the
USB interface5 can be changed from 5V to 12V voltage for output; when the
USB interface5 outputs a voltage of 5V, the FB pin of the
charging protocol module7 neither draws current nor sinks current, and the voltage of the
USB interface5 outputs a voltage of 5V.
Referring to fig. 3, in detail, the
detection circuit4 includes a first detection circuit, a second detection circuit and a third detection circuit, the
USB interface5 includes a
first USB interface51, a
second USB interface52 and a
third USB interface53, and the
first USB interface51, the
second USB interface52 and the
third USB interface53 are respectively connected to the
charging protocol module7.
The first detection circuit comprises a first plug detection circuit connected with the
voltage output circuit2 and the
first USB interface51 and a first MOS tube Q1 which is connected with the first plug detection circuit in parallel and used for connecting or disconnecting the
voltage output circuit2 and the
first USB interface51, the first MOS tube Q1 is connected with the
control module3, the first plug detection circuit forms loop current when the charging equipment is inserted into the
first USB interface51, and voltage is generated at two ends of the first plug detection circuit. The first plug detection circuit includes a first detection resistor R4, a Gate of the first MOS transistor Q1 is connected to a port Gate1 of the
control module3 through a first current limiting resistor R1, one end of the first detection resistor R4 is connected to a pin GND of the
first USB interface51, a source of the first MOS transistor Q1, and a port Point1 of the
control module3, the other end of the first detection resistor R4 is grounded and connected to a drain of the first MOS transistor Q1, a pin VCC of the
first USB interface51 is connected to one end of the resistor R7, which is connected to a Vout end of the
power supply1, and a pin D + of the
first USB interface51 and a pin D-of the
first USB interface51 are connected to the
charging protocol module7, respectively.
The second detection circuit comprises a second plug detection circuit connected with the
voltage output circuit2 and the
second USB interface52 and a second MOS tube Q2 which is connected with the second plug detection circuit in parallel and used for connecting or disconnecting the
voltage output circuit2 and the
second USB interface52, the second MOS tube Q2 is connected with the
control module3, the first plug detection circuit forms loop current when the charging equipment is inserted into the
second USB interface52, and voltage is generated at two ends of the first plug detection circuit. The first plug detection circuit includes a second detection resistor R5, a Gate of the second MOS transistor Q2 is connected to a port Gate2 of the
control module3 through a second current limiting resistor R2, one end of the second detection resistor R5 is connected to a pin GND of the
second USB interface52, a source of the second MOS transistor Q2, and a port Point2 of the
control module3, the other end of the second detection resistor R5 is grounded and connected to a drain of the second MOS transistor Q2, a pin VCC of the
second USB interface52 is connected to one end of the resistor R7, which is connected to a Vout end of the
power supply1, and a pin D + of the
second USB interface52 and a pin D-of the
second USB interface52 are connected to the
charging protocol module7.
The third detection circuit comprises a third plug detection circuit connected with the
voltage output circuit2 and the
third USB interface53, and a third MOS transistor Q3 connected in parallel with the third plug detection circuit and used for turning on or off the
voltage output circuit2 and the
third USB interface52, the third MOS transistor Q3 is connected with the
control module3, the third plug detection circuit forms a loop current when the charging device is inserted into the
third USB interface53, and generates a voltage at two ends of the third plug detection circuit. The third plug detection circuit includes a third detection resistor R6, a Gate of the third MOS transistor Q3 is connected to a port Gate3 of the
control module3 through a third current limiting resistor R3, one end of the third detection resistor R6 is connected to a pin GND of the
third USB interface53, a source of the third MOS transistor Q3, and a port Point3 of the
control module3, the other end of the third detection resistor R6 is grounded and connected to a drain of the third MOS transistor Q3, a pin VCC of the
third USB interface53 is connected to one end of the resistor R7, which is connected to the Vout end of the
power supply1, and a pin D + of the
third USB interface53 and a pin D-of the
third USB interface53 are connected to the
charging protocol module7, respectively.
When the first MOS transistor Q1 is in an off state, when the port Point1 of the control module 3 detects that the voltage at two ends of the first plug detection circuit is greater than the first preset value, at this time, the control module 3 determines that the charging device is inserted into the first USB interface 51, and the port Gate1 of the control module 3 outputs a high level to drive the first MOS transistor Q1 to be turned on, so that the first USB interface 51 outputs a charging voltage to charge the charging device; otherwise, when the port Point1 of the control module 3 detects that the voltage at the two ends of the first plug detection circuit is smaller than or equal to the first preset value, the port Gate1 of the control module 3 outputs a low level, and the first MOS transistor Q1 is not turned on; when the first MOS transistor Q1 is in a conducting state, the control module 3 reduces the driving voltage of the first MOS transistor Q1 at preset intervals, in this process, when the port Point1 of the control module 3 detects that the voltage at the two ends of the first plug detection circuit is smaller than the second preset value, at this time, the control module 3 determines that the charging device is plugged out of the first USB interface 51, and the port Gate1 of the control module 3 outputs a low level to drive the first MOS transistor Q1 to be turned off; if the port Point1 of the control module 3 detects that the voltage at the two ends of the first plugging detection circuit is greater than or equal to the second preset value, at this time, the control module 3 determines that the charging device is not plugged out of the first USB interface 51, and the control module 3 reduces the driving voltage of the first MOS transistor Q1 at preset intervals to detect whether the charging device is plugged out of the first USB interface 51 in real time.
When the second MOS transistor Q2 is in an off state, when the port Point2 of the
control module3 detects that the voltage at two ends of the second plug detection circuit is greater than the first preset value, at this time, the
control module3 determines that the charging device is inserted into the
second USB interface52, and the port Gate2 of the
control module3 outputs a high level to drive the second MOS transistor Q2 to be turned on, so that the
second USB interface52 outputs a charging voltage to charge the charging device; otherwise, when the voltage detected by the port Point2 of the
control module3 is less than or equal to the first preset value, the port Gate2 of the
control module3 outputs a low level, and the second MOS transistor Q2 is not turned on. When the second MOS transistor Q2 is in a conducting state, the
control module3 reduces the driving voltage of the second MOS transistor Q2 at preset time intervals, in this process, when the port Point2 of the
control module3 detects that the voltage at the two ends of the second plugging detection circuit is smaller than a second preset value, at this time, the
control module3 determines that the charging device is plugged out of the
second USB interface52, and the port Gate2 of the
control module3 outputs a low level to drive the second MOS transistor Q2 to be turned off; if the port Point2 of the
control module3 detects that the voltage at the two ends of the second plug detection circuit is greater than or equal to the second preset value, at this time, the
control module3 determines that the charging device is not plugged out of the
second USB interface52, and the
control module3 reduces the driving voltage of the second MOS transistor Q2 at preset intervals to detect whether the charging device is plugged out of the
second USB interface52 in real time.
When the third MOS transistor Q3 is turned on and off, when the voltage detected by the port Point3 of the
control module3 is greater than the first preset value, at this time, the
control module3 determines that the charging device is inserted into the
third USB interface53, and the port Gate3 of the
control module3 outputs a high level to drive the third MOS transistor Q3 to turn on, so that the
third USB interface53 outputs a charging voltage to charge the charging device; otherwise, when the voltage detected by the port Point3 of the
control module3 is less than or equal to the first preset value, the port Gate3 of the
control module3 outputs a low level, and the third MOS transistor Q3 is not turned on. When the third MOS transistor Q3 is in a conducting state, the
control module3 reduces the driving voltage of the third MOS transistor Q3 at preset time intervals, in this process, when the port Point3 of the
control module3 detects that the voltage at the two ends of the third plugging detection circuit is smaller than the second preset value, at this time, the
control module3 determines that the charging device is plugged out of the
third USB interface53, and the port Gate3 of the
control module3 outputs a low level to drive the third MOS transistor Q3 to be turned off; if the port Point3 of the
control module3 detects that the voltage at the two ends of the third plugging detection circuit is greater than or equal to the second preset value, at this time, the
control module3 determines that the charging device is not plugged out of the
third USB interface53, and the
control module3 reduces the driving voltage of the third MOS transistor Q3 at preset intervals to detect whether the charging device is plugged out of the
third USB interface53 in real time.
When the port Gate1, the port Gate2 or the port Gate3 of the
control module3 outputs a high level, which represents that one
USB interface5 is plugged into the charging device, a counter n is introduced, and n counts once, for example, when the counter n is equal to 3, which represents that three
USB interfaces5 are plugged into the charging device, by the above-mentioned detection method for detecting the plugging and unplugging of the charging device, when the charging device of one
USB interface5 is unplugged, the counter n is decremented by 1, which represents that the charging device of 1
USB interface5 is unplugged. When the counter n is equal to 1, it represents that only one
USB interface5 is inserted into the charging device, at this time, the port En1 of the
control module3 is set to high level, the
charging protocol module7 receives a high level signal, and the
charging protocol module7 controls the
voltage output circuit2 to output the charging voltage of the corresponding charging device to the
USB interface5 according to the charging voltage of the charging device, so as to implement fast charging. When the counter n >1, it represents that two or
more USB interfaces5 are plugged into the charging device, the port En1 of the
control module3 is set to low level, and the
charging protocol module7 receives the low level signal and controls the
voltage output circuit2 to output a preset charging voltage to the
USB interfaces5, so as to implement a normal charging function.
According to the charging device provided by the embodiment of the invention, by arranging the plugging detection circuit for connecting the voltage output circuit and the USB interface and the MOS tube which is connected with the plugging detection circuit in parallel and is used for connecting or disconnecting the voltage output circuit and the USB interface, the principle that the plugging detection circuit forms loop current when the charging equipment is plugged into the USB interface and generates voltage at two ends of the plugging detection circuit is utilized, and the control module detects whether the voltage at two ends of the plugging detection circuit is larger than a first preset value when the MOS tube is in a disconnected state, so that whether the charging equipment is plugged into the USB interface can be judged, the condition that only a Lightning data line is plugged into the USB interface and the charging equipment is mistakenly judged to be plugged into the USB interface is avoided, and the accuracy for detecting whether the charging equipment is plugged into the USB interface is improved. When the MOS tube is in a conducting state, the MOS tube is controlled to reduce the driving voltage at intervals of preset time through the control module, so that a voltage difference is generated at two ends of the plug detection circuit, and whether the voltage at the two ends of the plug detection circuit is smaller than a second preset value or not is detected through the control module so as to judge whether the charging equipment is pulled out or not. When the control module detects that the voltage at the two ends of the plugging detection circuit is smaller than the second preset value, the control module judges that the charging equipment is plugged out of the USB interface and drives the MOS tube to be kept disconnected so as to enable the USB interface to stop outputting the charging voltage, so that whether the charging equipment is plugged out of the USB interface or not can be accurately detected, the situation that a user is mistakenly judged that the charging equipment is not plugged out when the user only plugs out the apple mobile phone but does not plug out the Lightning data line is avoided, and the USB interface is timely stopped outputting the charging voltage after the charging equipment is plugged out of the USB interface.
Referring to fig. 5, an embodiment of the present invention further provides a control method of the charging device, where the control method of the charging device includes:
step S1, when the
MOS transistor42 is in the off state, the
control module3 detects the voltage at the two ends of the
plug detection circuit41;
in this step, when the
MOS transistor42 corresponding to each
USB interface5 is in the off state, that is, the
USB interface5 is in the off state, it is determined whether a charging device is inserted by detecting the voltage Vab at the two ends of the
plug detection circuit41.
Step S2, the
control module3 determines whether the voltage Vab at the two ends of the
plug detection circuit41 is greater than a first preset value; if yes, go to the next step S3; if not, returning to the previous step S1;
in this step, when the
control module3 determines that the voltage Vab at the two ends of the plugging
detection circuit41 is greater than the first preset value, it represents that the charging device is plugged into the
USB interface5, and the
control module3 inputs a high level to the
MOS transistor42 to turn on the
MOS transistor42, so that the
USB interface5 outputs a charging voltage to charge the charging device.
Step S3, the
control module3 determines that there is a charging device inserted into the
USB interface5 and controls the
MOS transistor42 to be turned on, so that the
USB interface5 outputs a charging voltage to charge the charging device;
as an embodiment of the present invention, when the number of the
USB interface5 and the
plug detection circuit41 is one, and the
MOS42 corresponding to the
USB interface5 is in the off state, and when the
control module3 detects that the voltage at two ends of the
plug detection circuit41 is greater than the first preset value, the
control module3 determines that the charging device is inserted into the
USB interface5 and drives the
MOS42 to be turned on, so that the
USB interface5 outputs the preset charging voltage to charge the charging device. The preset charging voltage is 5V, and common charging of the charging equipment is achieved.
As another embodiment of the present invention, when the number of the
USB interfaces5 and the plugging
detection circuit41 is two, the charging apparatus further includes a
charging protocol module7 connected to the
voltage output circuit2 and the
control module3, respectively, and the
charging protocol module7 is connected to each
USB interface5 at the same time.
When the
control module3 detects that a charging device is inserted into one
USB interface5, the
control module3 sends a first control signal to the charging protocol module, and the
charging protocol module7 receives the first control signal and controls the
voltage output circuit2 to output the charging voltage corresponding to the charging device to the
USB interface5 according to the charging voltage of the charging device; when the
control module3 detects that two or
more USB interfaces5 are plugged into the charging device, the
control module3 sends a second control signal to the
charging protocol module7, and the
charging protocol module7 receives the second control signal and controls the
voltage output circuit2 to output a preset charging voltage to the USB interfaces 5.
In this embodiment, when the
control module3 detects that any one
USB interface5 is inserted into the charging device, the
control module3 switches on the
MOS transistor42 corresponding to the
USB interface5, the
control module3 outputs a high level signal to the
charging protocol module7, the
charging protocol module7 identifies the charging voltage of the charging device through a handshaking protocol, and the
voltage output circuit2 is controlled to output the charging voltage corresponding to the charging device to the
USB interface5, so as to realize the quick charging of the charging device.
When the
control module3 detects that the
second USB interface5 is inserted into the charging device, that is, when it detects that the two
USB interfaces5 are inserted into the charging device, the
control module3 drives the
MOS transistor42 corresponding to the
second USB interface5 to be turned on, at this time, the
control module3 outputs a low level signal to the
charging protocol module7, and the
charging protocol module7 receives the low level signal and controls the
voltage output circuit2 to output a preset charging voltage to the
USB interfaces5, so as to implement normal charging of two or more charging devices. Therefore, when any one
USB interface5 is detected to be inserted into one charging device to realize the quick charging of the charging device, and two or two
USB interfaces5 are detected to be inserted into the charging device to realize the ordinary charging, the requirements of the quick charging and the ordinary charging can be met, the total power is not increased, and the production cost is effectively reduced.
Step S4, when the
MOS transistor42 is in the on state, the
control module3 controls the
MOS transistor42 to reduce the driving voltage and detect the voltages at the two ends of the
plug detection circuit41 at preset intervals;
in this step, the
MOS tube42 is controlled to reduce the driving voltage of the
MOS tube42 at intervals of a preset time by the
control module3, so that a voltage difference is generated at two ends of the
plug detection circuit41, and the
control module3 detects the voltages at two ends of the
plug detection circuit41 to determine whether the charging device is plugged out in real time.
Step S5, the
control module3 determines whether the voltage Vab at the two ends of the
plug detection circuit41 is smaller than a second preset value; if yes, go to the next step S6; if not, returning to the previous step S4;
in this step, in the on state of the
MOS transistor42, the
control module3 determines whether the voltage Vab at the two ends of the
plug detection circuit41 is smaller than the second preset value, so as to accurately detect whether the charging device is plugged out of the
USB interface5, thereby avoiding the situation that the user is mistakenly determined that the charging device is not plugged out when the user only plugs out the apple-phone but does not plug out the lighting data line. When the
control module3 detects that the voltage at the two ends of the
plug detection circuit41 is greater than or equal to the second preset value, the
control module3 determines that the charging device is not plugged out of the
USB interface5 and keeps the
MOS transistor42 turned on, so that the
USB interface5 continues to output the charging voltage to charge the charging device, and the
control module3 continues to reduce the driving voltage of the
MOS transistor42 every preset time interval and detects the voltage at the two ends of the
plug detection circuit41, so as to detect whether the charging device is plugged out in real time.
In step S6, the
control module3 determines that the charging device has pulled out the USB interface and controls the MOS transistor to be disconnected, so that the
USB interface5 stops outputting the charging voltage.
In this step, when the
control module3 detects that the voltage at the two ends of the
plug detection circuit41 is smaller than the second preset value, the
control module3 determines that the charging device has pulled out the USB interface and drives the MOS transistor to be disconnected to stop the USB interface from outputting the charging voltage, so that the
USB interface5 stops outputting the charging voltage in time after the charging device has pulled out the
USB interface5. After the
MOS transistor42 is in the off state, the
control module3 detects the voltages at the two ends of the
plug detection circuit41 in real time to determine whether a charging device is plugged.
According to the control method of the charging device provided by the embodiment of the invention, whether the voltage at two ends of the plugging detection circuit is larger than the first preset value or not is detected by the control module when the MOS tube is in the disconnected state so as to judge whether the USB interface is inserted into the charging equipment or not, so that the situation that only the Lightning data line of the built-in chip is inserted into the USB interface and the USB interface is wrongly judged as the USB interface is inserted into the charging equipment is avoided, and the accuracy of detecting whether the charging equipment is inserted into the USB interface is improved; when the MOS tube is in a conducting state, the MOS tube is controlled to reduce the driving voltage by the control module at preset time intervals so as to generate a voltage difference at two ends of the plugging detection circuit. When the control module detects that the voltage at the two ends of the plugging detection circuit is smaller than the second preset value, the control module judges that the charging equipment is plugged out of the USB interface and drives the MOS tube to be kept disconnected to stop the USB interface from outputting the charging voltage, so that whether the charging equipment is plugged out of the USB interface or not can be accurately detected, the situation that a user is mistakenly judged that the charging equipment is not plugged out when the user only plugs out the apple mobile phone but does not plug out the Lightning data line is avoided, and the charging voltage is timely stopped being output by the USB interface after the charging equipment is plugged out of the USB interface.
The above-mentioned embodiments are merely preferred embodiments of the present invention, which should not be construed as limiting the present invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention should be included in the scope of the present invention.