Help! RGB LED strips with Arduino

Hi there,

Any advice I could get would be most appreciated! I am a total noob with coding and electronics. For my first project I am hoping to control some LED strips with an Arduino Uno. I can't work out whether my issue is with the coding or wiring.

I have purchased WS2818B LED Strips (30 LEDs per meter). The pads are 5V, DI/DO, and GND. Very similar to this: Pololu - Addressable RGB 60-LED Strip, 5V, 2m (WS2812B)

I am running an Arduino Uno.

I have wired up according to the attached picture. Basically, I have plugged a USB cable into an iPhone adapter, which is then plugged into the mains. I have stripped the other end of the cable, and have attached the ground and power wires to a terminal block. The other end of the terminal block is attached to the auxiliary power cables for my LEDs.

The code is copied below.

I have managed to get one LED to light up green, and three others to light up blue (both solid). However, when I unplugged this arrangement and plugged it in again, the LEDs did not light up again.

I am not sure whether this is a problem with wiring, or code, or both.

Any advice would be most appreciated!

Thanks,

Marty

// color swirl! connect an RGB LED to the PWM pins as indicated
// in the #defines
// public domain, enjoy!
 
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
 
#define FADESPEED 5     // make this higher to slow down
 
void setup() {
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
}
 
 
void loop() {
  int r, g, b;
 
  // fade from blue to violet
  for (r = 0; r < 256; r++) { 
    analogWrite(REDPIN, r);
    delay(2);
  } 
  // fade from violet to red
  for (b = 255; b > 0; b--) { 
    analogWrite(BLUEPIN, b);
    delay(1);
  } 
  // fade from red to yellow
  for (g = 0; g < 256; g++) { 
    analogWrite(GREENPIN, g);
    delay(FADESPEED);
  } 
  // fade from yellow to green
  for (r = 255; r > 0; r--) { 
    analogWrite(REDPIN, r);
    delay(FADESPEED);
  } 
  // fade from green to teal
  for (b = 0; b < 256; b++) { 
    analogWrite(BLUEPIN, b);
    delay(FADESPEED);
  } 
  // fade from teal to blue
  for (g = 255; g > 0; g--) { 
    analogWrite(GREENPIN, g);
    delay(FADESPEED);
  } 
}

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Ok, thanks.

WS2818B

You sure if that? Is ith not a WS2812b? It was in that link.

If so that code is totally wrong, as is probably your wiring but without a schematic we can't tell how you have wired it up.

The code is for led strips with power and three inputs, and that code is meant to drive a transitor or FET on each output and is not suited to direct connection between the Arduino and the strip.

Thanks Grumpy_Mike.

I'll knock up a sketch and repost.

Appreciate the help