[Solved] Switching off DC/DC converter output when charging, USB LiPo charging circuit


#1

Hello everyone,

My question is simple. I would like to be able to switch off power to the DC/DC converter (orange rectangle) according to the following conditions:

  1. When the charging USB cable is plugged in (VUSB) I would like to cut off power to the DC/DC converter. I would like to prevent battery usage while charging for safety reasons so that the battery is charging with the power to the DC/DC converter and therefore the rest of the functional components on the pcb cut off.

  2. When USB power is disconnected, the power supply to the pcb coming from the 3.3V output of the DC/DC converter is managed by a simple toggle switch preventing the DC/DC converter and therefore the rest of the circuit from powering on when you don’t intend to use it and unplug the USB cable.

This is the circuit:


How this circuit works via 4 functional groups on this layout:
Blue: TP4056 constant current/constant voltage battery charging IC
Green: FS312F One cell battery protection IC
Orange: TPS63001 DC/DC Buck-Boost converter 3.3V output

My question is about the Red section, the toggle switch is easy and does not require modification in my opinion. However as I am still quite new to electronics I realised my solution using a PNP transistor might not be optimal as depicted in the circuit above.

Problems I can think off with the current layout:

  • I am not preventing electricity to flow back into the USB port from the battery.
  • Voltage at he Base of this PNP transistor is not necessarily going to be higher (5V USB) than the voltage at the Emitter when switching off flow from emitter to base. So I could see that this PNP transistor might be permanently on.

I just immediately thought about transistors when thinking about switching something with electricity. The NPN transistor wouldn’t work here as I want the electricity to flow from Collector to Emitter when USB is unplugged (no power). This made me think this might be a use case for PNP?

I would be grateful for any suggestion on switching this part of the circuit!


#2

I would utilize the enable pin of your boost converter.
Pull it up to positive rail with separate resistor from R7. Add an npn or a small n-fet to pull enable pin down when there is power on VUSB. Remember to add base resistor if you use a bjt.


#3

In the TP4056 data specs it reads in chinese English,

  • ‘No blocking diode is required due to the internal PMOSFET architecture and have prevent to negative Charge Current Circuit.’

Nothing to worry about in this department of back currents.

As for On/Off functionality no need to reinvent the wheel. Something like this can do that for you. Since you already use TI components this could be a suitable addition.


#4

Is this what you are saying? Wouldn’t this short the battery to ground when voltage at the base is sensed which switches the transistor?
What would be an appropriate value for the base of the npn?


#5

In the TP4056 data specs it reads in chinese English,

  • ‘No blocking diode is required due to the internal PMOSFET architecture and have prevent to negative Charge Current Circuit.’

My bad I was concerned about the base of the pnp (red square) in my original post. But the base is isolated from the collector/emitter.

As for On/Off functionality no need to reinvent the wheel. Something like this can do that for you. Since you already use TI components this could be a suitable addition.

Isn’t this adding an unnecessary IC as I already have an enable pin on the TPS63001 which I overlooked initially? I am however not entirely sure how I should be using it as the data sheet does not say much more than when EN pin high the device is on. When EN pin low the device is off.

Thank you for your device however!


#6

Yes, that was the idea. 10k for base resistor is fine but use bigger value for pullup, 10-100k there will be fine too. It won’t short the battery to ground because pullup resistor will limit the current greatly, you will just use a tiny bit of charging current provided from tp4056 which is not an issue.


#7

As per 7.3.1 in tps63001’s datasheet you should be fine. No extras needed.


#8

Thank you very much for helping me! :grinning:
Are you referring to both resistors? Or just the base or pull up in the following sentence?

10k for base resistor is fine but use bigger value for pullup, 10-100k there will be fine too.

As far as I can see bigger resistance values will prevent unnecessary battery drain so I went with 100K for now.
For completeness the schematic as it is now:


#9

Base resistor will not drain anything, it only takes power from usb. I would stick to 10k there to ensure that the bjt is saturated enough and Vce drop is low. Keep the pullup 100k to not steal more current from the charging circuit than necessary. It will not drain battery either because the transistor will shut off when on battery power. EN pin typical input current is listed as 0.01uA so you have no worries there either.


#10

Awesome! Thanks for the explanation too. It makes a lot more sense right now :grinning:


#11

Quick question, when looking at several data sheets for this npn transistor I stumbled upon the Max Emitter to Base Voltage rating of 4.0 V. My base is at 5V and my Emitter will be 0V (GND). Am I exceeding this rating if I would use this NPN? All the other specs seem to be within limits.


Source: 1901241704_Foshan-Blue-Rocket-Elec-KTC3880-Y_C358506.pdf (699.4 KB)

The term Emitter to Base throws me off here. To my knowledge the Base Voltage in an NPN has to always be at least >0.6V above the Emitter for the NPN to be able to function.
It would be stupid to have Emitter > Base voltage as the transistor would never function properly in this setting. Or is this just stating that if a voltage spike (due to other circuitry downstream the emitter lead) at the Emitter >4.0 V above the Base voltage may damage the Transistor permanently?


#12

“Emitter Base Voltage” is the maximum voltage that may be applied when the base-emitter diode is in reverse; not conducting. This is generally much lower than a small signal diode in reverse can handle.


#13

Hermit is right, this is about reverse breakdown of emitter-base junction, not applicable in your case.
Also your base will be at Vbe or 0.6-0.7v, not 5v because most of the voltage drop will happen on base resistor.
Unless they are very cheap I wouldn’t use that particular transistor. Datasheet states they are designed for low noise high frequency stuff. For this just pick a jelly-bean dollar-a-bucket npn like MMBT3904, MMBT8050, MMBT2222.