PyRaspBeta

NeoPixel ring (12)

The NeoPixel ring is twelve WS2812B LEDs laid out in a circle, pixel 0 at the top and the rest running clockwise. It costs $10, is wired exactly like the stick — one data line, one 5 V supply — and speaks the same neopixel.NeoPixel API, so anything you write for one runs on the other by changing the pixel count. It suits clocks, dials, VU meters and anything that wants an angle.

NeoPixel ring (12)

Pins

PinWhat it isType
DINData in (800 kHz)io
5VSupply 5 Vpower
GNDGroundground
DOUTData out, to the next board's DINio

DIN receives the 800 kHz data stream, DOUT forwards the leftover bytes to the next board, and 5V/GND power the ring. On a real Pi the data line lives on GPIO18 (PWM), which the neopixel library uses under the hood.

Wiring it in circuit.py

circuit.py
from wiring import *

pi = Pi()

ring = NeoPixelRing()

pi.GPIO18 >> ring.din
pi.V5 >> ring.v5
ring.gnd >> pi.GND

Chain a stick and a ring by wiring the first board's DOUT to the second's DIN; the second board's pixels start at index 12. Keep the 5 V and GND wires shared and short.

Driving it in main.py

main.py
import board
import neopixel
from time import sleep

pixels = neopixel.NeoPixel(board.D18, 12, auto_write=False)
pixels.brightness = 0.3

while True:
    for tick in range(12):
        pixels.fill((0, 0, 0))
        pixels[tick % 12] = (0, 80, 200)
        pixels[(tick + 6) % 12] = (200, 0, 0)
        pixels.show()
        sleep(0.15)

The ring is just a list of 12 pixels; math.sin and friends turn a list index into a position on the circle.

Electrical notes

  • Twelve LEDs at full white draw up to 12 × 60 = 720 mA from 5 V, plus about 12 mA idle. That is well past what a Pi header should supply continuously — a separate 5 V supply with a common ground is the right answer, and the simulator warns above 1 000 mA.
  • Everything else matches the stick: 20 mA per channel nominal, 800 kHz data rate, GRB byte order, and a data line that prefers 3.5 V or more at a 5 V supply.
  • Keep brightness below 1.0 when many pixels are white; the judge only fails on damage, but the power meter and the warning are there to teach the real budget.

Simulator vs real hardware

  • The part consumes 12 pixels' worth of the data stream and forwards the rest through DOUT; pixel 0 is at the top of the canvas and indices run clockwise, matching the real board's silkscreen.
  • Current follows the same model as the stick: idle current plus channel sum, measured against the 5 V rail.
  • Protocol timing and root requirements are simulated away; on a bench you would also see a first-pixel glitch if the data line is too long, and voltage drop around the ring on thin wires.
  • brightness scales all channels in the simulator exactly as the library does before sending.

Going deeper

Further reading