Sunday, September 27, 2015

Lightwad Top Hat

Introducing the Lightwad Top Hat

Burning Man has this way of causing otherwise reasonable people to spend their entire summer and thousands of dollars preparing for a week of suffering in the desert.

People go to Buring Man for all sorts of reasons. I, for one, enjoy playing the role of teetotalling, fully-clothed cyclist, lost in the desert on opposite day. But mostly, Burning Man is an excuse to build cool toys.

This year I built a shiny gold top hat covered with 480 addressable LEDs. It's driven by a Teensy 3.1 (96 MHz ARM Cortex-M4), which is wired up to a compass, gyro/accelerometer, GPS receiver, and a 2.4 GHz nRF24L01+ transceiver. I also built an Arduino-based wireless NES controller to operate the hat.

This thing was a real pain in the ass to build, but v2.0 is in the works (which I'm going to open source). I'm removing as much of the frustration as possible so you too can get asked to turn down your lights at Burning Man (true story).

Interestingly, not everybody who goes to Burning Man draws inspiration from the sun. There exists a special breed of burners known only as darkwads. The veritable ninjas of the playa, they stealthily remove all lighting from their person and bike. This enables them to dart around unseen once the sun goes down, only to reappear in front of moving art cars and bikes. I salute you, darkwads, for it takes a true hero to brave the playa at night with but a faded glow stick to light your way.

Despite my lifelong dream of being a darkwad, I lack the sheer dedication required to reach their level. Much to my chagrin, I was given the playa name Lightwad after rescuing a village of refugee LEDs and teaching them to love. In lieu of some web 2.0 cloud-enabled gluten-free short-on-vowels name, I'm calling this thing the Lightwad Top Hat.

By The Numbers

This project got a little out of hand, in the best way possible. It started out relatively modest, but I have this feature where I get really excited (drunk) and brainstorm (beerstorm?) more engineering work for myself.

  • Parts: ~$350-400 (excluding the battery pack)
  • Time: ~200 hours
  • Solder Joints: 364
  • LEDs: 481
  • Lead Fumes: Change places!

LED Matrix and Hat Construction

The core of the hat is a 48x10 matrix of WS2812B addressable LEDs (popularized by Adafruit as NeoPixels). I'm a big fan of these things because they're exceptionally bright, reasonably easy to work with, and can do well above 30 fps in a matrix this size.

I soldered the matrix together one column at a time, testing after attaching each column, and applying a layer of duct tape to the backside as I went. I attached power and data connectors to the beginning of the matrix, and a second power connector to the end. A strip of this length requires power at multiple points to maintain even brightness and color.

After soldering and testing the matrix, I applied hot glue to the ends of the silicone sleeves.

The main cylinder of the hat is made out of boxboard that I first covered in a layer or two of duct tape. I attached the matrix to the boxboard with double-sided tape, and applied some more hot glue for good measure.

I was in the mood to lose a little fingertip skin at this point, so I broke out the gorilla tape and wildly stuck it to everything in sight. The result was a cylinder of LEDs with some wires sticking out the top.

I then fashioned a cardboard divider to sit about halfway up the cylinder and serve as the top of the head (who said head?) compartment.

Before I started on the hat, I had ordered a couple shiny gold cloaks for the burn. It seemed too good to be true at $12/each from China, but I'm an eternal optimist. Sadly they weren't the luxuriously flowing wizard cloaks I had envisioned, but the fabric was still nice and shiny. To make the top and brim of the hat, I glued some gold fabric to cardboard, and willed it into shape.

The hat wasn't exactly comfortable yet, so I used a bicycle helmet padding kit to fit it to my head, and added a chin strap so I wouldn't lose it out on the playa.

Hat Electronics

Shiny gold top hats are cool, but shiny gold top hats that light up are even better.

Parts list:

  • Teensy 3.1
  • nRF24L01+ transceiver
  • u-blox NEO-6M GPS breakout board w/ U.FL antenna
  • HMC5883L compass breakout board
  • MPU6050 gyroscope / accelerometer breakout board
  • LM2596 based buck converter
  • 8x AA battery box
  • Industrial strength velcro

The hat electronics went through a number of revisions, eventually reaching the current design. The core of the hat is the excellent Teensy 3.1, which offers a small form factor, Arduino compatibility, lots of I/O pins, and a 96 MHz (when overclocked) ARM Cortex-M4. It has an nRF24L01+ transceiver to receive input from the NES controller, a GPS receiver (along with a compass and accelerometer) to guide you safely back to camp, and an LM2596 based buck converter to support various power sources if needed.

My initial plan was to use alkaline AA batteries to power the hat, and in that configuration, the electronics shared an 8x AA battery holder with 5x AA batteries.

This design had a couple flaws.

  • The buck converter I used in this iteration was generating a ton of heat, and while it had a very wide operating temperature range, everything in the enclosure was getting pretty toasty.

  • I neglected to RTFM on the WS2812Bs, and was incorrectly assuming that there wouldn't be much power draw from an "off" LED. As it turns out, the idle draw is roughly 6mW. Coupled with the rest of the electronics, the total idle draw is around 4.5 watts. With even a small number of LEDs turned on, the load caused a significant voltage drop, making alkaline AAs unsustainable.

I didn't like the idea of having a bunch of lithium batteries resting on my scalp, and additional alkaline weight would have been too heavy to wear. I opted then to use an external power source and a better buck converter.

I cleared out the rest of the 8x AA battery holder to give the components some breathing room (and make room for the new buck converter). It turns out that digging out a jumbled mess of hot glue and narrow gauge wire is a giant pain in the ass, so I velcroed the components in place in case I needed to fix a solder joint at the burn.

I assembled the hat electronics about as you'd expect -- wired everything up and tested it incrementally. I attached the enclosure (8x AA battery holder) to the hat divider with velcro, and added connectors for battery in, LED matrix data out, and LED matrix power out.

To power the hat, I used a 195 watt-hour lithium-ion battery bank, and kept it charged with a 10 watt ~18v solar panel.

Wireless NES Controller

What fun is a hat if you can't control it with a wireless NES controller?

Parts list:

  • USB NES controller
  • 2x AAA battery holder
  • 5.1 volt boost converter (like you'd use to make a USB charger)
  • SPST rocker switch
  • Arduino Nano
  • nRF24L01+ transceiver
  • 1x WS2812B LED
  • Vibration motor

I started with a cheap USB NES controller and retrofitted it with an Arduino Nano. It talks to the hat using an nRF24L01+ transceiver, and provides feedback to the user using a single WS2812B LED coupled with a cell phone vibration motor.

For DEF CON, I built an NES controller that can hijack Logitech wireless mice, and I quickly fell in love with using NES controllers as a platform for wireless input. The nostalgia combined with a sufficiently roomy case and simple PCB makes these things pretty fun to work with.

I had to make some modifications to the controller to fit all of the goodies inside. This required removing some plastic to provide access to the USB port, mounting the rocker switch, making room for the voltage converter and batteries, and mounting the LED.

The PCB also required some love. The largest thing in the controller is the 2x AAA battery holder, and I needed to modify the PCB to make room. Conveniently, the section of the PCB above the A/B/start/select buttons doesn't contain anything we care about.

As I approached the Ballmer peak, I tediously soldered everything together and hot glued that shit down.

The controller software is really simple, and just transmits a single byte each time a button is depressed. I included some basic rate-limiting logic to conserve battery, and further input rate-limiting is implemented on the receive end.

Lightwad Top Hat in Action

These functionality examples barely scratch the surface, and the real magic is going to come from community exploration of the software side of the hat.

Procedural Randomized Rainbow Tail

NES Controller Driven Rainbow Tail

Compass Demo

Version 2.0 (making it suck less)

This hat is pretty fucking cool, but it's certainly rough around the edges. I've been iterating on the design, and will be open sourcing version 2.0 as soon as it is ready.

If you're one of those maker-wizard types, you should probably start building one right now, but if you're a mere mortal like the rest of us, you'll probably hate yourself less if you hold off until v2.0.

If you want to stay in the loop, send me an email (gmail) at marc.newlin (or find me on the twitter) and you'll know the moment it's released.

Safety Third!