Home > Music, Programming, Shits and Giggles > Arduino Controlled Music Lights!

Arduino Controlled Music Lights!

Uh oh, what have I been up to?About 3 months ago, I had the most random idea — I wanted a real time music visualizer. However, I just didn’t have the time to do the research necessary for this project because of homework. Well, now that I am on spring break, I decided to make a reality. And it worked! The first time too!

There are two sides of this project, the hardware and the software. The hardware part was the easy part. Mike had an Arduino board laying around and I went to radioshack to buy a relay, a 9 volt battery, a diode, and a transistor. Thats basically all that is needed for the hardware side. I used the schematic found on http://www.glacialwanderer.com/hobbyrobotics/?p=9 to make sure I’m doing everything right. Putting this together only took about 2 hours.

The software side was a little bit more tricky. I tried two differently languages: MATLAB and C#. Both turned out to be quite a big failure. Then I stumbled upon Processing, which is basically an extension onto Java that made it easy for visual artists to create programs. Processing included a library called Minim, which had lots of built in features for audio analysis. I used the beat detection algorithm from Minim and then used that to send a signal to the Arduino board over USB to turn on or off the lights.

Basically thats all! Later I plan to find a better relay, something that lasts longer [solid state relay?], and then put it in a box so it is safer and looks better.

For now, enjoy the video!

  1. March 11th, 2009 at 22:27 | #1

    Pretty sweet, can’t wait to see this in person. You are one step closer to a party button. Also, if you want to fire up some circuit boards in diptrace I can manufacture you some.

  2. March 12th, 2009 at 17:01 | #2

    I might just have to take you up on that offer Gerrit.

  3. davide
    March 13th, 2009 at 07:04 | #3

    any way to avoid passing through processing and a laptop and wiring up directly to arduino?

    nice job, thougt

  4. March 13th, 2009 at 13:42 | #4

    @davide
    There is a possibility of using one of the analog inputs on the arduino board. I just did not have the time to hack the minim library to use this input instead of javasound.

    The reason I am using an arduino board in the first place, is because in the future, I wanted to buy more relay switches and control several lights at once, each referring to their own frequency band.

    There are options other than using an arduino too! In fact, there is an entire site dedicated to this kind of application:
    http://relaycontrollers.com/

    I just happen to have an arduino board laying around, and since I’m in college on a limited budget, I decided to use that instead of buying one of the options from that site.

  5. Joe
    March 13th, 2009 at 18:30 | #5

    very cool! Any chance that you could upload the arduino and proccessing code?
    Thanks,
    Joe

  6. Dustin
    April 4th, 2009 at 09:06 | #6

    This looks awesome! I can’t wait to see the finished project.

    I second Joe’s request.
    I’d love to see how you set this up, if that’s okay with you.
    Thanks!

  7. Sally
    April 16th, 2009 at 18:41 | #7

    Hey Andrew,

    It’s really cool that you were able to rig it up so quickly!
    I’m doing a similar project but I used an Arduino Shield to play music instead. I am stuck in one part that I’m guessing you are the only one who can answer. How did you manage to send the output of beat signals to the arduino through MINIM? Did you have to code something?

    Please help!

  8. April 19th, 2009 at 00:28 | #8

    @Sally
    I used MINIM to do the beat detection – I then sent it to the arduino using processing’s serial connection. I just sent a 1 or a 0 determining if the light should be on or not.

    If you wanted to actually play music via minim on the arduino would be a different story. If you wanted to interface with speakers, you could put the output from the analog output pins on the arduino through an amplifier (LM386?) and then to the speakers. I’m not sure what quality of sound you might get out of it either. If you dont have analog out, then a digital-to-analog convert -> LM386 should work as well. Thats more complicated though. Software wise, I would look at the AudioBuffer class in Minim to extract the sound data.

    Good luck,
    Andrew

  9. Sally
    April 22nd, 2009 at 00:49 | #9

    Thanks alot!

    I’m completely new to this since I’m not an engineering student. I’ll try out what you told me. Thanks again.

  10. Grim
    September 27th, 2009 at 16:25 | #10

    Very nice! I’m working on a similar project. Any chance you could share your code?

  11. marcus
    November 26th, 2009 at 18:47 | #11

    please can you share the code,

  12. SpelunkingHenry
    November 30th, 2009 at 17:49 | #12

    Have you tried to use analog pins to define a better signal variation or does MINIM not do analog? Also,rather than just on and off – have you tried to connect multiple lights to include fade-in’s/out’s to denote beats other than a solid beat and silence?

  1. March 13th, 2009 at 03:00 | #1
  2. March 13th, 2009 at 03:00 | #2
  3. March 13th, 2009 at 06:35 | #3
  4. March 13th, 2009 at 23:00 | #4
  5. March 25th, 2009 at 20:04 | #5