At this time we only have example code for the SAMD21 chipset using the I2S peripheral, you'll be limited to what pins you can use and the digital filtering must be done in software but it does work! We don't necessarily recommend this mic for SAMD21 - an analog microphone will work quite well with less hassle!

The SAMD21 can be used with PDM but it's not ideal unless you're willing to put in the work to filter data and manage the peripheral - consider this code for test & experimentation!

Available I2S Pins

As we are using the I2S peripheral, not all pins can be used! For the Feather M0 / Metro M0 / Arduino Zero family, here's the available I2S pins:

Available Clock Pins:

  • PA10 a.k.a D1 or TX
  • PB11 a.k.a SCK
  • PA20 a.k.a. D6

Available Data Pins:

  • PA07 a.k.a D9
  • PA08 a.k.a D4
  • PA19 a.k.a. D12

Install Library

Download the latest version of the ZeroPDM library from github. Install as usual!

We have a two examples, one uses the DMA capability to grab data, which means we don't have to do as much work, but there's more setup involved and requires the ZeroDMA library.

We recommend starting with the basic demo, which will echo audio data to A0 (the the analog output). Connect up headphones or an oscilloscope to A0 to hear/see the audio!

Before uploading, be sure to change the instantiator to match your pinouts:

// Create PDM receiver object, with Clock and Data pins used (not all pins available)
Adafruit_ZeroPDM pdm = Adafruit_ZeroPDM(1, 4);  // Metro M0 or Arduino zero
//Adafruit_ZeroPDM pdm = Adafruit_ZeroPDM(34, 35);  // CPlay express

This guide was first published on Jan 10, 2018. It was last updated on Apr 17, 2024.

This page (Arduino Wiring & Test) was last updated on Mar 08, 2024.

Text editor powered by tinymce.