How it works
The ESP32-C3 runs the official MicroPython 1.28.0 image, and the script uses its built-in neopixel module. NeoPixel(machine.Pin(2), 12) prepares a buffer of 12 RGB values, and np.write() sends them to the ring as one WS2812 data stream at 800 kHz. Each pixel keeps the first 24 bits it receives and passes the rest along, which is how a single data wire sets every LED on the ring.
The RAINBOW list holds 12 colours that go once round the colour wheel. On each step, pixel i gets RAINBOW[(i + step) % 12], so the whole pattern moves one position per frame. The script writes 600 frames 120 ms apart, a little over a minute, and then prints ring demo done. The USB cable feeds the breadboard's positive rail through VIN at about 4.7 V. The ring takes VCC and GND from the rails, and a jumper connects G2 to DIN.
What to watch
The ring shows a full rainbow that turns one pixel at a time, a little more than eight steps per second. When the 600 frames are done, Serial prints ring demo done and the last frame stays lit, because WS2812 pixels hold their colour until new data arrives. Open the Logic analyzer on G2 to see each frame as one short burst of pulses with a long gap before the next.
What's on the bench
- ESP32-C3
- NeoPixel ring ×12
How it's wired
- hole a10→hole B-5
- hole a11→hole B+5
- hole a50→hole B+9
- hole a52→hole B-9
- hole a14→hole c51
- ESP32-C3 · gnd→hole e10
- ESP32-C3 · vin→hole e11
- ESP32-C3 · g2→hole e14
The code
This MicroPython script runs on the emulated board every boot; edit it in Code.
# Rainbow chase around the 12-pixel ring (DIN on G2). import machine, neopixel, time RAINBOW = [ (255, 0, 0), (255, 96, 0), (255, 200, 0), (96, 255, 0), (0, 255, 60), (0, 255, 200), (0, 160, 255), (0, 40, 255), (90, 0, 255), (200, 0, 255), (255, 0, 160), (255, 0, 60), ] np = neopixel.NeoPixel(machine.Pin(2), 12) for step in range(600): for i in range(12): np[i] = RAINBOW[(i + step) % 12] np.write() time.sleep_ms(120) print('ring demo done')
Try this
- Change time.sleep_ms(120) to time.sleep_ms(30) in Code and press Run on board. The rainbow turns four times faster.
- Reverse the direction with RAINBOW[(i - step) % 12]. Taking the result modulo 12 keeps the index between 0 and 11, even when i - step is negative.
- Replace the list with red and black alternating six times. The ring then shows lit and dark pixels in turn, and the pattern steps round instead of fading through colours.



