How to switch best between two voltage sources (5V & 3V3) for a "load" (e.g. a sensor in the application field or Arduino/Raspberry Pi/etc.). The basic setup is as follows: there are two voltage sources: 5V and 3V3 and based on a MCU
OUTPUT should either be supplied with the 5V supply or 3V3 supply. The MCU is a 3V3 system.
I thought of basically two ways (following). The question is, if they are correct and which one might work better (although hard to answer generally, question is for "rule of thumb"). The requirements are roughly: design as simple as possible, no fast switching required (e.g. max. once per minute or even less).
A) Using transistors
Description: Basically two PNP ("high side switches") are used to switch the 5V/3V3 to the output. In order to keep the PNP off the voltage at the base is going to be nearly at the 5V level and this would "overload" the MCU, so an intermediate NPN stage is driven by the MCU which drives the PNP. In order to protect "reverse voltage" a diode has been added (
The question is, if this would work (I'm not sure regarding
Q2) and also the diodes reduce the VCC by ~ 400 mV, so
OUTPUT would be 4.6V/2.9V, right? This will cause other "trouble" down the road since the OUTPUT should be proper 5V/3V3. A quick solution could be by increasing the 5V/3V3 accordingly. But the max. system voltage is 5V, therefore a boost converter is also required. Any better ideas here?
B) Using a relay
Description: relay limiting resistor (
R5) is calculated by dividing the required voltage drop (0,3V: 3V3 -> 3V of relay) by the current of the relay (33 mA). But this solution has mechanical implications (e.g. lifetime)
Edit: it seems that I left out important details:
- Imax (load) V tolerance? up to 75 mA and ± 10% for both rails (5V/3V3).
- Use-case: the user can plug in different sensor boards (imagine temp sensor, light sensor etc.), everything digital, the MCU knows which device by user input and based on this switches the defined VCC
Edit 2: based on the extensive answer of AnalogKid I redraw the schematic of A) just in case anyone want to see it (@AnalogKid thanks for giving so much detail):