Need help with spectrum analyzer!

Hi there,

I'm trying to make a spectrum analyzer like this one:

Pt1 - YouTube
Pt2 - YouTube

The guy has very graciously provided his code. It runs in Processing 3.3 and sends the data to the arduino.

There are 2 problems though, 1: the sound library he used is broken and I really don't know how to fix it, and 2: He uses a microphone to get the audio, I would much rather use a headphone jack.

There was another option which was to use the sparkfun spectrum shield but that only has 7 bands. I don't know much about audio but I belive that means I could only have 7 columns of LEDs. Is there a way to expand that to like, 30?

I really am lost at the moment. Could someone please point me to the right direction.

Thanks, Matthew

I can't answer all of your questions.

2: He uses a microphone to get the audio, I would much rather use a headphone jack.

Line-level or headphone-level is about right for the Arduino ADC, but the Arduino can't read the negative half of the AC audio waveform, so you just need to [u]bias[/u] the input (2 equal value resistors and a capacitor).

A microphone by itself won't work. But, you can buy a microphone board with a preamp and a biased output. (Or, you can get a microphone board with a digital output).

There was another option which was to use the sparkfun spectrum shield but that only has 7 bands. I don't know much about audio but I belive that means I could only have 7 columns of LEDs. Is there a way to expand that to like, 30?

No, the MSGEQ7 chip has a fixed number of filters.

Thanks for your reply. I must apologize, I'm very new to the whole audio thing.

I'll give the bias thing a try sometime.

Do you know if there are any other similar boards or shields that have more bands?

You may get up to 250 frequency bands using UNO with FFT - YouTube

So if I use this library: http://forum.arduino.cc/index.php/topic,38153.0.html

Do I still need to bias the input from the headphone jack?

Yes, you have to bias input anyway.
Here is another library

That library looks real good but I don't know how to use it. Does it input from a headphone jack?

And when I tried to upload the example I get the error: "ADCSRA was not declared in this scope"

Oh and how many bands can this library get? Is it up to 250 like you mentioned earlier?

Yes, it does.
What arduino do you have?

I have 3 with me, I’ve got the Due, Uno and the Mega 2560

Than try to compile with UNO selected via IDE board manager

It compiles alright now, but it doesn't upload, it's just gets stuck on uploading...
Then gives me this error:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x27
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x27
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

Should I try with the mega?

Something wrong with your Uno. Library is not compatible with Mega

I think it's a chinese clone, I don't think that should be a problem though. It's never done this before. Just to make sure, I am supposed to use the Arduino/ Genuino Uno from the boards menu right?

By the way, if I PM you, is there still a 5 minute limit between posts?

Hm, I was thinking, that may be russian hackers break into your computer -);
Do not know about timing PM.

Maybe something like this?

https://www.youtube.com/watch?v=mqlFNP1MAjE

spectrum.jpg

Hi guys. My name is Ilya and I'm from Russia. I am also interested in this project. There is code and references. Who can collect. Share on youtube

If anyone is still looking for guidance, look at my post.

I used adafruit Neopixel strips and created a MSGEQ7 circuit to show the left and right 7 bands on the strips.