Power ESP32 via USB, keep data connection with lipo and switch

What I have already:

I have a esp32 and some additional components with 5V. Currently I power this from a usb power supply (5V). The usb connector VOUT I pipe to a 3.3V regulator and get both voltages. The combined load of all components has a measured maximum of 0.25A on the 5V supply. With this setup I can still program the esp32 via the USB connector. In this setup I only have one 5V rail, VOUT of usb.

What I want:

I want to add a lipo battery able to use the gadget mobile. As I have a closed enclosure, I want to add a ON switch via a micro momentary button.

What I think would work:

I could use DDO6CVSA Board (DD06CVSA Lithium Battery Charging Discharging Protector Power Support Module for 3.7V 4.2V Battery)

I would connected this board to VOUT as inbound voltage. This charges the battery, has a stable 5V output and has a "KEY" input to trigger the on for the board. The 5V I then pipe in to the 3.3V regulator and get my 3.3V and 5V as desired. The board "listens" to the power usage and switches to off, when the demand drop below 50mA for more then 30 seconds. If I send the esp32 to deep sleep, this would go below 50mA and should work.

In this setup I have a 5V input rail, which sources from USB and a 5V output rail from the charger board, which then connects to to 3.3V regulator and the additional components. These 5V rails are separated.

The question:problem:

In the setup with the DDO6CVSA (or any other with a TP4056 or similar) is it possible to still use the USB data line and program the esp32 via this somehow? I suspect, because I decouple the 5V rails the usb data connection will not work any more. My current solution would be to add 2 USB connetors. First one for powering up and programming, the second one for loading the lipo via usb only.

Is there a way to achieve this, with only on usb connector? Could I put in a diode (maybe p-mosfet) between 5V inbound and 5V outbound of the charger board? I doubt, but I just lack the knowledge :slight_smile:

Many thanks for any help in advance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.