Go Down

Topic: Need help with spectrum analyzer! (Read 323 times) previous topic - next topic

mr-matt

Hi there,

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

Pt1 https://www.youtube.com/watch?v=x_UMY9pWhUA
Pt2 https://www.youtube.com/watch?v=R3IXl0XDYys&t=0s

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


DVDdoug

I can't answer all of your questions.

Quote
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 bias 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).


Quote
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.

mr-matt

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?

MasterT

You may get up to 250 frequency bands using UNO with FFT https://www.youtube.com/watch?v=r7Mm5jKa0qc

mr-matt

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?

MasterT

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

mr-matt

#6
Mar 04, 2017, 08:12 pm Last Edit: Mar 04, 2017, 08:26 pm by mr-matt
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?

MasterT

Yes, it does.
What arduino do you have?

mr-matt

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

MasterT

Than try to compile with UNO selected via IDE board manager

mr-matt

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

Code: [Select]

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?

MasterT

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

mr-matt

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?

MasterT

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

Paul Stoffregen

#14
Mar 06, 2017, 01:29 am Last Edit: Mar 06, 2017, 04:04 am by Paul Stoffregen

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy