Disable USB power without modifying the board.

I've found a number of threads where, usually because of high amperage requirements, there is a need for a board to NOT start up on only USB power. Several of these threads have ended in varying degrees of success.

One caveats that is a recurring problem is that power is still required for communication through the USB so just cutting the +5V wire is not the solution.

I am just venturing into this realm so please excuse my naivete if I'm off base. Would an easy way around after cutting the +5V be to simply draw power from the board (which would only be present with an external power supply) to power the USB port?

5V is not required for communication. If you have another supply powering your board then it doesn't need the USB power to be connected anywhere. You just need that other supply connected and turned on when programming.

This is exactly the opposite of what I usually want to do, I want to program the board with USB power, so that the motors connected to the outputs can't move during programming, because they have no power.

Thanks for the reply. At least it doesn't look like I offended anyone with my initial post.

The intent is when I switch the power off to the device I'm building, it will shut down the entire system including the controller. Depending on the state things happen to be in at that point, having it try to continue on USB power is not what I want to do. On the other hand, I don't want to have to disconnect the USB before shutting it down. It sometimes takes a while to reestablish the serial monitor connection when I start back up for testing.

I have found threads that state that your approach "should" work but in followup comments it seems that the Arduino is not always detected without the 5V connection. One speculation was that someone might have cut the ground instead. No trouble believing that might be problematic but there was no confirmation on that.

With that said, if I cut the 5V wire and it works then all is well and good. If not, would it be safe and reasonable to make the connection from the +5V pin on the Arduino to the Arduino end of the doctored cable? Seems to me that that would be a less cumbersome approach than some have resorted to such as this:
forum.arduino.cc/index.php?topic=124285.0

Thanks again.

To disable USB power, you pull out the USB plug.

Clearly, either you need USB communications, in which case you want the USB power, or you do not need USB communications, in which case you just disconnect it.

1 Like

The USB to TTL chip uses 5v from the pc USB power. As for the arduini, it is my understanding that the tutti-fruitti power auctioneering setup on the arduino will use power from an external power supply if available instead of from the USB supply. Check an arduino schematic for the circuit.

Paul__B:
To disable USB power, you pull out the USB plug.

Clearly, either you need USB communications, in which case you want the USB power, or you do not need USB communications, in which case you just disconnect it.

Sorry Paul, this does not accomplish the goal. Please re-read the requirements.

zoomkat:
The USB to TTL chip uses 5v from the pc USB power. As for the arduini, it is my understanding that the tutti-fruitti power auctioneering setup on the arduino will use power from an external power supply if available instead of from the USB supply. Check an arduino schematic for the circuit.

Zoom, this does not address the problem either. The USB port does not provide enough power for the board and attached components. When external power is off, I need the board to shut down regardless of whether a USB is attached or not.

The real issue here is that you say " without modifying the board".

That means that the only true way is to add something. The only thing I can think of is this:

Digistump Programmer

Don't let the name fool you. It completely breaks USB rules and inserts a switch in the power rail of the USB cable... allowing you to make sure that your USB wire either provides 5V or does not provide 5V power to the attached board while leaving all the other pins intact.

You may be better off not using USB at all. You can program the board by Bluetooth.

1 Like

If you just want to run the board from an external power supply but be able to program it just use a USB cable with the red (5V) wire cut. That way noting is power when only usb is plugged in (but you don't see the Arduino in the OS either). Programming is as easy as turning on the external power and just use the USB. As long as the GND is still connected all is fine. The USB serial chip (either the ATmega or the CH340 etc) is then just power from the external power.

If it takes a while for the Arduino/com port to show up you might just want to clean your computer :wink: Instantaneous even om my 8 year old PC.

1 Like

pwillard:
The only thing I can think of is this:

Digistump Programmer

This appears to simply switch the 5V supply on/off. I may be wrong but in the description I see that this is equivalent to DISCONNECTING the USB without the wear and tear on the connectors. I still need the USB functionality, just not the power. Not sure this buys me what I'm looking for. Can anyone offer a definitive answer?

dmjlambert:
You may be better off not using USB at all. You can program the board by Bluetooth.

Not a viable option. No bluetooth on the PC or controller.

septillion:
If you just want to run the board from an external power supply but be able to program it just use a USB cable with the red (5V) wire cut. That way noting is power when only usb is plugged in (but you don't see the Arduino in the OS either). Programming is as easy as turning on the external power and just use the USB. As long as the GND is still connected all is fine. The USB serial chip (either the ATmega or the CH340 etc) is then just power from the external power.

If it takes a while for the Arduino/com port to show up you might just want to clean your computer :wink: Instantaneous even om my 8 year old PC.

Again, I'm getting conflicting information on whether USB will work without 5V on the Arduino end of the USB connector. You, and several others say it SHOULD work. If that's the case then the Digispark switch should still allow programming when turned off.

Going back to the idea in my original post, what am I missing if I cut the 5V wire in the cable and instead of relying on power from the PC to power the port, simply draw from the +5V pin on the board the Arduino end of cable?

This appears to simply switch the 5V supply on/off. I may be wrong but in the description I see that this is equivalent to DISCONNECTING the USB without the wear and tear on the connectors. I still need the USB functionality, just not the power. Not sure this buys me what I'm looking for. Can anyone offer a definitive answer?

Let me clarify.

When the USB is the sole source of power... yes this Digistump switch will make the USB attached device "go away" as it will lose power. The USB will actually work when on external power, since the USB chip receives power from the 5V regulator when the DC jack is used. The onboard smart power switching will take care of that.

When the Digistump switch removes power, the USB on the BOARD side will be powered by the external power source on the AVR but the USB will still work since the data and gnd pins remain connected. If the MAIN external power source is removed... all source of voltage will also be gone and the board will power down.

Now, remember, I said this is not t USB spec. I cannot guarantee no harm will come from the data pins being being connected to the PC with the 5V pin isolated by a switch. I can say, I have done this with my 3D printer Mega/Ramps board combination and have had no issues.

I said it DOES work :wink: Simply because the Arduino and the serial interface (being it a CH341 or a ATmega on the original) is just power from the 5V line. And on a Uno that's already Vin when Vin is connected. It ONLY switches to USB power when no Vin is present.

@Backstage,
Your diagram of the USB adaptors running off the UNO 5V should work if you use an external power supply of 7V or more (up to 12V). When the external p.s. is off, there s no voltage on the 5V pin.

Yes, the external power supply is 9V so that is covered. I have not yet implemented this as I am still in the development stage of the overall project. I hate to see dangling threads so I will post the results once I'm up and running... one, for a high-five to the contributors and a warm fuzzy for anyone else asking the same questinon.
Thanks all!

I read conflicting things in these posts.
If USB can't power the 'unknown' devices connected to the Arduino, a 9volt supply also can't.
The onboard regulator can't handle more than a few hundred milliamps without overheating and shutting down.
High time you told us how and what you are powering.

A powered USB hub (without connecting the power) will do what you want.
Leo..

High time you told us how and what you are powering

As always, it eventually comes down to a game of "20 QUESTIONS"... ;D

The intent is when I switch the power off to the device I'm building, it will shut down the entire system including the controller

What exactly have you tried ?
If the board is powered from the external dc supply, the USB can still communicate but the USB 5V is not connected. Shutting down the external supply should shut down everything. I don't the need for this post. You have not explained why using an external supply will not work. If what you are trying to say is you want to disable USB COMMUNICATION on startup, then you need a 4PDT relay controlled by an arduino output with the USB signals connected to the N.O. contacts so there is NO USB connection until the arduino turns on the relay which turns off when the board shuts down.

Wawa:
High time you told us how and what you are powering.

I thought I had expressed the objective earlier. Apparently not to everyone's satisfaction.

I'm powering a number of controls, relays, contactors, and such to run a heating element, pumps, and valves up to 50 amps at 240 volts. Sure, the Arduino is not powering that but it is, through relays and such, controlling them. The USB power may be enough to drive all of that but from several sources I find that an external power supply roughly doubles the available amperage which is a good fudge factor to have. The unit will be powered that way once complete anyway.

My main objective is, when I turn the main switch OFF on the unit, I don't want power from the USB keeping those switches closed and allowing the high voltage components to stay live. It's a safety matter. Normally this won't be an issue as there will be no USB connection during normal operation. Only during development. The unintended live voltage is even more of a concern at that point as not everything is packed away nicely in the control panel.

Now, back to the point at hand.

I added a USB connector to a proto-shield as I started the actual build. From there, I connected all but the +5v wires to a USB jumper to the Arduino. Now when I kill the power, everything goes dead. Mission accomplished on that front. The down side is, when I flip the power back on, the board powers back up but it DOES NOT re-establish the serial connection over the USB port. I have tried the reset button, recompiling, closing and re-opening the Arduino software, but nothing works. From the "Tools" dropdown, no port is listed. The only solution I have found is to disconnect, the re-connect the USB cable. Do that and all works fine again.

Less than ideal but at least shutting off the switch reduces the possibility of electrocuting myself. If anyone has any ideas that might help with re-establishing the serial comunication without messing with the cable, please let me know.

Thanks!

ALL PROFESSIONAL microcontroller equipment uses relays to energize larger (high power) contactors.
Everything is under the microcontroller's control, such that if the uC loses power, EVERYTHING loses power.
WHY ? You don't want high power equipment operating without control (ie: the uC). I work with 240V /100A equipment everyday and when we need for contactors to be controlled by a uC, the relay energizing the contactor coil is always driven by the uC so when you turn the power off, if you turn off the uC power, you turn everything off.
USB 5V is limited to 500 mA. A 240V/100A contactor with a 120V ac coil draws 600 mA (ac) @ 120V. The relay that energizes that 120V coil only needs to handle 600mA (@120vac) so a 5V relay would work just fine for that. The USB can power that little relay but not the large contactor. The standard way to control external power supplies is to have code that controls a relay that connects/disconnects that external power supply , so that if you had a front panel for example, there would be an indicator lamp showing the status of that supply and whether or not the uC has turned it on or off. You don't want ANYTHING happening without the uC permission, including external power supplies. WHY ? Good question. Any smart designer includes sensors to sense the status of the equipment. He designs for WORST CASE and hopes for the best.
If he is really a smart guy, he can turn on his equipment and go golfing because if any bad SHXT happens,
the sensors will tell the uC and the uC will tell the external power supply to FXCK OFF. (TURN OFF).

You don't have to do any of that if you want to babysit your equipment.
Things have changed since I got into electronics 37 years ago. We didn't have arduinos or ebay or Google or CHINA to supply anything and everything for less than the cost of a hamburger. If you don't take advantage of all the cheap stuff available on ebay, then , well, you deserve what you wind up with.