Power consumption

I am using an Ardunio Uno and Xbee Series connected to a breadboard with 10 led's.

How would one go about calculating the power consumption of the device? Is there a way to calculate this?

I intend on powering this all through a 5V battery connected to the 2.1mm power jack.

Thanks.

You just add up the currents. You know what an led takes because you design the resistor value. The Xbee consumption will be in the data sheet and the arduino is about 30mA.

OK sorry, How do I correctly design my resistor value for the leds?

No need to apologize.

How much current do you wish to flow in the LEDs? If more than 20mA per LED, or if they add up to close to 200mA at a time, you'll need to use driver transistors.

What is the rated voltage drop across the LEDs you are using?

If no more than 20mA per LED and you never plan on having all 10 on at a time, use Ohm's Law and the difference between Vcc and the LED rated forward voltage to calculate the resistor value.

R = (Vcc - Vled)/I

I have some Green LEDs here that drop about 2V at 20mA. That would be:
R = (5V - 2V)/0.020A
R = 150 ohms

As for the Arduino power draw, it is greater than what just the microcontroller draws because of the support circuitry. I'm sure Grumpy_Mike is right about that, and as he says look to the Datasheet for the XBee module.

What 5V battery are you using? I don't know of any batteries putting out 5V. However, I have successfully powered a few Arduinos from 4 AA NiMH cells, which together add up to 5V fully charged and about 4.8V for most of the charge.

Feeding 5V to the barrel jack is not going to work. Recommended input voltage is 7-12V.

If you are going to power the arduino from a battery, you can use a boost (step-up/down) converter to supply 5V to the arduino. They are a bit more efficient than the voltage regulator on the arduino and can work with a supply voltage that is lower/higher than 5 V (depending on the type). That way the batteries will last a bit longer. I've had mine run off a set of 6 AA NiMH batteries for about four days (using the standard voltage regulator), using things like a servo (sparsely), lcd screen, a few sensors and a bluetooth module.
For some types of batteries a cut-off is recommended to prevent excessive drain.
Also, most arduino's will run fine on a supply voltage as low as 6 volts, but this depends on the regulator used, results may vary.

polymorph:
No need to apologize.

How much current do you wish to flow in the LEDs? If more than 20mA per LED, or if they add up to close to 200mA at a time, you'll need to use driver transistors.

What is the rated voltage drop across the LEDs you are using?

If no more than 20mA per LED and you never plan on having all 10 on at a time, use Ohm's Law and the difference between Vcc and the LED rated forward voltage to calculate the resistor value.

R = (Vcc - Vled)/I

I have some Green LEDs here that drop about 2V at 20mA. That would be:
R = (5V - 2V)/0.020A
R = 150 ohms

As for the Arduino power draw, it is greater than what just the microcontroller draws because of the support circuitry. I'm sure Grumpy_Mike is right about that, and as he says look to the Datasheet for the XBee module.

What 5V battery are you using? I don't know of any batteries putting out 5V. However, I have successfully powered a few Arduinos from 4 AA NiMH cells, which together add up to 5V fully charged and about 4.8V for most of the charge.

You can also refer back to the Arduino cookbook Chapter 7, it shows you how to design and choose the correct resistors for powering LEDs.

Thank you all for your advice.

Ok so I am using a 9V battery connected to the barrel jack and suing a 3.3V supply from the ardunio to the leds.

The led's are fairly standard so can I assume they have an operating voltage of approx 2V at 20mA.
This means that for 1 led, R = (3.3 -2V)/0.02 = 65 Ohms. So these are the resistor values I need for my leds. Thanks.

Even though I have 10 led's, I will only ever have a maximum of 3 led's on at the same time. So this means that my power consumption is for the device is:
Ardunio Current + Zigbee Current + Led Current x 3 = 30mA + 45mA(from Zigbee data sheet) + 60mA = 135mA total??

Does this sound correct? Is it then possible to calculate how long my 9V battery will last?

You can also refer back to the Arduino cookbook Chapter 7, it shows you how to design and choose the correct resistors for powering LEDs

.

Didn't see this. I will have a look at this thanks.

You can't assume anything, there is no such thing as a "standard LED". Different colors require different voltages.

The 3.3V output pins is only rated for 50mA on the Uno.

Is it then possible to calculate how long my 9V battery will last?

Only if you know the capacity of the battery.
This is quoted in mA per hour.
So with 135mA total and a 300mA hour battery that would last ( in simple theory ) 300 / 135 = 2.2 Hours.
In fact this is the absolute top and you are best to half the time.
And the capacity for 9V batteries very much depends on the type of battery.

Generally these 9V batteries are considered rubbish.

mAHr is normally rated at 10hr discharge times, and the number goes -way- down when you draw more than that. As Grumpy Mike says, 1/2 at best.

Do you have a multimeter? Hook up your ammeter between the power supply and the circuit and measure it directly. Watch it change as the LEDs go on and off, and as you transmit data and such.

So I've looked up the spec of the battery I'm using at its capacity is 550mAh.

So that means that the battery will last only 550/135 = 4.07 Hours max.

That's pretty abysmal? Is this a common problem and how do people overcome it? Just say for something like a walkie talkie? Unfortunately, I do need the Zigbee to be transmitting signals regularly.

Yes that is normal for those batteries , I said they were rubbish.
What life are you looking for?
Look at high power ones like AA, several aren needed to get up to the 7V minimum you need.

As Grumpy Mike said, 9V batteries are generally not good for much power. Four AA cells or six AAA cells take up just about the same volume, or a little more, and pack a lot more energy.

AA alkaline seem to pack about 2 to 2.5Ahr capacity. To tell the whole story, we need the energy in joules, so the voltage is needed, too.

Alkaline AA Voltage 1.6-1.1V 2.5Ahr
Alkaline 9V Voltage 9-6.6V 550mAhr (agrees with what I've read previously)
We'll inaccurately use the average voltage.

AA 1.35V x 2.5Ahr x 3600sec/hr = 12150 joules x 4 cells = 48.6kJ total
9V 7.8V x 550mAhr x 3600sec/hr = 15.444kJ total

So... over 3x the energy capacity. But that's not the whole story. Using the internal linear regulator, you need 7V minimum to get 5V for the Arduino. So we must redo our calculations again, but with six AA cells and a minimum of 7V for both batteries. However, we must also take into account losses in the linear regulator. In this case, it makes calculations much simpler, but it will be inaccurate because we can't use the entire energy capacity of the batteries, but only down to 7V. So let's chop off 15% of the Ahr ratings and ignore the losses by only considering the energy available as 5V after the regulator.

2500mAhr x 0.85 = 2125mAhr x 5V x 3600sec/hr = 38.25kJ
550mAhr x 0.85 = 468mAhr x 5V x 3600sec/hr = 8.4kJ

A significant difference in capacities.

There are many things you can do to reduce power consumption. If this will be on all the time, a SMPS chip such as the MC34063 can accept down to 5.4V to output 5V (one schottky diode drop) and be much more efficient than a linear regulator when the battery voltage is higher. A linear regulator is wasting nearly 50% of the power when the batteries are fresh.

You might consider using one of the Arduinos that does not have a built-in USB port. That chip consumes a fair amount of power. The Power LED on an Arduino board is also using up power.

Can the ZigBee that you are using be shut down when not required? That could save you some power.

If this isn't on all the time, you could use some of the tricks to putting the Arduino in Sleep mode.

Figure out just how bright the LEDs need to be, and design for the lowest permissible current. Power them directly from the Arduino's 5V supply. Using the 3.3V supply saves you nothing, as it is just another linear regulator and isn't capable of more than 50mA.