EE289 Lab Fall 2009 LAB 4. Ambient Noise Reduction 1 Introduction Noise canceling devices reduce unwanted ambient noise (acoustic noise) by means of active noise control. Among these devices are noise-canceling headphones which cancel out the noise within the enclosed volume of the headphone. Therefore one could enjoy music in a busy environment without raising the volume excessively. One of the methods for noise reduction is Least Mean Squares (LMS) filtering. LMS filtering is an adaptive filtering method which gradually finds the filter coefficients based on the least squares of error signal. The error signal is the difference between the desired signal and the input signal. We use LMS Filter module from signal processing blockset of Simulink. The LMS filter in our design accepts two inputs. One input is the incoming signal and another one is a delayed version of the incoming signal as a reference or desired signal. Based on these two inputs, it will find the best coefficients to reduce the error or in our case to cancel the ambient noise. 2 Simulation in Matlab Simulink 1) Go to desktop and run Matlab 2oo9. 2) Go to http://www.cems.uvm.edu/~mirchand/classes/ee275/2009/software/shahi n and save WaveletDenoising.mdl file in a local path on your PC and then open it in Matlab. Figure 1 shows the simulink model. We use a sine wave with an additive random noise as the input and a delayed version of it as the reference or desired signal.
Figure 1 Acoustic Noise Cancellation Simulink model 3) Run the model by pressing the Run button on the top toolbar or press and hold ctrl+t. Figure 2 Shows the input and output of the LMS filter. You can notice that initially the error associated to the input and the reference signal is considerable but it decays near to zero when the filter converges to the interest coefficients. Figure 2 LMS Filter input/outputs Figure 3 shows how the LMS filter coefficients change before become stable when the error gets near the zero.
Figure 3 LMS Filter Coefficients gradually converge 3 Real Time Implementation on DSK6713 In this lab we implement a noise reduction module with LMS filter on DSK6713. Beside the DSK board, we need a microphone and a speaker to connect to the board appropriately. Figure 4 shows the interface between computer and the DSK6713. Mic In Line Out to Speaker PC Power Supply +5v DSK6713 USB Figure 4 Ambient Noise Reduction hardware interface
4 The Procedure Power-ON and board Initialization 1. Plug the power supply to the DSK. 2. Power up the DSK6713 board with the USB cable connected to the PC. 3. Go to desktop and double click on the CCStudio v3.3 shortcut to run Code Composer Studio for DSK6713. This takes few minutes to load. 4. On CCS connect to the DSK by going to Debug Connect. Once connected you will see a small green cable icon on the far bottom left of the CCS software which says The target is now connected. Figure 5 Connecting to DSK 5. Connect a microphone to the Mic In input of DSK. 6. Connect a speaker to the Line Out output of DSK. Simulink Model and Build Process 7. Go to http://www.cems.uvm.edu/~mirchand/classes/ee275/2009/software/s hahin and save LMSNoiseReduction.mdl file in a local path on your PC and then open it in Matlab.
Figure 6 LMS Noise Reduction Top Level Model 8. Double click on the function() module named Denoising Algorithm to open the subsystem model. Figure 7 LMS Noise Reduction model As you see in Figure 7 we receive the input from Mic In. The input directly goes to the LMS filter input and a delayed version goes to the Desired input as a reference signal. We also have a switch right before the speaker output. So we can choose to have either the LMS filter output or the microphone input on the speaker output. 9. On the LMSNoiseReduction.mdl model go to Tools Real-Time Workshop Build Model. This would build the necessary files to be later used by CCS to program the DSK. This process might take several minutes in Matlab and CCS. You can
follow the ongoing building process in Matlab and CCS command window. In Matlab Command window you will see that Matlab generates the necessary C codes from the Simulink model and then creates a project for CCS. Once Matlab created the project, CCS compiles the project and downloads the program onto the DSK board. When CCS finished with programming the DSK, it will notify Matlab and you will see in the Matlab command window the message ### Download Done. Also at the bottom of CCS window, you will see ** starting the model** message. This means that the program is running on the DSK. Figure 8 Building LMS Noise Reducyion Model 10. On the bottom of DSK you see a set of 4 switches called SW1. When the switch number 0 is in its default position (up), it directly conducts the microphone input onto the speaker. And now by pressing down the switch number 0, you choose to have the LMS filter output on the speaker. So if you speak through the microphone you will see the noise reduction effect. Tuning the Model In order to tune our noise reduction design we can manipulate settings of our simulink model to find the best result. There are two settings in the LMS filter that we can change. We have to remember that each time we change the settings; we need to build the model again so that we can see the effect on the DSK. This means that we would have to go back to step number 9 to build the new updated model. Following steps are the two possible settings that we can change.
11. Go back to the LMSNoiseReduction simulink model, double click on the function() subsystem and once the inside subsystem opened, double click on the LMS filter module. Figure 9 LMS Filter Settings 12. Change the value of Step size (mu). You can change it from 0.001 to 0.5. With lower values of mu you can get a better result but longer response time and with higher values of mu you converge to the result faster but the accuracy are not as good as higher values of mu. Now you can build the modified model by following step 9 and once the download done on the DSK you can see the result. 13. The second thing to try is changing the LMS filter length. Try different filter length and go back to step 9 to build the modified model. Reference: Jacob Fainguelernt, Texas Instrument Inc. Matlab and Simulink.