loading

I've recently discovered Neopixels. I soldered a couple, connected them to my Arduino and made them do various light patterns. This was already pretty enjoyable to make and watch, but Neopixels have so much more potential!

First of all, they are very small, so you can embed them in a lot of things. They are also pretty easy to control and only take up 1 pin on your Arduino.

Therefore I felt like I had to do something cooler with my Neopixels. I decided to make a sound reactive string of LEDs that I could potentially hang in my room or in the christmas tree.

In this Instructable I will explain how I made my Neopixels respond to music or sounds!

This is what you'll need:

I highly recommend pre-soldered WS2812B's since the LEDs are not very easy to solder. Buying the pre-soldered ones will save you a lot of frustration.

Step 1: Soldering the LEDs

We're going to start with soldering wires to our WS2812B LEDs.

If your WS2812B's are not pre-soldered, make sure to solder a 104 capacitor on each LED between the VSS and VDD pin. If your LEDs are pre-soldered you don't have to worry about this, since it probably already has one built in.

The next step is to solder all the wires (see image). All the VSS pins have to be connected. The VDD pins also all need to be connected. Make sure to solder two extra wires on the first LED of your series. One from VSS to GND (Arduino) and one from VDD to 5V (Arduino).

Next you'll need to connect DOUT (data out) from the first LED with DIN (data in) on the second LED. Then you'll connect DOUT from the second LED with DIN on the third LED, etc.

Connect DIN of the first LED with pin 6 on your Arduino.

---

Test your LEDs to see if everything is working correctly. You can do this for example by using the strandtest sketch of the Adafruit Neopixels library. I didn't test my LEDs while building and ended up finding out at the end that green is broken in the third LED of my string. I'll now have to desolder everything and add a new LED. It saves you a lot of trouble if you test early!

Step 2: Connect the Microphone

Next up is the microphone. Solder wires to your microphone.

Connect the negative leg to GND on your Arduino. Connect the positive leg to a 10k resistor and to pin A0 on your Arduino. Connect the other side of the resistor to 5v on your Arduino (see image).

My microphone came with a plug so as you can see on the picture I connected it via a socket from another protoboard. The rest of my setup is the same as the image though.

Step 3: The Code

Now that everything is soldered, it's time for the code. I found this Trinket project that turns Neopixels (WS2182B) into sound reactive LEDs, but the code also works on Arduino.

We'll need to edit a few things in the code.

I used 4 WS2812B LEDs for this example. If you used more or less than 4, you'll need to change that in the code. On line 6 you'll see the following code: #define N_PIXELS 4 - Change that 4 to the number of LEDs you're using.

Next we'll have to define the noise level on line 9. This is a bit of trial and error. You'll just have to run the code and see if the microphone is too sensitive or not sensitive enough. If the microphone is not sensitive enough you'll need to lower the number on line 9.For example: change #define noiseLevel 2 to #define noiseLevel 1.

If your microphone is too sensitive. You'll want to raise the number. For example: change #define noiseLevel 2 to #define noiseLevel 6.

You also might want to change the fade delay on line 8. If your LEDs are blinking too fast, you'll want to raise the number. For example: change #define fadeDelay 10 to #define fadeDelay 50. If the LEDs are not blinking fast enough, you'll want to lower the number.

Step 4: Test Your Musical LEDs

Now that everything is soldered and the code is set up correctly, it's time to try your LEDs.

Connect the wires to your Arduino, plug it into your PC and upload the code.

Now put on some music and see if the LEDs are changing!

If they're not really changing color or not turning on at all, there is a couple of things you can do. Same goes for when your LEDs are changing too much.

  1. Change the noise level in the code. See previous step on how to change it. Change it until you're satisfied.
  2. Try and turn up the volume of your music (or lower the volume if they're changing too much)
  3. Try to put your microphone closer to your music source (or further away when changing too much)
  4. Change your 10k resistor to for example 1k or 100k. For my microphone 10k was working best, but your microphone might need an other resistor.

Step 5: Make the LEDs Pretty!

Next are the caps for the LEDs. The LEDs are fun by itself, but they're even more fun with a nice cap. You can use a 3D printer to print a cap, you can fold one with paper, or even build your LEDs into a christmas ball or ornament!

I made my own caps with paper. The folding instructions are attached to this Instructable.

If you unfold one corner (after you folded the whole thing) it gives you just enough space to slide a LED in (see images).

Make a cap for each LED.

Step 6: You're Done!

Now that your caps are done, there's only one thing left to do... Hang them in your christmas tree and watch them dance to your christmas music!

Please let me know what kind of cool stuff you made using this Instructable :)

And Merry Christmas in advance!

<p>verry nice and got it working. but i want to change the way the leds are reacting on the music. like the examples in neopixel or the effects in fastled.</p><p>how to do that</p>
<p>Very nice..coincidentally, I'm working on something very similar...is the 104 cap mandatory? I presume it its to ensure filtering of the power supply but if I'm using a regulated +5v supply to the entire bunch of LEDs, do you think I'll need it?</p>
<p>To be honest, I'm not a 100% sure. Adafruit only put a large capacitor between the + and - terminals of their power supply: <a href="https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices" rel="nofollow"> https://learn.adafruit.com/adafruit-neopixel-uber...</a> but they're using a LED strip, and by the looks of it I'd say it already has a build in capacitor for each LED.</p><p>However when you use an Arduino and power only a few LEDs, you might not need capacitors. I have previously connected about 5 LEDs without a capacitor. A couple of them started to act weird though, and adding a capacitor to each LED solved the problem.</p><p>So as long as you only connect a few you can probably do without capacitors. If you're planning on connecting a whole bunch, I'd recommend the capacitors.</p>
<p>The big cap they use is to prevent damage to the first LED in the strand. They were using a bigger power supply to power the strand and it has a chance of blowing out the built in cap so adding the big cap on the power supple prevents that initial surge. It is a poor man's surge protector.</p>
Thanks for the prompt response...I happened to solder quite a few without them...realised that I may have to redo all of them and was trying to understand if there's a way out :-)<br><br>I'll post on the Adafruit forums as well and see if I get a response.<br><br>Cheers
<p>Hello, will this wor with a project that when i speak near the mic it turns the NeoPixels on and whe i stop they turn off? no fancy fading ect?</p>
<p>I made this it and it worked some what, but noted I had to have the Vol. up High and I used 2 Mics for this. I used a sound mod. board that I made so I could Ajust both Right &amp; Left outputs. if you have a better way of doing this let me know?</p>
<div>&auml;<br><div><p>In my opinon, it is way better to actually sample an audio-source (as in, read the signal straight off of an unused output) instead of using a microphone. </p><p>For something like bass detection, a simple lowpass filter on your audio signal is enough to produce a reasonable voltage to get with analog.Read(), which can then in turn be mapped to the PWM of some LEDs for exampe.</p></div></div>
Good work
<p>Your nice build and christmas music</p><p>Merry Christmas!!!</p>
<p>Your nice build and christmas music</p><p>Merry Christmas!!!</p>

About This Instructable

24,667views

160favorites

License:

More by anouskadg:Dr. Who Tardis - IoT Door Sticker in Illustrator Galaxy Sneakers 
Add instructable to: