Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Could I connect a device that requires minimum 5V 1A from the 5V Pin to the Ground and somehow turn it off inside a sketch?

edit: I'm using a Due based boad, the digix http://digistump.com/wiki/digix/tutorials/basics

share|improve this question
1  
Provided you do not need to switch the load many times a second, your simplest solution to a task like this will be a shield with either magnetic or solid state relays on it - while transistor/FET solutions can be engineered to work, relays dramatically lessen the chance of the load coupling noise or damaging voltage spikes back into the Arduino. –  Chris Stratton May 8 at 14:54

4 Answers 4

up vote 5 down vote accepted

You would use a transistor. Something like this would work.

In this case the Arduino controls a transistor to drive a brushless motor.

Source: Arduino Cookbook: (https://www.inkling.com/read/arduino-cookbook-michael-margolis-2nd/chapter-8/figure-8-9)

Update: For the sake of clarity I should point out that the TIP102 is the device to use for the 1A required (not the 2N2222). And as pointed out by others the 5V supply of most Arduino boards would not be sufficient to supply 1A, so an external supply would be advised.

enter image description here

share|improve this answer
    
Thanks for this. Theres no reason why the motor power source and ground couldn't be 5v and gnd respectively, right? –  user2757902 May 8 at 14:43
1  
The 2n2222 is nowhere near up to the job, especially not the plastic TO-92 cased PN2222 shown. And no, using the Arduino's 5v rail to power a high current external device is not a good idea. Use a common ground, but a distinct supply. –  Chris Stratton May 8 at 14:52

Short answer: NO. It would fry your Arduino.

Long answer:

The current of Arduino pins is very limited (40mA max on UNO).

If you need to draw 1A, then you need a transistor between the Arduino pin and your device.

In such case, what you would normally do is:

  • connect any Arduino logical pin to the transistor base (through a resistor),
  • plug your device between a 5V supply (capable of 1A current providing) and the transistor collector,
  • connect the transistor emitter to the Arduino GND pin (and connect that pin also to the 5V-1A supply)

Note that you don't need to use an analog pin for that, a logical pin is enough if you just want to switch the device on or off.

Now notice that I specified a 5V 1A supply, that should normally be distinct from the 5V pin of the Arduino.

So the next question is: can you draw 1A out of the Arduino 5V pin?

The Arduino UNO page does not specify the current limitation on that pin. However it mentions the following:

5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V).

So the max current on this pin depends on 2 factors:

  • what is the power supply for the board: it is either USB, or an external power supply, which can be connected to the power plug or to the Vin pin.
  • the specs of the 5V regulator voltage on the Arduino board

If you use USB as power supply, then you are limited to 500mA as stated in the Arduino UNO page:

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

If you use an external power supply that provides at least 1A, then we have to find out the max current by ourselves.

If we take a look at Arduino UNO schematics, then we see that this regulator is referenced as "NCP1117ST50T3G" (this is "U1" on the top-right corner).

The spec sheet for this regulator mentions that it can supply 1.0A.

So in theory, that should work, however, you also have to consider that this regulator also supplies current to the Arduino borard itself and all its pins.

If you love your Arduino and don't want to fry it, you should probably stay away from using its 5V pin for your purposes.

Now if you're open to experiment, you may try it :-)

share|improve this answer
    
What if I used the 5V pin and the ground and put a transistor between them and attached that to a analog line? –  user2757902 May 8 at 10:31
    
According to what I understood from the question (load wired between 5V and ground board pins), the limiting factor will be the voltage regulator, and not the ATmega MCU. The 40mA absolute maximum current applies only to the MCU, which in my opinion is not the case. See my answer for more details. –  Ricardo May 8 at 12:57

The simpler solution is to power Arduino from some external supply, then fork that power through a relay to controlled device.

Then you can switch the device by controlling that relay through your digital pin.

share|improve this answer
1  
A standard magnetic relay cannot be driven by an Arduino Digital pin because of current requirement and inductive kick-back from the relay coil. –  akellyirl May 9 at 8:37

Have you try using a digital potentiometer name AD5220, it let you adjust the resistance with using your hand. You can find more info about it at www.analog.com. I would upload an image of the schematic but i just don't know how.

share|improve this answer
    
A digital potentiometer doesn't particularly sound like a solution for this problem. –  Chris Stratton May 8 at 22:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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