DSPRelated.com
Forums

Integrate PDM to PCM?

Started by Tom Becker October 13, 2016
Randy Yates <yates@digitalsignallabs.com> writes:

> Tom Becker <gtbecker@rightime.com> writes: > >> Knowles sent a much more informative application note on the >> SPH0641LU4H-1 MEMS microphone, including the noise spectra to 80kHz at >> 4.8MHz. The sigma-delta converter is 4th-order; its S/N at 80kHz is >>>100dB (pg 17). I've posted it on Dropbox: >> https://dl.dropboxusercontent.com/u/91727438/Application%20Note%20Multi-Mode%20Digital%20Microphone%20SPH0641LU4H-1%20V1.1%20101314.pdf >> >> This is encouraging and might let me off the hook somewhat, no? I'm >> wondering if my original idea of a bidirectional counter integration >> (which the ATMega can do in hardware) might work, after all - although >> DC run-away might still be a problem. > > Tom, > > If your goal is to get a high resolution output, e.g., something on the > order of 16 bits or greater at an 80 kHz bandwidth, I don't think you're > even close. You're so far off that I wonder if you really understand the > situation. > > Their spectral plot on p.17 is, as you've noted, is to 80 kHz. However, > the undecimated sample rate is 4.8 MHz, which means you'll have > frequency components all the way up to 2.4 MHz. That's a lot of > frequency "area" that is unspecified. > > And if the part operates like a typical delta-sigma modulator, there's > going to be a LOT of quantization noise power that's shaped into the > upper area of the undecimated spectrum, WAY above 80 kHz for a 4.8 MHz > sample rate. That's how these parts work. > > Now I haven't gone to the trouble to make an estimate of the total > quantization noise power in the 80 kHz bandwidth they did specify, but > it seems to me if you put a crappy moving average filter as your first > filter and then decimate by 8, you are going to alias most of the > quantization noise back into the decimated signal. Perhaps even most of > it. So if the analog A/D is 1-bit, your resulting decimating signal is > going to be awful. And no amount of subsequent filtering will remove it.
Tom, I found a plot of a 5th-order delta sigma modulator in a text by [bourdopolous] so you can see the spectrum shape I'm talking about: http://www.digitalsignallabs.com/delta-sigma-power-spectra.pdf --Randy @book{bourdopoulos, title = "Delta-Sigma Modulators: Modeling, Design and Applications", author = "George I. Bourdopoulos and Aristodemos Pnevmatikakis and Vassilis Anastassopoulos and Theodore L. Deliyannis", publisher = "Imperial College Press", year = "2003"} -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Wed, 19 Oct 2016 22:50:15 -0400, Randy Yates wrote:

> Tim Wescott <tim@seemywebsite.really> writes: > >> On Fri, 14 Oct 2016 23:09:51 -0400, Randy Yates wrote: >> >>> Tim Wescott <seemywebsite@myfooter.really> writes: >>> >>>> On Thu, 13 Oct 2016 21:20:10 -0700, Tom Becker wrote: >>>> >>>>>> ... set up an SPI port to clock at 4.8MHz [] then you have a look >>>>>> up table: >>>>>> 0 has 0 bits on, >>>>>> 1 has 1 bit on, >>>>>> 2 has 1 bit on, >>>>>> 3 has 2 bits on, >>>>>> etc. >>>>>> The output of that table gets 4 subtracted from it... >>>>> >>>>> Ah. So eight bits (0-255) @4.8MHz becomes three bits (0-7) @600kHz, >>>>> offset by -4 makes it bipolar? So now I have 3-bit PCM @600kHz? >>>>> How do I get from there to 16-bit @192kHz? >>>>> >>>>> Tom >>>> >>>> Low-pass filter. >>> >>> And resample. It's not a simple decimation either. >>> >>> You also will have an unwanted sync in the spectrum due to the >>> disjointed 8-bit "integration." >> >> That kinda depends on the noise characteristics going into the >> integration (AND I DON'T THINK IT NEEDS THE QUOTES). > > (emphasis mine) > > I wanted to get back and address this one more thing, Tim. > > Why not, i.e., why not the quotes? What you've described (i.e., counting > the number of bits over an 8-sample interval) looks to me like a moving > average filter followed by decimation. This is not an integrator. The > z-transform (before decimation) is not H(z) = z / (z - 1)!
Eh, OK. But a moving average filter (done pedantically) has an integrator in it. Misled myself... -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
Tim Wescott <seemywebsite@myfooter.really> writes:
> [...] > Eh, OK. But a moving average filter (done pedantically) has an > integrator in it. Misled myself...
Heh. If I had a dime for every time I've had to eat crow here on this group... -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Randy Yates  <yates@digitalsignallabs.com> wrote:

>Tim Wescott <seemywebsite@myfooter.really> writes:
>> Eh, OK. But a moving average filter (done pedantically) has an >> integrator in it. Misled myself...
>Heh. If I had a dime for every time I've had to eat crow here on this >group...
More pedantically, semantic quotes are to be avoid in clear writing. Rather than writing "integrator", write something like "the filter you referred to as an integrator". Ooops, I just did it! Steve
> ... I wonder if you really understand the situation.
Surely not to your degree, I acknowledge. That's why I sought a group like this and posted my proposition. I do understand the noisy nature of digital processing (OT: it's ironic that, to marketers, "digital" is noise-free and "digital quality" is perfect), and I understand Nyquist and aliasing, of course.
> ... there's going to be a LOT of quantization noise power that's shaped into the upper area of the undecimated spectrum...
I expect you're right; the question is to what degree does that mask the bat. I've started to breadboard the counter in an AVR so we can see what results. Tom
On Tuesday, October 18, 2016 at 6:54:30 PM UTC-4, Tom Becker wrote:
> A response from InvenSense: > > "Our analog microphones are not characterized and specified to ultrasonic frequencies, but they do maintain good response with low noise out to well above 40 kHz. We have also released a digital PDM microphone (ICS-41352) with a response specified up to 85 kHz. This mic and the related documents should be on our website soon." > > Tom
Microphones themselves, even the cheapest electrets, usually have pretty good response to 40 KHz and sometimes much higher The problem arises when you buy a finished product from manufacturer - a breakout board with mic, op-amp and other circuitry. Many of the manufacturers have some type of low-pass filter as part of their preamp design limiting output to audio frequencies only - that's their purpose after all, to provide quality audio input. I have tried same analog mics with preamp boards from different manufacturers and also with simple homemade op-amp-based preamp with wide frequency band. Results were drastically different with exact same analog microphone. ICS-52000 data sheet mentions pass-band of 20Khz at Fs=48Khz after low-pass decimation filter... Let us know if it can go higher than that. Are you going to solder those tiny mics yourself and not use ready-made breakout boards (assuming you can find them) ? In any case, if you are just looking for quality recording (not real-time analysis) you might be much better off with something like Wolfson Audio card for Raspberry Pi which goes up to 192KHz and give you full 24 bits resolution. Plus you can use full stack of available software
Tom Becker <gtbecker@rightime.com> writes:

>> ... I wonder if you really understand the situation. > > Surely not to your degree, I acknowledge. That's why I sought a group > like this and posted my proposition. I do understand the noisy nature > of digital processing (OT: it's ironic that, to marketers, "digital" > is noise-free and "digital quality" is perfect), and I understand > Nyquist and aliasing, of course. > >> ... there's going to be a LOT of quantization noise power that's shaped into the upper area of the undecimated spectrum... > > I expect you're right; the question is to what degree does that mask > the bat. I've started to breadboard the counter in an AVR so we can > see what results.
I suspect you're going to add a few dozen decibels of noise to an already medium quality signal. But sure, try it if you have the time. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Thu, 20 Oct 2016 10:05:49 -0700, Tom Becker wrote:

>> ... I wonder if you really understand the situation. > > Surely not to your degree, I acknowledge. That's why I sought a group > like this and posted my proposition. I do understand the noisy nature > of digital processing (OT: it's ironic that, to marketers, "digital" is > noise-free and "digital quality" is perfect), and I understand Nyquist > and aliasing, of course. > >> ... there's going to be a LOT of quantization noise power that's shaped >> into the upper area of the undecimated spectrum... > > I expect you're right; the question is to what degree does that mask the > bat. I've started to breadboard the counter in an AVR so we can see > what results. > > Tom
If (when?) you don't get satisfactory results, check back here -- there will be improvements that can be made. One way or another you need to filter the signal a lot more strongly than you'll achieve with just one integration. Basically, your integrator provides one pole of filtering; you need four or five in total. I think we can help you out, when you're open to doing something more than a simple one-stage filter. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
Tom Becker <gtbecker@rightime.com> writes:

> Surely not to your degree, I acknowledge. That's why I sought a group > like this and posted my proposition. I do understand the noisy nature > of digital processing (OT: it's ironic that, to marketers, "digital" > is noise-free and "digital quality" is perfect), and I understand > Nyquist and aliasing, of course.
> I expect you're right; the question is to what degree does that mask > the bat.
That depends heavily on the nature of, and requirements for, whatever system or application is sinking the data from your counter/integrator. But if it were my project, I would design in a known-good filter that is expected to sufficiently remove the quantization noise for all practical purposes. That way you avoid having to ask "maybe the filter isn't good enough" each time your application fails to perform. It will cut down on troubleshooting time. Steve
Tim Wescott  <seemywebsite@myfooter.really> wrote:

>One way or another you need to filter the signal a lot more strongly than >you'll achieve with just one integration.
Yep
>Basically, your integrator >provides one pole of filtering; you need four or five in total.
Yep
>I think we can help you out, when you're open to doing something more >than a simple one-stage filter.
I'll nitpick -- there may be a "one stage" filter that is good enough. I have used all-pole, 4th order low pass filters that are implemented in a single stage (direct form). Steve