Can I have my Arduino hooked to USB and to external power supply at same time.

Can I safely connect my Arduino to my PC using the USB port at the same time the Arduino is connected to an external power power source without frying my Arduino ?

Basically I need to plug it into my PC USB port while its being powered from an external source.

I need to run my Arduino off power supply for stable analog readings and at the same time I need to use the serial monitor screen from time to time so I can read Temp, PH and checking how much time is left for next batch of biodiesel.

I don’t know it for all models, but the Uno can be connected to external and USB at the same time.

see http://arduino.cc/en/Main/ArduinoBoardUno under “Power”.

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

It's possible...

But i swear i lost use of high speed USB because I was sharing voltage, maybe it was a co-incidence, a solution would be a small circuit to detect voltage and isolate / pass one but not the other, basically "sensing" the voltage and doing what's needed.

But i've connected USB 5v and 5v from a 7805, without blowing up my PSU lol.

bakkerl: I don't know it for all models, but the Uno can be connected to external and USB at the same time.

see http://arduino.cc/en/Main/ArduinoBoardUno under "Power".

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

That quote from the web page is ambiguous.... it doesn't actually say that both can be plugged in at the same time. It can be taken to mean you can use either, and that the Uno will sense which one is present. It's not 100% clear that it means it will select from two being plugged in at once.

In other words, is the "or" in "via the USB connection or with an external power supply" an ior or an xor?

JimboZA:
In other words, is the “or” in “via the USB connection or with an external power supply” an ior or an xor?

“Use the Force, Luke!”

Or in this case, study the circuit.

It contains a switch that determines if one power source is present, and switches the other out.

Paul__B: It contains a switch that determines if one power source is present, and switches the other out.

Ok .. which one does it shut off? Does it shut the other one off soon as i plug one in? Or is one more of master and will always shut the other one off???

I would have thought that the USB interface would always only be powered from USB power and that if there is no USB power, it has no function, but that may not be the case.

If power (greater than 6.6V) is supplied to the Vin, it uses that to supply the 5V on the terminals and disconnects the USB supply.

The circuit is admittedly, a trifle indistinct. I might also add that if you provide 5V to the "5V" pin (or IOREF as it happens) instead of a higher supply to Vin, it will remain connected to the USB 5V line. As long as it is in fact, 5V, this should cause no actual harm; the polyfuse will limit current flow.

Sorry for the necromancy, but I thougth this was a better option than starting yet another thread on this.
I have and Arduino Leonardo¹ that controls a LEGO robot crane arm I built.

I need sufficient power for the LEGO motors. It’s not that much power actually, but more than the Arduino can supply.
I power the arduino trough an exteral adapter rated 12V 1.5A. The crane runs a demo program at the moment, and will operate with a limited AI once I can get the LEGO light sensor installed in a way that works with the rotating claw.

I want to be able to read data from, and write instructions to the Arduino using the USB interface (virtual serial interface).

However when I connected both external power supply and USB, I started to smell the characteristic smell of a frying PCB, and I quickly disconnected the power, before anything was permanently damaged.

Is there a safe way to connect an Arduino Leonardo to a USB interface without frying the board?

I doubt my laptop is connected to ground, since the anodised aluminium parts feel slightly electrified, and there are capacitive touch buttons above the keyboard.

The arduino is definitely not connected to ground, since the adapter has a non-grounded plug.

I am a software engineer that recently started dabbling in electrical engineering, so I am limited in my understanding of these things, and I thought it would be safer to ask, than to risk fry the board.

¹ Actually it is a BE² Board³
² Borderless Electronics (borderlesselectronics.org)
³ Which is built from the same Open Source hardware specification as the Arduino Leonardo, to ensure the specifications are identical.

On my Uno, I can connect both the external power source and USB, and the board will select the input with the higher voltage as the power source. I assume, an official Leonardo would do the same thing, but you will need to delve into the datasheets of your work-alike to make sure it does that. Also, be sure you plugged your 12v power supply into the correct side of the voltage regulator. These microprocessors don't like 12v running through them.

Finally, 12v is getting up to the high end of recommended voltage on the Arduino. You might want to use a multimeter to verify that your power source is 12 volts.

However, it strikes me that maybe you don't know the way to wire up external motors. Basically you connect the grounds of the motor's power source to the ground of the Arduino, and then wire the the power source to the power pin of the motor, but connect the control pin of the Arduino work alike to the microprocessor. Here is a tutorial: http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html

If your Leonardo work alike takes standard shields, you can get several shields that simplify this by having an external power connection, and breaking out the pins into rows with ground, signal, and external power.

Ghostbird: I need sufficient power for the LEGO motors. It's not that much power actually, but more than the Arduino can supply.

It's actually vastly more than the Arduino can supply.

I'm going with Michael - the problem is not a matter of connecting two supplies to the Arduino, it would be a matter of connecting something wrong. Without more visual information, I cannot suggest exactly what.

I will not explain the full details of my project set-up here. Since I did so twice, and both times my work was gone. After the first time I did not understand why, but after the second time I realised that the Arduino Forum login time-out is too short to write it down.

@Paul_B: Of course the LEGO motors do not draw their current from the Arduino, merely from the same power supply.

@MichaelMeissner: My power supply delivers no higher than 12.3V unloaded, and no lower than 12V under the maximum load my project puts on it.

I could in the end, after studying the circuitry, my laptop, and the net supply, not find any reason why connecting both USB and external power should damage the Arduino. I tried again, and nothing bad happened. I guess I must've been to cautious the first time I connected the Arduino, and imagined that something smelled of fried electronics, or I had something else set-up wrong, and that started to overheat. This time I made sure to use a board that was disconnected of everything else.

MichaelMeissner: On my Uno, I can connect both the external power source and USB, and the board will select the input with the higher voltage as the power source. I assume, an official Leonardo would do the same thing, but you will need to delve into the datasheets of your work-alike to make sure it does that. Also, be sure you plugged your 12v power supply into the correct side of the voltage regulator. These microprocessors don't like 12v running through them.

Then you don't own a standard Uno. The auto-voltage switching circuit will always select the external voltage source (if it's within valid voltage range) and switch off the USB voltage, even if the USB voltage is higher (USB spec is like 4.75 to 5.25) then the output voltage of the on-board +5vdc voltage regulator. It does not make it's voltage switch decision on the difference between the two +5vdc voltage sources, just the presence of valid Vin voltage.

Lefty

As I mentioned before. I own a Leonardo, and as I said in my previous post, it does work as you say here. I must've been mistaken the first time. And of course I had studied the data sheets, when the data sheets said it should be possible and I thought I had witnessed evidence to the contrary, only then did I ask here. In the end it turned out that repetition of the experiment showed that it did work, and my previously witnessed evidence must've either been a mistake, or the result of some wrong wire-up in that set-up.

You can use the USB power for maximum 250mA of current usage. You may hack your uno board by disconnecting the USB<–>5V PIN from your board but make sure that the GND pin is as usually connected USB<–>PCB, after doing that you have can use both the USB & EXTERNAL PSU. But you will not be able to power up the board from USB power source.
Try to use another power supply for your motor driver circuit but make sure the ground pins must be connected to arduino board.

retrolefty: Then you don't own a standard Uno. The auto-voltage switching circuit will always select the external voltage source (if it's within valid voltage range) and switch off the USB voltage, even if the USB voltage is higher (USB spec is like 4.75 to 5.25) then the output voltage of the on-board +5vdc voltage regulator. It does not make it's voltage switch decision on the difference between the two +5vdc voltage sources, just the presence of valid Vin voltage.

Lefty

Is that a standard behaviour of the regulator? Or have you got a circuit diagram with some extended logic?

The circuit for an Uno shows a p-channel MOSFET (PMOS) between VIN and +5V:
UNO_R3_USB2VIN.png

It looks like the PMOS will turn off when VIN goes over about 6.6V (CMP is half of VIN). The PMOS also has a body diode but as long as 5V is output from the +5V regulator it should not conduct.
Uno_R3_PlugTo+5V.png

It seems a little risky when VIN is less than 6.6V, I don’t think all USB devices can handle the back drive that could happen (e.g. the supply I power my Raspberry Pi and its USB ports would cause the 1117 regulator to smoke or go into current limit).

to run a 2 stepper motors, can i use Vin and ground pin or i should use 5volt and ground pin only for logic supply?