Arduino 2560 - disconnect USB 5V, but not data

Greetings All,

I want disconnect the USB vbus power from my arduino 2560 board but not the data lines, so that the board can still interface with a computer providing an external power source is available.

I was thinking of removing the fuse F1 to do this. Or perhaps cutting the track and add a switch to that connection.

My questions are, is this going to do what I want? Is there another way of do achieving this? And is it going to cause me issues?

For clarification, I want to do this because when both power supplies - USB and the external - are connected, I get interference on the lcd display being run by the arduino (pixels in the wrong places, poor contrast and the backlight flickers).

R

Hi @Robin50543,

I’m not sure what Mega variant you are using - but from what I understand the genuine boards will automatically switch between USB and jack/VIN. Jack/VIN has priority (VIN > 6.6V). You can connect both (VIN and USB or jack and USB) at the same time.

Clones might work different.

Hi Robin,

First, I would try connecting external power first, powering the board up, then connecting USB. If that works, great, if not, then adding a switch between the 5V pin at the USB connector would be the easiest way to manage it.

It’s a bit strange that you’re getting flickering and noise in your setup though, my first thought would be that it could just be the fault of the power supply. Does it go away when the power supply is connected without USB? If not, then the power supply could be at fault. If it does, it might be worth connecting your USB power to something that isn’t a computer; battery power bank or something like that. It may be ground noise causing the issue.

If you have a scope handy, you could fairly easily track down the source of the noise, but testing it like this should still help to track the issue.

Thanks for the responses.
I am using a rev3 Mega 2560, it claims to be genuine. Though I recently modified it by replacing the linear regulator IC1 with a switch mode 5v 5a regulator - I removed the reg and ran wires to the pads.

The mod appears to have solved the problem, except for a little weirdness when adding or removing the usb or external 12v. I think it rebooted when I touched usb ground the board ground before plugging it in, which could be problematic in future.

I couldn’t actually run the board with only the 12v supply before modifying it. The various leds would flash on and then die, only to turn on again but nothing else happened. I suspected it was boot looping or the little linear regulator was cutting off to stop itself cooking.

The micro and lcd would run fine with only USB power, but that’s not much use because I need the 12v to run motors and such.

It is good to know that I can remove the 5v from the usb without losing communication though, that will be useful.

Edit. Alas I do not own a scope.

Hmm, that does sound a bit strange. As far as removing the power on the USB line, be sure to only cut the 5V trace, and leave ground connected. Are you still getting the noise/glitching issues with the switchmode regulator you installed?

No issues since installing the switchmode supply. It will operate without the usb connected now, which is ultimately what I wanted.

I found that if I connect the usb first, than the external supply everything works without weirdness. Going the other way I think it reboots, I am guessing grounding issues there.

Ah ok, glad to hear that it’s all sorted now. I do recall reading something about the order that power is plugged in on the Mega 2560 having an impact.