Recording audio?

We want to record images of animals in a nature conservation project, and also birdsong: initially as audio clips on the SD card but later perhaps for processing onboard - see here, for instance: Birdsong analysis and visualisation | The Cacophony Project

In our case audio and video processing do not have to be simultaneous.

Cheap digital microphones are available, with the I2S interface.

Q1 - has anyone attempted to record sound on the OpenMV?
Q2 - are I2C pins available on the OpenMV?

Thx - Charles

Hi, I’ve seen a few attempts on the forums to play WAV files, but no recording, and yes we have two I2C interfaces on the pin header.

The ADC pin can record audio. However, there’s no driver software to make a WAV file for this.

Hmmm - I have found some background that might be of value if anyone wants this feature…

I have never interfaced to digital audio products. I had heard of I2S (which is different from I2C) as an audio interface.
And the ST processor supports this interface. It seems it needs three pins: in effect clock, data and sync (called WS).
When WS is low the left data is clocked out and when WS is high the right data. Microphone chips have a left/right select pin,
so if you want stereo you can connect two chips in parallel with their selects wired differently.

From what I can see, The OpenMV camera can support I2S on the pins provided for SPI interface (possibly - is this right?):
PB12 = SPI2_NSS on JP1 pin 7 = I2S2_WS
PB13 = SPI2_SCLK on JP1 pin 3 = I2S2_CK
PB14 = SPI2_MISO on JP1 pin 2 = I2S2_SDI (audio in?)
PB15 = SPI2_MOSI on JP1 pin 1 = I2S2_SDO (audio out?)

An example of a digital microphone with an I2S interface is the Ivensense ICS-43434: https://invensense.tdk.com/wp-content/uploads/2016/02/DS-000069-ICS-43434-v1.2.pdf Modules with these may be available, for instance here: ICS-43434 I2S Digital Microphone Breakout Board - SensorMaestros
Other I2S digital microphone modules seem to be available.

As for the software - I don’t know. Someone has got this working on an STM32 chip:

This person has done it in Python for the ESP32: I2S Microphone | Details | Hackaday.io

This this seems to describe a MicroPython I2S library (but is it only for ESP32?): GitHub - miketeachman/micropython-esp32-i2s-examples: Usage and examples for I2S support on the ESP32 microcontroller

If there’s an I2S interface on SPI2 then you just need to write a C driver and then you can support a Microphone. The STM32 hardware will take care of audio data reception.

Yes, I also want this feature. So it there any plan to integrate the I2S interface into openmv? :grinning:

It’s too much to add to the plate right now.