Hey guys,
I made a circuit to control a sensor via the ESP32. I recently updated it by adding a USB module to load programs (I was using UART before) and recharge the battery. I get that from Let's Learn Circuits in KiCad #2 - ESP32 and CP2104 (youtube.com).
Before doing that, consumption was about 20uA in deep-sleep. It is now 6.8mA.
After a few good advice (thanks to Wawa), I realized that after cutting the alimentation source to this USB module (see the yellow trace below), it went down to 100uA.
What should I do now to turn it off when it's not used?
If I remove the trace, I won't be able to load my program when connected to the USB plug since the ESP32 won't be powered... unless if the battery is connected, or if I connect the VBUS to the VDD of the ESP32
control the power going to the USB by adding a diode or something (sorry, I'm not expert in electronics)??
control the power by connecting it to a GPIO so I can turn it off??
adding a switch that I will switch to off after loading the program?
something else ??
For info, this is my USB module, I have a feeling I did something wrong. I should have configurated it as a USB self-powered device?
Thanks @DrDiettrich . I know this converter but I really want to use the USB directly. Maybe I should have configured it as a USB bus-powered device rather than a USB self-powered device?! Not sure if that would solve my problem. I can't really test it without reordering the PCB plate. I don't have all the components.
I don't know the full context because only a small section of the schematics are provided. But assuming that this is a battery powered device and the low-current consumption is important only when it's running on batteries, you can use a small P-channel mosfet in the section that you've now cut. Pull up its gate to battery voltage to ensure it remains off when only battery power is present, but an nmos or npn to pull down the gate if VUSB is present.
Something like this:
Again, maybe this won't work because there's something in the context I'm not aware of. I had to assume what wasn't posted...
Not sure what you're doing, but can't you just move your project to an ESP with integrated software USB and battery management, like the Seeed ESP32-C3.
They claim 43uA deep sleep for that board.
Leo..
Thanks to all of you for your suggestions. Actually, before adding this USB module, I had less than 20uA in deep sleep mode. I don't know why it is so complicated to add a USB module to my current circuit.
I configurate it as a USB bus-powered device. Do you think changing configuration for a USB self-powered device would help me? Check p.18 and 19 here: cp2104.pdf (silabs.com).
I will try it @rsmls
Thanks. I didn't check back on other threads you had open. You can use the schematic I proposed possibly with some bells & whistles, although I guess it should work as depicted. Maybe hold on while others might chime in and point out anything I might have missed.