Introduction: Beat Detecting LEDs in Resin
In this instructable, I will show you how I created a resin cast LED strip that lights up based on music. Bear with me because I am somewhat of a novice but I will do my best to explain each part so that you can follow along and maybe make one for yourself. First off, I'd like to thank lonesoulsurfer as his projects inspired me to create this one (his are also a lot nicer looking but thats beside the point). Also this instructable by dwang4 was instrumental in the audio aspect of my project so I would like to thank him as well. This project is great for giving a visual identity to the music you love and works surprisingly well with most genres of music. Liven up your bedroom or a house party with this cool design and impress your friends! So without further ado...
Step 1: What You'll Need...
I've listed below all the materials I used to create this project. Not all of them are pictured in the photo so READ THE LIST to be sure you get everything. Some things could be considered optional depending on how you wanna adapt the project to be your own but I will merely be listing the things that I used.
1 x Breadboard
1 x Solderable breadboard or PCB (if you want to solder this to make it more stable. I'd recommend it)
1 x 9V Power Supply (I used a wall wart. You might want 12V if you're somehow managing to use the entire 5 meter strip, I only used a small section of it so 9V was enough for me. The 5V from the Arduino, I found, was not enough)
1 x LED Strip (I used the 5050 version which contains all three colors on each node. However, in some ways, I feel like the 3528 could create a better visual since each color is separated. It's up to you which you would like to use)
1 x Audio Jack
1 x 3.5 mm Audio Cable
1 x 3.55 mm Audio splitter (1 male to 2 females)
3 x N-channel MOSFET Transistors
3 x 10k ohm resistors
1 x 200k resistor
2 x 100nf ceramic capacitor
1 x 10nf ceramic capacitor
1 x 33pf ceramic capacitor
1 x Arduino Uno
1 x MSGEQ7 Integrated Circuit
1 x 8-pin IC socket (if you plan on soldering to a PCB of some sort. The chip can easily overheat and fry if you try to solder it directly)
An assortment of Jumper wires
1 x Clear Casting Resin (There are a variety of options when it comes to this but I simply linked the type that I used. 16 oz was just enough for my project but I bought the 32 oz just in case. It worked well enough and was simple to use. It was my first time using casting resin so the 1:1 ratio required from this type was the easiest to work with.)
1 x 3.5mm Male-Female Stereo Feed Through
1 x 2.1mm DC Power Inline Plug
1 x 2.1mm DC Power Panel Mount Jack (This is the one I used but I would recommend something longer as it didnt even fit all the way through the wood I used for the box. It still worked but it is far from ideal. But one with a longer jack if possible)
4 x 10mm insulated standoffs for your circuit board and/or arduino
Soldering Iron with Solder
Power sander (not needed but helpful)
Hot glue gun
Step 2: Wiring...
I've posted an image from Fritzing that shows how everything should be wired with annotations in case its hard to understand. If you follow this exactly, you should be able to hook it up just fine. Alligator clips will be handy here for testing purposes since you likely wont wanna solder to the LED Strip yet.
Step 3: The Code...
The coding is pretty straight forward but might require some tweaking to get it how you like it. I borrowed this code from dwang4's tutorial so thank you to him for his work on it. Other color organ instructables will have similar code that you can parse on your own. The filterValue integer and the delay value are the two that will have the greatest impact on the functionality of the lights. filterValue will filter out some of the lower frequency readings. Often times, the MSGEQ7 signal will have some small amount of noise. Tweaking this value allows your lights to react better with the music instead of being all of the place. I went with a really high value for mine (170) but you should definitely play around with it to see what suits you. The delay value is also something you should experiment with until you find one that reacts how you want for your project. Here is a link to a pastebin with the code that is also posted below:
int analogPin = 0;
int strobePin = 2;
int resetPin = 4;
int filterValue = 170;
int ledPinR = 9;
int ledPinG = 10;
int ledPinB = 11;
for (int i = 0; i < 7; i++)
spectrumValue[i] = analogRead(analogPin);
spectrumValue[i] = constrain(spectrumValue[i], filterValue, 1023);
spectrumValue[i] = map(spectrumValue[i], filterValue, 1023, 0, 255);
Step 4: Casting the Resin...
I won't claim to be an expert on this part of the process because, in fact, this was my first time doing such a thing. I cannot recommend enough the following tutorials by lonesoulsurfer. They will help tremendously so please read through them for the casting process: This one and this one.
Here is the steps I took to cast my resin.
1. Find what you want to use as a mold. I used a Crystal light drink mix container because I thought the shape was interesting but really you could use anything. You want a mold made of plastic (don't use any kind of paper or anything) or you can make a mold yourself out of a yard sign like in lonesoulsurfer's projects. Keep in mind that the resin will get very hot when casting so don't use too thin of a plastic or you might make a huge mess and ruin your mold. Also, you might have to destroy the mold to get out the dried resin so use something you don't mind throwing away afterwards.
2. Find a way to suspend the LED strip into the mold so that the wires are left exposed (you still need to solder these after so you definitely don't want them cast in there!! I just hung them with string into the contained. If you tape anything for any reason, it will become unstuck when the resin is casting from all the heat so keep that in mind. This part can be hard to get right so think hard and find a method that works for you. Mine ended up working fine but the LED strip became a bit crooked which was a bit annoying.
3. The clear casting resin is a two part mixture. The type I used was a 1:1 ratio for the resin and the hardening catalyst. You'll want to pour equal amounts into two separate cups then add them together at the same time into a mixing bowl. Stir them together for two minutes until you don't see any swirls in the mix and then you're ready to pour. Please please pleasewatch this video or read the instructions that come with the resin before you begin. You may even want to do a test casting before you move forward with a big cast so that you don't screw up your project and waste a lot of this stuff.
IMPORTANT NOTE: Don't dilly dally around during this part. You don't have a ton of time to work here before the chemical reaction occurs and the resin starts to harden. You don't necessarily have to rush but don't take breaks during this process. You'll also wanna be sure to wear gloves because this stuff is a skin irritant and a pain to get off.
4. Pour the mixed resin into your mold until the desired height and tap the sides to let some of the bubbles up. The resin has a degasser and will send bubbles to the surface. Every few minutes, you might wanna check to see if there are bubbles on the top. If so, you can breathe hot air onto it to remove these bubbles.
5. Wait 24-48 hours for it to finish hardening. You want it to be completely hardened before you start to sand off the imperfections.
6. As far as sanding, there are techniques to sand it to a crystal clear polish but I preferred it to be visibly sanded to give it a frosted texture that would help diffuse the lights. WEAR A MASK when sanding this stuff cause I'm pretty sure you don't wanna be breathing it in.
Step 5: Soldering the Circuit Board (optional But Recommended)
While the resin is casting, why not solder your parts to a proper board? This process is very simple even for a novice like me so there's really no reason not to do it. Soldering will make the circuit much more durable. With a breadboard, things can become unplugged fairly easily and also, breadboards are bulkier and harder to mount. So I would really recommend soldering.
I strongly suggest purchasing a protoboard (also called solderable breadboard) like the one included in the materials list and posted above. It makes things so easy and you basically just have to follow the breadboard layout as you solder. It really couldn't be simpler so take my advice and do it!
The process is pretty straight forward, just solder everything exactly how it is on the breadboard and youll be fine. The one thing of note is DO NOT solder the MSGEQ7 directly. Use the 8 pin socket like I told you! Trust me on this one. You don't wanna fry the chip and you will likely fry it if you try to solder the IC directly. One you have EVERYTHING soldered how you want, you can plug the MSGEQ7 into the 8pin socket (make sure its facing the right way according to the diagram I posted earlier). Voila! youre done. any free areas you have on the board can be drilled to make room for your standoff screws. Just make sure you're not drilling through anything important or you're going to be really upset.
Step 6: Building an Enclosure...
I won't go into too much detail on this but you should make a box (or buy one) that suits your needs and will fit all of your parts. I just picked up some wood at Lowes and glued it together with gorilla glue. I also used some hot glue to reinforce it so it would hold. I was totally clueless on how to make one but it's really pretty simple and turned out well enough. If you need help building a box, there is a plethora of resources if you do a google search. Find a method that works for you.
1. You will want to drill holes in the side of the box once its complete in order to have spots for your panel mount jacks (the audio and the power plug) and also some holes in the bottom for your standoffs. As you can see, I used an Arduino holder that was 3D printed. However, you can mount the Arduino directly with standoffs if you so choose.
2. If you want to paint or stain the wood, now is the time to do so. I used black spray paint because I didn't want the enclosure to distract from the focus of the project which is the flashing LEDs. This is up to you so get creative!
3. Connect the DC Power Inline plug into the Arduino and connect the wires to your DC Power Panel Mount. Each panel-mount jack is different so use your multimeter to find out which pin is which (mine was a 3pin plug but I only needed to use two of them).
4. You will also need to put your feed-through stereo plug in the hole you drilled and screw it in. Take the audio jack you wired earlier and plug it onto the male end of your audio panel mount jack.
5. For the lid, you will want to drill a hole in the middle for the wires from your LED strip to come through. At this point is when I soldered these wires to the ones coming from the circuit board. Also you can now hot glue your resin mold to the lid and it will hold it just fine.
6. Once everything is hooked up. Close up the box and it's time to see your project in action! Exciting, huh?