Hardware Procedure

We began by testing the initial microphone circuit we were given. The circuit converts audio frequencies detected at the microphone to an AC voltage output at the same frequency. We found that the circuit provided would output a peak to peak amplitude of around 50 mV to 70 mV with no DC offset. This was the start of our first problem. We were giving the LM358 Op-Amp rails at 0V and 5V (from the Arduino). Thus if we tried to amplify the signal through the LM358, our signal would clip at 0V.

Hardware Procedure

We needed to add some sort of DC offset to our signal in order to prevent clipping. We solved this problem by providing a DC offset of 2V at the positive terminal of the Op-Amp. We then decided on a gain of about 100 in order to get an output signal with a peak to peak amplitude of about 3V.

Software Procedure - FFT Analysis

We connected a function generator to the arduino and ran the example code from the Arduino Music Library (fft_adc_serial). We put several signals of different frequency into pin A0 and graphed the output of the serial monitor vs bin number (1 to 128) (Figure 3). The peaks we found were at bin 5 for a 660 Hz signal, bin 10 for 1320 Hz, bin 14 for 1980 Hz, and bin 117 for 21 kHz. We did not change the sampling frequency or number of samples in each run because our peaks matched those of Team Alpha

Software Procedure - Logic to Detect 660 Hz Signal

From our previous test, we found that the output of bin 5 corresponds to the 660Hz signal. To detect the 660Hz signal, we checked if the value at bin 5 (fft_log_out[4]) is greater than a threshold value 185 (Figure 4). To prevent false starts, we check if the machine constantly detects 660Hz by incrementing a counter if the signal is detected. The counter is reset if the signal was not detected during a cycle. If the signal is detected 10 cycles in a row, we will set flag to start the robot. Temporarily, we set the code to print “detected 660 Hz signal” in place of starting the robot

Working Microphone Detecting 660 Hz

Unfortunately, files bigger than 25 MB can't be uploaded to Github. Here's a link instead:

  • Microphone Detecting 660 HZ Signal
  • (I will resolve this problem shortly, as soon as I get better wifi than starbucks so I can actually run the pixel reducer online)

    Optical Signal Processing

    Materials

    Arduino Uno

    IR transistor (OP598)

    IR hat

    IR decoy

    LM358 Op-Amp

    Various Resistors

    Breadboards

    Wiring

    Hardware Procedure

    We began by investigating how well we could read infrared light through our sensor. The circuit for this is shown below. The sensor used is a phototransistor which will pass more current when the more infrared light is hitting it. This means that in the absence of infrared, Vout will read 0V while when the phototransistor is saturated, it would read 5V. By hooking up this circuit to power and attaching an oscilloscope probe to Vout, we were able to read the frequency and amplitude of this signal.

    Hardware Procedure

    We decided that we’d only need to detect treasures within 6 inches to 18 inches away from our robot, so we held infrared sources these distances away, oriented so that the photodiode could read them. The oscilloscope reading at these distances is shown below. The IR hat is outputting a frequency of 6.08kHz.

    Hardware Procedure

    Within our range of distances, we noticed that the magnitude of the signal varied from 100 mV to 500 mV. Although we expected our Arduino’s ADC to be able to properly read this signal, the lab required that we built a circuit component so built a non-inverting op-amp with a gain of 11.

    Hardware Procedure

    In this image, the input signal is CH1, the output CH2. These signals have the same period an shape, only differing by a magnitude of ~10. This confirmed our op-amp worked. After we’d validated both our infrared circuit and op-amp, we connected the output of the circuit of the input of the op-amp and the output of the op-amp to ADC port 1 of the Arduino.