Hi all, I'm having an issue with an APA102 strip,

Hi all,

I’m having an issue with an APA102 strip, and would be very grateful for any help.

I have set all the LEDs to ‘Grey’, displaying them with FastLED.show() once all colours are set, however all the LEDs except the first glow the same colour.
When using .show() after setting each LED, all the LEDs except the first become more yellow as more LEDs light up.

I am using FastLED version 3.001.003, and I am controlling and powering the strip with an Arduino Mega2560.
Code is here: https://gist.github.com/z-0/3284e1ae04ce94eb43b1252ecb0412d9

The colour in the photo is not quite right as the camera I used does not accurately capture colour, but you can see what the issue is.

Many thanks!

Have you tried slowing the data speed down. I think that the default speed is 12Mhz for APA102s. Try 8, 6 or even 4. If this works but the LEDs are too slow then look at the quality and shielding of your data wiring.

It may also be worth trying declaring then as SK9822s as many vendors use these instead.

A level shifter may help, but you don’t normally need them with these LEDs.

And your first led may just be faulty!

@Jeremy_Spencer Thanks for the response. Unfortunately setting the data speed to any of those values does not fix the issue, nor does declaring them as SK9822s, even in combination with the data speed change.

Update: the first LED works correctly when the strip is powered from both ends. The colour changing issue is lessened as the overall brightness of the strip is decreased with FastLED.setBrightness.

Tried measuring the voltage at different points of the strip, if possible? Sounds like they might be under powered. What are you using for a power supply?

@Jason_Coon I’m powering them straight from the arduino which is USB powered. Reading around suggests that this is the wrong thing to do! When running at low brightness there are no issues.

Yeah, be careful, you can’t pull much current from the 5V pin on an Arduino without damaging it. You can pull a little more from the VIN pin, depending on your USB power supply. PCs can’t supply more than 1 or 2 amps, usually lower. 60 LEDs can pull 3.6A (60mA each) at full brightness white.

@Jason_Coon Thank you for your help. I’ll look into properly supplying power.

You should be able to use a 5V 4A power supply to power both the strip and the Arduino (connect to the VIN and GND pins). Use a large capacitor to protect your components from current inrush. Be careful not to connect both power and USB, as this can feed current back to and damage your PC USB port. Read this, if you haven’t already: https://learn.adafruit.com/adafruit-neopixel-uberguide/power

Or just keep the brightness down and keep using USB and VIN power. :slight_smile:

@Jason_Coon thanks again!

@Zac_Rubin And remember, if you power the controller and the LEDs with separate power supplies, you must connect the LEDs ground and the controller ground together (otherwise your LEDs will randomly blink).