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
- Small Strips (< 20 LEDs): Can use ESP32โs 5V pin (if available) or 3.3V with level shifter
- Medium Strips (20-50 LEDs): Use external 5V power supply (2-3A recommended)
- 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