Capture audio from a microphone on your Raspberry Pi Pico or any RP2040 based board. 🎤
-
RP2040 board
-
Microphones
Raspberry Pi Pico / RP2040 | Analog Microphone |
---|---|
3.3V | VCC |
GND | GND |
GPIO 2 | SCK |
GPIO 3 | WS |
GPIO 6 | SD |
GND | L/R |
Raspberry Pi Pico / RP2040 | Analog Microphone |
---|---|
3.3V | VCC |
GND | GND |
GPIO 26 | OUT |
Raspberry Pi Pico / RP2040 | PDM Microphone |
---|---|
3.3V | VCC |
GND | GND |
GND | SEL |
GPIO 2 | DAT |
GPIO 3 | CLK |
GPIO pins are configurable in examples or API.
-
Set
PICO_SDK_PATH
export PICO_SDK_PATH=/path/to/pico-sdk
-
Create
build
dir, runcmake
andmake
:mkdir build cd build cmake .. -DPICO_BOARD=pico make
-
Copy example
.uf2
to Pico when in BOOT mode.
The OpenPDM2PCM library is used to filter raw PDM data into PCM. The TinyUSB library is used in the usb_microphone
example.
Get data raw using I2S protocol and using algorithm fill buffer to decode audio.
Buffer App = Buffer Ring / 4 = Buffer DMA / 8.
To record data, using [TinyUSB](GitHub - hathach/tinyusb: An open source cross-platform USB stack for embedded system) library is used in the usb_microphone
example. Buffer output <= 32 bytes <=> 256 bytes in DMA buffer
Using [Audacity software](Download | Audacity ® get audio output