document

14
Beat Sync is a single frequency audio spectrum volume meter. It can isolate around a certain frequency ( I choose the bass ) and display it on a creative 8 segment LED bar graph. This is meant to be quite simple, yet allowing room for more difficult upgrades. It is built around the Arduino Open Source Environment. The circuitry is also quite simple. So if you want to show off at your next house party or just make something cool to add some visualization to music, lets go! About This Instructable License: 15,642 views 43 favorites akcarl Follow 15 More by akcarl led music audio arduino electric circuit Tags: Beat Sync by akcarl Collection I Made it! Download 8 Steps Favorite Share let's make share what you make > share what you make > Explore Create Contests Community Login | Sign Up converted by Web2PDFConvert.com

Upload: sudeepsingh1

Post on 25-Dec-2015

8 views

Category:

Documents


3 download

TRANSCRIPT

Beat Sync is a single frequency audio spectrum volume meter. It can isolatearound a certain frequency ( I choose the bass ) and display it on a creative 8segment LED bar graph. This is meant to be quite simple, yet allowing room formore difficult upgrades. It is built around the Arduino Open Source Environment.The circuitry is also quite simple.

So if you want to show off at your next house party or just make something cool toadd some visualization to music, lets go!

About This Instructable

License:15,642 views

43 favorites

akcarl

Follow 15

More by akcarl

led music audio arduino

electric circuit

Tags:

Beat Sync by akcarl

Collection I Made it! Download 8 Steps Favorite Share

let's make

share what you make >share what you make >

Explore Create Contests Community Login | Sign Up

converted by Web2PDFConvert.com

One Stop ShopWe have Flat flexible cables,crimpflex housings, Jumpers,

etc.

Remove these ads by Signing Up

Step 1: Parts List

Basic- Arduino UNO (or similar)- 8 Super Bright LEDs- 8 Resistors- Wire/Ribbon Cable- 3.5 mm Female Connector- Soldiering Equipment - Poster Board- X-acto Knife- Audio Equipment- Mini Breadboard- Mini Blank Circuit Board- Heat Shrink

Related

See More

How to Make LEDs Flashto Music with an Arduinoby Hyrulian

How to Make an LEDAmbient Mood Light: ABeginner Tutorialby elevenbytes

This Is Your Brain OnMusicby terranlune

Bass Responsive RGBLeds using Arduino by Bforcer

Analog VU meter andClock (Arduino Powered)by tech-e

converted by Web2PDFConvert.com

Additional- 10 k Potentiometer- Potentiometer Knob- Colored PVC/Arcylic Film- Diffuser

Step 2: The Enclosure

converted by Web2PDFConvert.com

The enclose is pretty much a shelf. It can be made out of wood, plastic, orposter/cardboard. Then you can choose to glue the pieces together, make theminterlocking or nail/staple gun them. In the spirit of recycling and reusing, I havefound an interlocking cardboard design works well.

The dimensions are kind of up to your likes, whether you like squares orrectangles. This design gives more rectangular segments but you can draw it outbefore hand to see what it could look like.

1 - 8" * 24" (back)2 - 4" * 24" (sides)8 - 4" * 8" (dividers)

I left the one side uncut and had to ducktape the other(because I accidentally cutit). It folds into nice 90 degree edges that way.

NOTE - The dividers have edges that extend past the 8" width to meet flush with thesides. The sides also have notches cut into them. You should be able to figure outa spacing that makes sense.

A laser cutter would work much better than blades or saws.

Step 3: The Circuity

converted by Web2PDFConvert.com

The circuit is fairly simple although spread out when all said and done. The 8LED's anode legs are connected to the Arduino's digital output pins(5-12) and thegrounds are joined together. -- Based on all rational electrical knowledge youshould put in current limiting resistors between each anode and the Arduino, butbecause the LEDs are powered for such a short time, I believe it is simplerwithout them. --

The 3.5mm female audio connector's ground should be joined with the LED'scommon ground and then to the Arduino. -- The ground on the audio connectorshould be the furthest from the outside. --

The Right or Left channel of the audio connector will be attached to one of theArduino's analog input pins.

Now for the code...

The breadboard and schematic view were done in Fritzing!

converted by Web2PDFConvert.com

Step 4: The Code

The code relies on a Fast Fourier Transform Library, which can be found here. The FFT, in short breaks down the audio signal into 14 frequency bands and fromthat this project continues with the lowest. The bass... Then some if-elsestatements to light up specific LEDs.

Here is the code as in Arduino 1.0.1

//// Beat Sync// A music visualiztion device.// Created by// Carl Smith// [email protected]//

#include <fix_fft.h>

int led[] = {5,6,7,8,9,10,11,12};

int x = 0;

char im[128], data[128];

char data_avgs[14];

int i=0,val;

#define AUDIOPIN 3

void setup(){ for (int i = 0; i <8; i++) { pinMode(led[i], OUTPUT); } Serial.begin(9600);

}

void loop()

converted by Web2PDFConvert.com

{ for (i=0; i < 128; i++){ val = analogRead(AUDIOPIN); data[i] = val; im[i] = 0; };

fix_fft(data,im,7,0);

for (i=0; i< 64;i++){ data[i] = sqrt(data[i] * data[i] + im[i] * im[i]); // this gets the absolute value of thevalues in the //array, so we're only dealing with positive numbers };

// average bars together for (i=0; i<14; i++) { data_avgs[i] = data[i*4] + data[i*4 + 1] + data[i*4 + 2] + data[i*4 + 3]; //average together data_avgs[i] = map(data_avgs[i], 0, 30, 0, 9); // remapvalues for LoL } int value = data_avgs[0];//0 for bass ledArray(value);}void ledArray(int input){ // if (input > 8) { for (int i = 0; i <8; i++) { digitalWrite(led[i], HIGH); } } else if (input > 7) { for (int i = 0; i <7; i++) { digitalWrite(led[i], HIGH); } for (int i = 7; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 6) { for (int i = 0; i <6; i++) { digitalWrite(led[i], HIGH); } for (int i = 6; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 5) { for (int i = 0; i <5; i++) { digitalWrite(led[i], HIGH);

converted by Web2PDFConvert.com

} for (int i = 5; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 4) { for (int i = 0; i <4; i++) { digitalWrite(led[i], HIGH); } for (int i = 4; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 3) { for (int i = 0; i <3; i++) { digitalWrite(led[i], HIGH); } for (int i = 3; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 2) { for (int i = 0; i <2; i++) { digitalWrite(led[i], HIGH); } for (int i = 2; i <8; i++) { digitalWrite(led[i], LOW); } } else if (input > 1) { for (int i = 0; i <1; i++) { digitalWrite(led[i], HIGH); } for (int i = 1; i <8; i++) { digitalWrite(led[i], LOW); } } else { for (int i = 0; i <8; i++) { digitalWrite(led[i], LOW); } }}

Step 5: Putting It All Together

converted by Web2PDFConvert.com

First is to measure out the distance of the height and divide it by 9. That will be theLED spacing and I use a safety pin to poke holes in the card board for the LEDs topoke through.

Then bend the legs of the LEDs. MAKE SURE TO HAVE ANODES ANDCATHODES ON SAME SIDE

After making this design a few times, I have found a ribbon cable makes it easier tokeep track of pins between the different elements (refer to previous step incircuity). I also used heat shrink to connect the wires and LEDs. The anodes allused different wires on the ribbon cable and the ground (cathode) used a commonwire.

For simplicity I cut a mini circuit board to soldier the wire and headers intobecause the ribbon cable is too fragile for the bread board.

Step 6: Test it!

converted by Web2PDFConvert.com

Load it all up and see if it works! Then add a base and insert the dividers. I have a3.5 mm audio splitter plugged into the female audio connecter of the Beat Sync. The audio source (computer or iPod) and the speakers are plugged into the femaleend of the splitter. Also through a diffuser on the front to make it look better, a fewlayers of wax paper works quite well.

converted by Web2PDFConvert.com

Step 7: Party On

Step 8: Extras

After you get the basic version working you can add a few extras to make it evenbetter.

1. An potentiometer can be added to and the values can be remapped (using mapfunc.) and the value can be the the high end of volume analyzed in this line ofcode. (It would be an integer value in place of the 30)

data_avgs[i] = map(data_avgs[i], 0, 30, 0, 9); // remap valuesfor LoL

2. You may realize that there is some feed back in which ever channel is beingused from the audio sensing and the volume will be lower in the channel too. Youcould use an op-amp to create a voltage follower.

3. Upgrade the diffuser to add some color. I have added some color to simulate themax volume with yellow, orange and red. A fluorescent light cover (the industrialtype found in schools that are 4' long) have a diamond like pattern that looks goodtoo.

converted by Web2PDFConvert.com

We have a be nice comment policy. Please be positive and constructive. I Made it! Add Images Make CommentMake Comment

4 months ago Reply

2 years ago Reply

10 months ago Reply

2 years ago Reply

1 year ago Reply

1 year ago Reply

wannagomoon

can i ask you about the audio part? I don't really understand about audioinput/output. How can I input music signal to arduino? Do I must haveaudio splitter? And I don't know about connecting between ipod and3.5mm audio jack.

Ghild.Zero

why the sketch not working on me ???

wahahahaha Ghild.Zero

im having the same problem...what to do?

Ghild.Zero Ghild.Zero

it said,"fix_fft was not declarated" , I already add the fix_fft.h . Ihave no Idea why this happen

BobThAK Ghild.Zero

having same problem. did you ever figure it out?

akcarl (author) BobThAK

I have only been able to use the Arduino_22 verison with the fix_fftlibrary. Hope that helps!

converted by Web2PDFConvert.com

1 year ago Reply

2 years ago Reply

2 years ago Reply

2 years ago Reply

2 years ago Reply

2 years ago Reply

2 years ago Reply

2 years ago Reply

humacao

having trouble with fix_fft.h header file. how is it included in the library?How do I create an ".h" file?

abhijeet de

Awesome project !!!

sable.07

what if I wanna change the channel, instead of using the bass frecuency,what line of the code should I change?, It's a great project btw.

akcarl (author) sable.07

int value = data_avgs[0]; //0 for bassThe data_avgs[ ] array becomes 14 different frequencies rangingfrom about 80Hz (the bass) to 12000Hz (the highest treble). So ifyou change the "0" to a "7" or so, you will get the higherfrequencies. Thanks!

sable.07 akcarl

thanks!... las doubt jaja, If i connected a microphone instead ofthe 2.5 plug, do you think it'd work as fine as it does now?

akcarl (author) sable.07

You really need an amplifier circuit for the mircophone, i've beenworking on a code and a circuit to make it possible. This is oneoption i've been trying https://www.sparkfun.com/products/9964?please vote for this project on the LED contest! and rate it! :)

mintzrya

Nice project, I did a similar thing using a band-pass filter instead of a FFT(hardware instead of software)

Just a tip for the code, you should be able to write:

void ledArray (int input) {

for (int i = 0; i < input; i++) { digitalWrite(led[i], HIGH); }

for (int i = input; i <8; i++) { digitalWrite(led[i], LOW); } }

and save yourself some if statements!

akcarl (author) mintzrya

That's a good idea. In my latest code I used a switch statementwhich made it much simpler too! Thanks for your comment.

converted by Web2PDFConvert.com

About UsWho We AreAdvertiseContactJobsHelp

Find UsFacebook

Youtube

Twitter

Pinterest

Google+

Tumblr

ResourcesFor TeachersArtists in ResidenceGift Pro AccountForumsAnswersSitemap

Go Pro Today »

We're Hiring! »

MobileDownload our new apps for iOS,Android and Windows 8!

Android iOS Windows

Join our newsletter:Join our newsletter:

Terms of Service | Privacy Statement | Legal Notices & Trademarks | Mobile Site

Join!Join!

© 2014 Autodesk, Inc.

EnglishEnglishenter email

converted by Web2PDFConvert.com