How to Drive WS2811 LED Strips with ESP8266 & FastLED

ESP8266 is an affordable, high-performance Wi-Fi microcontroller that is increasingly being used.

How to drive WS2811 LED Strips with ESP8266 & FastLED?

Just follow this article to complete the steps from powering the WS2811 Led Strip to programming the ESP8266 controller. Are you impatient?

1. Materials Required

5V Power Supply

Output

  • Voltage: DC5V
  • Current: Up to 40A
  • Power Rating: 200W

Input

  • Voltage Range: AC 110V/220V (dual input supported, switch-selectable)
  • Strong compatibility (USB standard voltage).
  • Low voltage is safer (very low risk of electric shock)

12V Power Supply

Output

  • Voltage: DC12V
  • Current: Up to 33.3A
  • Power Rating: 400W

Input

  • Voltage Range: AC 110V/220V (dual input supported, switch-selectable)
  • Strong compatibility: Most devices support 12V input (such as hard disks, fans).
    Smaller voltage drop:
  • Compared with 5V, it is more suitable for long-distance power supply (such as 0.75mm² wire can be used within 10 meters).
power supply 5V
5V LED Power Supply
12V
12V LED Power Supply

For this setup:

  • DC5V Power to the the ESP8266 from the power supply (5 volts/GND wire) and DC12V to power the WS2811 Led strip.18-22AWG is the most stable choice for light strips
  • Sufficient current for many Led strips
  • Industrial-grade reliability and good heat dissipation and ventilation

ESP8266 Control Board

ESP8266 1

                                   ESP8266 Control Board Area Pin Introduction

Model: ESP8266
Operating Voltage: 3.3V-5V
Input Voltage (recommended): ESP8266 has two voltages, one is the external power supply port is 5V, Type-C5V, output pin 3.3V
Digital I/O Pins: 5
Maximum operating pixels: 800-1000 pixels
Wireless connection: Built-in Wi-Fi function, supports STA (client), AP (hotspot) and STA+AP mixed mode.
Application of ESP8266: With Wi-Fi function and strong cost performance, ESP8266 is widely used in the Internet of Things and smart home
Programming Interface: USB Type-C

Use in this setup:

  • The ESP8266 controller is used as a controller to send digital data signals to the WS2811 LED strip.
  • The LED strip is connected to a DC12V power supply and the controller is connected to 5V
  • It should be noted that the GPIO of the ESP8266 is a 3.3V logic level, so the GPIO pins need to be level-converted before connecting to the LED strip signal pins. The “D0” interface of the WS2813 LED strip is connected to the 5V data output pin (such as HU1-HU4) in the level converter through a wire, and then connected to the digital I3 interface through a 3.3V (LU1-LU4) interface. The positive pole of the strip is connected to the positive pole of the DC12V power supply, and the negative pole is connected to the negative pole of the DC12V power supply.

WS2811 LED Strip

DA1 12V WS2811
60LEDs/m WS2811 LED Strip

Type: External IC, RGB LED built-in WS2811 control chip, only supports single-line serial communication
Voltage: DC12V
Communication protocol: single-line, 8bit, 400-800Hz
Features: DC12V power supply, 1 IC control 3Leds, suitable for projects requiring long distance and low cost
LED density: 60 LED/m

 

Accessories & Tools

  • Connecting Wires: Use appropriate gauge, e.g., 18–22 AWG
  • Logic-Level Shifter: Must use 4-way level converter

2. Wiring Schematic

SuntechLite provides a schematic diagram of the ESP8266 circuit connected to the WS2811 LED Strip.

ESP8266 WS2811 schematic
How to Control WS2811 LED Strip with ESP8266 Wiring Diagram

Note:
1.The control board current of ESP8266 is less than 500mA;
2. The current of the led strip is too large, please use an external power supply to power the light strip;
3. The DC3.3 interface is the voltage output port of the control board and cannot be connected to the power supply;
4. The led strip is powered by DC12V, and the power supply range of the control board is DC3.3-9V, so the control board is powered by DC5V alone, and the light strip is powered by DC12V;
5. The wiring of RGB is the same as that of RGBW, but it should be noted that the programs cannot be shared, otherwise it will cause confusion.
6. The more points, the lower the refresh rate;
7. Note that the GPIO of ESP8266 is 3.3V logic level, so the GPIO pin needs to be converted and then connected to the signal pin of the led strip.

3. Connection Diagram

ESP8266 SK6812 1
How to Control WS2811 LED Strip with ESP8266 Suntechlite

Tips:

  • Short, direct data wire from ESP8266 to DIN
  • Safety terminal connection on power supply
  • Always disconnect power before rewiring

4. Code Upload

Software: Arduino IDE

Library Used: FastLED

The Suntechlite team provides ready-to-use dynamic coding below, and our team of technical experts are always available to answer all your engineering questions.

				
					#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 WS2812s are GRB order

CRGB leds[NUM_LEDS];

// Effect mode enumeration

enum Effects {
EFFECT_FLOW,
EFFECT_BLINK,
EFFECT_MARQUEE,
EFFECT_COUNT
};

uint8_t currentEffect = EFFECT_FLOW;

unsigned long lastEffectChange = 0;

unsigned long lastUpdate = 0;

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

// Full color water effect
void flowEffect() {
static uint8_t hue = 0;
static uint8_t pos = 0;

// Gradually turn off all LEDs
fadeToBlackBy(leds, NUM_LEDS, 10);

// Set a color light spot at the current position
leds[pos] = CHSV(hue, 255, 255);

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

// Change hue
hue += 3;

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

// Full color blinking effect
void blinkEffect() {
static bool lightsOn = false;
static uint8_t hue = 0;

if(lightsOn) {
// Random color for all lights
fill_solid(leds, NUM_LEDS, CHSV(hue, 255, 255));
hue += 5;
} else {
// All lights 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;

// Gradual extinguishing
fadeToBlackBy(leds, NUM_LEDS, 20);

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

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

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

// Brightness control (optional)
// adjustBrightness();
}

// Optional: switch effects via serial port 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 the potentiometer to A0
int newBrightness = map(potValue, 0, 1023, 0, 255);
FastLED.setBrightness(newBrightness);
}
				
			

5. Demonstration Video

Let’s take a look at the real connection video below:

WS2811 programmable LED strips can achieve your desired effects through ESP8266. Through the correct power connection diagram and professional programming code, you can achieve a stable and smooth full-color animation effect. If you need any technical support, our engineering team can provide professional solutions.

Share To

Enquiry