Power problems

Hello all!
I have been at work on my new project for some time now. Today I have
been testing it and I came across some power problems. It seems that
my MEGA 1280 will only work when it is powered by the USB cable from
my computer. I had exactly the same problem with the 'tiny LED cube'
(http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293830865/)
I built earlier.

When I plug the project in, it works for a few seconds, before adding in
some random functions that were not written anywhere in the code, then
just stopping working all together. Whenever it adds in some random,
un-specified actions, it stops quickly and flashes the LED 'L'. When it stops
working all together, it flashes the LED 'L' fairly fast.

This has done a good job of confusing me, however, it seems fairly obvious
that it uses LED 'L' as some kind of warning. Any help is much appreciated.

Thanks, Onions.

The L LED is connected to Pin 13 of the ATmega. There is nothing special about it, it is not really any kind of warning light. When the processor is reset, the Bootloader will flash it a couple of times before executing what program is stored on it. The flashing you see could be nothing more than the microprocessor going through a serious of resets (very quickly.)

There are a number of things that can cause the microprocessor to reset.

You said when you are connected to USB it works. You didn't say what the alternative power source is. What is its regulated voltage and how much current is it capable of supplying?

On the LED matrix I didn't see any current limiting resistors. Running LEDs without current limit resistors will damage the ATmega's IO pins and will likely cause excessive current draw from the power source.

You didn't say what the alternative power source is. What is its regulated voltage and how much current is it capable of supplying?

The alternative power supply is a 12 volt battery pack thrown together from a 9 volt
clip and a 3XAA battery holder. I made it a while ago, so the batteries have lost charge
and it supplies 9.8V. There is no regultor with it.

I have just checked the current, it will supply me with only 0.1 millivolts. Somehow
this doesn't seem right...

I took some readings with my multimeter earlier on this afternoon. The LEDs I am
using took just 0.08mA each, when connected in series with my multimeter. This
seems stupidly low, but I am considering whether having the multimeter in the
circuit would have effected this.

On the LED matrix I didn't see any current limiting resistors

You are right there. As you said it dammages the IO pins, I am starting
to get worried...
:-/

I don't mean to hijack this thread, but I'm having a similar problem. I have my Arduino Duemilanove powered externally by the same 5V 2A supply that powers the rest of my project. My project only seems to work correctly when both the barrel jack is plugged in to the 5V power supply and the USB is plugged in to my computer.

My LEDs all have their current limited. A diagram is below. I would draw the rest of the project, but I'm fairly certain it's a power supply issue. Any ideas what I am doing wrong? Thanks.

@Onions,

  1. I'm making an assumption here about how you measured current. When you measure current with a Multimeter, the leads must be placed in series with the circuit you are measuring. Putting the leads across a component will not measure current (and will probably blow the fuse in your Multimeter.)

It takes a great amount of care to switch between measuring voltage and current. It is why most multimeters force you to move one of the test leads. (Current is measured in Series. Voltage is measured in Parallel.)

  1. As for your power, I said "regulated voltage" because I assumed you were using a wall-wart. If you are using batteries, you should measure the voltage while it is connected to your circuit. Measuring the no-load voltage of a battery is almost meaningless. (I say almost meaningless because if you are measuring no-load of 9.8V from a 12V battery it most certainly does not have enough energy left to do anything useful.)

  2. It sounds very likely the batteries you are using are unable to supply the current necessary to power your project. Your observation that adding any kind of code causes this behavior would fit. As soon as there is a (relatively) high amount of current draw the battery's voltage drops significantly causes the microprocessor to reset. You see L LED flash. The cycle repeats.

  3. Again, if you aren't using current limiting resistors you need to. :slight_smile:

@AlexXx

My project only seems to work correctly when both the barrel jack is plugged in to the 5V power supply and the USB is plugged in to my computer.

The barrel jack is connected to the on-board 5V regulator. All of the Arduino's documentation clearly states that inputs to the barrel jack or Vin need to be at least 7V (ideally 7.5-12V).

Since you have a regulated power supply, you would connect directly to the 5V pin.

Thanks!
I do have a variable (wall) power supply, so I should try using that. I will
go out and buy some limiting resistors soon. I was considering putting some 330[ch937] resistors in, but, when I saw the test LED did not break without
one, I decided against it to save money. I will remember in the future! :slight_smile:

To measure the current draw of the LED, I connected the positive lead to
a pin, set the pin to high, then connected the multimeter from the LED -
to the arduino ground, hence in series.

I found the battery load test very interesting though, so thankyou. :slight_smile:
I found your reply very informative, so thankyou again!

I have just done a very quick test with my power supply and it works
a treat! Thankyou very much for all your help, and buying those
resistors is something I will (almost) definately do tomorrow, if not,
at the weekend.
:slight_smile:

Thanks James. That documentation has always confused me, but I think I understand it now. So, I need to connect my 5V supply to the 5V pin on the Arduino, and I need to connect the Arduino's ground pin to the ground on my supply, correct?

Since the Duemilanove automatically selects the power supply, will I still be able to communicate through serial over USB?

Thanks again. Those power pins have always given me trouble, but I think I'm finally starting to catch on.

So, I need to connect my 5V supply to the 5V pin on the Arduino, and I need to connect the Arduino's ground pin to the ground on my supply, correct?

Yes.

Since the Duemilanove automatically selects the power supply, will I still be able to communicate through serial over USB?

The autoselect only works between two nodes: 5V and Vin. Remember that Vin is the same node as the Barrel connector. Unless there is at least 7V on the Vin node, the auto-select circuit will not select the external supply. It will select the 5V node.

To be safe, when connected to USB you should disconnect your external 5V supply. USB isn't always exactly 5V (the spec allows some variance.) Your power supply probably isn't always exactly 5V either. So if the two are connected at the same time, there will be some voltage drop that needs to drop somewhere between them.

Oh my mistake. My project will draw more than 500ma when it is completed which is why I am using an external supply rather than USB. Perhaps I need to find a different way of sending serial data then. :confused:

Thanks for the clarification though, this is very useful information.

I chopped up a USB cable and spliced in a line from my external power supply. That seemed to solve my problem. I can now send serial data via USB along with over 500ma of current.

http://www.extremecircuits.net/2010/03/usb-power-injector-for-external-hard.html

I've made one... works nice.