Introduction: LED Graduation Hat

For all of those graduates or almost graduates who have either had or will have graduation soon, Congratulations!

My roommate just graduated from the Washington State University College of Apparel Merchandising Design and Textiles, with a degree in fashion merchandising. As most families of graduates find out, one of the struggles of graduation is finding their graduate in the huge crowd of graduates. This can also be part of the fun of graduation as you are allowed to decorate your hat.

Since I have access to lots of electronics I offered to put LEDs on her hat to make it extra flashy. I used WS2812 LED strips to create the LED high heel on her hat, and the LED Digilent logo on the hat I will use as an example in this Instructable.

As you can hopefully see in the super blurry phone picture I took, the LED hat definitely stood out.

In this instructable I will go through creating an led shape, camouflaging the strips and wires, programming the microcontroller to run the strips, and additional hardware needed for powering the board.

If you've never programmed the LED strips before I would advise going through this instructable. I will go through the steps you need to program them for this application, but you may want more information.

Step 1: Gather Materials and Tools

In this tutorial I will go through making the LED hat with WS2812 LED strips, and a chipKIT UC32 microcontroller.

Electronics:

- WS2812 LED strips (Neopixel)

Generally you can buy the strips in rolls, you shouldn't need more than one roll but the amount that you need depends on the shape you choose to make.

The strips that are closest to what I used can be purchased here. The strips I used had the leds more spaced out, but if you want more space between the LEDs you can cut the strips and solder wires in between. The color doesn't particularly matter as you will end up painting them.

You can purchase weatherproof strips from Digilentinc, but you won't be able to have ideal curves.

- A microcontroller that can run the strips

I used the UC32 from Digilent in this tutorial. The main requirement for the microcontroller is that it has a fast enough clock speed.

- A battery

I choose a 3.7 V 2500mAh Lipo flat battery. I chose this so it would be a long lasting battery and to minimize the weight since it will end up on a hat. The battery I bought can be purchased here, and lasted for almost 3, 8 hour days, which was a bit excessive.

- A switch

I choose to put a small switch in my hat so that the wearer could easily turn the hat on or off. The switch that I found can be purchased here.

- Wires

To connect components and create curves in the LED strips.

- Solder

To solder the various components to wires.

Tools

- Soldering Iron

- Wire cutters and strippers

- Scissors

- Hot glue gun

Other Materials

- Matte Black Spray Paint

- Painters tape

- Velcro

And of course you need various crafting supplies to decorate the hat after the LEDs are affixed.

Step 2: Pick Your Shape and Cut the LED Strips

After you've decided what shape you want, you can begin by cutting the strips so that you can make the correct shape. To make the high heel I printed an outline of a high heel and laid the pieces of strips on it to get the correct shape. Unfortunately I didn't take a picture until I had all the LEDs soldered. Wherever there is a bend in the shape there has to be a break in the LED strips.

When I made the Digilent logo I made two triangles of LEDs, the bigger one contained one more LED per side.

One very important thing to note in this step is that the shape will not result from the outline of the strips, but from the placement of the LEDs. Try to picture just the LEDs to make sure the shape will come out correctly.

Step 3: Solder the Strips Together

If you've never soldered or just would like more detail on this step I've also made a short instructable on soldering LED strips.

If not continue on to soldering, but read these tips, they are all based on mistakes I made.

3 Very important tips:

- Pay attention to the direction to the LEDs. They have Data in and Data out as indicated by the pins and the arrows on the strips.

- Make sure you solder the correct pins. If GND is soldered to one side of the wire, make sure the other side of the wire is also soldered to the other side. I made this mistake when I stopped paying close attention to it.

- If you make a mistake, de-solder the connection, do not try to rip it off the strip.

- Note the arrows on the strips. Make sure all of the arrows are going the same direction. This ensures each data out goes to a data in. The strips only go in one direction.

Step 4: Paint the LED Shape

Now that you've achieved the shape you want from the LED strips it's time to paint the strips.

I found it looked a lot better if the LED strips were painted the same color as the graduation hat you are using. If you use matte spray paint then the strips don't reflect as much so they look more like the hat.

Cover each LED with a piece of painters tape. If you have a single hole punch that makes the tape the perfect size to cover the LEDs.

Spray paint the strips and wires, making sure to get the sides and bottoms of the wires.

Wait for the paint to dry and remove the LEDs.

Step 5: Test the LEDs

The next few steps will set you up to program the UC32 to run the LEDs.

Once we program the UC32 we will finish assembling the hat. If there was a mistake made in soldering it is a lot easier to fix before the strips are attached to the hat.

Step 6: Download MPIDE

If you followed the Addressable LED instructable I recommended in the introduction you can skip this step as it should already have been done.

1. Download MPIDE using this link.

2. Unzip it into the directory you prefer.

3. Double click on the Application to open it

Step 7: Install the PICxel Library

If you followed the Addressable LED instructable I recommended in the introduction you can skip this step as it should already have been done.

In order to easily program the led strips you will need to download and install the PICxel library. This makes it so you can treat the LEDs like an array.

1. Click this link.

2. Open MPIDEGo to File -> preferences

3. Take note of the "sketchbook location"Close MPIDE

4. extract the PICxel library compressed file to the libraries folder in the "sketchbook location"if there is not a directory named "libraries" then create a folder named "libraries" (the folder name must be exactly "libraries".

5. Copy the PICxel-master folder into the libraries folder

6. Rename the PICxel-master folder to "PICxel"Now the library is installed in MPIDE

Step 8: Open the Demo or Write Code to Run the LEDs

There are a few Demos in the PICxel library that you just installed.

The sketch that runs the high heel is is a modification of the demo that is in the library that can be accessed as follows.

Open MPIDEGo to File -> sketchbook -> libraries -> PICxel -> PICxel_demo

The demo will open in the MPIDE text editor

I changed the number of LEDs and the colors from green and red to red and white.

The demo that runs the Digilent logo is attached to this step.

Step 9: Connect the LEDs to the UC32

Connect the ground wire from the LED strip to the GND terminal on the chipKIT

Connect the 5V wire from the LED strip to the 5V0 terminal on the chipKIT

Connect the data wire to PIN 4 of the chipKIT

Step 10: Upload the Sketch

Open MPIDE

Go to Tools -> Board -> chipKIT -> chipKIT UC32

Go to Serial Port -> Comm port assigned to the chipKIT when plugged in (likely the only one available to choose)

Go to File -> Upload to board to compile and upload the program to the board.

If "Done uploading" is displayed on the grey bar then your chipKIT has programmed successfully

If not then you probably chose the wrong comm port in step 3.

Try a different serial port and try again.

Step 11: Check to Make Sure All LEDs Work

Check that all of the LEDs work and are colored as expected.

If some of the LED's don't work, there may be a wire that is soldered incorrectly. Or the number of LEDs in the sketch isn't correct.

If the LEDs are the wrong color the program may be using the wrong color values or LED numbers.

Step 12: Position the Strips on the Hat

Peel the paper that protects the sticky backs of the LEDs off.

Position the LEDs where you want them, keeping in mind the orientation and location of the front of the hat.

Once you are sure of the positioning of the LED strips, hot glue the strips on the hat.

Also make sure that there is enough wire to the input of the strips so that it can reach to the edge of the hat and wrap to the bottom to put the UC32 underneath the hat.

Step 13: Solder the Switch

At this point if you decided to buy a switch, you should solder two wires to the switch. One on the pin marked switch and one on the pin marked ground.

The other end of the wires should be attached to the External Voltage input and ground of the microcontroller.

Glue the switch to the bottom of the hat. Since graduation hats are tilted down in the back it works best to have the microcontroller and switch glued to the back.

Step 14: Attach the Battery

Take two pieces of Velcro and attach one side to the back of the battery and one side to the back of the hat on the part that would go on the back of your head.

The battery will lie against the back of your head. I tried putting the battery on the brim, but it was just to heavy.

Even though my Velcro was sticky I found it helpful to also hot glue it on.

Cut a rectangle of black felt and glue the bottom and left side to make a flap on top of the battery.

Cut a thin piece of Velcro and use it to attach the other side of the flap down.

This way you can lift the flap to remove the battery. The Velcro on the battery helps it stay in place.

Step 15: Graduate!

Now you will have the flashiest hat at graduation. Go get that degree!