USB charging battery and powering my MCU simultaneously

Thread Starter

kowshik1729

Joined May 10, 2020
99
Hi Guys,

I'd like to start by telling I have gone through a lot of similar threads from allabout circuits but I have concluded my problem is little different from all of those. I have a battery charger circuit that will be powered by USB, which will charge a 3.7V Li-Po battery.

My Requirement:
  1. When USB connected -> Charges battery and powers the entire board.
  2. When USB removed -> Battery charging stops and battery takes over the powering of board.

What have I implemented:

Attempt 1-
I have used a P-Channel MOSFET as below to switch between USB and BAT. However I have made a mistake of not isolating the USB and battery power with a diode there by it's bypassing the charging circuit.

1737910357443.png

Attempt 2 - To correct this I have added a diode at the BATT header as below and made sure the charging circuit will work properly. However it looks like my board is still not working (What I mean by not working is, I have a LCD display connected which is going blank and not recovering as soon as I connect the battery)

1737910541626.png

My Ask - Why is this circuit wrong? If it's wrong what's the correct way to implement such circuit with less components. Any cheaper IC alternatives are also fine as long as they're widely available in hobby market but my preference is analog circuits. I have attached full schematics
 

Attachments

Last edited:

sghioto

Joined Dec 31, 2017
8,633
I don't see a problem with the USB battery switching circuit.
We spoke about this on another thread and you explained it was working properly so why is there a problem?
Or are you wanting to isolate the battery from the charging circuit when the USB is not connected as well?
 

Thread Starter

kowshik1729

Joined May 10, 2020
99
I don't see a problem with the USB battery switching circuit.
We spoke about this on another thread and you explained it was working properly so why is there a problem?
Or are you wanting to isolate the battery from the charging circuit when the USB is not connected as well?
Oh hi there, yes I tried making modifications my existing PCB by scraping off the tracks and soldering wires. However it still looks like the SPI lines connected to my display are seeing some kind of ground potential variation which is making the display fail. I wasn't completely sure what's causing this problem. As there's no other circuitry involving the display the only one that I can suspect is this switching circuitry.
 

Thread Starter

kowshik1729

Joined May 10, 2020
99
We spoke about high side switching the +DC input to the display instead of the ground.
Did you try that?
Yes, infact I have completely removed the MOSFETs and powered the display (saying to myself enough of this power switching crap) but still the display is weird which made me realize the issue is not just there.
 

sghioto

Joined Dec 31, 2017
8,633
How long does the display blank out when switching to battery?
Where is the +DC lead of the LCD connected to currently?
 
Last edited:

Thread Starter

kowshik1729

Joined May 10, 2020
99
How long does the display blank out when switching to battery?
It blanks off forever, never recovers back

Where is the +DC lead of the LCD connected to currently?
It's currently connected to the main power source that's powering the board i.e., if USB is connected then 5V if battery then 3.7V. To be more precise it's connected here

1737921176770.png

Overview of the power path of my PCB

USB/BAT -> Power latch mosfet (U10 in above picture) --> input of LDO (this same node is connected to the LCD's VCC) -> 3.3V to MCU
 
Last edited:

Thread Starter

kowshik1729

Joined May 10, 2020
99
Try connecting to PWR IN.
Bypassing the Latch circuit.
Okay, but what will change? I'm trying to understand what's the reason behind this suggestion, i don't want to randomly try something because it's a good effort of scraping PCB tracks and soldering.
 

sghioto

Joined Dec 31, 2017
8,633
Eliminate possibilities.
Before trying this does the LDO voltage on the output of that latch circuit stay ON when switching to battery?
 

gaber2611

Joined Mar 14, 2013
321
I don't see a problem with the USB battery switching circuit.
We spoke about this on another thread and you explained it was working properly so why is there a problem?
Or are you wanting to isolate the battery from the charging circuit when the USB is not connected as well?
How the mosfet will work in the battery/USB switch work?
I mean where from will get the threshold voltage for turning on and so, pass the current from battery to pwr on?
 

Thread Starter

kowshik1729

Joined May 10, 2020
99
Does the display come back on when switching back to USB?
What does LDO read on battery power?
Here's a detailed debug info

Scenario 1:

When only USB is connected, Display powers on but nothing is rendered on display.(MCU is working because we have Wifi code running which is working fine)

Scenario 2:

When only battery is connected everything works fine, display and MCU.

Scenario 3 -

When only battery is connected when the system is functioning correctly, and suddenly when USB is plugged in display shuts down instantly and MCU keeps working fine.
 

sghioto

Joined Dec 31, 2017
8,633
OK, wells that's the opposite of what I thought was happening.
Thinking it might a USB power problem.
Where does this USB power come from?
 

sghioto

Joined Dec 31, 2017
8,633
Appears the display does not like the higher voltage from the USB.
What if you added a separate 3.3 volt regulator just for the display?
 
Top