Saturday, June 20, 2015

Building a light up headband

This project is about building a light up headband which blinks flowers in "random" patterns.


Shira asked for a headband with glowing flowers, which we built.

Parts:

Shira chose this headband

I used the following parts:

QtItem
1surface mount attiny85
1circuit pattern board
3Red surface mount LED
3Pink surface mount LED
2220ohm surface mount resistor; 1 110ohm likely would work.
13 battery button cell holder; This project will work with 3v, 4.5v-5v
makes for brighter LEDs. This holder yields 4.5v
1Surface mount slide on/off switch
several feet of 26AWG wire
1White felt to place over the wires and circuit board

Things you will probably want

SIOC-8 test clip
tinyUSB programmer, which can accept the attiny85, I used: The sparkfun tiny avr programmer
Hot Glue Gun and glut
Magnifying headset, This or a better one


While waiting for parts to arrive from around the world, I prototyped this with a DIP mounted
attiny85 and a breadboard, arriving at: Code used in this project. Courtesy of arduino electronics
 I found a set of low power routines which let me reduce power usage down to ~5ua when not running the LEDs and about 8ma when using them. 

Caveats:


1) hacking a basic circuit board like I did is somewhat a recipe for pain. One likely would do well using fritzing and making their own logic board up. I didn't do this, and somewhat regret not having done so.

2) the attiny85 is insanely durable. After burning off a pad during assembly (price of having a 5 year old help) and then doing a godawful job fixing things up, I later managed to inadvertantly put my programmer on it backwards which heated the processor up enough to desolder it from the board causing it to land and melt into my tablecloth. Oopsie! Worse, it bent/broke a leg, fortunately the cpu still worked (really), I had to build a solder bridge to cover for the broken leg on pin0, otherwise no apparent harm.

3) Keep the pinout of the attiny85 handy

Assembly:


A) Solder the attiny85 to your circuit board. It is a lot easier to program it with a test clip after it is mounted. If you are test oriented, have a breadboard ready for testing.


I then drilled a set of holes into the circuit board to wrap wire around to act as a strain reliever to keep wire pulling from harming solder joints. Very useful if you aren't very good at soldering small stuff.

Here is my board after soldering the power switch and attiny85:


B) Prepare the circuit board for power.


  • You want to run positive power from one side of the slide switch to Vcc (pin 8)
  • Run a lead from  pin 4 (GND) out to the edge. You'll then want to connect that pad via the two 220ohm resistors (in parallel!) or single 110ohm resister (if you have that), to another set of pads (I ran around most of the outside) to  have a place to land the cathode leads from the LEDs. I hoped that a single pair of resistors would probably be able to move enough power to cover all LEDs on at once. This worked, likely one resister would be sufficient, too.


C) Program and test the attiny85 make sure that it is doing what you want. I have it blink through all of the pins in sequence on startup so that it is easy to debug loose/failed connections.

This is my board hooked up to my prototype via a debug clip:

D) Next, solder about 6-8" of wire to both legs of each LED. This is a bit of a pita.


E) Glue each LED into the center of a flower. 

I used a hot glue gun, dipped the back of the LED into hot glue, then landed it into the flower and held it in place using electronics tweezers. This worked really well. Make sure that you have a way to distinguish the anode from the cathode. This will help later on.

I chose to debug everything at this point by hooking it all together via a breadboard
ignore the DIP8 attiny85 on the breadboard, it is not in use.

F) Prepare the battery pack by glueing a 6-8" piece of wire to both positive and negative leads

G) Glue the battery pack into an appropriate gap in the headband.


H) Run all of the wires back to the circuit board. 

I ran them through the drilled holes a few times so that strain wouldn't pull on the solder joints. Then solder the leads into place

here is my board after soldering the LED anodes into place, if you look in the lower left, you'll see the two resistors creating a ground bus for the LEDs across the left and top of the board.


Here is the board with all wires except the battery soldered in. I attached it to external power to test:


I) Verify that you've got the LEDs in the order you want. 

I ended up with 0/1 swapped; The easy fix is to adjust the array defined in shira-headband.ino rather than resoldering. For 0/1 being swapped, the following diff adjusted the ordering:

diff --git a/shira-headband/shira-headband.ino b/shira-headband/shira-headband.ino
index e7cbaf2..e91721d 100644
--- a/shira-headband/shira-headband.ino
+++ b/shira-headband/shira-headband.ino
@@ -6,8 +6,8 @@
 #define NR_LEDS 5
 
 LED leds[] = {
-  LED(0),
   LED(1),
+  LED(0),
   LED(2),
   LED(3),
   LED(4),

J) Use hot glue strategically on the wires to  hold them in place.

K) Solder on the battery

L) Turn it on, make sure it works

M) cut a piece of white felt to size against the bottom and hot glue it into place



No comments:

Post a Comment