This question already has an answer here:
- Switch between battery and USB power 2 answers
I've come across this issue multiple times already and never really figured out the best way to do it.
I'm designing a controller PCB for a drone and I would like to have a few different ways of powering it. USB power just for the control electronics, a battery connector (2-4S, not really sure yet) for the ESCs/motors and another regular connector for development 12V supply so I don't have to rely on batteries.
Now, I'd love to have a circuit that would automagically switch between these and make sure only one of them is active at any time to protect other supplies from reverse current and what not if multiple are plugged in at the same time. For instance, I would probably have USB and the 12V supply or battery plugged in at the same time during development because USB would just be used for debugging and the 12V supply or the battery to power all of the electronics and motors. Priorities would be
12V supply > battery > USB.
I could probably figure out the rest out myself but I just don't know where to start with this.