0
\$\begingroup\$

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?

ThanksON OFF USB Cable

\$\endgroup\$
  • \$\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 at 21:20
0
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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