Homework 4 In this homework, you will be acquiring data from the ADC and processing it in MATLAB to remove noise and identify trends. First, program your board to read data from a sensor of your choice. Since we've been working with the temperature sensor over the last couple of weeks, you should already have code that reads the temperature sensor and logs the data either to the serial port or to the network. You can use the temperature sensor for this project if you want, or you can choose a different sensor. If you want to use a different sensor, you should probably choose one with an analog output (which should be easy to get data with the ADC example project). For whatever sensor you choose, set your board up to sample the sensor continuously at a fixed time interval. For the temperature sensor, the time interval can be every 30 or 60 seconds. If you're using a different sensor, you may need to sample more frequently. Set up your experiment so your board samples your signal continuously to acquire 5,000-10,000 samples. It's probably easiest to print your sampled data to the serial port and record it with minicom. Use the log function in minicom to record the output to a file. Once you've saved your data, use a text editor or stream parser (vim/sed/awk) to convert your minicom log file to a single-column CSV file, which can be imported into MATLAB: load -ascii 'data.txt' This command will create a MATLAB variable called data. Calculate the FFT of the data and plot it: MATLAB Warmup ------------- Create some artificial data and plot it: t = linspace(0,8*pi,1000); sig = sin(t) + 0.5*sin(2*t); % Create a signal sig = sig + 0.1*randn(1,1000); % Add some normally distributed random noise sig_freq = abs(fft(sig)); plot(sig_freq); This plot should be symmetric. The points at the extreme ends (low frequency indexes and high frequency indexes) represent low frequencies. The points in the middle represent high frequencies. Remove the noise by zeroing out some of the high-frequency components. Inverse transform to see the de-noised signal: sig_filt = real(ifft(sig)); figure; plot(sig_filt);