Go Down

Topic: Audio input to arduino (Read 4032 times) previous topic - next topic


Aug 04, 2011, 12:59 am Last Edit: Aug 04, 2011, 01:15 am by Tetsh Reason: 1
Hello, i want some help regarding the hardware schematic for allowing the audio signal to be splitted into 8 bands then connected to mux then to analog input of arduino (actually making a 8 band spectrum analyzer with a midi controller also).
I have created two schematics in my mind but i m not sure which of them will react better with the analog readings for arduino.

First one:

Second one:

Please note that the op-amp is lm386 and the filters are passive RC filters.
So the basic question is to get the true voltage analog reading for each band, should i shift the signal upwards or rectify it?

For the op-amp should it better be placed before filters or after the mux ?

If i ignored the part of the rectifier/clamper as first stage and just directly connected the audio signal to amplify it first. That means i ll lose the -ve part of the audio signal right?

If i used a Pot with the input as in http://itp.nyu.edu/physcomp/sensors/Reports/CondenserMicrophones this will add a positive DC offset to the audio signal to shift it all upward, i will no longer need the clamper? and if he already shifted it all upwards why did he use the rectifier at the end? ( I understand the he removed DC offset after amplification using the capacitor but he used another voltage divider to shift it up again (correct me if i m wrong.

Would it be better if i used the audio input directly to filters then multiplex them then rectify then amplify?

Sorry if it took so long and sorry for the bad block diagrams...


Please note that the op-amp is lm386 and the filters are passive RC filters.
So the basic question is to get the true voltage analog reading for each band, should i shift the signal upwards or rectify it?

You can't build more or less functional band-pass filter bases on passive RC filters. So , answer is neither.  If you follow idea of the graphic equalizer, you could create 8 pass-band active filters with OPA or transistors as active components, than rectify and filter out outputs.
and if he already shifted it all upwards why did he use the rectifier at the end?

My guess, it is for educational purposes only. Schematics doesn't have any practical sense.

Other options would be for you, MSGEQ7 chip (7 band, but you can put 2 chips, I think, and get 14 band or so), search for it on a forum or Google, there are a lot of posts.
Or look into software FFT approach:


Why won't the passive filters work? i am just cascading high pass with low pass and i ll pre amplifiy or post amplify


Aug 04, 2011, 03:45 am Last Edit: Aug 04, 2011, 04:15 am by Magician Reason: 1
Well, first order filters would give you only 6 db/octave, which is too slow. For more complex design, "Twin-T" or Wien bridge problem would still persist, low Q with significant attenuation of the signal.


That second block diagram is rubbish, you can't filter once you have rectified, I think you are confusing level shifting (which has absolutely no effect on the final result) with rectification.
and if he already shifted it all upwards why did he use the rectifier at the end?

Because the rectifier gives you an envelope follower where the voltage output is proportional to the peak amplitude which is what you actually want.

just using passive R&C filters will not look any good, you are much better off going with that chip.


@ Magician : Ok i get what you are aiming at but won't the RC filters work for the lower frequencies?

@Grumpy : That chip is actually not available anywhere near me and i ll have to order it online but unfortunally it ll take up to 2 weeks and i m running out of time for this project :( .

Should Sallen-Key filter solve that problem?
Also, about the attenuation accompanied with the passive filters, can't it be fixed with an op amp and regarding the slow slope/octave should that really be a big problem even if i try to minimize the BW as much as i can ?

Should i use a clamper circuit or a voltage divider to get the signal in the +ve region before amplification? or it won't really matter?

I am also taking the audio output from a line level which as far as i know ranges from -0.707v to 0.707v giving around 1.4v peak to peak and the minimum gain offered by the lm386 is 20 so i can't by anyway scale it from 0 to 5 volts, should i use another op-amp which i have full control on its gain or there is a way to do it around with this chip?

Thanks guys


should i use another op-amp

Yes, that chip is not an op amp.

Use a capacitor in line with the audio input and put it to the junction of a 50:50 potential divider.

If you think the small slope of a first order filter is no problem then you don't understand what you are doing or don't cair what the results look like.

It helps if you fill in your location then we can advise on where to get things from in your part of the world.


I have used the MSGEQ7 chip. I had a problem with the input signal being to high so you definately want some clamping and attenuation.
However, because of availability, lack of an alternative and the 7 band limits on the chip, I was going to switch to the Arduino FFT library and see how that works. IF it doesn't there are good PIC FFT libraries people are working on.


The other approach to the problem is to digitize the signal then do the frequency analysis in software using digital filter techniques.

Incidentally 'clamp' means limit to a voltage level, I think the poster meant 'offset' - add a fixed offset voltage.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


This should help if you looking for straight forward hardware solution :
And 8 channel:
The same time study FFT in spare moments, you can get astonishing frequency/amplitude resolution (512 band / 15-bit) even on small arduino board.


I think in "exhibits" area, focalist demostrated a 16 or 20 band spectrum analyzer running on arduino and with output displayed on a TV using tvout library. See if you can find that.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Thanks alot guy for the replies the links magician posted were so much helpful.

Would going with a tone decoder like the lm567 should be a bad idea ?


Not good idea, logic output doesn't provide amplitude data, only present/not present.
Bandwidth 14%, you would need 7 chips just to cover 100 - 200 Hz range.
IC specifically design to detect "known" single frequency, which isn't the case with spectrum analyzers.


Go Up