For an external circuit attached to the ESP32 Thing Plus C I need a 3.5V source and thus the 3.3V source isn’t going to work. I thought I would replicate the circuit used by the Thing Plus C to create VIN for the system regulator and hook it to the available VUSB and VBAT pins.
Basically a diode and a MOSFET. This is preferred over two diodes (which was my first thought) as it completely turns off drawing from the battery if there is a constant source to draw from. But then I discovered it didn’t work…
Through investigation I found that the VUSB and VBAT pins do not work as I would expect from the schematic. From there I would expect VUSB to be near 0V (~280mV due to reverse leakage) if only VBAT was plugged in and VBAT to be near 0V whenever the USB was plugged in. But this wasn’t so - both always have significant voltage (this is with nothing else attached to the board):
USB | Battery | VUSB | VBAT |
---|---|---|---|
X | 5.2V | 4.1V | |
X | 2.9V | 3.9V | |
X | X | 2.2V-2.7V* | 3.9V |
* fluctuates over about a half second
I would like to understand why this happens from the circuit (because my understanding of the MOSFET + diode is apparently wrong).
Additionally, I would like to know if it would be safe/reasonable to just use two diodes to get the max of the to voltages?