Spinning ring stopwatch
A sixteen-LED ring sweeps like a clock hand to show seconds, with start and stop buttons.
Build it step by step
0 of 8 doneInstall the library
Add Adafruit NeoPixel.
Wire the ring
5V, GND and DIN through a 330 ohm resistor to D6.
Add the capacitor
100 uF across the ring supply.
Wire the buttons
D2 and D3 each to GND.
Upload the sketch
The ring stays dark.
Press start
LEDs fill one per second.
Press lap
White flash and a line in the serial monitor.
Stop and reset
Press start, then the lap button.
How do you build a spinning ring stopwatch?
A sixteen-LED ring sweeps like a clock hand to show seconds, with start and stop buttons. You need Arduino Nano, WS2812B ring 16 LEDs, Tactile push button 6 mm × 2, Resistor 330 Ω, Electrolytic Capacitor 100 µF and Breadboard 830 Tie Points. It takes 8 steps and about 75 minutes.
- Level
- Beginner
- Time
- About 75 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- OptoelectronicsBuy
- SwitchesBuy
- PassivesBuyResistor 330 Ω × 1
- PassivesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Ring 5V | Nano 5V | Keep brightness low in code |
| Ring GND | Nano GND | Common ground |
| Ring DIN | 330 ohm | Then to Nano D6 |
| 100 uF capacitor | Ring 5V to GND | Long leg to 5V |
| Start and stop button | Nano D2 to GND | Uses the internal pull-up |
| Lap and reset button | Nano D3 to GND | Uses the internal pull-up |
Code
A WS2812B ring holds sixteen RGB LEDs on a single data wire, so one Nano pin controls the whole ring. This stopwatch lights one more LED each second, so a full turn of the ring is sixteen seconds, and every turn uses a new colour so you can count turns at a glance. The bright white head LED works like a clock hand. The start and stop button runs and pauses the count. While it is running, the lap button prints the lap time to the serial monitor and flashes the ring white. When it is stopped, the same button resets to zero. The buttons use the internal pull-up resistors, so no extra parts are needed. A small resistor on the data line and a capacitor across the ring supply protect the first LED from surges. Keep the brightness low: all sixteen LEDs at full white can draw close to one amp, more than a USB port on a laptop should give, and low brightness also looks nicer in a dim room. The timing uses the board clock, which drifts by a second or so a day, so this is for fun and lap timing, not for precise timekeeping.
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, N = 16, START_BTN = 2, LAP_BTN = 3;
Adafruit_NeoPixel ring(N, RING_PIN, NEO_GRB + NEO_KHZ800);
bool running = false;
unsigned long elapsed = 0, lastTick = 0;
unsigned long lastPress = 0;
int lap = 0;
bool clicked(int pin) {
if (digitalRead(pin) == LOW && millis() - lastPress > 250) {
lastPress = millis();
return true;
}
return false;
}
uint32_t lapColour(int l) {
uint32_t c[] = {ring.Color(0, 0, 60), ring.Color(0, 60, 0), ring.Color(60, 30, 0), ring.Color(60, 0, 40)};
return c[l % 4];
}
void show() {
ring.clear();
int pos = (elapsed / 1000) % N; // one LED per second, one lap every 16 seconds
int laps = (elapsed / 1000) / N;
for (int i = 0; i <= pos; i++) ring.setPixelColor(i, lapColour(laps));
ring.setPixelColor(pos, ring.Color(70, 70, 70)); // bright head
ring.show();
}
void printTime() {
unsigned long s = elapsed / 1000, tenths = (elapsed / 100) % 10;
Serial.print(s / 60); Serial.print(":");
if (s % 60 < 10) Serial.print("0");
Serial.print(s % 60); Serial.print("."); Serial.println(tenths);
}
void setup() {
pinMode(START_BTN, INPUT_PULLUP);
pinMode(LAP_BTN, INPUT_PULLUP);
ring.begin();
ring.setBrightness(40);
ring.show();
Serial.begin(9600);
}
void loop() {
unsigned long now = millis();
if (running) { elapsed += now - lastTick; }
lastTick = now;
if (clicked(START_BTN)) running = !running;
if (clicked(LAP_BTN)) {
if (running) {
lap++;
Serial.print("Lap "); Serial.print(lap); Serial.print(": "); printTime();
for (int i = 0; i < N; i++) ring.setPixelColor(i, ring.Color(70, 70, 70));
ring.show();
delay(120);
} else {
elapsed = 0; lap = 0; // reset when stopped
Serial.println("Reset");
}
}
show();
delay(20);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Press start | Ring fills one LED per second |
| Sixteen seconds | Ring restarts in a new colour |
| Lap press while running | Ring flashes and a lap is printed |
| Stop then lap press | Back to zero |
| Press start again | Counts from the stopped time |
If it does not work
Ring stays dark
Check the DIN direction on the ring and the pin number.
Wrong colours
Change NEO_GRB to NEO_RGB.
Flickering LEDs
Add the 100 uF capacitor and a common ground.
Buttons act twice
Increase the 250 ms debounce time.
Nano resets
Lower the brightness value.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the spinning ring stopwatch?
Arduino Nano, WS2812B ring 16 LEDs, Tactile push button 6 mm × 2, Resistor 330 Ω, Electrolytic Capacitor 100 µF and Breadboard 830 Tie Points.
How long does the spinning ring stopwatch take to build?
About 75 minutes for a beginner maker, in 8 steps.
How do I know the spinning ring stopwatch works?
Press start: Ring fills one LED per second. Sixteen seconds: Ring restarts in a new colour. Lap press while running: Ring flashes and a lap is printed.
Ring stays dark: what should I check?
Check the DIN direction on the ring and the pin number.
Wrong colours: what should I check?
Change NEO_GRB to NEO_RGB.
Flickering LEDs: what should I check?
Add the 100 uF capacitor and a common ground.
Buttons act twice: what should I check?
Increase the 250 ms debounce time.
