Introduction: Rainbow LED Headband (WS2812 + ATTiny85)

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

ScottW28 (author)2016-02-24

What libraries did you use?

the_new_mr (author)2014-11-04

Really nice job :)

Do you mind if I ask how many LEDs per metre your stip was? I'm thinking of making a costume and am not sure how many LEDs per metre to go for (trying to keep costs down).

Thanks in advance!

gada888 (author)2014-06-17

can a bare attiny85 do the job.is digispark any diffirence with bare attiny85?

aav1 (author)2014-05-30

really cool! how long does these batteries last?

craftclarity (author)2014-05-29

That is so cute!!! Holy cow, I bet she's impossible to lose in a crowd now.

miralp (author)craftclarity2014-05-30

Yes, indeed it was one of the few benefits that i've found.

The video doesn't show the rainbow and chasing rainbow animation which are cool (for a 6 year old).

I think I'll post another video showing more colorful animations.

About This Instructable

13,118views

76favorites

License:

More by miralp:Rainbow LED Headband (WS2812 + ATTiny85)
Add instructable to: