Rainbow LED Headband (WS2812 + ATTiny85)

14,829

82

7

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020

    7 Discussions

    0
    VijayS72
    VijayS72

    4 months ago

    Does it require prior bootloading...if yes whats the proceedure details....

    0
    ScottW28
    ScottW28

    4 years ago

    What libraries did you use?

    0
    the_new_mr
    the_new_mr

    5 years ago on Introduction

    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!

    0
    gada888
    gada888

    5 years ago on Introduction

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

    0
    aav1
    aav1

    6 years ago

    really cool! how long does these batteries last?

    0
    craftclarity
    craftclarity

    6 years ago on Introduction

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

    0
    miralp
    miralp

    Reply 6 years ago on Introduction

    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.