Circuit Analysis
Before you layout a circuit, it's generally a good idea to understand what is happening in your schematic. And before you lay out a schematic, it's generally a good idea to understand what is happening in your block diagram.
"This book is a bit technical. If you are a beginner, it's okay that you don't understand everything that follows -- your first project will still be successful. Try to pick up as much as you can, and ask questions in the forums!"
2. Power System Overview
2.1. MOSFET Magic
Understanding Dr. Bob's Source Selector
Let's take a look at the four options available for power sources. Nothing attached, only battery power, only USB Power, and both usb and battery power.
Option 1: Nothing attached
"Just a reminder, 'closed' means conducting and 'open' means non-conducting."
Transistor Switch Status | |||
Q1 | Q2 | Q3 | Q4 |
Closed | Closed | Closed | Closed |
As you can imagine, nothing happens. P-channel MOSFETs behave as a normally closed (conducting) switch that opens (non-conducting) when a voltage is present at the gate. Since no voltage is present at the gate of Q1, Q2, Q3, or Q4, the "switches" are all closed and any current that arrives will be readily conducted.
Option 2: Only Battery Attached
Transistor Status | |||
Q1 | Q2 | Q3 | Q4 |
Open | Open | Closed | Closed |
With the battery attached and the switch turned on, current flows through to the 5.0V LDO and through Q3 and Q4 to the 3.3V LDO and out to the rest of the circuit. R3 keeps the gate potential of Q3 and Q4 at 0V. At the same time, the gates of Q1 and Q2 are energized, stopping reverse conduction of current through the circuit.
Option 3: Only USB Attached
Transistor Status | |||
Q1 | Q2 | Q3 | Q4 |
Closed | Closed | Open | Open |
With the USB power connected, R2 keeps the gate of Q1 and Q2 and ground potential, which keeps Q1 and Q2 conducting current between the source and drain. At the same time, the gates of Q3 and Q4 are connected to the net that connects Q1 and Q2, closing the conducting paths between Q3 and Q4 drain and source, which prevents the backward flow of current.
Option 4: Both Sources Attached
Transistor Status | |||
Q1 | Q2 | Q3 | Q4 |
Open | Open | Closed | Closed |
When both sources are energized, the 5.0 V LDO generates a potential difference at the gates of Q1 and Q2, shutting off the conduction path across the drain and source, stopping USB_VBUS current before it ever gets a chance to enter the rest of the circuit.
Summary
Dr. Bob's Battery Selector circuit prefers the 5V LDO over USB. If either source is energized, power will be delivered to the rest of the circuit.