Page 1 of 1
ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Sun Jan 28, 2018 8:33 pm
by tolo69
Hi all,
I want to connect the MEMS-microphone ICS43434 to the ESP32. This microphone chip comprises I2S Interface to transmit the audion data stream. There is an "I2S.h" library compatible for the Arduino board MKRZero. I'm looking for a library for ESP32. Has somebody already done the porting or using similiar library for ESP32 ?
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Mon Jan 29, 2018 4:28 am
by onehorse
+1
I am able to use these mics with the nRF52 and STM32L4 and Teensy (various) but am not sure if there is an easy way to do so with the ESP32 Arduino core.
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Mon Jan 29, 2018 8:04 pm
by rudi ;-)
tolo69 wrote:Hi all,
I want to connect the MEMS-microphone ICS43434 to the ESP32. This microphone chip comprises I2S Interface to transmit the audion data stream. There is an "I2S.h" library compatible for the Arduino board MKRZero. I'm looking for a library for ESP32. Has somebody already done the porting or using similiar library for ESP32 ?
did you try
simple insert the megaphone c code example in your arduino project?
try it - i am sure it work's
best wishes
rudi
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Mon Jan 29, 2018 10:31 pm
by tolo69
The microphone data can be captured. But in the Serial plotter I'm facing square wave, but I would expect analog graph. What do I have to change in my Code?
Code: Select all
#include <WiFi.h>
#include "driver/i2s.h"
void i2s_config() {
// http://esp-idf.readthedocs.io/en/latest/api/perip herals/i2s.html
// input
i2s_config_t i2s_in_config = {
mode: (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX),
sample_rate: 44100,
bits_per_sample: (i2s_bits_per_sample_t)32,
channel_format: I2S_CHANNEL_FMT_RIGHT_LEFT,
communication_format: (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB),
intr_alloc_flags: ESP_INTR_FLAG_LEVEL1,
dma_buf_count: 14,
dma_buf_len: 64
};
i2s_pin_config_t i2s_in_pin_config = {
bck_io_num: 16,
ws_io_num: 4,
data_out_num: -1, //Not used
data_in_num: 17
};
pinMode(17, INPUT);
pinMode(16, OUTPUT);
pinMode(4, OUTPUT);
i2s_driver_install((i2s_port_t)0, &i2s_in_config, 0, NULL);
i2s_set_pin((i2s_port_t)0, &i2s_in_pin_config);
}
void read_i2s() {
uint32_t sample_val[2] = {0, 0};
uint8_t bytes_read = i2s_pop_sample((i2s_port_t)0, (char *)sample_val, portMAX_DELAY);
Serial.println(sample_val[0]);
}
void setup()
{
Serial.begin(115200);
delay(4000);
i2s_config();
}
void loop()
{
read_i2s();
}
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Sun Feb 04, 2018 2:51 am
by hassan789
tolo69 wrote:The microphone data can be captured. But in the Serial plotter I'm facing square wave, but I would expect analog graph. What do I have to change in my Code?
I don't use arduino, but just looking at your code, here are some ideas:
1. "sample_val" should be signed (aka "int32_t", not "uint32_t")
2. the println might be slowing down your sampling. Might want to buffer up (maybe 100 samples atleast?) and print them all at once
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Thu Feb 15, 2018 9:07 pm
by tolo69
Correcting the data type of sample_val to int32_t solved the problem
Not it works
Thanks a lot
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Sat Feb 17, 2018 3:09 am
by onehorse
Please post the entire working Arduino sketch or link to a github repository where I can find it. Thanks!
Re: ESP32 using ICS43434 as MEMS microphone in Arduino IDE
Posted: Tue Mar 06, 2018 4:43 pm
by tolo69
It is same sketch as posted above. Just 1 line has to be replaced:
uint32_t sample_val[2] = {0, 0}; ---> int32_t sample_val[2] = {0, 0};