5

I'm trying to find a way I can toggle the 5V pin to turn on/off. I want the voltage to pass to another wire at a certain point. It should be off and then when something happens, the 5V should turn on.

How can I do this?

2
  • 2
    This sounds like an X-Y problem. Can you give some background on why you want to turn off the 5V pin? There may be a better way to accomplish your goal.
    – BowlOfRed
    Dec 5, 2015 at 0:25
  • 1
    Can you provide a schematic which will illustrate your project better? Isn't the 5V pin hardwired to be "on" permanently.? You could add an external transistor to switch the circuit connected to the 5V pin, but I don't thin that you can switch the pin on the board itself. I might be wrong though. Jan 3, 2016 at 15:09

4 Answers 4

5

For energy-efficient switching (along with relatively high-current capability), I recommend using a Darlington transistor connected to one of the output pins (digital for on/off, analogue for variable). Then you would just call pinMode(A0, OUTPUT); followed by digitalWrite(A0, HIGH); Here is a sketch I made demonstrating what I mean: enter image description here

Note that a normal transistor would draw more current from the Arduino's pin, which could be bad for the Arduino, and which would waste energy.

2

There isn't programmatic control of the 5V pin, it is hard wired to the USB or the output of the Vin Voltage regulator.

You might try something from How can higher current devices (motors, solenoids, lights, etc.) be controlled by an Arduino? to control the low side of the external device. If you need high-side control, maybe an opto-isolator would be a good solution.

2

If I'm understanding you correctly, you want a 5 V output that is under programatic control. Do you know how much power you want to pull from the pin?

If the demand is fairly low, you could use one of the digital pins directly – they will supply about 40 mA on an "official" Arduino.

If you need more power, then you could use the pin to switch an external device such as a transistor or a relay.

1

You don't really want to do that. The 5V pin is on the power bus of your Arduino board. If it were possible to turn it off, the entire Arduino would shut down.

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