breadboard
docs

Example project · Builds & projects

ESP32-S31 rainbow ring

RMT on GPIO0 drives a powered 24-pixel ring through the stock rainbow chase. A J2 jumper to GPIO60 also feeds the CoreBoard RGB LED. The upstream program's byte order exchanges red and blue on GRB pixels; its source is unchanged. Serial announces the chase. Enable verbose in Serial to see the stock INFO lines. Unmodified ESP-IDF v6.1.1 on the bounded S31 simulator profile; no physical flashing.

The ESP32-S31 rainbow ring circuit as rendered by the simulator

How it works

ESP-IDF's led_strip example drives WS2812 pixels with the RMT peripheral. The channel runs at 10 MHz, so one tick is 0.1 µs, fine enough for WS2812 bit timing, and a custom encoder turns each byte into RMT symbols. The program fills a buffer for 24 pixels, sends it on GPIO0 and waits 10 ms between frames.

The chase lights every third pixel. In each of three passes the program gives pixels i, i + 3, i + 6 and so on a hue spread round the ring, sends the frame and clears it. After the three passes it moves the starting hue on by 60°. Each lit frame has eight of the 24 pixels on. An all-dark frame separates one lit frame from the next. The ring takes 5 V from the CoreBoard. A J2 wire from GPIO0 to GPIO60 also sends the same data to the board's RGB LED, D7, which shows the first pixel.

What to watch

Enable verbose in Serial to see Start LED rainbow chase. The ring then shows coloured pixels with dark gaps that move round, and D7 on the board shows the colour of pixel 0. The hues are not the ones the program intends: the upstream code writes the bytes in an order that swaps red and blue on these GRB pixels. The source is left unchanged on purpose.

What's on the bench

  • ESP32-S31-Function-CoreBoard-1
  • NeoPixel ring ×24

How it's wired

  • ESP32-S31-Function-CoreBoard-1 · g0→ESP32-S31-Function-CoreBoard-1 · g60
  • ESP32-S31-Function-CoreBoard-1 · g0→NeoPixel ring ×24 · din
  • ESP32-S31-Function-CoreBoard-1 · 5v→NeoPixel ring ×24 · vcc
  • ESP32-S31-Function-CoreBoard-1 · gnd→NeoPixel ring ×24 · gnd

This project runs prebuilt firmware on the emulated board; open it in the simulator to watch it work and inspect every part live.

Try this

  • Remove the GPIO0 to GPIO60 jumper. The ring keeps chasing, but D7 stops changing, because the onboard LED only sees data that reaches GPIO60.
  • Pause the simulation and open Time travel. Step through the capture to find frames with eight lit pixels and frames where the whole ring is dark.
  • Compare it with the NeoPixel ring rainbow, where MicroPython on an ESP32-C3 drives a 12-pixel ring with the same protocol.

Related projects