Powering Arduino Mega R3 with 5V

Thread Starter

dpetican

Joined Jan 13, 2016
38
My power supply board for this project has reverse diode protection. My master supply is 12V, but I don't want to apply that to Vin for reasons beyond my question, which is: I'm wondering can I still plug in the USB if I'm powering with 5V applied to the 5V pin? Thanks.
 

djsfantasi

Joined Apr 11, 2010
9,237
My power supply board for this project has reverse diode protection. My master supply is 12V, but I don't want to apply that to Vin for reasons beyond my question, which is: I'm wondering can I still plug in the USB if I'm powering with 5V applied to the 5V pin? Thanks.
The answer, you can't plugin USB if you're applying external power. You have to devise a method such that only one power source at a time is in use

What are you using USB for? In my project, USB was only used to upload new sketches. If you need
Serial communication - used for debugging -, use one of the three serial comms pins.

In my case, I used a simple switch to disable the external power supply when uploading.
 

Thread Starter

dpetican

Joined Jan 13, 2016
38
Ah I get it. In my case the 5V does not come from the external supply directly to the 5V pin. I'm using the mega prototyping board so I apply the 5V in to the power rail first. Then I go from there to other places including the 5V pin. So an inline switch to disconnect the 5V going into the 5V pin NOT the board would disconnect the mega but leave everything else powered.

What about parasitic power? If I power the system then disconnect the 5V going into the 5V pin, the mega may still try and draw power through the I/O pins connected to powered devices until I connect the USB cable. Is this a problem? Thanks.
 

Thread Starter

dpetican

Joined Jan 13, 2016
38
Ah I get it. In my case the 5V does not come from the external supply directly to the 5V pin. I'm using the mega prototyping board so I apply the 5V in to the power rail first. Then I go from there to other places including the 5V pin. So an inline switch to disconnect the 5V going into the 5V pin NOT the board would disconnect the mega but leave everything else powered.
That was not correct. The 5V pin *is* connected to the power rails on the prototyping board so they can get power from this pin. I will just shut off the main 12V supply before connecting the usb cable. Simple but it works. I should be okay because my additional load on the 5V supply won't be active when the system boots giving me time to load a new program. In fact what I could do is use the switch to stop execution of the program or put it into a maintenance mode so I can guarantee this.

I'm thinking of just creating a programming port instead. I will post that as a new question. Thanks for the help.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,237
My code checks an digital input pin. If the pin is 0, I halt the process. If the pin is 1, the program runs. A simple SPST switch is all that is need for additional hardware.
 
Top