Introduction: Sound Reactive LEDs Bucket Hat

About: French human-robot interaction engineer. I look to make stupid things with LEDs.

A sound-reactive bucket hat, perfect to sport during the night or at raves. When the LEDs are off, it's a discreet accessory that gives no hint of its capabilities.

The project utilizes WLED, so it requires no programming whatsoever. WLED has multiple built-in animations, so you can just have an illuminated hat without the sound-reactive feature if you want, simply remove the microphone.

I crafted this project quite some time ago but it is still one of my favorite choice of wearable when I want to wear LEDs at a party. This project combines multiple craft methods which is why I think it's interesting :)

Supplies

Components:

  • Bucket Hat
  • WS2812b LEDs strip
  • ESP32/ESP8266
  • Fabric (preferably one that matches the hat!)
  • Light diffusing technique of your choice (I used baking paper)
  • INMP441 Microphone
  • 5v powerbank
  • Perfboard

Consumables:

  • Duct tape
  • Solder
  • Heat shrink tubing
  • Thread

Tools:

  • Sewing machine (you can also sew by hand, but obviously it takes more time)
  • Breadboard
  • Jumper wires
  • Soldering iron
  • Needles

Step 1: Fitting the LEDs

First things first, the LEDs! ✨

LEDs strip

I opted for the WS2812b, which are quite handy because they are relatively inexpensive, widely used, and operate optimally at 5V. Mine are 60LEDs/meter. However, you can choose a higher density if you aim to minimize the "dot" effect of the lights (bear in mind, more LEDs mean increased power consumption ;)).

Most LEDs strips come with pre-soldered wires at one end. If yours doesn't, you'll need to solder three wires (for data, VIN and GND). Ensure you solder them to the correct side of the LED strip (look for arrows marked on the strip). For the length, I'd suggest at least 40cm but it depends on where you plan to put the circuit when wearing the hat.

💡 You can also just solder them to a JST connector. This way, you can repurpose the circuit for other LEDs projects. (Unfortunately, this didn't cross my mind when I started this project ahah).

After soldering, encase the connection in heat shrink tubing to fortify it.

LEDs Placement

Start by wrapping the strip around the hat to find how many LEDs you'll need, It's a good idea to do this while wearing the hat, considering it might stretch slightly when on your head. You can then cut the desired length (if you're not sure, leave one or two extra LEDs that you can remove after).

To temporarily hold the strip in place, consider using duct tape. This will give you a clearer idea of how it'll sit when worn.

Step 2: Circuit

Before assembling your final setup, you will need to test first your circuit using a breadboard and some jumper wires.

The pinouts of your ESP might vary (for the final circuit, I used a LOLIN32), but the GPIO numbers remain consistent. To identify the pin locations on your specific board, simply search for "<esp name> pinouts" on the internet :)

LEDs connections

As mentioned earlier, ensure you connect the wires to the appropriate end of your LEDs strip.

WS2812b | ESP32 
---------------
DIN ----> GPIO2
GND ----> GND
VIN ----> 5V


Microphone

I chose the INMP441 microphone but as said above, feel free to use any microphone of your preference or even opt not to include one.

INMP441 | ESP32
---------------
VDD ----> 3V3
GND ----> GND
L/R ----> GND
SD ----> GPIO32
WS ----> GPIO14
SCK ----> GPIO15


Powering

I prefer to use a simple powerbank (you can find some easily on Amazon) that can be directly plugged into the micro USB port of the ESP. I use a 5000mAh one, which is sufficient for an evening's usage, but it may vary according to the brightness you set for the lights.

Step 3: WLED

WLED is a fantastic open-source project that enables control of LEDs strip animations and effects over Wi-Fi. The installation is effortless, truly a plug-and-play experience.

https://kno.wled.ge/

💻 Installing WLED

You can install WLED directly from their installer site! The process is pretty straightforward, just plug your microcontroller to your PC via USB (it might require some USB drivers to install if you're on Windows), select the version that you need (Sound reactive in our case, one of the latest releases otherwise).

If you chose the audio-reactive option, you might want further explanations that you can find here. It is also possible to use another type of microphone if you'd like.

🪄 Getting started

After the installation is done, you can set the wifi from your browser. I use personally the hotspot of my phone, as I mainly wear my hat outdoors.

I strongly recommend that you install the WLED app, available for both iOS and Android. You can easily connect, configure, and control your LEDs from there.

⚙️ Config

LED Preferences

You need to configure which GPIO you are using (by default, it's set to GPIO2, identical to our setup, meaning your LEDs should already be illuminated) and the number of LEDs.

Sound Settings

If you have a microphone, you should do the same. Options to adjust include squelch and gain. Alternatively, the Automatic Gain Control feature can be activated, especially handy if the device is to be used in diverse settings.

💡 Tips

Presets

You can set multiple effects as your favorite with their settings, to easily switch between them. In the LED settings, you can configure a default preset that will be used when you turn on your ESP32 (instead of the orangish solid one).

Create segments

Some effects are centered around the middle of your strip, if you've put the start of the strip on the side of the hat, it might be not centered at all! You can easily fix this issue by creating segments.

Explore!

There are tons of possibilities to customize your LEDs: Color palettes, effects, playlists, etc.

Step 4: Sewing

Once you've checked that the strip is working properly, it's time for the "packaging" phase.

Light diffusion

There are multiple options for you to consider, I recommend you check this video of Zibartas to learn more about light diffusion.

I opted for baking paper, mainly because it is cheaper and you can buy some at your local grocery store.

Hide the LEDs

The aim is to cover the LEDs so they are not visible when they are off, making the hat look totally like a normal hat.

  1. Wrap the strip with the paper, and place it on your fabric (ensure the fabric is not too opaque otherwise, the light won't be visible).
  2. Drap the fabric over the LEDs (make sure it's not too tight)
  3. Add pins along where you have to sew
  4. Pull off the strip, and it's time to sew!
  5. Once it's done, cut off the fabric excess
  6. Turn the fabric inside out, you can then put again the LEDs strip inside!

Fix the strip on the hat

With a needle and thread, hand-sew the strip onto the hat. Remember to create an aperture for routing the wires through. ;)

Step 5: Soldering

Once you've successfully prototyped the circuit using a breadboard, you can solder all parts together :)

I used a perfboard. These are available in multiple shapes and sizes, just make sure all your components fit in! I would recommend not directly soldering the microphone and the board of the perfboard but using extra female pins so it would be easier to change any part if one gets damaged.

For low (and cheap) effort finishing touches, you can wrap the finished circuit with some duct tape to slightly protect it However, ensure the microphone remains uncovered. Additionally, wrap the wires going from the hat to the circuit with tape (yeah it's a bit ugly but way more discreet).

Step 6: Et Voilà!

Congrats, it's done!

You can use the WLED app to switch between effects and colors 🌈

Here's a quick video of the final result (along with a very traditional French song 👌). Special shoutout to my teddy bear, Marcel, who kindly accepted to be my model for the occasion.

Wear It Contest

Participated in the
Wear It Contest