Hardware Setup

This guide covers the physical connections and hardware requirements for WS2812 LED strips.

Pin Connections

Basic Connections

1
2
3
4
5
ESP32              WS2812 Strip
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
GPIO (e.g., 18) โ”€โ”€โ”€ DIN (Data In)
5V/3.3V         โ”€โ”€โ”€ VCC (Power)
GND             โ”€โ”€โ”€ GND (Ground)

Connection Details

ESP32 Pin WS2812 Pin Description Notes
GPIO (configurable) DIN Data input Any output-capable GPIO
5V or 3.3V VCC Power supply See power requirements below
GND GND Ground Common ground required

Important: The data line (DIN) must be connected to a GPIO capable of output. Most GPIOs on ESP32 support this.

Power Requirements

Power Supply Considerations

WS2812 LEDs can draw significant current:

  • Per LED: ~60mA at full brightness white
  • 30 LEDs: ~1.8A at full brightness
  • 100 LEDs: ~6A at full brightness

Power Supply Options

  1. Small Strips (< 20 LEDs): Can use ESP32โ€™s 5V pin (if available) or 3.3V with level shifter
  2. Medium Strips (20-50 LEDs): Use external 5V power supply (2-3A recommended)
  3. Large Strips (> 50 LEDs): Use external 5V power supply (5A+ recommended)

Power Wiring

For strips requiring external power:

1
2
3
4
5
6
7
8
9
External 5V Power Supply
    โ”‚
    โ”œโ”€โ”€ VCC โ”€โ”€โ”€ WS2812 Strip VCC
    โ”‚
    โ””โ”€โ”€ GND โ”€โ”€โ”€โ”ฌโ”€โ”€ WS2812 Strip GND
               โ”‚
               โ””โ”€โ”€ ESP32 GND (COMMON GROUND REQUIRED!)

ESP32 GPIO โ”€โ”€โ”€ WS2812 Strip DIN

Critical: Always connect grounds together! The ESP32 GND and power supply GND must be connected.

Level Shifting (Optional)

WS2812 LEDs expect 5V logic levels, but ESP32 outputs 3.3V. For short strips (< 1 meter), 3.3V often works, but for reliability:

  • Use a level shifter (e.g., 74AHCT125) for the data line
  • Or use a resistor divider (not recommended for long strips)

Physical Layout Recommendations

  • Keep data line short: Minimize distance between ESP32 and first LED (< 1 meter ideal)
  • Add capacitor: Place 1000ยตF capacitor across power supply near strip
  • Power injection: For long strips, inject power at multiple points
  • Shielding: Keep data line away from noise sources

Example Wiring Diagram

Small Strip (< 20 LEDs)

1
2
3
4
5
6
                    WS2812 Strip
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
ESP32 GPIO18 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค DIN         โ”‚
ESP32 5V     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค VCC         โ”‚
ESP32 GND    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค GND         โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Large Strip (External Power)

1
2
3
4
5
6
7
8
9
10
External 5V PSU     WS2812 Strip
    โ”‚               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”œโ”€โ”€ VCC โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค VCC         โ”‚
    โ”‚               โ”‚             โ”‚
    โ””โ”€โ”€ GND โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ค GND         โ”‚
                โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
ESP32 GPIO18 โ”€โ”€โ”€โ”ผโ”€โ”€โ”€ DIN
                โ”‚
ESP32 GND โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

GPIO Selection

Recommended GPIOs:

  • GPIO 18 (default in Kconfig)
  • GPIO 19, 21, 22, 23
  • Any output-capable GPIO

Avoid:

  • GPIO 0 (boot mode, may cause issues)
  • GPIO 6-11 (SPI flash, not available)
  • Input-only GPIOs

Next Steps

  • Verify connections with a multimeter
  • Proceed to Quick Start to test the connection
  • Review Configuration for GPIO and timing settings

Navigation โฌ…๏ธ Quick Start | Next: Platform Integration โžก๏ธ | Back to Index