Intro: Pulse (Volume Activated LEDs)
Have you ever wanted to build something with LEDs, but were not sure where to start? This guide will give you some easy to follow steps to design your own volume-visualizing code for addressable LED lights. This is a fun desktop noise meter, rave device, workshop noise warning system, or the like. If you want, feel free to follow my component housing design, but beware that my box is not an entry-level shape and I will not cover how to make it here. However, feel free to get creative or try to copy it from the images.
To start this project you will need:
Adafruit NeoPixels (or other comparable addressable LEDs)
I use concentric LED rings bought from amazon.
Separate Power Supply (If more than 8-10 LEDs, an external battery pack will do)
Solder and Soldering Iron
Some Sort of Component Housing
Step 1: Familiarize Yourself With Arduino
If this is the first time you are attempting a project with Arduino or anything with wiring, I suggest you look at the tutorials below. It is important to learn how to do the basics before you try attempting to alter code or work with the equipment. This will allow for less mistakes and also less injury. If you are already comfortable with Arduino and wiring, then by all means, feel free to skip these.
Step 2: Setting Up the Wiring
In order to set up the wiring I recommend drawing out a diagram. In the examples below you can see how I have wired my system as reference. It is messy in actuality, but is way easier to understand on paper. Break out the pen or pencil and go for it.
For the process of setting up your lights, make sure to solder wires to direct in, power, and Ground. These wires will then be inserted into the Arduino board at 6, 5v, and gnd respectively. Note that if you have lights like mine you will want to solder from direct out to direct in between LED sections. This allows for the LEDs to be addressed in number order, like a strip of LEDs.
• Warning – read below if you have over 8-10 LEDs connected together
When setting up the microphone, solder the wires to vcc, gnd, and out. The other ends will then insert into the 3.3v, gnd, and A0 respectively.
Assuming all is good and everything is attached you are now ready for code, except if you have a lot of LEDs. As warned this can be problematic, because the Arduino board can only power so many lights. You will need to connect an external power source, such as a battery pack. To connect the battery pack you will need to connect the lights power and ground directly to the battery pack power and ground by soldering. The catch here is to solder an extra wire into the ground connection that will tie into the Arduino board. These elements must share ground or otherwise you will get random LED flashing or other errors.
Step 3: The Code
Congratulations! You have made it to the next exciting step. At this point you should have a cool setup that unfortunately does nothing. Exciting, I know. If it is doing something then you may be hallucinating or perhaps you’ve already plugged in and there is some old code running. Let’s get the new code in there. My code is attached below.
This code works by first setting up the LEDs by calling the NeoPixel library, defining the inputs and outputs, stating the number of LEDs, and setting the brightness and sample frequency. In the setup code, the strip is set to the brightness and the LEDs are initialized off. The last part of the code is where all the fancy stuff happens, this is where the volume is analyzed and the peaks are measured.
In the audio visualization piece, a frequency is sampled by the microphone, read, and then correlated to the lights when within certain ranges. The lights then can be controlled in groups and adjusted as seen fit for color, rate of refresh and other fun things.
Here are some key ways in which you can alter the code. First off, the color can be easily switched. Inside the code for each ring there is a tag that looks like (i, (0,0,0)) here is where the color can be altered by changing the numbers. The three digits are for red, green, and blue and dictate the amount of each. As you can see, my code does have different color values.
Second, if you want to adjust how loud things get before the lights active you will need to change the value at the beginning of each “if” statement. It looks like (<=number), the higher the number the louder the sound has to be to activate it.
If you want to get fancy you can also adjust how the lights are activated. For example, you could recode to have the lights fade instead of blink, change color over time, over even have frequency activation. The options are many and pretty limitless, if you know what you are doing.
Step 4: 30 Second Dance Interlude
If you have got the code running, then by now you have seen the magic. There is something about sound reactive lights that is very mesmerizing. If you haven’t jumped up and gone to grab someone to show them what you just did, then go, I’m sure others will be interested.
Step 5: Back to Business
It is finally time to design the housing for your electronics. Feel free to go as simple or as complex as you want, it’s really only limited by your skill with tools. Above is an example of what I did, but remember the Arduino board needs a place to be mounted and there has to be a hole or something for the microphone to be able to listen well.
Step 6: Assembly
The final moments are now upon you! Figure out the ways you want to secure your parts down and go for it. You’ll soon have a finished product and something you can be proud of. Above are the pictures of ways I decided to go about securing pieces.
Step 7: Finished
Congratulations for real this time! Throw yourself a party to celebrate…no really, throw yourself a party and put this thing out. Your finished piece deserves to be shown off.
It’s my hope that during this process you learned a little something about how to code, how to build, and how to have fun, because we all need to have a little fun. Please upload any further additions or alterations; I love to see what others come up with, especially if you can get this to read frequency instead of volume. Happy building and making!