[answered] Which Arduino power input takes priority?

Says here:

Power The Arduino/Genuino Uno board can be powered via the USB connection or with an external power supply. The power source is selected automatically.

But afaics, it doesn't say what the basis for "selected automatically" is.

What are the criteria for which power supply's in play at any instant?

Power is power, it just takes it from the best available source, as it says, automatically. It doesn't "select" in terms of shutting out the other sources

Nick_Pyner: it just takes it from the best available source,

That's exactly my question: what's the criterion for deciding which of the supplies is "best"?

If I have (say) a battery in the barrel, and mains derived usb in the usb, I'd rather it used the mains usb than run my battery flat.

The barrel jack has priority. Usually you don't want the Arduino sucking too much power from the USB. Standard USB is limited to 500mA (half an Amp) and many many projects use more than this, which is exactly the time you plug in a DC jack.

But if the barrel jack power drops, like you have a very weak battery, then the USB power will take over again.

MorganS: The barrel jack has priority.

Thanks.

That's a pity, since that's ass-backwards from what I would want as battery backup. I would want it not to use the battery while there's usb from the grid, so that the battery's in good shape when the mains goes out.

But I won't shoot the messenger ;)

The DC jack needs to be a reverse protection diode drop plus the minimum dropout voltage of the regulator higher than USB for an external supply to take over. That could be a threshold of (USB+0.7+1) = ~6.7volt. Below that, USB power will still be used. Threshold would be (USB+1volt) if the battery is connected to V-in. USB is switched off (by a mosfet) if V-in is >6.6volt (or DC jack is 6.6+0.7= >7.3volt). Leo..

Ok, so a battery backup strategy would be to supply mains derived ~7.5V on the barrel for normal use, with a 5V regulated battery supply (ie within the usb specs) on the usb. The wrinkle there is that the battery supply needs to be within usb specs, whereas if the mains was on the usb it would be in spec from any decent adapter, and the battery could be any old crap up to 12V.

But, at least I now have a strategy.

Thanks @Wawa and @MorganS.