How to Wire and Code WS2815 LED Strips on ESP32

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

How to wire and code WS2815 LED strips on ESP32?

The 12V power supply and dual-signal backup design of WS2815, if combined with the low power consumption characteristics and GPIO expansion capabilities of ESP32, can build a highly reliable long-distance LED control solution.

The high-performance processor of SP32 can efficiently process complex LED animations and real-time data streams, and support scenarios such as music synchronization and dynamic lighting effects.

1.Material Required

Power Supply DC12V and DC5V

12V
   DC12V Power supply

DC12V output

  • Voltage: DC 12V
  • Current: Up to 33A
  • Power Rating: 400W

DC12V Input

  • Voltage Range:                                      AC 100~120V/200V~240V 
power supply 5V
DC5V Power supply

DC5V Output

  • Voltage: DC 5V
  • Current: Up to 80A
  • Power Rating: 200W

DC5V Input

  • Voltage Range: AC 110V/220V (dual input supported, switch-selectable)

Setup Tips

  • The positive pole of the WS2815 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
  • The control board power supply range is DC3.3-9V, so the control board is powered by DC5V alone;
  • Good and reliable ventilation and heat dissipation allow you to get twice the result with half the effort

The power supply is like the human heart, which bears the core responsibility of energy supply. It is particularly important to choose a brand power supply, which is guaranteed in terms of quality and after-sales service. A complete after-sales system can maximize the protection of user rights. In addition to non-waterproof power supplies, we also have waterproof power supplies to choose from. For more options, please contact us.

ESP32 Board

ESP32

                                    ESP32 Control Board Area Pin Introduction

Model: ESP32
Workting Voltage: 5V
Input Voltage (recommended): DC5V,
(If you choose to use a DC adapter for power supply, it can be DC6.5V~DC9V)
Digital I/O Pins: GPIO0~33 can be used for PWM output, GPIO34~39 can only be used for input, not output.GPIO2, 12, 15: Keep high level when starting, otherwise it may fail to start. GPIO0: Pull low in download mode and pull high in normal operation.
Analog Input Pins: 9
Clock Speed: 30 MHz
Programming Interface: USB Type-C

Setup:

  • The Esp32 controller sends digital data signals to the WS2815 strip
  • Control board current <500mA
  • The GPIO of ESP32 is 3.3V logic level, so the GPIO pin needs to be level-converted before connecting to the signal pin of the light strip (74HCT125 or MOSFET level conversion)

WS2815 RGB LED strip

ws2815 led strip
Dual Signal RGB WS2815 LED Strip

Type: Addressable WS2815 RGB led strip
Input Voltage: DC12V
Features: The dual signal line design. Even if a single LED is damaged, the subsequent lamp beads can still work normally to avoid overall damage.

LED number: 60 LEDs/m

WS2815 Application Scenarios

WS2815 smart LED lights have high brightness and programmable features, becoming the main trend in nightclub lighting design. Through the controller or music synchronization software, the real-time interaction between lights and DJ beats can be accurately achieved. Its 12V low-voltage power supply supports ultra-long distance series connection, making it easy to build multi-level spatial narratives such as ceiling light curtains, bar outline lights, and ground guide lights.

2.How to connect the wire

The wiring diagram from Suntechlite 

ESP32 WS2815 Schematic diagram
How to Control WS2815 LED Strip with ESP32 Wiring Diagram

Note:

1. The current of the control board must be<500mA;

2. The current of the light strip is too large, please use an external power supply to power the light strip;

3. The DC3.3/5V interface is the voltage output port of the control board, which cannot be connected to the power supply. The DC interface is used for connecting the power supply;

4. The power supply range of the control board is DC3.3-9V, so the control board is powered by DC5V alone;

5. The wiring of RGB is the same as that of RGBW, but the programs cannot be shared;

6. The more points, the lower the refresh rate;

7. Note that the GPIO of ESP32 is 3.3V logic level, so the GPIO pin needs to be converted to a level before connecting to the light strip signal pin (74HCT125 or MOSFET level conversion).

3.WS2815 RGB LED Connection Diagram

ESP32 WS2815 connect picuture
How to Control WS2815 LED Strip with ESP32 Suntechlite

Tips:

  • Short and direct data wire from Arduino to  LED DIN
  • Please disconnect power before rewiring

4.Programming code

Software: What it used is Arduino IDE

SunTechlite : We can provide the codes for a variety of light effects. 

				
					#include 

#define LED_PIN     19     // Light strip data pin
#define NUM_LEDS    80    // LED quantity
#define BRIGHTNESS  128   // Initial brightness (0-255)
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB   // Most WS2812 are GRB sequential

CRGB leds[NUM_LEDS];

// Effect mode example
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 colored light spot at the current position
  leds[pos] = CHSV(hue, 255, 255);
  
  // move location
  pos = (pos + 1) % NUM_LEDS;
  
  // change hue
  hue += 3;
  
  FastLED.show();
  delay(30);
}

// Full color flashing effect
void blinkEffect() {
  static bool lightsOn = false;
  static uint8_t hue = 0;
  
  if(lightsOn) {
    // Random color of full light strip
    fill_solid(leds, NUM_LEDS, CHSV(hue, 255, 255));
    hue += 5;
  } else {
    // All off
    fill_solid(leds, NUM_LEDS, CRGB::Black);
  }
  
  lightsOn = !lightsOn;
  FastLED.show();
  delay(lightsOn ? 200 : 800); // 亮200ms,灭800ms
}

// Marquee effect
void marqueeEffect() {
  static uint8_t hue = 0;
  static int position = 0;
  static int tailLength = 15;
  
  // Gradual fading
  fadeToBlackBy(leds, NUM_LEDS, 20);
  
  // Create a Marquee
  leds[position] = CHSV(hue, 255, 255);
  
  // Creating a gradient tail
  for(int i = 1; i  30000) {
    currentEffect = (currentEffect + 1) % EFFECT_COUNT;
    lastEffectChange = millis();
    FastLED.clear();
    FastLED.show();
  }
  
  //Execute 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 &gt;= '0' &amp;&amp; c &lt;= &#039;2&#039;) {
      currentEffect = c - &#039;0&#039;;
      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 shows

Here is a video shows how to use the ESP32 to control the addressable WS2815 RGB led strip

WS2815 combined with ESP32’s GPIO signal amplification capability can stably drive a light strip over 5 meters long. WS2815 RGB addressable led strip adopts a dual signal line design with break continue function. Even if a single LED is damaged, the subsequent lamp beads can still work normally to avoid overall damage. ESP32 is easy to use and is very suitable for DIY or batch commercial use, and power consumption optimization (deep sleep mode) extends outdoor use time.

Share To

Enquiry