Introduction: My Hat, It's Full of Stars!

Top hats are cool; just like bow ties.  Not only are they stylish, but they give you a lot of room for incorporating techno goodness.  I recently had cause to buy a tuxedo, which necessitated a kilt, and then a top hat.  You know how it goes.  To the tux I added silver buttons, the kilt was exemplary on its own, so only the top hat needed some flash.  I decided that since my head is generally in the stars, I should try filling my hat with stars.  Initially I was going to use an arduino and some 1W white LEDs hanging off the PWM lines, and feeding the light through fiber optic lines, to create a twinkling effect.  By the time I started work on the project I realized that I wanted colors, and that 1W LEDs were going to drain my LiPo battery pretty darn fast.  Multiple color LEDs on a single arduino is a bit of a problem, though.  There are only six PWM channels, so I would max out at two RGB LEDs.  Fortunately I had a few sample Total Control Lighting control chips from Cool Neon in my kit, and with a little hacking they are perfect light sources for this project.  Each TCL chip is a latching, addressable, three-channel PWM controller; so I can control a near infinite number of RGB LEDs from a single arduino.  Hat space is limited though, so I settled on four; that provided sufficient variety.  The end result of my project is a super-stealth techno-mage top hat that looks amazing when it is turned on, and completely normal when it is turned off.  I can wear it to Dicken's Chrismas Fair and nobody will notice, or to That Thing In The Desert where everyone will notice; one hat for all occasions.

I built this project on-site at Burning Man, with only the tools and parts I had in my travel kit.  You should be able to complete this project in two days, accounting for glue drying, using easily available parts for less than $200.



tl;dr This article will walk you through every step necessary for adding multi-color dynamic fiber optic lighting to your hat, or any other project to which you want to give a star field effect.

tags:  SteamPunk, Arduino, TopHat, LEDs, TCL, PWM

Step 1: Parts

Almost everything used to make this project is 'off the shelf'. While something may not already be in your toolkit, there isn't anything here that will be hard to find or for which you won't be clever enough to make a substitution. :)

- Top Hat (Amazon) ($79)
- Optical fibers (I used 156 x .03" fibers I had in my kit, cut to around 12") (ebay) (1' = $12.95) (For my most recent hat, I purchased my surplus fiber from this guy on eBay. Here's a link to his store.)
- 4x Cool Neon TCL controller chips (Not on their website, but $2 w/LED if you call them directly) (4x$2 = $8)
- 4x 8mm RGB common anode LEDs. (Got mine from Cool Neon, paired with the TCL controller chips)
- 2000mAh Lithium Polymer rechargeable battery (Cool Neon / Seeed Studios) ($12)
- LiPo Rider recharging module (Cool Neon / Seeed Studios) ($9.50)
- Seeeduino (Cool Neon / Seeed Studios) ($27)
- 40-pin IDE cable (junk drawer)
- bits of velcro (Home Despot)
- 1/4" heat-shrink tubing (Cool Neon - Ask, and they'll throw some in with your order.)
- 2x short USB to USB-mini cables
- 3"x2" piece of cardboard

Cost of major parts (including hat): $159.50

Step 2: Tools

Everything here should be fairly standard.  The one item here that will probably need to be substituted out is the hypodermic needle.  Threading the fiber optics is a lot easier with a needle that has a dimple in the point, but any large needle should do, with a little extra care.

- Computer with Arduino IDE installed, and internet access to download libraries and code.
- Wire strippers
- Needle nose pliers
- Soldering iron
- adjustable clamp stand
- 28 gauge hypodermic needle (Any thick craft needle will do, but the hollow tip of a hypodermic needle makes it easier to lead the optic fiber back through the hole)
- small paintbrush
- flush-cut wire cutters
- heat gun
- electrical tape
- wood glue (Home Despot)
- Liquid Electrical Tape (Home Despot)
- solder
- masking tape
- zip ties

Step 3: Secure the Optical Fibers to the LEDs

It's a bit easier to do this step before the LEDs have been attached to the TCL chips. 
 
- Cut four 2" pieces of 1/4" shrink tubing. 
 
- Fit the shrink wrap over the light emitting end of the LEDs.  You may need to stretch it out just a little more with the needle nose pliers.

I suggest doing the following steps one LED at a time:

- Pack the open end of the shrink wrap with optical fibers. 

- Using the .03" fibers that I had on hand, this came out to around 40 fibers per LED. 

- Heat shrink the tubing around the fibers, and very carefully around the LED as well. 

- For extra strength, wrap some electrical tape around the shrink wrap and LED.

-I bound the shrink wrap with zip ties over the LED and the fibers, to provide extra support.

Step 4: Wire Up the TCL Chips

The key to this project is the TCL controller modules.  Without them, I'd be limited to six monochrome LEDs, or two RGB LEDs, because the 'standard' Arduino only has six PWM pins.  By daisy chaining TCL modules, I can hang a spectacularly large number of RGB LEDs off a mere two pins, leaving me plenty of other input and output pins. 

TCL controller modules are four connectors on the front, and four on the back, for communication:  Ground, Clock, Data, +5V
These are daisy chained from chip to chip, simply matching the corresponding connections.  The order is reversed on the back, but I think the pictures below will be better than a thousand words of explanation.

When bought in quantity they come in a perforated block. I left the chips in a solid four chip strip to minimize footprint.

- Cut a four-conductor strip off a spare IDE cable.  I used an old 40-pin cable, because they have wire than the newer 80-pin cables. 

- Cut this into one six inch segment, and three two inch segments.

- Strip the ends of all segments back about 1/8 of an inch.

- Solder the six inch segment to the chip side of the TCL module you are designating to be #1 in the series.

- On the reverse side, solder one end of each of the two inch strips to modules number 1, 2 and 3.

- Back to the front, solder the free ends of the two inch strips to modules 2, 3 and 4 on the corresponding pins.

Now that you have the TCL chips daisy chained, with a six inch control lead, we are ready for the LEDs.  I mounted my LEDs alternating front, back, front, back; to make running the optical fibers evenly a bit easier.

- Align the cathode pin with the hole marked +5, and the rest of the pins line up.

- Push the leads through the hole as far as you can, solder and cut them.

Step 5: Wire the TCL Chips to the Controller

Let's wire up the kit and test it out. I soldered my wiring to the Seeeduino, but you can temporarily use the shield connectors to test.

- Split the ribbon into four separate wires, about two inches from the free end.

Working the wires left to right, as connected to the chip-side of TCL module #1

- connect wire 1, GND, to GND on the Seeeduino

- connect wire 2, clock, to pin 13 on the Seeeduino

- connect wire 3, data, to pin 11 on the Seeeduino

- connect wire 4, +5, to +5 on the Seeeduino


At this point, we should be ready to program and test.

- Download the TCL library and install it into your IDE.

- Download the TopHat sketch, and open it in your IDE.

- Use the IDE to download the TopHat sketch to your Seeeduino.

Once it finishes downloading, the sketch should automatically start, and you will notice that the fiber optic bundles are color cycling.

Step 6: Tying the Electronics Together

The power supply for this project is pretty simple.  I taped a LiPo Rider charging module to a 2000mAh Lithium Polymer battery, with a piece of cardboard as an insulator so the solder points on the bottom of the LiPo Rider can not damage the battery casing.

The LiPo Rider is a nifty module.  It does USB pass-thru, so you can power and program your Arduino/Seeeduino without disengaging the LiPo Rider.  While you are working on your project, the LiPo rider is charging your battery.  The LiPo Rider will also accept power from solar cells, for charging.  For complete details, check out the LiPo Rider wiki page.

- Cut a piece of cardboard to the size of the LiPo Rider, sandwich between the LiPo Rider and the 2000mAh battery, and secure with electrical tape.

- Connect the Lithium Polymer battery connector to the BATT terminal on the LiPo Rider

- Connect the LiPo Rider and Seeeduino together using a short USB cable

- Flip the LiPo Rider switch to the on position, to verify that your Seeeduino and LEDs are receiving power.  Once tested, flip the switch off to conserve power.

Step 7: Stuffing the Hat

Since I didn't plan on having any stars on the top of the hat, I chose this as the place to secure the electronics.  These steps assume the LiPi Rider and Seeeduino are still connected by a USB cable, for the last section.

- Place the top hat upside down on a clean flat surface.

- Attach some Velcro the 'top' side of the LEDs, wiht top defined as the part furthest from the ribbon cables.

- Attach velcro to the bottom side of the Seeeduino and the LiPo battery.

- Peel the backing off the Velcro.

- Secure the TCL/LED module to the center of the flat space at the 'bottom' of the hat.

- Secure the LiPo battery and Seeeduino to the sides of the LED array.

- Attach a mini USB cable to the LiPo Rider.  We'll leave this attached permanently, as a way to charge the battery and re-program the effects.  Tape the free end of this cable to the outside of the hat using masking tape.

My apologies about this picture.  I forgot to take one immediately after securing the electronics, but before threading some of the optics.  You'll get the idea though.

Step 8: Threading the Optics

This is by far the most tedious and time consuming part of this project.  Depending on the thickness of the optical fibers you chose, you've probably got 160+ optical fibers to thread through the hat and secure in place.    This phase is less step-by-step and more play it by ear, depending on the tools you are using and the way you want to stars to align.

I worked from the 'bottom' of the upside-down top hat.  I would randomly grab a fiber from one of the four bundles.  I would push my needle through from the outside, and then I would draw it back out following it with the chosen fiber.  I would pull as much slack out as I could, but I wouldn't draw it tight; you need some play in the fibers at this stage.  I worked around the hat in a circle, picking random placements; and then every cycle or two I would look for obvious gaps and fill them in.

You might want to create bands of like colors, or other patterns, and you will need to adjust your tactics accordingly.

After all the fibers are threaded through, you want to make sure you have enough slack in the hat to remove components in case you want to add to the design later.  You also need to be able to reach the power switch on the LiPo Rider.

Once you are happy with optics placement, it is time to glue it all down.  For the first pass I used carpenter's glue because it would bind well with the wool of the hat.  Using a small, but long, paint brush I applied glue to each fiber and a circle of hat around the point of penetration.  I gave this a day to dry.

Carpenter's glue can be pretty brittle, so I then used 'liquid electrical tape' to add a flexible layer on top of the anchoring glue.  Again using a brush, I painted over the carpenter's glue on the hat and fiber, and then a little further inward on the fiber for extra support.

Once I was sure the fibers were sufficiently secured, I used flush-cut clippers to trim the fibers flush with the surface of the hat.

OR...  You can leave the fibers swaying in the breeze.  The first night on the playa, before the glue was fully dried, I wore the hat out for a burn.  The fibers would swing in little circles every time I turned my head.  Everyone thought it was amazing, but since I wanted to wear the hat in other venues, I decided to trim them.  You might want to play with it for a while after the glue dries, and see which way you want to go.

And now you are ready for a night of trick-or-treating in your sparkly new hat.

Step 9: Final Touches...

I have a couple of last tweaks I want to make to my hat, that didn't make it into this tutorial.

1) Add a solar panel or two to the top, for self-charging.
2) Add a Cool Neon "Remote Shield" RF controller so I can change the programmed effects without taking off the hat.

I've added gamma correction, and code for working with the Cool Neon Latching Remote Module. Check it out at the github repo: https://github.com/ghstwhl/hat-full-of-stars

Have a suggestion for me? Please share it in the comments!

Thank you for your interest, and for making it to the last page. :)

Step 10: Supercharger!

If you want more variety in your colors, the NeoPixel FeatherWing could be just the thing for you. 32 RGB pixels, and the FeatherWing is Arduino compatible and includes a LiPo port with charging capabilities! The only bad thing is that it would be really hard to attach fiber optics to the pixels. That is, until now... Check out this 3d printable fiber optics guide designed for the NeoPixel Featherwing!