Disclosure of Invention
The embodiment of the invention aims to provide a prompting circuit and electronic equipment, which can make an accurate charging prompt according to the actual charging condition, effectively solve the problem of false charging or incapability of making the charging prompt and reduce the cost.
To solve the above technical problem, an embodiment of the present invention provides a notification circuit, which is applied to an electronic device, and includes: the device comprises a Universal Serial Bus (USB) interface, a charging chip, a battery, a power management chip, a switching unit, a control unit and a prompting unit; the charging chip and the power management chip are respectively connected with the USB interface and the battery; the switching unit is provided with a first input end, a second input end, a control end and an output end; the first input end is connected with a power supply VBUS pin of the USB interface, the second input end is connected with the output end of the prompt unit, the control end is connected with the second output end of the control unit, and the output end is grounded; the control unit is provided with an input end, a first detection end, a second detection end, a first communication end, a second communication end, a first output end and a second output end; the input end of the power management chip is connected with the output end of the power management chip, the first detection end is connected with a positive data D + terminal and a negative data D-terminal of the USB interface, the second detection end is connected with an access identification pin and a temperature pin of the battery, the first communication end is connected with the communication end of the charging chip, the second communication end is connected with the communication end of the power management chip, and the first output end is connected with the input end of the prompting unit; when the power management chip determines that the VBUS pin of the USB interface has charging voltage output and the first detection end of the control unit detects that the external charger and the USB interface successfully handshake based on the charging protocol, the control unit controls the first output end to output high level and prompts the unit to start working; when the second detection end of the control unit detects that the battery is fully charged, the control unit controls the second output end to output high level, and the prompting unit stops working.
In order to solve the above technical problem, an embodiment of the present invention further provides an electronic device, including the cue circuit provided in any embodiment of the present invention.
Compared with the prior art, the embodiment of the invention provides the prompt circuit capable of accurately monitoring the charging state of the electronic equipment, the voltage output is detected on the VBUS pin of the USB interface by the power management chip, when the charger is inserted, the control unit is informed through the communication line between the control unit and the charger, so that the control unit can timely detect whether the handshake between the charger and the electronic equipment is successful based on the charging protocol, and when the handshake is successful, the first output end of the control unit is pulled up, thereby enabling the first output end to output high level to the prompting unit and flow into the switching unit, and the switching unit is arranged to work when the first input end and the second input end both input high level, and the current flowing in enters the ground through the grounding end of the switching unit, so that the line where the prompting unit is located can form a complete loop and start to work. In addition, when full charge, through the second output that draws high the control unit for the tip unit stop work, thereby make the tip unit can make accurate suggestion according to the actual charging situation, effectively solved the problem of pseudo-charging or can't make the suggestion of charging, and owing to need not additionally to increase the drive chip of control tip unit in whole suggestion circuit, directly adopt the inside control unit originally of electronic equipment, therefore also reached the purpose that reduces the preparation cost.
In addition, the control unit is a processor; a detection end of a charging protocol module of the processor is used as a first detection end of the control unit, a detection end of an analog-to-digital conversion module of the processor is used as a second detection end of the control unit, a first general input/output (GPIO) pin of the processor is used as a first output end of the control unit, and a second GPIO pin of the processor is used as a second output end of the control unit; the D + terminal in the detection end of the charging protocol module is connected with the D + terminal of the USB interface, the D-terminal in the detection end of the charging protocol module is connected with the D-terminal of the USB interface, and the output end of the charging protocol module is connected with the first GPIO pin; an access identification pin in the detection end of the analog-to-digital conversion module is connected with an access identification pin of the battery, and a temperature pin in the detection end of the analog-to-digital conversion module is connected with a temperature pin of the battery; the first GPIO pin is connected with the input end of the prompting unit, and the second GPIO pin is connected with the control end of the switching unit. In the invention, the processor in the electronic equipment is directly selected as the control unit, the detection of the charging protocol and the current state of the battery is realized by each detection module of the processor, and then the control of the prompting unit is realized through different GPIO pins, so that the processing effect is ensured, and the integration cost is also saved.
In addition, the switching unit includes a first switch, a second switch, a first voltage dividing resistor and a second voltage dividing resistor; the first end of the first voltage-dividing resistor is used as the first input end of the switching unit and connected with a VBUS pin of the USB interface, and the second end of the first voltage-dividing resistor is connected with the first end of the second voltage-dividing resistor in series and then connected with the input end of the first switch and the control end of the second switch; the control end of the first switch is used as the control end of the switching unit and is connected with the second output end of the control unit, and the input end of the second switch is used as the second input end of the switching unit and is connected with the output end of the prompting unit; the second end of the second voltage-dividing resistor, the output end of the first switch and the output end of the second switch are connected and are used as the output end of the switching unit to be grounded. Through set up two independent switches in the switching unit and manage the operation of control suggestion unit alone to after the protocol that charges is shaken hands successfully, just control the work of suggestion unit when the first output of the control unit outputs the high level, after being full of the electricity, when the second output of the control unit outputs the high level, suggestion unit stop work, thereby can make accurate suggestion according to the actual charging condition, effectively solved the problem of pseudo-charging or can't make the suggestion of charging.
In addition, the first switch and the second switch are both PNP type transistors. Through selecting when base and penetrating electrode all input for the high level, just PNP type transistor of work to can realize through two PNP type transistors the accurate control to the suggestion unit like the charge indicator, make the suggestion unit can make accurate suggestion according to the actual charging condition, effectively solve the problem of false charging or can't make the suggestion of charging.
In addition, the first switch and the second switch are both NMOS tubes. By selecting the NMOS tube with better processing effect and performance, the prompting unit can prompt more accurately.
In addition, the first communication end of the control unit is communicated with the communication end of the charging chip through a bidirectional two-wire system synchronous serial bus. The communication connection between the charging chip and the control unit is realized by adopting a bidirectional two-wire system synchronous serial bus, so that the data synchronization and the clock synchronization in the communication process can be ensured, and the accuracy and the real-time performance are further ensured.
In addition, the second communication end of the control unit is communicated with the communication end of the power management chip through a serial peripheral bus. The communication connection between the control unit and the power management chip is realized by adopting the serial peripheral bus which has high data transmission speed, is synchronous and occupies fewer chip pins, so that the pins of the chip are greatly saved, the layout space of a flexible circuit board in the electronic equipment is greatly saved, and the prepared electronic equipment is lighter and thinner.
In addition, the prompting unit is a light emitting diode. The whole circuit is more energy-saving and environment-friendly by selecting the light-emitting diode as the prompt unit, and the light and thin electronic equipment can be ensured to be manufactured as far as possible due to the small size of the light-emitting diode.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
The first embodiment of the present invention relates to a cue circuit, and the specific structure is as shown in fig. 1.
The alert circuit shown in fig. 1 is mainly applied to electronic devices, such as smart phones, tablet computers, personal digital assistants, wearable electronic devices, and the like. Specifically, the prompting circuit related to fig. 1 specifically includes a USB (Universal Serial Bus) interface 101, a charging IC (i.e., charging chip) 102, a battery 103, a PMIC (Power Management IC) 104, a switching unit 105, a control unit 106, and a prompting unit 107.
Specifically, the USB interface 101 mainly includes a VBUS pin, a D + terminal, a D-terminal, and a GND (ground) pin, the charging IC 102 mainly includes a charging terminal (VBUS pin in the charging IC 102 in fig. 1), a power supply terminal, a ground terminal (GND pin in the charging IC 102 in fig. 1), and a communication terminal, the battery 103 mainly includes a temperature pin, an access identification pin (ID pin in fig. 1), a positive tab (power supply pin VBAT in fig. 1), and a negative tab (usually, the negative tab is grounded, and therefore, is denoted by GND in fig. 1), and the PMIC104 mainly includes a detection terminal, an input terminal, an output terminal, and a communication terminal.
The switching unit 105 has a first input terminal, a second input terminal, a control terminal, and an output terminal, and the control unit 106 has an input terminal, a first detection terminal, a second detection terminal, a first communication terminal, a second communication terminal, a first output terminal, and a second output terminal.
The VBUS pin of the USB interface 101 is connected to the VBUS pin of the charging IC 102 and the detection terminal of the PMIC104, so that when a charger is plugged into the USB interface 101, the PMIC104 can timely know whether the VBUS pin of the USB interface 101 has voltage output, and the charging IC 102 can directly obtain the voltage provided by the charger through the VBUS pin and charge the battery 103 through the power supply terminal connected to the VBAT pin of the battery 103.
In addition, in order to enable the prompting unit 107 to make accurate prompts according to actual situations, the first input terminal of the switching unit 105 needs to be connected to the VBUS pin of the USB interface 101, the second input terminal of the switching unit 105 needs to be connected to the output terminal of the prompting unit 107, and the control terminal of the switching unit 105 needs to be connected to the second output terminal of the control unit 106, so that after a charger is plugged into the USB interface 101, the USB interface 101 can provide a high level for the switching unit 105 through the VBUS pin. Moreover, the output end of the switching unit 105 needs to be grounded, so that the prompting circuit can form a complete loop to work normally.
In order to ensure that the control unit 106 can control the whole prompting circuit, the input terminal of the control unit 106 needs to be connected to the output terminal of the PMIC104, so as to obtain the operating voltage from the PMIC 104.
In addition, a first detection terminal of the control unit 106 needs to be connected to the D + terminal and the D-terminal of the USB interface 101, a second detection terminal of the control unit 106 is connected to the ID pin and the temperature pin of the battery 103, a first communication terminal of the control unit 106 is connected to the communication terminal of the charging IC 102, a second communication terminal of the control unit 106 is connected to the communication terminal of the PMIC104, and a first output terminal of the control unit 106 is connected to the input terminal of the prompt unit 107.
It is easy to find out from the above description that, since the first detection end of the control unit 106 is connected to the D + terminal and the D-terminal of the USB interface 101, when a charger is inserted into the USB interface 101, it can be determined whether the handshake between the charger and the electronic device is successful based on the charging protocol, and in the whole charging process, the control unit 106 can read the information of the ID pin and the temperature pin of the battery 103 through the second detection end, thereby knowing the charging condition of the battery 103 in real time, and determining whether to control the second output end to output a high level according to the current charging condition of the battery 103.
It should be noted that, in practical application, the PMIC104 specifically detects a voltage on a VBUS pin of the USB interface 101 through an Analog-to-digital converter (ADC) pin or a module, and an output terminal of the PMIC104 connected to an input terminal of the control unit 106 is specifically an output terminal of a power supply module therein, and an input terminal of the power supply module is connected to a VBAT pin of the battery 103, so as to provide a working voltage for the control unit 106 to normally work for the control unit 106.
In addition, in order to ensure that the charging cable part can form a complete loop to really achieve the effect of charging the battery 103, the USB interface 101, the charging IC 102 and the GND pin of the battery 103 need to be grounded.
After the connection of the whole prompting circuit is completed, if a charger is inserted into the USB interface 101, the PMIC104 detects whether a charging voltage capable of charging the battery 103, such as a 5V voltage, is present on the VBUS pin of the USB interface 101 through the ADC pin, if it is determined that the VBUS pin of the USB interface 101 has the 5V voltage output, the PMIC informs the control unit 106 through the communication terminal, the control unit 106 detects whether the external charger and the electronic device have successfully handshake based on the charging protocol through the first detection terminal, if the handshake succeeds, it is indicated that the currently inserted charger is matched with the electronic device, and the battery 103 in the electronic device can be charged, at this time, the control unit 106 controls the first output terminal to output a high level to the prompting unit 107, the high level enters the second input terminal of the switching unit 105 through the prompting unit 107, and the switching unit 105, when the first input terminal and the second input terminal are both high voltage, and is conducted and grounded through the output end to form a complete loop, and the prompting unit 107 works and gives a prompt to inform a user that the electronic equipment is charging.
When the second detection terminal of the control unit 106 detects that the battery 103 is fully charged, the control unit 106 controls the second output terminal to output a high level, and at this time, the control terminal and the first input terminal of the switching unit 105 are at a high level, and the prompting unit 107 stops working.
The above description is only for illustrative purposes and does not limit the technical aspects of the present invention.
Compared with the prior art, the prompt circuit that this embodiment provided, there is voltage output on the VBUS pin that power management chip detected the USB interface, when inserting the charger, inform the control unit through the communication line who is connected with the control unit, make the control unit can in time detect whether it is successful to handshake based on the charging protocol between charger and the electronic equipment, and when the handshake is successful, through the first output that draws high the control unit, thereby make the first output can output high level to the prompt unit, and flow into the switch unit, just work when first input and second input all input high level through setting up the switch unit, and the electric current that flows in goes into ground through the earthing terminal of switch unit, make the circuit at prompt unit place can form complete return circuit, thereby the prompt unit begins to work. In addition, when full charge, through the second output of drawing high the control unit for the tip unit stop work, thereby make the tip unit can make accurate suggestion according to the actual charging situation, effectively solved the problem of false charging or can't make the suggestion of charging.
A second embodiment of the present invention relates to a cue circuit. In the present embodiment, the control unit 106 is implemented by a processor (CPU), and the switching unit 105 is specifically composed of a first switch Q1, a second switch Q2, a first voltage-dividing resistor R1, and a second voltage-dividing resistor R2, and is specifically configured as shown in fig. 2.
Specifically, in this embodiment, the detection terminal of the charging protocol module of the processor 106 is used as the first detection terminal of the control unit 106, the detection terminal of the ADC module of the processor 106 is used as the second detection terminal of the control unit 106, the pin GPIO1 of the processor 106 is used as the first output terminal of the control unit 106, and the pin GPIO2 of the processor 106 is used as the second output terminal of the control unit 106. The first terminal of the R1 is connected to the VBUS pin of the USB interface 101 as the first input terminal of the switching unit 105, and the second terminal of the R1 is connected in series with the first terminal of the R2 and then connected to the input terminal of the Q1 and the control terminal of the Q2, respectively.
The D + terminal in the detection end of the charging protocol module is connected with the D + terminal of the USB interface 101, the D-terminal in the detection end of the charging protocol module is connected with the D-terminal of the USB interface 101, and the output end of the charging protocol module is connected with the GPIO1 pin. An ID pin in a detection end of the ADC module is connected with an ID pin of the battery 103, and a temperature pin in the detection end of the ADC module is connected with a temperature pin of the battery 103. The pin of GPIO1 is connected to the input terminal of the prompt unit 107, and the pin of GPIO2 is connected to the control terminal of the switch unit 105.
The control terminal of the Q1 is connected to the GPIO2 pin of the processor as the control terminal of the switching unit 105, and the input terminal of the Q2 is connected to the output terminal of the prompt unit 107 as the second input terminal of the switching unit 105. The second terminal of R2, the output terminal of Q1, and the output terminal of Q2 are connected to ground as the output terminal of the switching unit 105.
It should be noted that, since the switching unit 105 needs to cooperate with the processor 106 to control the operation of the prompting unit 107, and in order to enable the prompting unit 107 to operate only during the charging process and stop operating after the battery is fully charged, the Q1 and the Q2 in the switching unit 105 need to select an element, specifically, a PNP transistor or an NMOS transistor, which operates when the first input terminal and the second input terminal are both at a high level, for understanding, in this embodiment, taking the first switch Q1 and the second switch Q2 as NMOS transistors as an example, specific description is made:
as shown in fig. 2, the drain of Q2 is connected to the output terminal of the prompting unit 107, the gate of Q2 is connected to the second end of R1, the drain of Q1 and the first end of R2, the source of Q2 is grounded, after the high level provided by the VBUS pin of the USB interface 101 is divided by R1 and R2, the divided high level is respectively input to the gate of Q2 and the drain of Q1, at this time, if the output of the GPIO1 pin is high level, Q2 is turned on to operate under the condition that both the gate and the drain are high voltage, and the current provided by the GPIO1 pin is finally grounded through the drains of the prompting units 107 and Q2 and then through the source of Q2, so as to form a complete loop, and thus the prompting unit 107 operates to remind the user that the electronic device is being charged.
The gate of the Q1 is connected to the GPIO2 pin of the processor 106, when the processor 106 detects that the battery 103 is fully charged through the ADC module, the GPIO2 pin is pulled high, so that the GPIO2 pin outputs a high level, the Q1 is turned on to operate when both the gate and the drain are at a high level, and the current flowing through the pin goes to ground through the source of the Q1. Since the drain of Q1 and the gate of Q2 are connected together, after Q1 is turned on, the gate of Q2 is pulled low, i.e., the gate input of Q2 is at low level, and Q2 stops working, in this case, the circuit where the prompting unit 107 is located cannot form a complete loop, and therefore, the prompting unit 107 stops working.
It should be noted that, in order to ensure that data synchronization and clock synchronization can be achieved in the communication between the processor 106 and the charging IC 102, so as to perform better communication, a bidirectional two-wire system synchronous serial bus (I2C bus for short) is selected to communicate the first communication end of the processor 106 with the communication end of the charging IC 102 in this embodiment.
In addition, in order to save the layout space of the flexible circuit board in the electronic device, and thus make the prepared electronic device lighter and thinner, in this embodiment, a serial peripheral bus (SPI bus for short) that has high data transmission efficiency and can ensure data synchronization is used to communicate the second communication terminal of the processor 106 with the communication terminal of the PMIC 104.
In addition, since the prompting circuit in this embodiment is mainly used for the electronic device to make an accurate prompt to the user according to the actual charging condition, in order to reduce the power consumption and achieve the purpose of prompting the user, the light emitting diode is selected as the prompting unit 107 in this embodiment, but in practical application, the prompting unit 107 is not limited to the light emitting diode, and a developer may select other suitable elements as the prompting unit according to the actual application scenario of the electronic device and the user requirement, which is not limited herein.
Compared with the prior art, the prompt circuit that provides among this embodiment, through set up two independent switches in the switching unit, like PNP type transistor or NMOS pipe, by two independent switches management and control prompt unit alone, specifically be emitting diode, only export the work of high level control charge pilot lamp after shaking hands successfully based on the protocol of charging between charger and electronic equipment to can make accurate suggestion according to the actual charging situation, effectively solve the problem of pseudo-charging or can't make the suggestion of charging.
A third embodiment of the present invention relates to an electronic device including the presentation circuit provided in any of the embodiments of the present invention. The electronic device may be a smartphone, tablet, personal digital assistant, wearable electronic device, or the like.
For convenience of understanding, taking the prompting circuit in the second embodiment as an example, after the electronic device is plugged into the charger, the power management chip detects whether a voltage is present on the VBUS pin of the USB interface through the ADC module, and if the voltage is detected, the power management chip communicates with the processor through the SPI to notify the processor that a charging device is currently plugged into the processor. After obtaining the signal transmitted by the power management chip, the processor performs charging handshake through a D + terminal and a D-terminal in the charging protocol module, and outputs high level through a GPIO1 pin after the handshake succeeds. Therefore, current output by the pin GPIO1 can flow into the drain electrode of the second NMOS tube Q2 through the charging indicator lamp, meanwhile, high level output on the VBUS pin of the USB interface is input into the grid electrode of the Q2 after passing through the two voltage division resistors, so that the Q2 enters a working state, the current flows through the charging indicator lamp and the drain electrode of the Q2 from the pin GPIO1, and finally, the source electrode of the Q2 is grounded to form a complete loop, the charging indicator lamp is lightened, and the electronic device of a user is reminded of charging.
When the electronic device is fully charged, the gate of the first NMOS transistor Q1 is pulled high by the pin GPIO2 of the processor, and since the drain of Q1 obtains the high level provided by the VBUS pin of the USB interface through two voltage dividing resistors, the Q1 enters a working state, and since the source of Q1 is connected to the ground after being connected to the voltage dividing resistor R2, the voltage of the drain is pulled low, and the gate of Q2 is connected to the drain of Q1, the gate of Q2 is pulled low, at this time, the Q2 cannot work, and the line where the charging indicator lamp is located cannot form a loop, so that the charging indicator lamp stops working, and goes out, thereby achieving the purpose of reminding the user that the electronic device is fully charged.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific embodiments for practicing the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.