How to Make a Frequency Audio Visualizer for a Costume (Arduino Project)
by Mechanical Attraction in Circuits > Arduino
7411 Views, 25 Favorites, 0 Comments
How to Make a Frequency Audio Visualizer for a Costume (Arduino Project)
In this Instuctable, I will provide tips, plans, and codes to make an exciting audio visualizer built into a fiberglassed foam suit. Along the way I will share helpful steps and extra codes that some wanting to implement arduino FFT libraries into their projects could find valuable.
Materials and Prices
Before making the foam suit, I first made an array to learn how to make the FFT library work. The materials needed are:
- 2x 30 neopixel WS2812B strips......................................................................$3.22 a strip
- Arduino uno (used Chinese)...........................................................................Already owned
- Hook up wires.................................................................................................Already owned
- External power supply.....................................................................................Already owned
- Mounting surface (used Cardboard)...............................................................Already owned
- LM386 Audio Amplifier Module.......................................................................$8.98 for 5 units
- 3.5mm Stereo Audio Male to AV 3-Screw Terminal Female Connector..........$6.50 for 5 units
- 3.5mm Stereo Jack Female to Female...........................................................$5.99 for 6 units
- Breadboard......................................................................................................Already owned
To eventually adopt the setup for a suit with a microphone, the following is needed:
- 19 neopixel strip....................................................................................Cut from 5m of 300 LEDs for $26.67
- 5 neopixel strip......................................................................................Cut from same roll
- Arduino nano (used Chinese)................................................................$3.00 (5 for $15)
- Hook up wires........................................................................................Already owned
- Talentcell Rechargeable 6000mAh Li-Ion Battery..................................$29.99
- 3.5mm stereo audio male to AV 3-screw terminal female connector.....$6.50 for 5 units
- 3.5mm Stereo Jack Female to Female..................................................$5.99 for 6 units
- Switches.................................................................................................Pulled from broken car
- A costume..............................................................................................$50 for assorted items
Assembly and Wiring
Start with two strips of 30 WS2812 LED strips and cut them to 5 LED lengths of strips along the cutting lines. Glue these strips to a flat surface. In my example I used cardboard. Then wire the components together as shown. Make sure sufficient time is taken to insure good solder points. To make sure they all work correctly, use the examples within Adafruit's Neopixel library (the "Straintest" example works great).
Arduino Code
Only two libraries are required for this project.
For the FFT I used Open Music Lab's ArduinoFFT http://wiki.openmusiclabs.com/wiki/ArduinoFFT. Make sure you follow their installation instructions precisely otherwise it will not work. After installing it correctly I would still get error messages regarding an "invalid library," however everything still worked for me. Comment if you identify what I missed. For the neopixels I used Adafruit's NeoPixel library (as previously mentioned). I recommend using the Library Manager within the arduino software to install.
The SuitFFT file is the code running on the Suit with all the extra inputs from my controller. LightShowFFT is for the aux input 60 LED array.
Both of these codes can be made to run faster by reducing N. N in my examples is 256 and found that it is more than suitable for my projects. I experimentally found that the full audio spectrum worked far past 9 kHz as seen tested on the next step!
What the FFT Is Doing
An FFT or Fast Fourier Transform takes a signal and transforms it into the frequency domain. What each of the lights show is a frequency bin. Since the FFT is a mathematically complex calculation one can make the code run faster by limiting the number of samples. However the frequency resolution will suffer. For lack of words, the FFT in the Arduino is a balancing act between: sampling rate, number of samples, loop time, and more. I encourage others to play with the settings to find what works best for their own project.
Now time to make the suit.
Costume Tips
My costume was made from foam where many other Published Instrucatables have better covered the topic. The difference with mine was that I took extra steps to bondo, fiberglass, and paint. Tips for that are as follows.
- Do great prep work (taping, masking, etc) as it makes a huge time difference later
- Always mix bondo and fiberglass in small quantities
- Use Bondo to fill voids
- Use fiberglass resin to seal in and strengthen
- Use fiberglass cloth to better stiffen weak points
- TAKE your time and be patient with your work
- For sanding
- 40-100 grit to removal material
- 100-400 grit for primer prep
- 400-1000 grit for sanding primer
- 1000-3000 grit for sanding paint
To mount the neopixel strips I used hot glue to fixed the strips in place. A few challenges now are to make it battery supplied, microphone sensing, controller operated, and more.
Making or Picking a Controller, Wiring It In, and Code
Any switch or switches can be used. For my project I found the window controls of a 96 Honda Prelude worked great. After removing the switches from their housing, I used a multi meter set on continuity mode to find which wire did what, once the switches where pressed (note that sometimes switches break the continuity). I decided to make the toggled window lock, lock the controls from accidental hits, window up and down for brightness controls, and the last switch for "light modes."
For the switches to work properly, pull down resistors are needed. Normally 50-100 kΩ resistors will work but a few switches had to use a much lower resistor (some around 300 Ω) to change the voltage enough for the Arduino to properly interrupt the digital input (roughly less than 0.3*Vcc for low and greater than 0.6*Vcc for high). Anyone doing this needs to go switch by switch, preferable with a bread board first to make sure the controller works properly.
After figuring out the switch, I soldered the components together using the diagram shown. Use a PCB circuit board to better fixed the components. Refer to the picture for a detailed look. The 19 LED array goes down the spine of my suit and the other on the front as an indicator of what is going on.
To fix the controller to the suit, I used hot glue to place it. Then I made smaller foam wedges and hot glued them in as well to support the controller.
Downloads
Final Touches
To finish up, cut slits in the foam to run the wire through. Secure the wires with hot glue. For extra touches I also bought a few additional items to "seal the deal." I figured... if you're going to go out looking ridiculous in a light suit, go the extra step!
That's It! (Plus Trouble Shooting Tips)
Thanks visiting my instuctable and have fun you DIY-ers!
Trouble shooting tips from project experience:
- If lights act weird (flickering light, not all properly working, unusual colors)
- Poor power supply to lights
- Multiple power supplies
- Don't string so may neopixels together
- Run extra power lines to strips
- Code problem
- Check number of lights is correct
- Check to see if code is correctly displaying lights and frequency bins
- Poor power supply to Arduino
- Increase power supply
- Voltage from Arduino to neopixels off
- Use same power supply to power both
- Poor power supply to lights
- Lights on but no FFT
- Check wire from amplifier and amplifier power, grounds, and input
- Increase/decrease amplifier gain
- Poor power to lights