All these power pins. In/Out/Vin etc.

I am a bit confused with what is going on with the power pins.

If I am using the Arduino (UNO) - for instance - it is connected to the USB port and I "talk" to it via the USB.
It gets power from the USB.

All is good.

When the project starts to get bigger, external power is needed to power it.
As the UNO has a 12v 2.1mm plug, that is pretty good too.

But then I run in to problems when I am talking to it with external power and without external power.

Again: In a perfect world, I wouldn't make these mistakes, but still: They happen and I don't get why.
Well, I kind of do, and want to find out the underlying problem.

Say it needs external power.
I have found that I MUST power it up via the external power first, before plugging in the USB.
If I do it the other way around, as soon as I connect the external power, it won't talk to the PC.

This is very annoying when I have the comms window open and I am checking signals and realise I haven't powered up the main supply.

If I do that WHILE the comms window is open, I need to reboot to get it talking again. (Ok, maybe newer IDEs have fixed that. I don't know.)

I have another project too and I keep forgetting to apply power to it. But this is an NANO and its power is a whole different ball game.

Where as the UNO has a built in regulator which can handle (say) up to 15v in and happily run the board; doing that on a NANO is fatal.

There is a 5V pin, and a V - In pin.
I connect 5v to the 5V pin and there is 5 volts on the V - In pin.

But if I am plugged into the PC USB and then supply the external power, it is like the UNO, and the comms port is useless.

You hear the USB removed / inserted sounds played, so I am guessing that when it sees the external power it "swaps" to that and then when it goes, if the USB power is there, it switches back to it.

All well and good. But why does it have to "disconnect" and "reconnect" the USB side of things?
Rebooting the PC from doing the mistake is annoying - and yes, I guess I should now know better. Alas that threshold hasn't been reached yet.

And I am curious to what is going on, and if there is a "work around"?

Thanks.

When you connect the USB to the computer, it will reset the Arduino so the pc can talk to the boot loader; this is regardless oft the power source. This is achieved by asserting the DTR signal; check the schematics for that.

I confirm some weird behaviour, with my Uno from the Starter Kit, and IDE 1.6.10.

The first connect to the PC works for me, regardless of the power source. I also can connect and disconnect the external power source while connected to the PC, without facing a problem.

But when now I disconnect the USB cable, keeping the Uno running from the external power supply, and connect again, the port may become unavailable - not always, but every now and then. Once the port is lost, it will stay unavailable. Resetting the Uno does not help then, it must be powered off and on to make the port available again. Rebooting the PC is not necessary, it's sufficient to power the Uno off and on.

After some more tries it looks like the Serial Monitor is the culprit. Disconnecting the USB cable while the Serial Monitor window is open, and receives data, and the Uno stays powered externally, the port becomes permanently unavailable. Can you confirm this observation?

For me, it is "unavailable" until a reboot.

(maybe both, but usually just the PC.)

Your use of "permanently" is worrying. do you mean that as in: For ever, and so the board is no longer usable, or "for that session"?

The Raspberry Pi is more tolerant than the M$ version.

Here “permanently” means until the Uno is powered down and up again. I didn’t reset my PC, but nothing else helps there, not restarting the IDE, nor plugging the USB cable out an in. The system plays the “device un/connected” sounds on plugging the cable in/out, but the IDE doesn’t list the COM port any more.

Thanks.

I shall have to keep a note of what you say too.

But I guess at the end of the day the lesson is to not change the Arduino’s power WHILE the pc is plugged in.