PDM Mic on RP2040 Pico

Hi - I connected a PDM Mic at pins 26 & 27, modified pin defs in wire.h, built revised firmware, installed, connected - can’t get any signal out of it - flat line. The mic is a PDM MEMS from Adafruit. The data acquisition dashboard indicates a built-in mic for sampling, but my suspicion this is perhaps for the Arduino Nano?
I’m clearly missing something here, can you point me in the right direction?
Thank you

Project ID: Bark

Context/Use case:

Now trying to get some sort of microphone performance on the Arduino Connect RP2040 - rebuilt the firmware with the default pins in wire.h, as well as
// Wire
#define SDA (12u)
#define SCL (13u)

#define PIN_WIRE1_SDA (6u)
#define PIN_WIRE1_SCL (7u)

  • doesn’t matter. No models yield audio data. I also used the canned firmware image. Same result.
    I see the pdm library in the code set, and I know its being used, but can’t figure out why there’s this no data transfer.

Hello @moverturf,

Correct, in that case we are using the onboard Omnidirectional Digital Microphone, the MP34DT05 microphone:



Ok, I’ll go ahead and answer my own question then since this is such a difficult secret:


  • Line #53 and #54 add 2 definitions: PDM_DATA_PIN and PDM_CLK_PIN to whatever pins you want to use;
  • Line #248 comment out fixed definition for PDMClass creation;
  • Line#251 added new PDMClass creation using constants defined above.

Recompile, deploy. You should now be able to record samples for impulse creation through the board attached mic.
At least someone else may benefit and avoid this time-wasting goose chase.



@moverturf I do not have code line numbers up to #251 like you stated but am trying to do exactly as you did and add the PDM mic.

I added the two definitions above “PDMClass::PDMClass(int dinPin, int clkPin, int pwrPin) :” which i belive is where you said to put them not that it will matter.

Then I commented out PDMClass PDM(22, 23, -1);
should I then add a new class creation like PDMClass PDM(PDM_Data_PIN, PDM_CLK_PIN, -1);?


okay I got this working as well so maybe someone else doesn’t struggle though this as much as I did, so in the code all you have to do is change the last line “PDMClass PDM(22, 23, -1);”
the 22 is the data pin and the 23 is the clk pin since the pico does not have gpio 23 we need to change this. So I modified it to PDMClass PDM(2, 3, -1); which used gpio pins 2 and 3.

Then following the Getting started with Raspberry Pi Pico
we can build the code using section 9.2.
Works flawlessly and recognizes the Ada fruit PDM mic as an onboard one.
Thank you to the above poster for bringing this topic to the forum. Hopefully between both of our post we can assist someone else.