Implementation
In order to implement this, we started with the sound signal. This was input into an ADC0808 ( analog to digital converter ), and the digital output was fed into our Atmel. Our Atmel performs some computation to the wave (inverting it, in particular), and then feeds the output to a digital-to-analog converter.
At a very high level, that is the only thing that our project does. Unfortunately, the physics of the sound can be very unpredictable. So in addition, we added some more knobs to better control our output. Remember, that the ultimate goal is to compute the negation of the input sound wave, and then output it on the DAC. By the time that the Atmel has performed computation and output the wave to the DAC, the original sound wave (which we are trying to negate) will have traveled some distance closer to the users ear. Since it’s hard to know exactly how far that distance is, we added a knob that allows the user to phase-shift the output wave by a certain amount. This knob is also fed into the ADC. The Atmel switches between reading the analog input from the sound wave, and reading the analog input that controls the phase shift. Of course, the Atmel reads the phase shift input much less frequently than the sound input. Specific details of how one ADC can handle several analog inputs can be found inside our resources section.
We also found, that in addition to controlling the phase shift of our output wave, we also needed to control the amplitude. We added a second knob that would allow the user to control this. We originally tried to input this into the ADC, the same way that our phase shift knob was input. However, after experimenting with the source code, we could find no practical way to implement this digitally. The calculation required floating point multiplications, which were much to computationally intensive for the Atmel to handle and still have a decent looking output. We eventually decided to hook this knob into the Vref pin of the DAC. We allowed the knob to vary in between zero and ten volts. Why did this work? Look at the DAC documentation in our resources section, and you should see why. (as a smaller detail, we also had to modify our code a bit to get this to work).
After we had this working correctly, we had a decent looking output signal, but it was rather choppy. The digital nature of our device made the signal look stepwise instead of smooth. Because of this, Mathew used his brilliant circuit knowledge and created a low pass filter that smoothed the signal. Pure genius…
Here’s a diagram , showing our underlying themes.