Arduino | external power supply and USB at the same time
I have got an Arduino Mega 2560 project with many sensor and outputs. Right now I’m supplying it with an external stabilized 5V over the 5V pin (so that I’m using only one power source for all sensor, outputs and Arduino.)
I also have a Raspberry PI connected to the Arduino via USB for flashing and also logging. The Raspberry PI has got an external power supply (and also a board with SSD.)
The problem: If I unplug the RPI external power supply, the Arduino Mega is supplying the RPI with power!!! That’s exactly what I do not want. (Also it’s far too little power for RPI, which isn’t even booting correctly.) Even when I power the Arduino Mega 2560 over the barrel plug (stable 9V), the RPI will be provided with a 5V over the USB cable.
I’m looking in the electrical wiring diagram: I can see the FDN304V The comparison circuit (LM358D) controls this p-channel mosfet FPN340P. But why is it USBVCC connected if the Gate provides 5V over the LM358D?
I saw this interesting articles but I'm a bit confused:
What happens if I power the Arduino with both the USB and external power voltage simultaneously?