- Joined Apr 25, 2022
Here is a diagram of what I am trying to achieve. I have a block representing a portion of the PCB that I have labeled "Audio". These components require 5v DC and output an analog audio signal. I also have two blocks representing two ATmegas and supporting circuitry that requires 5v (2.7v-5.5v) DC. I will most likely be using ATmega32U4s for the USB support. I need to power this with the 2 USB ports which is the issue I am trying to deal with. Each ATmega only needs power if its respective USB is connected, but the audio circuitry needs power when either both USBs are connected or just one. What would be the best way to accomplish this? I would ideally like to have fail-safes and other protective circuitry if needed to prevent damage to the USBs. One idea I have is to do the following (using two NPN transistors).
This circuit seems to accomplish the task. I have built the circuit and tested it with various USB hosts (Desktops, Laptop+Desktop, etc...) and it seems to work fine. My issues with this circuit are as follows:
- This circuit results in a voltage drop of about 0.61v which is a bit more than I would like.
- While every USB host supplied 5v with a very small deviation (only like <0.1v difference in most cases even with a laptop (battery) vs desktop), I suspect this is due to being powered from the same power grid? If the difference is large enough (say one host device has a +2v ground compared to the ground of the other device) it could fry the PCB right?
Any better ways? With more protection? The above circuit could work with a 5v regulator for protection (but then it would still have a voltage drop).