I have some projects with Arduino and a separate battery power source and I'm tired of plugging and un-plugging my usb cable when to program the arduino using my laptop USB. Sometimes it even broke the tiny micro USB connector in the Arduino.

So I want to put a on-off switch on the USB cable. When I'm about to program the arduino I disconnect the battery and turn on the cable, and when I want to test the programmed Arduino and circuit, I turn off the cable, and just connect the battery. The USB cable would always be connected in both Arduino and laptop.

So I want to do this. Put a LED in parallel with the 5V and GND to tell me when the cable is "On" or "Off", so I don't mess with plugging the battery with the cable "ON"

Which would be the best setup? How do the data lines behave, if they are always connected between the laptop and arduino (when powered by a 7.4V battery)? Will the data lines be turned off also, if USB supply line is cut?

Is it best, or safer, to cut the power by the putting the switch in the 5V line (A) or in the GND line (B)?

Could and Arduino (or any clone that has an USB programming/power port), if connected to a battery (but still connected to this USB cable in an OFF switch position) be able to light the LED, by "supplying" current to the cable? Even if the connection with the computer is cut?



  • 3
    \$\begingroup\$ I would never ever cut the ground wire between two devices. If there is a ground loop that already connects the grounds via some other route, cutting the ground won't do anything, on the contrary, excessive current could flow via a wrong route, instead of the intended route. \$\endgroup\$
    – Justme
    Aug 14, 2020 at 21:20

1 Answer 1


Cutting the 5 V will disable the Atmega32U4 USB interface, which is used in Uno and Leonardo. I think rest of the boards will behave pretty much the same as USB interfaces usually activate when 5 V "VBUS" is detected.

So I'd cut the 5 V.

  • 2
    \$\begingroup\$ I just leave all connected, it works fine on the Nano and Uno devices. The isolation circuit is there for that reason, it does not backfeed into the laptop. In my units the power is all drawn from the external power supply as the Vf of the diode places the 5V to about 4.5V Note: I power via Vin, not the 5V pin. \$\endgroup\$
    – Gil
    Mar 13, 2021 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.