Author Topic: help with charging when on  (Read 1504 times)

0 Members and 1 Guest are viewing this topic.

Offline cmumfordTopic starter

  • Contributor
  • Posts: 48
  • Country: us
help with charging when on
« on: September 17, 2020, 04:02:19 pm »
I'm stuck and hoping for some advice. I'm designing something that is battery operated, and will use around 150-200 mA when powered on. I'd like to be able to have this on when being charged via USB. I'm going with the CP2102N USB-to-UART bridge controllers, which automatically detects available power for charging, and conveys that via three pins, to an external charger. I'm using the MCP73833 charge controller, and am connecting the three CP2102N pins to the MCP73833's PROG pin as shown in the attached schematic (resistor values are mine).

So, at present, I'm using all of the available USB current for charging the battery, and if the device is on then I'll be drawing too much power. What is the "right" way to allow the device to be in use without drawing too much overall current?
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2714
  • Country: us
Re: help with charging when on
« Reply #1 on: September 17, 2020, 08:58:01 pm »
You might look at the MCP73871, which I believe does the power sharing automatically.

Could you show how you are providing power to the load?  If that current is flowing through the charger I/C, then the charger will be providing up to 4.2V at up to the maximum charging current, and I think the load will use what current it needs, and the rest, if any, will go towards charging.  But I've never used this charger, so I'm not sure about this.

If the load current is supplied directly from USB, you could just adjust the resistor values so the charging PROG-set current is 200mA less than what the CP2102N says is available.



« Last Edit: September 17, 2020, 09:02:15 pm by Peabody »
 

Offline cmumfordTopic starter

  • Contributor
  • Posts: 48
  • Country: us
Re: help with charging when on
« Reply #2 on: September 17, 2020, 09:58:15 pm »
Thanks Peabody:

Attached is that portion of my schematic. The MOSFET's are the wrong type, but that's the only part that I believe is incorrect. If I'm not mistaken the power will be routed through the power regulator (AMS1117), bypassing the battery portion entirely, due to the unlabeled MOSFET at the top.

The CP2102N has one mode where it reports there is only 100 mA available for charging - for low power devices. I haven't done the power budget yet, but I know my circuit will be drawing more than that, so I need to figure out if I want to allow it to run on battery, or just power down the components.

Thanks for mentioning the MCP73871. I'll give that a look.

Edit: I should mention that I'm currently investigating pairing a small MCU (PIC maybe) with a digital rheostat. I won't, of course, if some product like the MCP73871 will work. But, that's where I was heading...
« Last Edit: September 17, 2020, 10:04:13 pm by cmumford »
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9709
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: help with charging when on
« Reply #3 on: September 17, 2020, 10:18:18 pm »
If you're using USB-C, note that checking the available power is a little more complex. At a minimum, you have to pull down the CC lines with 4.7k resistors to signal "smart" devices to supply power. Then you have to check the voltage on those pins to determine if the extra current provided by USB-C is available.

What microcontroller is connected to the USB UART? Might be better off using a microcontroller with native USB.
Cryptocurrency has taught me to love math and at the same time be baffled by it.
Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
BTC: 18813fu8LQEdDwH9YLM1ABed3XwCfeSeFi
 

Offline cmumfordTopic starter

  • Contributor
  • Posts: 48
  • Country: us
Re: help with charging when on
« Reply #4 on: September 17, 2020, 10:36:16 pm »
It's an ESP32-WROOM-32E. Thx for the info on the CC lines.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2714
  • Country: us
Re: help with charging when on
« Reply #5 on: September 18, 2020, 03:43:39 am »
The diode and mosfet near your regulator will provide direct power to that regulator whenever USB is connected, and will switch over to the battery when it isn't, so you already have what the MCP73871 provides.

I don't think the 100mA scenario is realistic.  Even USB 2.0 will provide 500mA.  It seems the simplest solution is just to set the Prog resistor to a fixed value that provides 300mA of charging current.  Then I think you would be sure to have enough current for the project load.  But if the CP2102N outputs really do work with USB-C, then you could change the resistor values so that, for example, when the 500mA mode is in effect, the charging current will be 300mA, and when 1A is available, the charging current will be 800mA.

 

Offline cmumfordTopic starter

  • Contributor
  • Posts: 48
  • Country: us
Re: help with charging when on
« Reply #6 on: September 18, 2020, 04:34:00 pm »
Agreed that simply fixing the resistors would solve the problem. However, I really like the simplicity of the circuit with the MCP73871 as the current regulation pins on both chips are logic level, so no resistors are required. This also allows me to utilize as much power as the bus can provide. I still need to look into the USBC's CC/VCONN pins to see how those are used.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf