This is the relevant part of the schematic for ESP32-2432S028 board I have.

esp32-2432s028 schematics

It's normally powered by 5V over Micro-USB (the right-hand schematic). I want to power it with 5 V through the HC-1.25-4PWT socket (the upper left schematic). I suspect I should be able, with the voltage line marked VIN going towards the 5V line... but I'm a bit stumped about the transistor (Q1) along the way. What does it do in this configuration, and should I worry?


3 Answers 3


It's to protect against an accidental reversed power connection.

Normally, when VIN > Q1_threshold, Q1 will turn on and supply VIN to then'5V' line. Q1 will just act like a negligible resistance.

If VIN was negative, Q1 wouldn't turn on, nd '5V' would not be connected.

With USB connectors this power connection reversal is unlikely and you could remove Q1.

  • \$\begingroup\$ I would add that it's done to save a diode forward voltage, either to get the full 5V or for efficiency. In motor (and other inductive devices) applications it also allows reverse current flow, without which the voltage inside can rise too much. \$\endgroup\$
    – TQQQ
    Commented Jun 25 at 13:35
  • \$\begingroup\$ The Q1 does not protect from reversed USB supply, but from reversed input from connector P1. In which case it does not make sense to remove Q1 contrary to the suggestion in this answer. \$\endgroup\$
    – Justme
    Commented Jun 26 at 17:35
  • \$\begingroup\$ P1 is specified as a polarized type, as well: lcsc.com/product-detail/… it's mysterious why the transistor would be required, but it might've been added out of superstition or repetition. Oh wait, I think this has been misread: USB1 is the input, and has a regular diode; P1 is a serial (TTL) output. OP wants to use it as 5V input, which will certainly work with the diode present. \$\endgroup\$ Commented Jun 26 at 21:32

Q1 is a P-Channel Enhancement MOSFET is open in case your vgs is positive. In this case, you can ensure VIN > GND and protect the circuit from reverse connections.


Q1 is a P-channel MOSFET that is normally used in this configuration as a form of reverse polarity protection (for example, if you reverse the cable connection on P1) that is more efficient than a diode, as it won't drop much voltage in the component itself.

In this way, if the circuit is powering on, with Q1's drain (D) of 5V, the MOSFET's body diode will allow voltage to pass to the 5V net connected to Q1's source (S), which will turn on the transistor due to the created \$V_{GS}\$ (voltage between Q1's Gate and Source). When it turns ON, the \$R_{DS}\$ resistance will drop, usually to a few mΩ if the transistor is correctly sized, which will make the voltage drop in Q1 (\$V_{DS}\$) negligible.

However, for your circuit, you need to be careful with some things. If \$V_{IN} < V_{USB}-V_{D1}\$, you will effectively short both power supplies (USB's and the other circuit's), which will usually cause problems (it won't cause problems only if some other component, such as internal resistance, absorbs the drop). This might be the case if the other circuit's power supply fails, the consequences of which will depend on the power supply's failure mode.

  • \$\begingroup\$ Can one arrange the MOSFETs like that into a "full bridge rectifier" to make the input polarity-agnostic? (don't care about AC, just "connect any way you like") \$\endgroup\$
    – SF.
    Commented Jun 27 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.