Objectives:

Materials:

Procedure:

1. Learn Some LTSpice Basics

In order to simulate the behavior of filters, we used LTSpice.

The low pass RC circuit with R=1.2kΩ and C=0.1μF and its simulation:

lab3a

The high pass RC circuit with R=1.2kΩ and C=0.1μF and its simulation:

lab3b

2. Build and Test the Microphone Circuit

We built a basic microphone circuit on our robot based on the graph below.

lab3j

We also wrote Arduino code to do ADC on sound picked up by the microphone and use MATLAB code to collect and analyze the data generated by the Arduino and visualize what is going on.

Below is the graph output by MATLAB that shows in the top part the time domain signal, and the spectrum of the 500Hz signal in the bottom.

lab3c

As observed, the spectrum’s value at the frequency of 500 Hz is relatively weak because our microphone is not really good at picking up sounds. So we then improve the microphone circuit by adding an amplifier

lab3k

With this new circuit implemented, we got the better output graph:

lab3d

3. Test a Filter

We then built a high pass filter at the end of our circuit based on the graph below:

lab3m

The output of our microphone amplification circuit will be fed into the filter so that we can characterize the filter and compare it to what simulations predict.

In order for cut_off frequency to be somewhere between 500-1000Hz, we choose R = 10kΩ and C = 0.022μF.

Here's our connected circuit:

lab3l

After building the cuicuit, we wrote matlab code to compare the experimental frequency response to the simulated one. For simulated frequency response, we used data obtained from LTspice’s Bode plot for high pass filter circuit. For experimental frequency response, we used equation H(Ω) = Y(Ω)/X(Ω) to calculate, where Y(Ω) is our system's output signal's spectrum and X(Ω) is our system's input signal's spectrum.

The smoothed graph of superposition:

lab3e

The plot of the difference between the simulated and experimental filter responses:

lab3f

4. FFT on Arduino

In order for our Arduino to perform Fourier analysis, we wrote Arduino code with the help from Arduino FFT library (V3.0).

Our code enables our robot to "listen" to the sound given, and the Nano will perform Fourier analysis on the signal to determine the frequency of the played sound so that the robot can take appropriate action.

With the code uploaded to and running in the Nano, we played a sound of 500Hz, 700Hz, and 900Hz, respectively, and observed a nice peak in/near the bin that corresponds to the frequency.

Spectrum obtained with the Nano for a sound frequency of 500 Hz:

lab3g

Spectrum obtained with the Nano for a sound frequency of 700 Hz:

lab3h

Spectrum obtained with the Nano for a sound frequency of 900 Hz:

lab3i