ESP32S3 + PDM mic(SPK0838HT4H-B ) Interface configuration

vivek.rana
Posts: 1
Joined: Wed Jul 06, 2022 1:59 pm

ESP32S3 + PDM mic(SPK0838HT4H-B ) Interface configuration

Postby vivek.rana » Wed Jul 06, 2022 3:28 pm

Hello Espressif team,

We are trying to interface ESP32-S3 Devkit with two PDM mic(SPK0838HT4H-B) in stereo mode.

We have connected clock and data pins of both the mic to ESP32 I2S Channel 0.

Here we are facing certain issue and could not able to get the clear voice from the PDM mic.

We are using ESP-IDF version 4.4.1 [stable release] and we are modifying sample code i2s_audio_recorder_sdcard to Interface the microphone and we have made following configuration changes for testing:

Code: Select all

i2s_config_t i2s_config = {
.mode                              = I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM,
.sample_rate                   = CONFIG_EXAMPLE_SAMPLE_RATE,    // CONFIG_EXAMPLE_SAMPLE_RATE = 16000
.bits_per_sample            = I2S_BITS_PER_SAMPLE_16BIT,            // I2S_BITS_PER_SAMPLE_16BIT  = 16
.channel_format              = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format  = I2S_COMM_FORMAT_PCM,
.intr_alloc_flags               = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count              = 8,
.dma_buf_len                  = 200,
.use_apll                         = 0,
};

// Set the pinout configuration (set using menuconfig)
i2s_pin_config_t pin_config = {
.mck_io_num                  = I2S_PIN_NO_CHANGE,
.bck_io_num                   = I2S_PIN_NO_CHANGE,
.ws_io_num                    = CONFIG_EXAMPLE_I2S_CLK_GPIO, //  GPIO 4  
.data_out_num               = I2S_PIN_NO_CHANGE,
.data_in_num                 = CONFIG_EXAMPLE_I2S_DATA_GPIO, //  GPIO 5
};

Here we read the data and we are pass the data to HPF to filter data below 10 Hz and then we pass output of HPF to LPF to filter data above 8 Khz.

i2s_read(CONFIG_EXAMPLE_I2S_CH0, (char *)d, SAMPLE_SIZE, 1024, 100);

dsps_biquad_gen_hpf_f32(coeffs_hpf, 10, 0);
dsps_biquad_f32(d, y, 1024, coeffs_hpf, w_lpf);

dsps_biquad_gen_lpf_f32(coeffs_lpf, 8000, 0);
dsps_biquad_f32(y, o, 1024, coeffs_lpf, w_lpf);



We are collecting the data received from LPF using serial output, and converting those data from HEX to ASCII to convert it into ".wav" format so that we can play the audio.

Here, we are not getting proper audio output. So can you please share your inputs here if we are missing any trick to configure PDM.

Please let me know If you need more additional information.


Thanks!!!

Digvijay Reddy
Posts: 2
Joined: Thu Feb 09, 2023 3:53 am

Re: ESP32S3 + PDM mic(SPK0838HT4H-B ) Interface configuration

Postby Digvijay Reddy » Thu Feb 09, 2023 3:55 am

Can u please send the full code. It would be easier then.

Who is online

Users browsing this forum: No registered users and 51 guests