help with charging when on - Page 1
Forum section: electronics / projects

author: cmumford
author_rank: Contributor
timestamp: September 17, 2020, 04:02:19 pm
content: 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 theCP2102NUSB-to-UART bridge controllers, which automatically detects available power for charging, and conveys that via three pins, to an external charger. I'm using theMCP73833charge controller, and am connecting the three CP2102N pins to the MCP73833's PROG pin as shown in the attached schematic (resistor valuesare 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?

author: Peabody
author_rank: Super Contributor
timestamp: September 17, 2020, 08:58:01 pm
content: 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.

author: cmumford
author_rank: Contributor
timestamp: September 17, 2020, 09:58:15 pm
content: 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...

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 17, 2020, 10:18:18 pm
content: 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.

author: cmumford
author_rank: Contributor
timestamp: September 17, 2020, 10:36:16 pm
content: It's anESP32-WROOM-32E. Thx for the info on the CC lines.

author: Peabody
author_rank: Super Contributor
timestamp: September 18, 2020, 03:43:39 am
content: 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.

author: cmumford
author_rank: Contributor
timestamp: September 18, 2020, 04:34:00 pm
content: 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.