Pages: [1] 2 3   Go Down
Author Topic: Arduino as a Simple Power Source  (Read 2968 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll be honest and say I can't remember why I thought of this, but is there a simple way to have the Arduino output power and nothing else?
I'll admit I have no specific reasons of wanting to do this, it's just something I thought of the other day and couldn't find it referenced anywhere.

Also, I am completely new to Arduino/electronics etc, but if this does work, the flow of how things work is (in the case of Arduino) 5v --> components on breadboard --> Ground, right?

Thanks for the help!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13739
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can be done but depends on the load the breadboard will use...  Too much and the Arduino can/will be damaged
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll be honest and say I can't remember why I thought of this, but is there a simple way to have the Arduino output power and nothing else?

Each pin on the processor is able to supply 20 ma * 5 volts = 0.1 watts of power.  To output that power on a pin requires two lines of code...

  pinMode( 7, OUTPUT );  // Turn pin 7 into an OUTPUT
  digitalWrite( 7, HIGH );  // +5V is now present on pin 7

Quote
Also, I am completely new to Arduino/electronics etc, but if this does work, the flow of how things work is (in the case of Arduino) 5v Pin --> components on breadboard --> Ground, right?

Right (with a minor clarification).  The keyword for that circuit is "source"; as in the pin "sources" five volts or "sources" 20 milliamperes.

It is also possible to wire...

Arduino Pin --> components on breadboard --> 5V

The keyword in this case is "sink"; as in the pin "sinks" five volts or "sinks" 20 milliamperes.  The logic is reversed.  This allows current to flow through the components...

  digitalWrite( 7, LOW );
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is also possible to wire...

Arduino Pin --> components on breadboard --> 5V

The keyword in this case is "sink"; as in the pin "sinks" five volts or "sinks" 20 milliamperes.  The logic is reversed.  This allows current to flow through the components...

  digitalWrite( 7, LOW );


Thanks for your reply, I was following everything up to the quoted text.  I'm not sure I understand what "sink" and "source" means.  If I were to follow the second example you provided, what would be the difference between that and the first example?

And while we are here, as stated I'm pretty new to this so following examples I have found online are all I've been able to do so far (though I did manage to get a 7 segment to count from 0 to 9). 
My (3rd?) question is this:  The way I understand resistors (in this case specifically with LEDs, though I'm sure it applies elsewhere) is that resistors should be between the source and the anode.  Is this always true (or am I completely wrong) in thinking this?  The reason I ask is that occasionally when looking at schematics and diagrams it appears that the resistors are placed between cathode and ground.
Logically that doesn't seem right, and I don't see it often, but I have seen it.
My guess is that the true answer is far more complicared than I'm ready for.  smiley

Thanks again!
Logged

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3487
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

According to the datasheet each pin of the controller can drive up to 40mA. The total DC current of VCC and GND must not exceed 200mA. Bear in mind that some pins already have some load attached to them though (Pins 13, 1, 0) and that this is the maximum rating.
Logged

Check out my experiments http://blog.blinkenlight.net

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My (3rd?) question is this:  The way I understand resistors (in this case specifically with LEDs, though I'm sure it applies elsewhere) is that resistors should be between the source and the anode.  Is this always true (or am I completely wrong) in thinking this?  The reason I ask is that occasionally when looking at schematics and diagrams it appears that the resistors are placed between cathode and ground.
Logically that doesn't seem right, and I don't see it often, but I have seen it.
My guess is that the true answer is far more complicared than I'm ready for.

Not complicated at all. In a series circuit, such as a LED wired to it's current limiting resistors, it doesn't matter which side of the led the resistor is wired to. The electrons have only one path to flow, so the current is the same value anywhere in that series string. It's one of Kirchhoff's laws which is a very useful subject to learn while studying electronics fundamentals.

http://www.tpub.com/doeelecscience/electricalscience260.htm

Lefty
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Lots of discussion about using the I/O pins for power.

There is nothing stopping you from just using the 5V pin on the Arduino to power your project.  If you are connected by USB then you are drawing power directly from your PC's USB port.  If you are using an external supply (>7V) then you are powering through the on-board regulator. 

In the case of an external supply it would be no different than if you used your own 7805.  Since the pin headers are convenient, I often use my Arduino as the 3.3v and 5.0v source for a circuit that isn't being connected to the Arduino's I/O.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27118
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"According to the datasheet each pin of the controller can drive up to 40mA."
That's not what it says.  When will folks stop perpetuating that?

Here's what the datasheet actually says:

Absolute Maximum Ratings*

DC Current per I/O Pin ............................................... 40.0 mA

*NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device.
This is a stress rating only and
functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not
implied
.

Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

Output Low Voltage(Note 3) except RESET pin with IOL = 20 mA, VCC = 5V:     0.9V
Output High Voltage(Note 4) except Reset pin with  IOH = -20 mA, VCC = 5V:  4.2V


Notes: 1. “Max” means the highest value where the pin is guaranteed to be read as low
2. “Min” means the lowest value where the pin is guaranteed to be read as high
3. Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48PA/88PA/168PA/328P:
1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.
3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.

4. Although each I/O port can source more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega48PA/88PA/168PA/328P:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150 mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150 mA.
If IIOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
greater than the listed test condition.


Thus 20mA should be consired the max current for guaranteed voltage levels and reliable long term operation.
« Last Edit: July 11, 2011, 06:29:14 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thus 20mA should be consired the max current for guaranteed voltage levels and reliable long term operation.
The notes quoted in the post above relate to footnotes 3 and 4 of the DC Characteristics table (29-1) of the datasheet .  That table provides the specs for the output voltage at the given test current (20ma). I interpret the notes to say that if you draw more than the test current then you will not achieve the voltage levels in the table. Do you think that means that loads above 20ma and below the absolute maximum rating of 40ma are not advisable  (assuming the changes in min and max output voltage levels are acceptable) ?
I think the following :
Quote
Functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not
implied.
is saying that you should not be drawing 40ma from pins totalling 200ma if running at the maximum operating temperature(+125 degrees C) 
I would be interested to see if Atmel has any documentation indicating that running maximum current for extended periods at temperatures well below the maximum operating temperature are a problem.

I am all for informing people to not abuse their chips, but 20ma seems unnecessarily cautious.


Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27118
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As an electrical engineer, I interpret the data sheet to say that if one sources more than 20mA with VCC=5V, the output will <=4.2V and likely decreasing, and if one sinks more than 20mA with VCC=5V the output will be >=0.9V and likely increasing.

Total current allowed is 300mA if spread across the ports correctly.
Sinking current:
1] The sum of all IOL, for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.
2] The sum of all IOL, for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.
3] The sum of all IOL, for ports D0 - D4, RESET should not exceed 100 mA.

Sourcing current:
1] The sum of all IOH, for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150 mA.
2] The sum of all IOH, for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150 mA.

There are 2 VCC, 2 GND pins each with absolute max of 200mA. The limit of 300 is well below the 400mA absolute max.

There is usually no need to sink/source that much current unless driving something like LEDs. Interfacing with other logic parts does not need that much current. If the LED specs are read, one can find that running them at high currents also shortens the brightness life of the LED (that is the rated mCD are no longer emitted).  So you have a lose-lose all around.
When I was designing circuits for a living, we always derated the capability of parts to ensure they could meet spec & timing requirements, and performed computer thermal analysis to ensure they stayed under the limits over their planned temperature extremes.

"Unnecessarily cautious", no, just making sure we didn't have boards fail prematurely.

If folks want to smoke their chips, their $5-6 loss is no skin off my nose.
If they want to make reliable projects that will stand the test of time, I'm willing to provide info that will help.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There are 2 VCC, 2 GND pins each with absolute max of 200mA. The limit of 300 is well below the 400mA absolute max.

So AVCC is the supply for the A/D Converter and for port C.  I've been through that thing dozens of times and never made that connection.  Man, you know how to read a datasheet!
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27118
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Like I said, Electrical Engineer  smiley-wink
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As an electrical engineer, I interpret the data sheet to say that if one sources more than 20mA with VCC=5V, the output will <=4.2V and likely decreasing, and if one sinks more than 20mA with VCC=5V the output will be >=0.9V and likely increasing.
yes, but you seem to be suggesting that more than 20ma could  "smoke the chip". I don't see anything in the datasheet that implies that 40ma at room temperature would be a problem.

I hope my replies here don't come across as argumentative, I know that your advice is based on sound manufacturing principles.

Being an electrical engineer myself I understand the importance of designing products that are well within the manufactures specifications.
But we are not talking about designing products here. Arduino is about tinkering. If a project needs to drive a couple of LEDs at 40ma then why not?
If there is any information from Atmel advising otherwise then it would be good to get that aired.  But I have never heard of anyone smoking a chip by drawing 40ma from an Arduino  pin, have you?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27118
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"If a project needs to drive a couple of LEDs at 40ma then why not?"

This is why not:
"Exposure to absolute maximum rating conditions for extended periods may affect device reliability."

We often see questions about "why doesn't my pin work anymore? I only connected an LED to it like this Instructable ..."
or "why doesn't the motor spin when I connect it to this pin..."
So, yeah, I have.

Anyway, off to bed, day job to go to to pay the tinkering bills ...
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 208
Posts: 12936
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I hope my replies here don't come across as argumentative

Your replies don't come across as argumentative to me.  I'd use the (non-)word "debative" to describe the tone.   smiley-grin

Quote
I know that your advice is based on sound manufacturing principles.

In my opinion, in some cases, it is necessary to put aside things like sound manufacturing principles and datasheets.  Someone very new to the Arduino (like the original poster) should initially be given "unnecessarily cautious" advice for at least two reasons: 1. Some folks simply may not be able to obtain a replacement board.  It's easy for those of us in First World countries to forget that things like an Arduino are sometimes very expensive for folks in less developed parts of the world.  I know I would feel bad if someone had taken my advice, smoked a board, and did not have the means to replace the board.  2. Some people come to Arduino already very intimidated.  Imagine how someone already uneasy would feel if they ruined a board.  They may set it aside never to return.

Without a doubt, "don't exceed 20 mA per pin" is well below what an AVR processor can tolerate but it provides a nice safety margin until the new user (@fritzcharleston) gets their "sea legs".

Quote
But we are not talking about designing products here. Arduino is about tinkering. If a project needs to drive a couple of LEDs at 40ma then why not?

For someone who understands the risks or who has the means to recover from a failure (like CrossRoads  smiley-wink), I absolutely agree.
Logged

Pages: [1] 2 3   Go Up
Jump to: