ESP32 s3 Sense Microphone with Micropython

Hi, someone has informations how to use the ESP32s3 sense integrated microphone with micropython? I can use the microphone with C++ and circuitpython samples, but it’s not working with micropython. The only difference I see is that micropython have an additional ws pin that C++ and circuit don’t have. In the esp32s3 schematic the microphone ws pin is grounded and therefore not available.

Mi basic code is following

mic_sck_pin = Pin(42)
mic_ws_pin = Pin(1)
mic_sd_pin = Pin(41)

audio_in = I2S(
    0,
    sck=mic_sck_pin,
    ws=mic_ws_pin,
    sd=mic_sd_pin,
    mode=I2S.RX,
    bits=16,
    format=I2S.MONO,
    rate=16000,
    ibuf=8192,
)

samples = bytearray(2048)
    while True:
        read_bytes = audio_in.readinto(samples)
        # amplify the signal to make it more audible
        I2S.shift(buf=samples, bits=16, shift=4)
        # send bytes to socket
        s.send(samples[:read_bytes])

Thank you to anyone can help me
bye

1 Like

Hello,

Could you please tell me if you made an progress on reading the sense mic under Micropython? I have one arriving in the post today hopefully and am also keen to get this working. I see what you mean by ws not being supported. Did you try a pin value of -1? Also, do you have the rest of your code for example where you initialise i2s please?

Thanks, G.

I’m looking here in case this helps but again it’d be useful to see more of your code please:

https://docs.micropython.org/en/latest/library/machine.I2S.html

Additionally I got the “-1” idea from the Arduino sketch but I doubt that’s a compatible solution actually.

Hi Grunts, I ended use C++ and got some result. But abandoned the project so I can’t help you with a working solution

1 Like