Introduction: LED Pattern Hat

About: "I work on starships, not alien machines!" ---Isaac Clarke

This is a (moderately) simple Arduino project that is a spectacular display from LEDs - that you can wear on your head! It also uses a program that is not intricate at all, so you can modify it for different patterns and cycles. It's also a great first or second project for people new to Arduino. And, of course, it looks great in the dark!

(I know the video isn't ideally situated; I'll try to fix that soon)

Step 1: Parts List

You will need:

A hat (of course)
16 paperclips
24 LEDs for the version pictured - Radioshack sells a bundle of red, yellow and green LEDs, which is what I used x2
Jumper wires
Duct tape
9V battery
9V connector or plug
Electrical Tape
Fishing line or string
Very small breadboard
Arduino Uno, Leonardo, etc.

Step 2: Parallel Vs. Series

It might be simpler, but building the circuit with the LEDs in series (with the positive leads connected to the negative ones of the next; 5th picture) requires more voltage than the Arduino can provide. Two LEDs work, but for this design with three LEDs I used a parallel circuit. When connected in this way, like the in first four pictures, the Arduino can power at least four LEDs at once, although they are slightly dimmer.

Step 3: Construct the Ground Circuit

Since the Arduino Uno has only 3 ground ports, you'll need a circuit that you can plug all 8 LED strips into. With a super-small breadboard (this one is 5x10), plug one wire into the ground pin on the Arduino and a row on the breadboard, and two more wires from that row into two other rows. 

Step 4: Assemble the LED Strip

Straighten out 2 paperclips and bend the leads on the LEDs as shown in the first picture. Wrap the positive leads around the paperclip while leaving some of the it exposed on both ends, then do the same for the negative leads. The more times you wrap it around, the better it will stay connected. Also, it may be helpful to have one paperclip longer than the other at the green end so you know which one is positive and vice versa. If necessary, add electrical tape around the connections to keep them together some more; however, the residue from the tape can interfere with the contact between the leads and the paperclips. Finally, connect jumper wires to the green end of the paperclips.

Repeat all that as many times as you want strips on the hat; for this Instructable I used 8 (this is also the amount you can make using two LED bundles from Radioshack).

Step 5: Setup the LED Strips on the Hat

Arrange the strips like shown on a piece of duct tape about 2"x2" or more. Use well-placed electrical tape to prevent the paperclips from making contact and potentially shorting out the circuit or overheating it (more info on that later). Center the assembly over the top of the hat like shown, and (if your hat has holes in it like in the 4th picture [that's from the inside]) thread fishing line through the holes to keep the strips apart from each other and to hold them to the hat.

The way I accomplished this is by starting from the inside of the front of the hat (going out) and going in the next hole, repeating this until I got back to the first. Then switch directions and do the same thing the opposite way around. When you have everything held together well enough, tie the loose ends together and cut off the extra string.

I should also point out that my hat had six holes in it, the pattern might be different for more or less holes.

Step 6: Duct Tape the Components

Duct tape works for just about anything, but surprisingly it has difficulty attaching to fabric. Make sure you do this step correctly since it's holding your components together on the hat.

Tape the ground breadboard to the top of the shade and the Arduino to the bottom. Make sure that the tape does not cover the ATMega IC or it will overheat faster (more info later). Tape in a loop on the bottom of the board and the side of the analog input ports works fine.

Also, tape a 9 volt battery to the shade and either plug the positive and negative leads into the Vcc and Ground ports, respectively, or the adapter into the 9 volt. This way you can turn on the hat by plugging in the adapter to the Arduino (if you have one with a plug) or by connecting the adapter to the battery (if you have one with leads). If you have an adapter with leads you could also add a switch somewhere on the hat to turn it on and off easier.

Step 7: Plug in the LEDs

As you've seen in previous pictures, connect the negative leads from the LED strips to the ground circuit board. Plug the positive leads into the Arduino's digital ports 1-8. For the program I have in this Instructable to work, connect the strips to the Arduino clockwise starting with the front right (if you're wearing the hat) strip (as in, front right goes to port 1, next one to the right goes to port 2, etc.).

Step 8: Programming

The great feature of this program is that it is very simple and easy to change for whatever kind of pattern you want. Copy and paste the code into your Arduino programming environment and upload it to your board... and you're done!

const int LED = 1;
const int LED2 = 2;
const int LED3 = 3;
const int LED4 = 4;
const int LED5 = 5;
const int LED6 = 6;
const int LED7 = 7;
const int LED8 = 8;
const int LED9 = 9;
const int LED10 = 10;

void setup(){
  pinMode(LED,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  pinMode(LED4,OUTPUT);
  pinMode(LED5,OUTPUT);
  pinMode(LED6,OUTPUT);
  pinMode(LED7,OUTPUT);
  pinMode(LED8,OUTPUT);
  pinMode(LED9,OUTPUT);
  pinMode(LED10,OUTPUT);
}

void loop(){
  /*digitalWrite(LED, HIGH);  Uncomment this to turn all the LEDs on
  digitalWrite(LED2, HIGH);
  digitalWrite(LED3, HIGH);
  digitalWrite(LED4, HIGH);
  digitalWrite(LED5, HIGH);
  digitalWrite(LED6, HIGH);
  digitalWrite(LED7, HIGH);
  digitalWrite(LED8, HIGH);
  digitalWrite(LED9, HIGH);
  digitalWrite(LED10, HIGH);*/


  digitalWrite(LED4, HIGH);
  digitalWrite(LED, LOW);
  delay(250);
  digitalWrite(LED5, HIGH);
  digitalWrite(LED2, LOW);
  delay(250);
  digitalWrite(LED6, HIGH);
  digitalWrite(LED3, LOW);
  delay(250);
  digitalWrite(LED7, HIGH);
  digitalWrite(LED4, LOW);
  delay(250);
  digitalWrite(LED8, HIGH);
  digitalWrite(LED5, LOW);
  delay(250);
  digitalWrite(LED, HIGH);
  digitalWrite(LED6, LOW);
  delay(250);
  digitalWrite(LED2, HIGH);
  digitalWrite(LED7, LOW);
  delay(250);
  digitalWrite(LED3, HIGH);
  digitalWrite(LED8, LOW);
  delay(250);
  digitalWrite(LED, HIGH);


}



One final note: running this many LEDs causes the ATMega IC on the Arduino to heat up after awhile, so don't have the hat powered on for long periods of time or it could damage the board.

Enjoy!!!

Instructables Design Competition

Participated in the
Instructables Design Competition

UP! Contest

Participated in the
UP! Contest