Introduction: Rainbow LED Headband (WS2812 + ATTiny85)

Hello, here's a Sunday morning project, my daughter gave me this idea some times ago :

First, you must find a headband that fits the person's head.

The headband can be an old one.

Strip any ornament to make the surface flat.

Materials:

- 1 x headband

- 1 x Digispark, or other small programmable MCU.

- 1 x WS2812 Led strip (length of 22 leds for this example)

- 1 x double position switch

- Enamel copper wires.( small toy motor coil)

- 2 x Male female pin header pair.

- 3 x CR2032 3V battery

- Tape.

Credits :

- Digistump (Digispark)

- Adafruit (Neopixel library)

- Arduino

Step 1: Wire It Up

Wire all necessary parts together with enamel copper wire. You can find this kind of wire inside coils of small toy motors. The enamel insulates copper wires, so you need to strip the enamel on the end of the wires with solder, until it becomes grey.

I have attached 3 CR2032 3V batteries with tape to have 9V output.

Pin 0 is used as LED signal output (Data in of the led strip).

Here are the connections :

Batt 9V + ---> Female header . Male Header --> Switch . Switch --> VIN Digispark.

Batt GND -->Female header . Male Header --> Gnd Digispark.

Gnd Digispark ---> GND Led.

P0 Digispark ---> Din Led

5V Digispark ---> 5V Led.

Step 2: Arduino Sketch or MCU Firmware

Make sure you have installed correctly the necessary Arduino IDE for your Arduino favor.

Download the NeoPixel library from Adafruit.

https://github.com/adafruit/Adafruit_NeoPixel

If you are using another MCU and have a C compiler you can use this library, and adapt the below arduino example:

https://github.com/cpldcpu/light_ws2812

Adaptation :

Take the "strandtest" example of the Adafruit library, and do the following changes :

1) Change the second line to what I/O pin you want to use. In this example : Pin 0 is used in the Digispark.

#define PIN 0

2) Change the next uncommented line with the length of the strip you want to use, ex :22 leds instead of 60.

Adafruit_NeoPixel strip = Adafruit_NeoPixel(22, PIN, NEO_GRB + NEO_KHZ800);

3) Decrease the brightness of the LEDs, it's better for the eyes.

at the end of setup() function :

strip.setBrightness(90); // Or less.

That's it, compile and upload it to your MCU. And watch the leds chase.

Step 3: Integrate Electronics Inside the Headband

Use a hot glue gun, to fix MCU, switch and battery.

Hide the wires below the LED strip. The led strip is sticky, you don't need hot glue to stick it.

I'm sure you can make it tidier than mine (see photo).

And it's done.

Improvements you can make :

- Must consider better battery options : doesn't last too much.

- Hide components better.