0
\$\begingroup\$

I'm planning to switch between two power sources DC and USB with an Arduino like below diagram.

What I'm going to do is cut off the DC V+ wire when I insert the USB jack to the Arduino for uploading the code and then returning to the DC power again when I remove the USB from the board.

Is there any problem with my diagram below?

By the way, the Arduino should be always powered.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Why do you need to do so? What is wrong if just using the external supply? The usual arduino boards have a diode connected in series with USB +5V line to prevent damaging the USB port in case of reverse voltage. If you are using an external supply, it won't hurt if you just attach the USB cable to program the arduino. \$\endgroup\$ – Long Pham Jan 1 at 7:42
  • \$\begingroup\$ I just afraid for just burning my laptop usb and also burning the arduino board, This is why i draw this diagram to insure everything is safe. \$\endgroup\$ – dKorey Jan 1 at 7:54
  • \$\begingroup\$ study the Arduino schematic diagram and then decide if the builtin switch is not suitable for your needs \$\endgroup\$ – jsotola Jan 1 at 8:49
  • 1
    \$\begingroup\$ Using a relay for this is a Really Bad Idea. When you unplug the USB connector, the inductance of the relay coil is going to create one heck of a nasty negative glitch directly on the +5V line to the Arduino. Putting a flyback diode across the coil will clamp the glitch to -0.7V, but it will still disrupt the operation of the CPU. Since you need to interrupt the application to reprogram the code anyway, why not just do the power switching manually? \$\endgroup\$ – Dave Tweed Jan 1 at 16:19
  • \$\begingroup\$ Thanks Dave, I Need this procedure to be done automatically without loosing power for arduino,Is there any solution for that?, I can use something like a flyback diode and a PNP transistor with the coil positive pin? \$\endgroup\$ – dKorey Jan 3 at 11:42
0
\$\begingroup\$

I have done something similar because of a charging module I placed in my design and the answer was to go with Power Path instead this was done with the LTC4412 powerpath controller and worked fine.

The big reason I had to go there was to be able to switch the connection between my batteries between series and parallel as I had to charge them in parallel and use them in series.

The LTC4412 is very small and with very few external components it is easy to accomplish the power path.

Here is a datasheet for the LTC4412.

Take a look at the FET specs. I had to go with a bigger one than the one they used in their application notes.

\$\endgroup\$
  • \$\begingroup\$ Thanks JRE, But Is that will work between 2 different Dc source voltage in my case (5v source & 9v source) ? \$\endgroup\$ – dKorey Jan 3 at 11:44
  • \$\begingroup\$ same here i was using a 9v power supply to charge and also used usb 5v and either power source gets switched with the batteries \$\endgroup\$ – Tjaart van aswegen Jan 3 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.