LED's not lighting up unless bridged

Im trying to use some basic code to get some LED’s working, however, I’m not having any luck.

The issue I’m having is the LED’s will only light up when I bridge all three pads on the strip with my finger (found out by accident); and then will only blink random colours.

#include <FastLED.h>
#define LED_PIN 3
#define NUM_LEDS 120

CRGB leds[NUM_LEDS];


void setup() {
  FastLED.addLeds<WS2812, LED_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 500);
  FastLED.clear();
  FastLED.show();
 
}

void loop() {
  // Turn lights from green to blue from left to right   R G B 
  for (int i=0; i<NUM_LEDS; i++){
    leds[i] = CRGB(0, 255 - 4*i, 4*i );
    FastLED.setBrightness(2*i);
    FastLED.show();
    delay(50);
  }
  // Turn lights from blue to magenta from right to left 
  for (int i=NUM_LEDS; i>0; i--){
    leds[i] = CRGB(4*i,0 , 255-4*i);
    FastLED.setBrightness(100-i);
    FastLED.show();
    delay(50);
  }
  
  
}

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code

What kind of Arduino are you using? Is it a 5V model or 3.3V?

Do you have a resistor in the data line? What value?

Do you have a capacitor across the power pins to the strip?

Is the strip powered from usb or a separate PSU, in which case is there a common ground between Arduino and PSU?

1 Like

What kind of Arduino are you using? Is it a 5V model or 3.3V?

Im using the Arduino Uno 5v

Do you have a resistor in the data line? What value?

No

Do you have a capacitor across the power pins to the strip?

No

Is the strip powered from usb or a separate PSU, in which case is there a common ground between Arduino and PSU?

Powered by separate PSU without common ground to Arduino

Ok, so put a resistor in the data line, ~0.5K, the exact value is not critical, and an electrolytic capacitor across the power connections to the strip, e.g. 1000uF (check polarity!). Ideally both these components should be near the start of the strip, especially if long wires are used.

1 Like

Alright, I’ll give it a try.

That sounds wrong

Oops, I mis-read that! Yes, that’s probably the problem. But add the other components I suggested anyway.

The only connection between the Uno and the LED is the data pin. Does this still need a common ground?

The Uno is powered by a separate PSU.

Yes. Otherwise the data stream has no common point of reference for its signal levels