loading
This is a guide to make an LED flashing circuit that "beats" to an mp3 file on your computer, which can add an awesome effect to any sound-related device, or even your room (if you extend the concept with LED drivers or plenty of resistors/transistors).

The LED flashing circuit makes use of the Minim audio library and the Arduino program Processing to analyze sound, producing a response based on a snare drum hit, a bass drum hit, and a hi-hat hit from the percussion of the audio file.

Step 1: Parts/Tools Needed

Here is what you'll need to make the LED beat flashing circuit:

Hardware:
1. An Arduino microcontroller board. There are many versions of the Arduino, but I would recommend the Arduino Duemilanove. You can buy one online for around $20.
2. Three LEDs (different colors preferred, so you can see the difference in beats easier - I used a red, yellow, and green LED)
3. Three resistors (depending on your LEDs, the resistor value will be different - check the ratings on the LEDs to see what resistance corresponds to their maximum brightness, without burning them out)
4. A solderless breadboard
5. Some wire, to use as leads from the Arduino to the LEDs/resistors on the breadboard
6. A computer
7. A USB cable (A to B)

Software:
1. Arduino Software Environment
2. Processing Software Environment
3. The "arduino" library for Processing
4. The BeatWrite / BeatListener code from the minim JavaSound library examples

Download links for the software will follow in Step 3.

<p>what did I do wrong here? there are so many errors</p><p>it also keeps saying that all of the libraries but processing.serial haven't been downloaded, but I thought that the minim library came with Processing, so I'm not sure what the problem is. Please get back to me as soon as possible!</p>
<p>now it says that the ddf.minim library and the sun.audio library don't match, and also the the sun.audio library can't be found. is there something else I need to download?</p>
<p>Can some one please help :( I have no idea what this is and I've been at this for hours. It says &quot;unexpected token&quot; and it has line 19 highlighted &quot;Minim.minim;&quot; </p>
<p>You didn't install the minim library. Minim comes included by default on Processing 2 but not Processing 3.</p><p>To install it on processing 3, click sketch &gt; import library &gt; add library, then search for minim and click install.</p><p>Hope this helps</p>
<p>Has anyone tried to build it on Android Mode with Android SDK? I have tried but still stuck with error as below.</p><p><em><strong>[dx] </strong></em></p><p><em><strong> [dx] PARSE ERROR:</strong></em></p><p><em><strong> [dx] unsupported class file version 52.0</strong></em></p><p><em><strong> [dx] ...while parsing ddf/minim/javasound/BasicMetaData.class</strong></em></p><p><em><strong> [dx] 1 error; aborting</strong></em></p><p><em><strong>BUILD FAILED</strong></em></p><p><em><strong>C:\Program Files (x86)\adt-bundle-windows-x86-20140321\sdk\tools\ant\build.xml:888: The following error occurred while executing this line:</strong></em></p><p><em><strong>C:\Program Files (x86)\adt-bundle-windows-x86-20140321\sdk\tools\ant\build.xml:890: The following error occurred while executing this line:</strong></em></p><p><em><strong>C:\Program Files (x86)\adt-bundle-windows-x86-20140321\sdk\tools\ant\build.xml:902: The following error occurred while executing this line:</strong></em></p><p><em><strong>C:\Program Files (x86)\adt-bundle-windows-x86-20140321\sdk\tools\ant\build.xml:283: null returned: 1</strong></em></p><p><em><strong>Total time: 26 seconds</strong></em></p>
<p>It all worked out fine for me but the LEDs are not as in sync as I was hoping them to be. I hope to make improvements on the software myself. Has anyone else tried this?</p>
<p>would it be possible to make a cube of LEDs 3 by 4 on each side? </p>
<p>How to fix this?</p><p>No library found for ddf.minim</p><p>No library found for ddf.minim.analysis</p><p>Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.</p>
<p>Put the arduino library in <br>Documents&gt;Processing&gt;libraries, and if it doesn't work use <br>processing v2, download it from here : </p><p><a href="https://processing.org/download/?processing" rel="nofollow">https://processing.org/download/?processing</a></p><p>(Run processing at least once before doing that to create the Processing folder in Documents)</p>
<p>It works. Thanks for the great work. But may i know how do i store it into the arduino. because everytime it finish, I've to click play on processing in order to work again.</p>
<p>can you help me please , i'am stuck in this</p><p> Go to File -&gt; Examples -&gt; Firmata -&gt; StandardFirmata, and press the Upload button on the Arduino SE (see image 2).</p><p>and i don't found upload !!!!!!</p>
<p>Ctrl + U, just press it after the window of StandardFirmata opens up</p>
<p>Once you have loaded the code and selected the type of Arduino you are using as well as the Com. Port number from the tools menu/dropdown, you can choose upload, or press CTRL+U on your keyboard.</p>
<p>Hey</p><p>I found this tutorial really cool but I am having a problem with step 3 part 3. I do not understand where the processing folder needs to be nor do I understand where to put the libraries. This is clrealy my fault not yours as others have done this easily. Thnaks for the help in advance</p><p>PS - I only got my arduino today</p>
<p>It says 'No library found for ddf.minim'</p><p>'No library found for ddf.minim.analysis'</p><p>'No library found for cc.arduino'</p>
<p>Put the arduino library in Documents&gt;Processing&gt;libraries, and if it doesn't work use processing v2, download it from here : </p><p><a href="https://processing.org/download/?processing" rel="nofollow">https://processing.org/download/?processing</a></p><p>(Run processing at least once before doing that to create the Processing folder in Documents)</p>
<p>Hey samD71,Even I am facing a similar problem.My beat.pde file is not loading.`It displays some sketchbook error.</p>
<p>In processing, go to Sketch&gt;Add file..&gt;Arduino.jar, you will find Arduino.jar in the Arduino library you downloaded, if you placed it in the right place it should be in Documents&gt;Processing&gt;libraries&gt;arduino&gt;library... the code should work now</p>
<p>okay got through the problems going through an error where it says cant find class or type beatlistener .</p>
<p>okay got through the problems going through an error where it says cant find class or type beatlistener .</p>
<p>okay got through the problems going through an error where it says cant find class or type beatlistener .</p>
<p>Hello! Thank you for the tutorial first of all! I do how ever have a problem, I think it is a bit external to this tut but still.</p><p>This line &quot;arduino = new Arduino(this, Arduino.list()[1], 57600);&quot; is highlighted </p><p>and the error line tells me &quot;error opening serial port /dev/cu/Bluetooth-modem: port busy. &quot; although I didn't use the bluetooth to work in any way. </p><p>Where should I look for to resolve this?</p>
<p>all fixed!</p>
<p>Hi, I just did everything that's told on the instructions, I built the circuit, BeatWrite runs without errors but leds won't light up. Can anyone help me?</p>
<p>im having the same problem. did you figure out a solution? our arduino board is lighting to the beat but the LEDs are not and the wiring seems to be right.</p>
<p>What do you mean by the Arduino board is lighting to the beat? The RX LED on the Arduino?</p>
<p>Hey, I had the same prob! To fix wire everything up without the resistors. Like this:</p><p></p>
<p>You may need to change the 0 in this line to the com port number your Arduino is using:</p><p>&quot;arduino = new Arduino(this, Arduino.list()[0], 57600);&quot;</p>
<p>Hey, I had the same prob! To fix wire everything up without the resistors. Like this: </p>
<p>have the exact problem. It loads on the arduino but does not show up on the LED lights, can someone please help</p>
<p>Hey, I had the same prob! To fix wire everything up without the resistors. Like this: </p>
<p>Guyz I have problem saying Null Pointer Exception</p><p>can anyone help me?</p><p>Thanks a Lot</p>
<p>im pretty new to this side of programming i followed all the instructions and im getting a pretty big error could some please help me ive been struggling with what to do next ive searched all over and im sure its something simple here is the error </p><p>Arduino: 1.6.1 (Windows 7), Board: &quot;Arduino Uno&quot;</p><p>BeatWrite.ino:20:1: error: 'import' does not name a type</p><p>In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:24:0,</p><p> from BeatWrite.ino:20:</p><p>BeatWrite.ino:20:28: error: expected unqualified-id before 'true'</p><p>BeatWrite.ino:22:1: error: 'import' does not name a type</p><p>BeatWrite.ino:23:1: error: 'import' does not name a type</p><p>BeatWrite.ino:25:1: error: 'Minim' does not name a type</p><p>BeatWrite.ino:26:1: error: 'AudioPlayer' does not name a type</p><p>BeatWrite.ino:27:1: error: 'BeatDetect' does not name a type</p><p>BeatWrite.ino:28:1: error: 'BeatListener' does not name a type</p><p>BeatWrite.ino:29:1: error: 'Arduino' does not name a type</p><p>BeatWrite.ino: In function 'void setup()':</p><p>BeatWrite.ino:38:9: error: 'Arduino' was not declared in this scope</p><p>BeatWrite.ino:38:26: error: 'println' was not declared in this scope</p><p>BeatWrite.ino: In function 'void draw()':</p><p>BeatWrite.ino:42:13: error: 'background' was not declared in this scope</p><p>BeatWrite.ino:43:9: error: 'fill' was not declared in this scope</p><p>BeatWrite.ino:44:4: error: 'beat' was not declared in this scope</p><p>BeatWrite.ino:45:1: error: 'arduino' was not declared in this scope</p><p>BeatWrite.ino:45:30: error: 'Arduino' was not declared in this scope</p><p>In file included from BeatWrite.ino:20:0:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant</p><p> #define HIGH 0x1</p><p> ^</p><p>BeatWrite.ino:45:38: note: in expansion of macro 'HIGH'</p><p>BeatWrite.ino:48:4: error: 'beat' was not declared in this scope</p><p>BeatWrite.ino:49:1: error: 'arduino' was not declared in this scope</p><p>BeatWrite.ino:49:31: error: 'Arduino' was not declared in this scope</p><p>In file included from BeatWrite.ino:20:0:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant</p><p> #define HIGH 0x1</p><p> ^</p><p>BeatWrite.ino:49:39: note: in expansion of macro 'HIGH'</p><p>BeatWrite.ino:52:4: error: 'beat' was not declared in this scope</p><p>BeatWrite.ino:53:1: error: 'arduino' was not declared in this scope</p><p>BeatWrite.ino:53:31: error: 'Arduino' was not declared in this scope</p><p>In file included from BeatWrite.ino:20:0:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant</p><p> #define HIGH 0x1</p><p> ^</p><p>BeatWrite.ino:53:39: note: in expansion of macro 'HIGH'</p><p>BeatWrite.ino:56:1: error: 'arduino' was not declared in this scope</p><p>BeatWrite.ino:56:30: error: 'Arduino' was not declared in this scope</p><p>In file included from BeatWrite.ino:20:0:</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant</p><p> #define LOW 0x0</p><p> ^</p><p>BeatWrite.ino:56:38: note: in expansion of macro 'LOW'</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant</p><p> #define LOW 0x0</p><p> ^</p><p>BeatWrite.ino:57:39: note: in expansion of macro 'LOW'</p><p>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:41:14: error: expected unqualified-id before numeric constant</p><p> #define LOW 0x0</p><p> ^</p><p>BeatWrite.ino:58:39: note: in expansion of macro 'LOW'</p><p>BeatWrite.ino:59:18: error: 'textSize' was not declared in this scope</p><p>BeatWrite.ino:60:14: error: 'width' was not declared in this scope</p><p>BeatWrite.ino:60:23: error: 'height' was not declared in this scope</p><p>BeatWrite.ino:60:31: error: 'text' was not declared in this scope</p><p>BeatWrite.ino: In function 'void stop()':</p><p>BeatWrite.ino:72:1: error: 'song' was not declared in this scope</p><p>BeatWrite.ino:74:1: error: 'minim' was not declared in this scope</p><p>BeatWrite.ino:76:1: error: 'super' was not declared in this scope</p><p>BeatListener.ino: At global scope:</p><p>BeatListener.ino:1:31: error: expected initializer before 'AudioListener'</p><p>Error compiling.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p>
<p>If you are using Processing 3, you need to install the library.</p>
<p>i did everything but i got this error</p><p>&quot;no libraries found for ddf.minim&quot;</p><p>&quot;no libraries found for ddf.minim.analysis&quot;</p><p>please help me out.</p>
<p>Use processing V2 instead of 3, worked for me.</p>
<p>where to find processing v2. Its unavailable on net.If you have please send me the link.</p>
<p>https://processing.org/download/?processing</p><p>Scroll down to where it says stable releases, and choose 2.2.1 (19 May 2014)</p><p>A side note is that I got it working on Processing 3 as well, you just need to download and install the minim library!</p>
<p>Can we use arduino uno for this project?</p>
<p>Yes!</p>
<p>I got it working, you have to use Processing V2 as V3 does not have the required libraries.</p>
<p>Now all I need is a way for it to detect system audio output and not just a mp3...</p>
<p>I am having trouble finding the &quot;sketchbook&quot; folder (which has the proper &quot;Libraries&quot; folder, where you are supposed to copy the Arduino Library) within the main Processing folder.... Does anyone have a direct file path (starting at the main Processing folder) that maps out all the other folders one must navigate through in order to find &quot;sketchbook&quot; folder and then subsequently the correct &quot;Libraries&quot; folder????</p>
<p>hope this helps you.</p>
<p>how do i change the transition time b/w colors???</p>
<p> Works great! I used an Arduino R3 and it works fine. In processing, if you are missing libraries, go to &quot;Sketch &gt; Import Library &gt; Add Library&quot; and add &quot;Arduino (Firmata)&quot; and &quot;Minim&quot;. Also changing</p><p> &quot;arduino = new Arduino(this, Arduino.list()[1], 57600);&quot;</p><p>to:</p><p>&quot;arduino = new Arduino(this, Arduino.list()[0], 57600);&quot;</p><p>made it work. </p>
<p>Thank you so much...</p>
Also had the &quot;the package &quot;cc&quot; does not exist issue. To fix -- In the Processing Editor, select &quot;Sketch&quot; &gt; &quot;Add File&quot;, then just select the &quot;Ardunio.jar&quot; file. Should work! <br> <br>I also got &quot;ArrayIndexOutOfBoundsException&quot; -- To get this fixed; <br> <br>Changed line 35 from; <br> arduino = new Arduino(this, Arduino.list()[1], 57600); <br>To; <br> arduino = new Arduino(this, Arduino.list()[0], 57600); <br> <br>And then it works!! :) <br>
<p>thanks.</p>
<p>Thank you!!</p>

About This Instructable

514,622views

283favorites

License:

More by Hyrulian:How to Make LEDs Flash to Music with an Arduino 
Add instructable to: