Lab 105 (AI KIT): Dual Digital MEMS Microphone —
from PDM Capture to Sound Direction Sensing

Introduction

Almost every sensor you have interfaced with so far in this lab series answers a question about a single point in space: how fast is the board rotating, what is the air pressure here, and how strong is the magnetic field at this spot. A microphone is different. Sound is a traveling wave, and the moment you have two microphones separated by a known distance, you can measure not only what a sound is, but where it came from.

The PSoC 6 AI Evaluation Kit gives us exactly that opportunity. The board carries two Infineon IM72D128V01XA1 digital MEMS microphones (U4 and U5) that share a single two-wire PDM bus. This is not an accident of the board layout — it is a deliberate design choice that makes the kit suitable for microphone-array and Edge AI audio applications.

In this lab, we will build the complete audio signal chain from the ground up, layer by layer. We begin with a single microphone and the most basic question — "what do the raw numbers look like?" — and finish with a working demonstration that senses whether a sound came from the left, the center, or the right.

What You Will Learn

  • How a 1-bit PDM bitstream differs from conventional ADC sampling, and how the PSoC 6 PDM/PCM hardware block converts it into 16-bit PCM audio samples.
  • How the choice of decimation rate determines the PDM clock frequency, and how that clock frequency, in turn, selects the microphone's power mode.
  • Why raw PCM samples carry a DC offset, and how to remove it with a one-line first-order high-pass filter.
  • How to compute RMS energy and a relative dB reading using integer arithmetic only, and display it as a live text bar meter over UART.
  • How to detect acoustic transients (a hand clap) reliably using an energy threshold plus a debounce window.
  • How two microphones share one data line by using opposite clock edges, and how to separate them into independent Left and Right channels.
  • How to estimate the Time Difference of Arrival (TDOA) between the two channels using cross-correlation, and turn it into a coarse direction indication.


Prerequisite


Reading Materials: Datasheets and Other Resources

  • IM72D128V01 Datasheet - Infineon — XENSIV MEMS microphone: PDF
  • CY8CKIT-062S2-AI Kit Guide: PDF


Background and Theory of Operation

The IM72D128V01XA1 Digital MEMS Microphone — Device and Initialization

The IM72D128V01XA1 Digital MEMS Microphone — Device and Initialization

Overview of the IM72D128V01XA1 MEMS Microphone

The IM72D128V01XA1 is an ultra-high-performance digital PDM (Pulse Density Modulation) MEMS microphone featuring IP57 dust and water resistance, a high signal-to-noise ratio (SNR) of 72dB(A), and an acoustic overload point of 128 dBSPL. In this evaluation kit, there are two such microphones (U4 and U5) configured for stereo audio, which share a single PDM bus connected to the PSoC 6 MCU.

Step 1: Device Initialization

Unlike I2C or SPI sensors, the IM72D128V01XA1 does not rely on digital register writes for initialization. Instead, it is initialized purely via hardware signals:

  1. Supply Power and Clock: The device is powered by the kit's 3.3V rail (VCC_3V3). Initialization begins as soon as VDD and the PDM clock (fclock) are applied.
  2. Wait for Idle Tone: Within 3 ms of applying power and the clock signal, the microphone will output an idle tone (a sequence of alternating 1s and 0s representing a zero input signal) over the PDM data line until a valid microphone signal becomes available.

Step 2: Enable Sensors and Configure Power Modes

The operating power mode of the microphone is not set via software commands; rather, it is dynamically determined by the frequency of the PDM clock (fclock) supplied by the MCU:

  1. Standby Mode: Set the clock frequency to ≤ 350 kHz. The data pad becomes high impedance, putting the device in its lowest power state (typically 25 µA).
  2. Low Power Mode: Set the clock frequency to 450 ~ 850 kHz.
  3. Normal Mode: Set the clock frequency between 1.2 MHz and 1.65 MHz.
  4. High-Performance Mode: Set the clock frequency between 2.0 MHz and 3.3 MHz.

Step 3: Configure Output Data Rates (ODR)

The actual audio sample rate is handled by the MCU's PDM/PCM conversion block.

  • To match the standard data streaming applications on the PSoC 6 AI Evaluation Kit, configure the MCU to collect PDM or PCM audio data at 8 kHz or 16 kHz.

Step 4: Reading Audio Data

Audio data is transmitted over a 1-bit PDM interface using two shared MCU pins: PDM_CLK (P10[4]) and PDM_DATA (P10[5]). Because the two microphones share the same data line, they use a stereo multiplexing configuration based on their hardware SELECT pin wiring:

  • Reading the Left Microphone (U4): Its SELECT pin is physically tied to GND. You must read its data on the falling edge of the PDM clock.
  • Reading the Right Microphone (U5): Its SELECT pin is physically tied to 3.3V. You must read its data on the rising edge of the PDM clock.


Schematic Circuit and Pin Configuration


Lab Experiments

 

How the code in this lab is presented. The listings below are skeletons, not finished programs. Wherever you see a marker such as /* TODO 3 */, that line is yours to write. Each blank is preceded by a flowchart or a block of pseudocode describing exactly what the missing code must do. The surrounding structure, the module boundaries, and the function signatures are all given — you are filling in behavior, not architecture.


Q&A / Troubleshooting

© 2026 Air Supply Information Center (Air Supply BBS)