ESP32 I2S-PDM Interface for Digital Guitar Pedal Application
The PDM (pulse-density modulation) has been widely used in the current technology of audio signal conversion (from analog to digital) because its simplicity while achieving high quality conversion. This technology is widely used in digital microphone, and it is basically a sigma delta modulator circuit which is used in many modern audio codec chip as well. It is an interesting feature that ESP32 micro controller has PDM operation mode in its I2S peripheral interface, so it can be a very cheap method to interface with audio input-output, and here I have designed such circuit for digital guitar effect pedal application. Here is the schematic diagram of the circuit:
There are two main parts of the circuit: the PDM demodulator and the PDM modulator. The demodulator works by demultiplexing the left and right channel signal data. The WS (word select) input is a clock signal that trigger the D flip-flop (U105.1 and U105.2) to capture the data from the DO input. By using the Q1 transitor to invert the clock, now the first flip-flop (U105.1) will capture the data at the falling edge of the clock signal to get the left signal data. Similar with the first flip-flop, but without inversion, the second one will capture the right data on the rising edge of the clock signal. To recover the analog audio signal, the left and right data is then simply filtered by low-pass filters (U103.2 and U103.1). The filters are third order, with the corner frequency (where the output is attenuated by 3dB) is set at around 16kHz. The frequency response of the filter is shown in the Figure 2.
The second main part, the PDM modulator, consist of delta integrator U101.2, the comparator U104.2, and data latch D flip-flop U106.1. The delta integrator is a dual-slope integrator, or order 2 integrator. A dual slope integrator is constructed by adding R118 and C120 into a single integrator (where the output of the op=amp is just connected directly to the C119). The Figure 3 shows the improvement made by the second order (dual slope) integrator compared with a single slope (1st order) integrator.
(To be continued..)