Here’s
is a circuit that used for the USB source, power will enter through the USBVCC
section into a P-channel MOSFET FDN340P. Explaining briefly, MOSFETS are transistors that
are normally closed (connected) until a certain amount of voltage triggers the
gate. Consequently, triggering the MOSFET opens the transistor (disconnected).
Using this characteristic, a comparator is connected to the gate terminal of
the MOSFET to function as a switch mechanism. If you use the USB source, it
will just power up the 3.3V regulator since the MOSFET is normally connected.
If you plug a dc supply, the LMV358 op-amp will produce a high output triggering the gate
of the MOSFET, disconnecting the USB source from the 3.3V regulator. So if both
are plugged, the board will use the DC power supply. This is the figure
of the circuit.
The 5V terminal here indicates a connection to the circuit
powered by the DC power supply earlier. This means that the 3.3V regulator is
powered by whichever powers the circuit. Lastly, the LED indicator
circuit. Put simply, it lights the green LED up when it detects power from the
5V terminal.