I'm building a PCB where a Arduino Pro Mini will plug into headers on the PCB. I'll also have a header on the PCB for FTDI connection so I can program the Arduino. Normally the FTDI cable can supply 5 volts to the Arduino, but when I am powering the Arduino with another power supply, I don't need or want to use the 5 volts from the FTDI cable.
I'll have three scenarios for the Arduino Pro Mini:
1) At my desk when I'm programming, I'll have FTDI cable and the mini should be powered by the 5 volts from the cable. It will not be connected to any other power sources.
2) In my project, no FTDI is connected and I'll have 5-12 volts (not sure which yet) connected to the Arduino RAW (Vin) pin. Note: The Arduino Pro Mini has a regulator that brings this down to 3.3 volts.
3) Once in my project, I may need to make programming changes, so I'll want to plug in my FTDI cable to to this. The Arduino already has power, so I don't want the 5 volts from FTDI to reach the Arduino, it should continue to get power from the 12 volt source.
So I'm looking a circuit that will let the FTDI power the Arduino if there is no other power source, but if there is, I don't want the FTDI power going to the Arduino. The simplest thing is to just add a little switch on the FTDI voltage pin, but I'm concerned I'll forget to use it, especially if a lot of time has passed and I forget all about this.
I looked at the schematic for the Arduino Uno (attached) because the some of the Arduinos do this. The Uno uses a LVM358 op amp connected to a FDN340P p-chan MOSFET. I think the op amp is used as a comparator. I don't understand completely how the Uno circuit is working. From what I can tell if Vin = 0, then the op-amp compares this to 3.3 volts and brings the output of the Op amp low which is connected to the MOSFET gate. With the gate low, current flows from source to drain, source being USB power in this case. If Vin > 3.3 volts the Op-amp output goes high and stops current flowing in MOSFET. I think I've got that right, what I don't understand is if Vin = 0, where is the 3.3 volts coming from used by the op-amp. I guess if Vin = 0 and you plug in the USB, then current will flow in the Mosfet, and then make it to the 3.3 voltage regulator.
My circuit shouldn't draw more then a few hundred mA, if that.
I'm interested in recommendations on how to do this.