How to Control WS2811 Addressable LED Strips with Arduino

SuntechLite is a top manufacturer and supplier that focuses on pixel LED strips and LED neon lights.

In this guide, you’ll discover how to control WS2811 addressable LED strips with Arduino—even if you’re completely new to it. We’ll walk you through connecting and powering the components, uploading code using the Arduino IDE, and creating your own custom lighting effects.

1.Materials Required

Power Supply

12V
12V Power Supply
power supply 5V
5V Power Supply

In this setup, the 12V power supply drives the LED strip, offering a DC 12V output with up to 33A and 400W of power. The 5V power supply powers the Arduino, providing DC 5V output at a maximum of 40A and 400W. Both adapters support AC 200V–240V input, and the 12V model also accepts AC 100V–120V.

Arduino Board

suntechlite arduino 1 1
Arduino Pin Introduction

Arduino UNO R3 is based on the ATmega328P microcontroller and runs at 5V. In this setup, it’s powered directly through the 5V pin from the power supply. It has 14 digital I/O pins (6 with PWM) and 6 analog input pins. The board operates at 16 MHz and is programmed via a USB Type-B port. Here, Arduino acts as the controller for the WS2811 LED strip, sending control signals through digital pins to create various lighting effects. It’s simple and great for beginners.beginner friendly.

WS2811 LED Strip

DA1 12V WS2811
60LEDs/m WS2811 RGB LED Strip

The WS2811 RGB LED strip is a very common model of addressable LED strip. The model in the picture works at 12V DC. This strip has 60 RGB LEDs for each meter. Three LEDs form one pixel. So, there are 20 pixels per meter. The PCB width is 10mm. Each pixel can show any color. Data control uses a single-wire protocol. This strip is often used for decoration or creative projects.

Other Accessories

Wires: Connect the power supply, WS2811 strip, and Arduino.
Logic-Level Shifter (Optional): A 3.3V level shifter can protect the Arduino. 

 

2.Wiring Diagram

Arduino WS2811 wire diagram
How to Control WS2811 RGB LED Strip with Arduino Wiring Diagram

The diagram above shows how to connect the Arduino board, a WS2818 LED strip, and a Suntechlite LED power supply.

Please keep these points in mind:

  • The control board draws less than 500mA of current.
  • Never connect a power supply to the DC3.3V or 5V pin. These pins only output voltage. To power the board, use DC interface or VlN+GND to connect to VIN and GND.
  • The LED strip runs on 12V DC. The control board needs 3.3V to 9V DC. Power each device separately.
  • Wiring for addressable RGB strips, addressable RGBW strips, and addressable RGBWW strips is the same. Their control code isn’t the same and can‘t be shared.
  • Maximum pixel counts are: under 500 RGB, under 375 RGBW, and under 300 RGBWW. More pixels will lower the refresh rate.

3. Connection Diagram

How to Control WS2811 Addressable LED Strips with Arduino
How to Control WS2811 LED Strip with Arduino Suntechlite

How to wires:

  • Connect the Arduino Vin pin to the power supply’s positive terminal.
  • Connect Arduino GND to the power supply’s negative terminal.
  • Link the data pin you set in the code (for example, D7 or D8) to the DIN wire of the WS2811 LED strip.
  • Attach the LED strip’s positive wire to the 12V power supply’s positive terminal.
  • Connect both the GND near Arduino’s digital pins and the LED strip’s GND wire to the 12V power supply’s negative terminal..

4. Code Upload

Here is code examples for controlling a WS2811 LED strip with Arduino. It shows different lighting effects. If you have questions or need help, please contact us.

 

				
					#include

#define LED_PIN     19     // LED strip data pin
#define NUM_LEDS    80     // Number of LEDs
#define BRIGHTNESS  128    // Initial brightness (0-255)
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB    // Most WS2812 LEDs use GRB order

CRGB leds[NUM_LEDS];

// Effect mode enumeration
enum Effects {
  EFFECT_FLOW,     // Rainbow flow effect
  EFFECT_BLINK,    // Rainbow blink effect
  EFFECT_MARQUEE,  // Marquee effect
  EFFECT_COUNT
};

uint8_t currentEffect = EFFECT_FLOW;
unsigned long lastEffectChange = 0;
unsigned long lastUpdate = 0;

void setup() {
  delay(3000); // Startup safety delay
  FastLED.addLeds(leds, NUM_LEDS);
  FastLED.setBrightness(BRIGHTNESS);
  Serial.begin(115200);
}

// Rainbow flow effect
void flowEffect() {
  static uint8_t hue = 0;
  static uint8_t pos = 0;

  // Gradually fade out all LEDs
  fadeToBlackBy(leds, NUM_LEDS, 10);

  // Set a colored point at the current position
  leds[pos] = CHSV(hue, 255, 255);

  // Move to the next position
  pos = (pos + 1) % NUM_LEDS;

  // Change hue
  hue += 3;

  FastLED.show();
  delay(30);
}

// Rainbow blink effect
void blinkEffect() {
  static bool lightsOn = false;
  static uint8_t hue = 0;

  if(lightsOn) {
    // Fill the entire strip with a random color
    fill_solid(leds, NUM_LEDS, CHSV(hue, 255, 255));
    hue += 5;
  } else {
    // Turn all LEDs off
    fill_solid(leds, NUM_LEDS, CRGB::Black);
  }

  lightsOn = !lightsOn;
  FastLED.show();
  delay(lightsOn ? 200 : 800); // On for 200ms, off for 800ms
}

// Marquee effect
void marqueeEffect() {
  static uint8_t hue = 0;
  static int position = 0;
  static int tailLength = 15;

  // Gradually fade out LEDs
  fadeToBlackBy(leds, NUM_LEDS, 20);

  // Create the marquee head
  leds[position] = CHSV(hue, 255, 255);

  // Create gradient tail
  for(int i = 1; i  30000) {
    currentEffect = (currentEffect + 1) % EFFECT_COUNT;
    lastEffectChange = millis();
    FastLED.clear();
    FastLED.show();
  }

  // Run the current effect
  switch(currentEffect) {
    case EFFECT_FLOW:    flowEffect();    break;
    case EFFECT_BLINK:   blinkEffect();   break;
    case EFFECT_MARQUEE: marqueeEffect(); break;
  }

  // Optional: Brightness control
  // adjustBrightness();
}

// Optional: Switch effects via serial commands
void serialEvent() {
  while(Serial.available()) {
    char c = Serial.read();
    if(c >= '0' && c <= '2') {
      currentEffect = c - '0';
      FastLED.clear();
      FastLED.show();
    }
  }
}

// Optional: Brightness adjustment function
void adjustBrightness() {
  int potValue = analogRead(A0); // Connect potentiometer to A0
  int newBrightness = map(potValue, 0, 1023, 0, 255);
  FastLED.setBrightness(newBrightness);
}
				
			

5.Lighting Effect Demonstration

In this video, you’ll see how to use an Arduino to control WS2811 RGB LED strips and play with different light effects. Just make sure your power supply fits and all the wires are connected well. Using libraries like FastLED can make things easier. With these tips, you can set up your own lighting style on the strip.
Got questions about Arduino UNO or WS2811 strips? You’re welcome to ask in the comments!

Share To

Enquiry