Projects / LED ring wheel of fortune

LED ring wheel of fortune

A Nano spins a bright dot round a 16-LED ring when you press a button, slows it down and stops it on a random LED, as a prize wheel or a way to choose who goes first.

Beginner1.8 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO11.7 mA

    Wire the ring

    5V and GND to the Nano, DIN through 330 ohms to D6.

  2. NANO11.7 mA

    Add the capacitor

    Across the ring's 5V and GND, stripe to GND.

  3. NANO

    Wire the button

    D2 to GND.

  4. NANO

    Install the library

    Adafruit NeoPixel.

  5. NANO11.7 mA

    Upload the sketch

    The ring is dark.

  6. NANO

    Press the button

    A dot spins round and slows to a stop.

  7. NANO

    Spin again

    A different LED wins.

In short

How do you build an LED ring wheel of fortune?

A Nano spins a bright dot round a 16-LED ring when you press a button, slows it down and stops it on a random LED, as a prize wheel or a way to choose who goes first. You need Arduino Nano, WS2812B ring 16 LEDs, Tactile push button 6 mm, Resistor 330 Ω, Electrolytic Capacitor 100 µF and Breadboard 830 Tie Points. It takes 7 steps and about 110 minutes.

Level
Beginner
Time
About 110 min
Parts
6

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Ring 5VNano 5VPower from USB (brightness is kept low)
Ring GNDNano GNDCommon ground
Ring DIN330 ohm resistor to Nano D6Data line
100 microfarad capacitorAcross ring 5V and GND, stripe to GNDSteadies the supply
ButtonNano D2 and GNDStarts a spin

Code

A WS2812B ring has a tiny control chip in every LED, so one data wire sets the colour of all sixteen. The Adafruit NeoPixel library sends the colours, and the 330 ohm resistor in the data line protects the first LED while the capacitor smooths the supply when many LEDs change at once. Each LED can draw about 60 milliamps at full white, so the program keeps the brightness low and lights only a dot and a short tail at a time, which keeps the total current well within what a USB port can give. When the button is pressed the program picks a random number of steps and moves the dot round the ring, adding a longer wait at each step so it slows down smoothly. It flashes the winning LED green. The random numbers are seeded from an unconnected analog pin and the clock, so each spin differs. Do not look into the LEDs from close up at high brightness. Number the LEDs on a card around the ring for prizes, names or choices.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Adafruit_NeoPixel.h>

const int RING_PIN = 6, BUTTON = 2, COUNT = 16;
Adafruit_NeoPixel ring(COUNT, RING_PIN, NEO_GRB + NEO_KHZ800);

void dot(int p) {
  ring.clear();
  ring.setPixelColor(p % COUNT, ring.Color(255, 140, 0));
  ring.setPixelColor((p + COUNT - 1) % COUNT, ring.Color(50, 28, 0));      // a short tail
  ring.setPixelColor((p + COUNT - 2) % COUNT, ring.Color(12, 7, 0));
  ring.show();
}

void setup() {
  pinMode(BUTTON, INPUT_PULLUP);
  ring.begin();
  ring.setBrightness(40);                          // low, so a USB port can power the ring
  ring.clear();
  ring.show();
  randomSeed(analogRead(A0) + micros());
}

void loop() {
  static int pos = 0;
  if (digitalRead(BUTTON) == LOW) {
    int total = random(40, 80);                    // how many steps this spin lasts
    for (int i = 0; i < total; i++) {
      pos = (pos + 1) % COUNT;
      dot(pos);
      delay(15 + ((unsigned long)i * i * 300UL) / ((unsigned long)total * total));   // slows to a stop
    }
    for (int k = 0; k < 6; k++) {                  // flash the winner
      ring.clear();
      ring.setPixelColor(pos, ring.Color(0, 255, 0));
      ring.show();
      delay(200);
      ring.clear();
      ring.show();
      delay(200);
    }
    dot(pos);
  }
  delay(10);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Press the buttonA dot spins fast
Watch the endIt slows down and stops
WinnerFlashes green six times
Press againA new random result
Ten spinsDifferent winners

If it does not work

Ring stays dark

Check the arrow on DIN, 5V and GND.

Wrong colours

Change NEO_GRB to NEO_RGB.

Nano resets

Lower the brightness number and use a better USB port.

First LED flickers

Check the resistor is on the data wire.

Always stops at the same LED

Check the analog pin A0 is not wired to anything.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the LED ring wheel of fortune?

Arduino Nano, WS2812B ring 16 LEDs, Tactile push button 6 mm, Resistor 330 Ω, Electrolytic Capacitor 100 µF and Breadboard 830 Tie Points.

How long does the LED ring wheel of fortune take to build?

About 110 minutes for a beginner maker, in 7 steps.

How do I know the LED ring wheel of fortune works?

Press the button: A dot spins fast. Watch the end: It slows down and stops. Winner: Flashes green six times.

Ring stays dark: what should I check?

Check the arrow on DIN, 5V and GND.

Wrong colours: what should I check?

Change NEO_GRB to NEO_RGB.

Nano resets: what should I check?

Lower the brightness number and use a better USB port.

First LED flickers: what should I check?

Check the resistor is on the data wire.