Adding Analog mic to Raspberry Pi Pico

I am trying to add an analog mic to my Pi for a sound recognition project in Edge impulse. I see there is an “On Board Mic” but the pico does not have one. I looked into the PDM.cpp code as well as another forum post on here. It seems I could edit this to run a PDM mic pretty easily. However, I don’t currently have one. Can anyone point me in the right direction to get edge impulse to recognize an analog or I2s Mic. Or am I better off just ordering an PDM mic?

Hello @BJOHN159,

In theory, you just need to have a signal (raw features) and a label to train your embedded machine learning model.
That being said, I never tried our audio pre-processing method with analog microphones (maybe just normalizing the axis would do the trick if your signal is not saturated).

You can try to use the dataforwarder to upload a couple of minutes of audio, then train a first version of your model and see if it gives good results.

Let me know I’m interested to know if you get good results.

Also ping @AlexE, he probably knows more than me about this :wink:

Best,

Louis

See my modified code here ml_audio_classifier_example_for_pico/usb_microphone_analog.c at main · ferrygun/ml_audio_classifier_example_for_pico · GitHub. I am using Max9814 with Pico.

This is based on GitHub - ArmDeveloperEcosystem/microphone-library-for-pico: Capture audio from a microphone on your Raspberry Pi Pico or any RP2040 based board. 🎤

2 Likes

I am using that library too with my analog microphones. It works like charm.

1 Like

No concerns using analog, should work just fine! The DSP block doesn’t care about scaling (we actually scale everything to ±1 internally for the audio blocks anyway)