disable USB VCC on Mega

I have an Arduino Mega2560 in an enclosure with a couple of other atmega chips. These and the peripherals are all powered by the same 5v source using a separate DC barrel connector. Since I'm not using the mega's DC barrel connector, I need to make sure that when I connect the usb cable it isn't also supplying current. Is there an easy way to disable the usb's Vin?

Sure - make sure Vin <6.6V, the autopower switch will disable Vin.

I should have been more clear. The external power source is a regulated 5v.
Are you saying that if I connect this regulated 5v to the Mega's vin, the USB's vin will be disabled? That would be nice; however, I had thought that use of the Mega's vin in this manner required a minimum of 7v because of the board's internal 5v regulator's vin requirements. Am I missing something here?

After doing a little more research I think you meant >6.6v. This would make more sense since, as I understand it, there's circuitry that compares the two VINs (USB and external) and disables the USB VCC if the external voltage (either barrel connector or VIN) exceeds a minimum threshhold (which should be >7v for the regulator to output correctly).
If so I'll need to supply the VIN pin with the unregulated 9-12 volts that is also available inside the case.
Am I correct?

Am I correct?



You asked " Is there an easy way to disable the usb’s Vin?"
The way to the that is to have Vin < 6.6V so that when Vin/2 is compared to 3.3V, the 3.3V controls the switch to let the USB 5V be switched onto the 5V bus.
If Vin is >6.6V, the external 5V regulator will make 5V and it will go onto the 5v bus.

If you put external 5V on the Vin pin, the usb 5v will be switch in.
If you put external 5V on the 5v pin, the usb5v will be switched in.
If you want USB 5v Not switched on, Vin must be >6.6V.

Maybe "disable" is not what I meant.
What I want to do is make sure that the USB doesn't power the board. The board will be powered by an external source via the board's Vin (not the barrel connector). I want to be sure that there is no conflict between the two power sources, usb and external, that could damage the board or my computer.
Do you agree that applying >7v to the board's Vin is safe regardless of whether or not the USB is plugged in?