WS2812-2020 Control

Contents

WS2812-2020 Control#

The WS2812-2020 is a compact RGB LED that can be precisely controlled using the Touch Dot S3 board. This section provides technical guidance for driving WS2812 LEDs and generating custom lighting patterns with MicroPython, C++, and ESP-IDF.

On the Touch Dot S3, a dedicated GPIO pin (GPIO45) is directly connected to the WS2812 LED, allowing for straightforward hardware interfacing and reliable signal timing.

Table 12 Pin Mapping for WS2812#

PIN

GPIO ESP32-S3

DIN

45

rgb led

Fig. 21 WS2812-2020 LED Strip#

Note

The neopixel library is compatible with WS2812 and WS2812B LED strips. The WS2812-2020 is a variant of the WS2812B, so it is fully compatible with the neopixel library.

Code Example#

Below is an example that demonstrates how to control WS2812-2020 LED strips using the Touch Dot S3 board

from machine import Pin
from neopixel import NeoPixel
np = NeoPixel(Pin(45), 1)
np[0] = (255, 128, 0) # set to red, full brightness

np.write()

Tip

for more information on the NeoPixel library, refer to the NeoPixel Library Documentation.