Programming arduino via USB with load connected to Vin

In my Arduino projects, I often use a 9V battery or adapter to power both the load and the Arduino itself (through Vin). When I program the Arduino via USB, I always disconnect or turn off the 9V power supply. I also disconnect the Vin pin, because I'm worried the Arduino might get destroyed by supplying 5V (from the USB) through the Vin pin to the load.
So, do you harm the Arduino by connecting it via usb for programming while there is a load connected to the Vin pin?

You won't do any harm leaving it connected. You can't supply a load from Vin, the 'in' is the clue, it is for supplying power TO the Arduino, you can't use it to supply something else.

[Edit]
Ignore that, see comments from @Paul_B and @Boffin

And "Vin" is basically useless due to the limitations of the on-board regulator. It is advised you do not use it at all. Provide 5 V to the "5V" or "Vcc" pin, using a switchmode "buck" regulator rated for your overall current requirement, if necessary.

There is no harm in powering via "Vin" when connecting to a PC via USB. The only warning is to disconnect the "5V" pin when connecting to a PC via USB if using a UNO, Mega 2560 or similar. No problem at all with the Nano which is in any case more practical for any project not using a "shield".

1 Like

To make my question more clear:

I meant that I power my Arduino via a, let's say 9V rail connected to Vin and also connected to my load. When I connect the usb for programming while the 9V supply is turned off, the load will still be connected to Vin. So, the load might pull a current out of the Vin pin, which is not it's purpose and might harm it, I think.

Yes, I understood that to be what you meant, my answer in reply #2 stands.

1 Like

It is the case that current will flow back through the regulator from the 5 V line to the "Vin" terminal (which does not have a series diode). This is why the concern about "hot" connecting a fully powered 5 V supply to the "5V" terminal potentially causing a pulse of current through the regulator to charge the "Vin" capacitor - not actually a problem as the said capacitor is relatively small (but could be significant if a larger external capacitor was connected to "Vin").

Whether this causes harm to the regulator in the situation described here, since the voltage will be less than 5 V, is another matter. My comment stands that you should not be using "Vin" in the first place and the concern should be devolved to a proper, external regulator. :roll_eyes:

2 Likes

The Arduino board (I mean Uno) is built in such a way that 9V is fed to the central pin of the barrel connector, and goes through the V1 diode to the Vin pin of the NCP1117 regulator. In this case, you can leave the 9V and the load on while connecting the USB.
If you are using Vin, then as @Paul_B pointed out, 5V from USB goes to Vin through the regulator's internal diode. This is about 4.4V. If the low impedance load remains connected to Vin, you could damage the regulator. This is a bad decision.

2 Likes

Not to be confused with a NCC1701! :sunglasses:

3 Likes

So that you don't get confused, there should be NCP1117ST50T3G :slight_smile:

1 Like

@Paul_B , @Boffin
Thank you both, you are, of course correct.

@jorne_b
Take note.

I prefer XL5..

Tom... :grinning: :+1: :coffee: :australia:

1 Like