APA102 Wiring with External Power

Hi,

Long time lurker, finally come across a problem that I’ve been tearing my hair out trying to fix and can’t find a solution - mainly because I think I’m doing everything the way I should so have drawn a blank. Apologies in advance for the slightly shoddy diagrams.

Basically, I’m trying to power a long strip (up to 720) of APA102 LEDs from an Arduino. I’m using the FastLED library but the problem occurs with other libraries too.

Have tried with an Uno and Leonardo, over USB and Barrel Jack power, both behave the same.

Firstly, a setup that works as expected - no issues at all with this, other than obviously I can’t drive the whole strip with just the Arduino 5v Pin:
(Diagram 1)

Next up, I gave this a go but, predictably this didn’t work as no common ground:
(Diagram 2)

Most tutorials suggest something along these lines. This is where I’m really stumped. Am I missing something really obvious here?:
(Diagram 3)

And finally, I tried this after seeing a suggestion on a forum (I can’t for the life of me find the link). The Arduinos both die the second I join the grounds. As soon as I disconnect, it comes back to life. But no LEDs light up.
(Diagram 4)

To clarify, only with layout 1 do any LEDs on the strip light up, and then they do exactly as expected, animating etc. as per the code examples.

Option 3 seems to be the ‘right’ way to do it, but no LEDs.

I’m hoping that I’m just missing something simple - any suggestions of things to try would be very much appreciated - thanks!

Matt

(Other info in case useful)
Using Arduino IDE 18.3.13 on MacOS

Images added as attachments, as when I preview the embedded ones don’t seem to show.

This code works in option 1:

#include <FastLED.h>
#define NUM_LEDS 1
CRGB leds[NUM_LEDS];

void setup() { 
  FastLED.addLeds<APA102, RGB>(leds, NUM_LEDS);  // BGR ordering is typical
}

void loop() { 
  leds[0] = CRGB::Red;
  FastLED.show();
  delay(500);
  leds[0] = CRGB::Black;
  FastLED.show();
  delay(500);
}

Too little power. Too little memory.

If you are a "long time lurker" you must have seen these problems explained multiple times. Why did you mistake the same mistakes yourself?

I’m not sure I follow - I can drive the strip directly from the Arduino 5v pin without issues - I just need to draw more current than can be provided.

When I connect the LED strip VCC to a 5v 4A supply, and the strip GND to the supply (and then connect that to a GND pin on the Arduino), as in diagram 3, nothing happens with the exact same code.

So it works with the amount of memory and power the Arduino can provide directly. By increasing the power available, it stops working at all.

I’ve tried with multiple power supplies and can confirm there is voltage across VCC/GND on the strip.

Thanks
Matt

When I connect the LED strip VCC to a 5v 4A supply

You did not mention this in your original post. You mentioned only USB power and power via barrel socket, neither of which can provide more than a small fraction of the power needed by a 720 led strip. Your 4A PSU is also completely inadequate. You will need over 40A!

Even if every led is off, a 720 led strip will draw ~1mA per led, so more than USB can provide and close to or on the limit of what can be provided via the barrel socket.

In terms of memory, 720 LEDs will require 2.1KB just for the strip data. More than Uno has. Leonardo has 2.5KB, but with memory overheads and other requirements of your sketch, unlikely to fit.

Sorry that wasn't clear.

But I think the point still stands - if I plug all 4 wires from the Strip into the Arduino, I can make the 1st LED blink with the code in my original post. If I apply external power to the strip, and join the GND on the Arduino to the GND on the strip, removing the connection from the Arduino 5v Pin to the strip, and all other things being equal, I can't make the 1st LED blink.

Re power - my intention is to cut the strip into shorter lengths and apply power every metre or so from separate power supplies, with GNDs in common, but VCC isolated just to each individual strip.

And thanks for the info re Data - I've found a Mega I can use - will that provide sufficient memory?

Thanks
Matt


Insufficient power.

No common ground.

This should work. Try ~0.5K on data and clock lines, close to start of strip. Also large cap e.g. 1000uF across power lines close to strip.

Should also work.

I've tried with multiple power supplies

Identical supplies? Maybe they all put out too much ripple/noise on the power lines and this is preventing the LEDs reading the data signals.

I've found a Mega I can use - will that provide sufficient memory?

Yes. A bit overkill in terms of size/pin count! If you want something small & cheap, would recommend Wemos mini. Has WiFi, useful for remote control of the LEDs, but don't have to use it. But like most modern boards, it's digital outputs are 3.3V so will need to boost 2 to 5V to drive the strip. Don't use level shifters sold on eBay etc for i2c level conversion, they are not fast enough. Use 74hc14 or 74hct14.

I found the problem...

Reversed polarity on the power supply. I've used these exact supplies previously and swear the marked/striped wire was positive, and that seems to be the convention from what I can see. I even checked with a multimeter but clearly read it incorrectly.

So, back in business. Thanks for your suggestions and the info about the data. I've got some capacitors on the way and will look into the Wemos mini.

D'oh!