I just made an addressable RGB LED strip controller but im concerned about if I'm going to break the thing.

I know it sounds vague so let me elaborate: there is an external power supply connected to my 5V pin and the LED strips positive so it powers both the strip and Arduino, but I also have my Arduino connected to my PC at all times. So I'm concerned about IF my power supply is for some reason not connected the Arduino will supply power on its own.

Is there a way to prevent 5V pin from outputting 5V, so it only accepts 5V

EDIT: There are cases when the USB isn't connected so I need the 5V to be connected at all times, if its still vague then is there a way to only use data on USB and disregard the power?

  • If it's always connected to the PC why not just disconnect the 5V pin? – Majenko Sep 25 '16 at 14:26
  • @Majenko the current drwa is around 4 amps and i forgot to mention that its only connected when pc is on – TheKayneGame Sep 25 '16 at 14:40
  • So you want it to operate when the PC is off? – Majenko Sep 25 '16 at 14:42
  • @Majenko when its onn and off but when the pc is on the arduino will listen to the pc for commands – TheKayneGame Sep 25 '16 at 14:43
  • Sorry, you're not making any sense now. – Majenko Sep 25 '16 at 14:49

A simple diode is all you need. The USB power already goes through a diode, so another diode the same will create a "highest voltage wins" situation.

That is, if the voltage provided by the USB port is higher than the voltage you provide on the +5V pin (after the diode's forward voltage drop) then the USB port will power the nano. If the voltage on the +5V pin is higher (after the diode's voltage drop) than the USB then the voltage on the +5V pin will power the nano.

No power will flow out of the 5V pin to your LED strip because the diode is in the way.

Connect the 5V external power to the anode of the diode, and the 5V pin of the Arduino to the cathode of the diode. The cathode is generally the end of the diode with the stripe. Make sure the diode can pass enough current to power the Arduino when the USB is un-powered. The 1N4001 is a popular choice and very easy to get hold of.

That choice of diode also has a higher forward voltage drop than the on-board USB diode (0.7V as opposed to about 0.4V), so the USB will generally be chosen by default when connected and powered up, which is as it should be for a bus-powered device.

| improve this answer | |

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.