trouble powering a string of APA102 leds

Hi all! I have a string of 500 APA102 LEDs that I'm using for a project, but I only have to illuminate 10 at a time. I'm running them off of a Mega 2560 because of the memory requirements for the lights. Here is my problem. If I power the board via USB and my laptop, attaching the LEDs to +5V and GRD, they all light up correctly, as per the code. If I use an external power source (regulated voltage, of course) then all hell breaks loose. I've tried a 5V and 12V DC power supply. Here's what happens.

  1. If I power the board via USB but attach the LEDs to a regulated 5V 2A power supply (the lights are supposed to be given 5V) the lights go haywire, lighting up randomly.

  2. If I power the board using a 5V 2A power supply with the LEDs attached to +5V, the LEDs do not illuminate and the board goes dark.

  3. If I power the board using a 12V 2A power supply with the LEDs attached to +5V, the LEDs momentarily blink on, light up randomly, and then shut off. The voltage regulator on the Ardunio becomes burning hot.

I checked the current draw when powering everything off of USB, and its under 400 mA. I read that I shouldn't draw more than 200 mA off of any single +5V pin on my board, so am I right than in situation 3, I'm just drawing too much current and that's why the voltage regulator burns up? Also, the Mega should be powered by 7-12 V, so using a 5V external supply isn't enough, hence the board going dark in situation 2.

Two things have me perplexed.

  1. Why can I run the whole thing off the USB (i.e. it seems to be OK pushing 400 mA through one single +5V terminal, but I can't run it off my 12V supply? Does USB power skip the voltage regulator?

  2. Why would I be able to run everything perfectly off the USB, but then when I try to power the LEDs directly off a 5V power supply (but keep the arduino powered via USB), the lights all start misbehaving?

Thanks so much!

-ben

datasheet for APA102?

USB power only goes thru 500mA PTC fuse, not thru any regulator.

5V supply - you connected to 5V/Gnd on the power header?
If you tried bringing it thru barrel jack, you would lose voltage coming out of the regulator, and the Mega could act up.

If you power from 12V, the regulator has to dissipate (12V - 0.7V (diode) - 5V) x 0.4A = 2.52W, and its not sufficiently heatsinked for that.

The Mega can control up to 800mA across its IO pins, the current needs to be spread across the ports per the notes under Table 30.1 in the datasheet:

  1. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega640/1280/2560:

1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200 mA.

2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.

3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200 mA.

4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100 mA.

5.)The sum of all IOL, for ports F0-F7, K0-K7 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.

  1. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
    ATmega640/1280/2560:
    1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200 mA.
    2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.
    3)The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200 mA.
    4)The sum of all IOH, for ports E0-E7, G5 should not exceed 100 mA.
    5)The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100 mA.
    If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

Found it:

Looks sort of like a WS2812B but with clock/data so SPI could be used to drive it.

CrossRoads,

Thanks! Let me try to chew through all of that to make sure I understand.

  1. If I power the board via USB then I can draw up to 500 mA without throwing a fuse. But, is it wise to draw 400 mA continuously off the +5V or VCC pin in this situation? Or is it preferable to find a dedicated power source for the LED lights.

  2. If I used a 7V power supply through the barrel jack, the power dissipated by the voltage regulator would be much less. But still, it seems like a bad idea to try to continuously run this much current through the +5V pin, no?

  3. I can run the ensemble just fine if all is powered via USB, but as I noted in my post, if I try to then power the LEDs with a dedicated 5V supply of its own, the string of lights starts going haywire. It seems that would suggest a problem with the power supply?

Thanks again!

-ben

Run the LEDs from the separate 5V 2A supply, make sure you common only the grounds, it should work
fine. If not then something is seriously wrong somewhere with either your supply or the USB power
source.

So could I use a 5-V power supply, connect two sets of wires to it, run one set to Vin and GRD on the arduino and the other to the LED string? Or is it better to power the arduino and the LEDs with separate supplies?