Vin power and usb Arduino mega

I know this has been asked before but I couldn't seem to find a single yes or no answer to this question:

Is it safe to have USB connected and have +12v connected to the Vin pin on an arduino? (Specifically the Arduino mega 1280)

I need to be able to have the USB optional.

Thanks, Dan

(btw, I got the i2c figured out if anyone was wondering :), this is all going towards an awesome RepRap control panel)

Is it safe to have USB connected and have +12v connected to the Vin pin on an arduino?

Yes. There is an on-board power selector that determines which power source actually powers the board.

Thanks for the quick response, just out of curiosity, how does it decide? closest to 5v? or is it just that it'll only use USB if nothing else is available?

how does it decide?

I think that it uses USB if available, and external is not. Though, I could be wrong.

PaulS:

how does it decide?

I think that it uses USB if available, and external is not. Though, I could be wrong.

Correct, that is wrong. :wink: External power has priority over USB power if both are avalible.

Lefty

External power has priority over USB power if both are avalible.

As see it the external power has priority over USB power only when VIN (which is after the input diode D1) is greater than 6.6 volts.

By the way, it appears to me that there are two problems with this design. (1) Since the voltage regulator is a low-dropout device it will function properly when VIN is greater than 6 to 6.1 volts. This gives you a 0.5 to 0.6 volt range where both the external power and USB can be supplying "+5v". They are not likely to be exactly the same so something bad is happening somewhere. (2) When VIN is either not connected or lower than 6.0 to 6.1 volts then the three-terminal regulator is not delivering power. The USB supply will be applying +5V to the output terminal of the regulator and the regulator will be reverse-biased in terms of VOUT vs VIN. I don't see any reverse-bias protection for the regulator as recommended in the various application notes that are out there.

Don