I have an ESP32 dev board controlling an LED matrix, both of which are powered by the same 5V switching PSU. The ESP32 is powered through the +5V pin. Everything is meant to be enclosed in a box with a USB cable running out to allow reprogramming the ESP. The issue is that when I connect the USB cable to my computer (with the PSU being switched off) it also powers the LEDs through the 5V pin. These may draw too much current in certain settings potentially damaging the USB port.
I was thinking of three options to avoid the problem:
- Put a Schottky diode at the +5V pin allowing the current to flow in, but not out.
- Cutting the +5V wire in the USB cable and reprogramming with the ESP being powered by the main PSU.
- Have a switch on the +5V pin to disconnect the rest of the circuit from the ESP while reprogramming (I don’t like this option due to the extra switch, but it is still a possibility)
If I go with 1), is the voltage drop going to cause problems? Could I actually take advantage of the voltage drop, connect a suitable resistor in series, and power the board through the 3.3V pin instead of the 5V pin? Lastly, is there any trickery in choosing the diode?
If I choose 2), is the computer still going to recognize the ESP32 board? Could there be any other issues?
I kind of like option 2 as I don’t even need to turn the PSU off for reprogramming.
In case you can think of another simple solution (I’m rather inexperienced, so please don’t suggest anything crazy), please let me know as well.