1

I'm trying to convert PDM data into analog form by passing the data through a low-pass filter in Matlab. My approach is fairly simple and matches the answer given in this Electrical Engineering Stack Exchnage thread: How can I convert an audio PDM bitstream into analog form? However, the result of the filtered PDM data looks like this:

enter image description here

Running an FFT doesnt work on this analog data. What could I be doing wrong? I've tried a butter filter (various orders) and Cheby 2 filter and elliptic as well. Here's what my FFT chart looks like for reference:

enter image description here

dg1271
  • 45
  • 6
  • An FFT of that data should give you a spectrum of some sort. What does "doesn't work" mean? Wrong results? Is it possible you've just got a problem with calculating and displaying the FFT? – JRE Sep 18 '20 at 15:24
  • My issue is that I used the same FFT code on other sets of PDM data (three different types of FFT generating functions) and it displayed an FFT successfully. – dg1271 Sep 18 '20 at 15:28
  • 3
    The signal has a low amplitude, as well as a somewhat low frequency. Your FFT plot looks somewhat reasonable for the signal you show. – JRE Sep 18 '20 at 15:31
  • The FFT also doesn't make sense since the microphones were exposed to an ultrasonic source in roder to collect the PDM data. – dg1271 Sep 18 '20 at 15:33
  • Your signal also has a DC offset (0.472V) which is larger (by far) than the signal (just a couple of millivolts peak to peak.) – JRE Sep 18 '20 at 15:33
  • Whether or not the shown signal is a reasonable match for the PDM data is another question. – JRE Sep 18 '20 at 15:34
  • Tthe FFT makes sense. What doesn't make sense is your signal as the result of an ultrasonic experiment. Likely you lost the ultrasonic content in the filtering from PDM if not before. What evidence do you have the microphones even pass ultrasonic content? Some MEMS devices do, some filter it out. – Chris Stratton Sep 18 '20 at 15:34
  • 2
    Voting to close as a duplicate of your existing question, because the loss of ultrasonic content is not in the FFT, but rather in either the PDM conversion or in the original experimental setup itself. [How can I convert an audio PDM bitstream into analog form?](https://electronics.stackexchange.com/questions/521799/how-can-i-convert-an-audio-pdm-bitstream-into-analog-form) – Chris Stratton Sep 18 '20 at 15:35
  • The mics are rated for ultrasound by the manufacturer and have successfully been able to capture ultrasound. I do understand that its a possibility that something might not have been right with the current experimental setup however. – dg1271 Sep 18 '20 at 15:46
  • If you are using the filter code give as an answer in your other question, did you change the sampling rate and set the cutoff frequency? That code assumes the sequence value is related to real time, but your description sounds more like a simple counter. If the sequence value is just a counter then you need to change the code to use the real sampling rate (4000000) for fs and you need to set fcutHz to maybe 60000. – JRE Sep 18 '20 at 15:55
  • I did indeed change those values so that they would applicable to my application. – dg1271 Sep 18 '20 at 15:56
  • What are the units on the "time domain" plot x-axis? – user1850479 Sep 18 '20 at 15:58
  • Technically, I'm using the time domain as a reminder that the data has not been FFTed. The sample values are simply numbered (0,1,2,3 etc.). I do know and have used Fs within my Matlab code. – dg1271 Sep 18 '20 at 16:05
  • @dg1271 If its is not some type of confidential data, can you post a sample of the data ? If you can please [edit] it into the question. We don't need the full data. Since the data is 4Mhz (from your other question) and the signal of interest is 50kHz, I request you to post the raw data for 160 samples (two cycles of 50kHz data at 4Mhz). – AJN Sep 18 '20 at 16:41
  • "My issue is that I used the same FFT code on other sets of PDM data (three different types of FFT generating functions) and it displayed an FFT successfully." Can you show those fft examples ? Are those data also from the same (MEMS) hardware ? Please [edit] it into the question. – AJN Sep 18 '20 at 16:42
  • @dg1271 Can you also [edit] in the particular Matlab code you have ran on the excel file ? – AJN Sep 18 '20 at 16:47
  • Whe you are plotting fft of the data are you plotting \$\mathcal{Re}(\mathrm{fft}(x))\$, or \$\mathcal{Im}(\mathrm{fft}(x))\$ or \$\mathrm{abs}(\mathrm{fft}(x))\$ ? Please show that code also. – AJN Sep 18 '20 at 16:48
  • 1
    @AJN I've got three types of FFT calcs running that follow these examples: 1. https://www.mathworks.com/help/matlab/ref/fft.html 2. https://www.allaboutcircuits.com/technical-articles/design-of-fir-filters-design-octave-matlab/ 3. Variation of #1 that uses abs like #1 – dg1271 Sep 18 '20 at 16:52

0 Answers0