Most of the filter design is done in software because of the extensive computations.   However, since we are getting inputs directly from a waveform generator to the AT90S8535 microcontroller, we added 2 circuits to protect the chip and to avoid aliasing.

Hardware List for Basic Spectrum Analyzer with RS232 link


Testing Equipment


    This filter has cut off frequency of 3333.33Hz.    Two poles are used instead of a single RC circuit to get flatter frequency response at lower frequencies.  To achieve a gain of 1, we connected the inverting input of the op-amp to the output.   With a constant sampling frequency of 9 kHz, the maximum input frequency has to be 1/2 of 9kHz (from Nyquist Rate).   For our purposes, the cut-off at 3.33kHz is sufficient to keep the higher harmonics of non-sine waves from aliasing.  In addition, our target frequency range of 200 - 1600 Hz is sufficiently smaller than the cut-off, so that they lie under the flattest region of the curve, with the biggest possible gain of approximately 1.0.

Bode Plot Sketch for the Low Pass Filter


    The Atmel Microcontroller has a 10 bit Analog-to-Digital Converter (ADC).   In order to prevent unnecessarily large voltages or currents (e.g. from the -12V, +12V DC power source) from damaging the chip, we regulated the voltage from the output of the op-amp before it reaches channel A0 of the ADC.  When voltages exceed VDD (5V) or become negative, the diodes will be activated and draw all current to VDD or GND respectively.