I am playing around with the ArduinoFHT library. I am sampling at 9.6kHz for a Nyquist frequency of 4.8KHz. The basic RC low-pass filter as outlined here http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/ doesn't seem to be doing the trick: I'm still getting high frequencies aliasing down into the spectrum, and I think the RC high pass might be attenuating the upper end of the pass-band more than is necessary.
My problem is: I haven't the faintest clue where to begin for a hardware anti-aliasing filter design. My instinct is to go with something with a sharp cutoff at the expense of adding some pass-band ripple. I know Matlab uses Chebyshev at 80% of the nyquist for anti-aliasing, but it looks like maybe an Elliptic filter would give even sharper cutoff?
Once I've selected a filter, how do I go about building it? I haven't even been able to get a simple op-amp preamp to work, so I'm interested in a tutorial that is as detailed as possible, for absolute beginners in hardware filter implementation, but thorough enough to actually show me how to build a filter that meets my needs. Do I want an active or passive filter? How do I compute component values to achieve the desired pass-band? If the pass-band cutoff frequencies do not uniquely specify the component values, what sort of engineering trade-offs are captured by the additional degrees of freedom? If anyone has solved this problem before and has a circuit that I can just drop in and have work, that would be amazing.
Every filter is a compromise and the "type" of filter is up to you. As you may know, the cutoff frequency is defined as the 3dB down point. So, a 4.8kHz filter is NOT going to work. You probably want any alias signals at least 40dB down. That's the basic problem with a simple passive RC filter... You'd have to set the cutoff frequency way below 4.8kHz in order to get significant attenuation at 4.8kHz.
An off the shelf solution like MAX7400 has appeal, as does purchasing that book to learn about active filter design. The only downside here is that I'd have to wait for parts to arrive to test them out, so I couldn't build something myself from passive components and op-amps this weekemd.
So you're saying that most people on this forum probably buy and off-the-shelf switched capacitor filter if they want a good anti-aliasing solution?
I suspect that, theoretically, much sharper attenuation can be achieved with high order passive filters incorporating inductors. I had hoped that perhaps there was a standard passive circuit people were using that performed better than the RC filter.
Long time back I messed a lot with active filters - it is not as easy as it seems, as you need quite precise components to build something useful. The easiest way is the MAX or something else of that kind. Mind when messing with arduino's ADC the effort with high-quality analog AA filters is not appropriate, afaik.
"The MAX7400/MAX7404 provide 82dB of stopband rejection and a sharp rolloff with a transition ratio of 1.5. The MAX7403/MAX7407 provide a sharper rolloff with a transition ratio of 1.2, while still delivering 60dB of stop band rejection."
A misunderstanding of Nyquist trips up even experienced EEs. DVDdoug is right. Your cutoff must be low enough to attenuate frequencies at and above 4.8kHz to nearly nothing, not merely have its -3dB point at 4.8kHz.
There are free books such as Op Amps for Everyone.
And online calculators. TI has FilterPro Desktop and an online tool called Webench, and Linear Technology has FilterCAD (and LTSpice for general simulation).
http://www.ti.com and click on "Tools and Software", select the Filter tab on Webench, and start it.
I don't understand this TI filter app, it seems to select filter parameters, but doesn't actually tell you anything about how to built the filter in hardware?
mrule:
TI filter app ... seems to select filter parameters, but doesn't actually tell you anything about how to built the filter in hardware?
I think you're talking about WEBENCH. When you see the list of filter types at the bottom of the page, push a green "Select" button on the right side of the table. That'll take you to a schematic. If you haven't logged in to TI, it'll make you do that first.
Tip #1 : Don't use regular arduino's for Audio unless lo-fi is your thing. Get a teeny which has a Cortex M4 core and single precision DSP built in to hardware. It also has decent built in converters unlike many of the other Arduino boards.
If you don't want to buy a dedicated IC, you can use two second order Sallen-Key lowpass filters in series to give you a fourth order, which can still provide a steep enough cut-off, and enough band width depending on the desired results.