Build it step by step
0 of 7 doneTest one ring
Light all 16 LEDs red at low brightness.
Chain both rings
Light 32 LEDs.
Write the comet
Spin it around both rings.
Add the colour wheel
Fade through colours slowly.
Add the button
Cycle through effects.
Add the battery
Fit a LiPo in a pouch.
Build the goggles
Diffuser film and a soft strap.
How do you build an LED cosplay goggles?
Two 16-LED rings in goggles spin, blink and change colour for cosplay or a party. You need Seeed XIAO RP2040, WS2812B ring 16 LEDs × 2, Li-Po battery 3.7 V 1000 mAh and Tactile push button 6 mm. It takes 7 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 4
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Ring 1 DIN | XIAO D0 | Data |
| Ring 1 DOUT | Ring 2 DIN | Chain |
| Rings VCC and GND | XIAO 3V3 and GND | Power (use a protected LiPo, keep brightness low) |
| Button | XIAO D1 and GND | Next effect |
| LiPo | XIAO BAT pads | Power and charging |
Code
Two 16-LED rings are chained on one pin, so the code treats them as one strip of 32. Brightness is capped at about 10 percent, which is comfortable close to the eyes and keeps the current low enough for a small battery; full white from 32 LEDs would take about 2 A. Avoid fast flashing: flicker at 3 to 30 flashes per second can trigger seizures in people with photosensitive epilepsy, so the effects here fade or step slowly, and the blink is slow. Build the goggles so the LEDs shine out and do not shine into the wearer's eyes, with diffuser film over the rings. Use a protected LiPo in a sewn pocket, never wear it while charging, and make sure the goggles never block the wearer's view in a way that is unsafe, such as on a road or stairs. Arduino IDE with the Raspberry Pi Pico/RP2040 boards package by Earle Philhower, board "Seeed XIAO RP2040".
Runs on a virtual Seeed XIAO RP2040 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).
// LED goggles: three effects, button to change. Board: Seeed XIAO RP2040. Library: Adafruit NeoPixel.
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel px(32, D0, NEO_GRB + NEO_KHZ800); // two rings of 16
const int BTN = D1;
int effect = 0; unsigned long lastBtn = 0; int pos = 0, hue = 0;
void setup() {
pinMode(BTN, INPUT_PULLUP);
px.begin(); px.setBrightness(25); // low brightness: comfortable near the eyes and easy on the battery
}
void loop() {
if (!digitalRead(BTN) && millis() - lastBtn > 300) { effect = (effect + 1) % 3; lastBtn = millis(); px.clear(); }
px.clear();
if (effect == 0) { // spinning comet on both rings
for (int t = 0; t < 5; t++) {
uint8_t b = 255 - t * 50;
px.setPixelColor((pos - t + 16) % 16, px.Color(0, b, b));
px.setPixelColor(16 + (pos - t + 16) % 16, px.Color(0, b, b));
}
pos = (pos + 1) % 16; px.show(); delay(60);
} else if (effect == 1) { // colour wheel, slow fade
for (int i = 0; i < 32; i++) px.setPixelColor(i, px.gamma32(px.ColorHSV(hue + (i % 16) * 4096)));
hue += 300; px.show(); delay(30);
} else { // gentle eye blink, no fast flashing
px.fill(px.Color(255, 40, 0)); px.show(); delay(1800);
px.clear(); px.show(); delay(150);
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Power on | Comet spins on both rings |
| Press the button | Colour wheel, then eye blink |
| Look at a mirror | Effects are comfortable, no harsh flicker |
| Battery | Lasts a few hours |
If it does not work
Wrong colours
Change NEO_GRB to NEO_RGB.
Second ring dark
Check DOUT of ring 1 goes to DIN of ring 2.
Too bright
Lower setBrightness.
Battery drains fast
Lower brightness or use fewer LEDs.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the LED cosplay goggles?
Seeed XIAO RP2040, WS2812B ring 16 LEDs × 2, Li-Po battery 3.7 V 1000 mAh and Tactile push button 6 mm.
How long does the LED cosplay goggles take to build?
About 90 minutes for a beginner maker, in 7 steps.
How do I know the LED cosplay goggles works?
Power on: Comet spins on both rings. Press the button: Colour wheel, then eye blink. Look at a mirror: Effects are comfortable, no harsh flicker.
Wrong colours: what should I check?
Change NEO_GRB to NEO_RGB.
Second ring dark: what should I check?
Check DOUT of ring 1 goes to DIN of ring 2.
Too bright: what should I check?
Lower setBrightness.
Battery drains fast: what should I check?
Lower brightness or use fewer LEDs.
