Mico: A PDM to USB microphone based on the Raspberry Pi RP204020 Dec 2021
Earlier this year, I was doing audio experiments with Machine Learning (ML) on the Raspberry Pi, and was looking for a compact USB microphone. The one which is commonly available is shown below.
While it was convenient to plug this in and access it from Python using pyaudio, the sound quality from this mic was terrible. Extremely noisy with poor (distance) sensitivity.
Ultimately I completed my audio recognition project using an I2S microphone which had a much better audio quality.
But I kept thinking about this problem, and did some research on I2S to USB bridge ICs. I found a couple of ICs like the Si Labs CP2615, but they looked obsolete. I also looked at the Cypress FX2 series with I2S support, and that seemed like a possible option, provided I was willing to put in a fair amount of work.
Recently, I’ve been working with the Raspberry Pi Pico. I’ve been dazzled with the RP2040 - especially with the PIO and the documentation and software support provided by the company. The Pico uses TinyUSB which has audio support, which got me thinking - surely someone must have thought of making a USB mic with this? And sure enough, Sandeep Mistry has done just that, with his Microphone Library for Pico open source project. So I already had firmware for my project. Now I just needed to make the hardware. Thus the idea of Mico was born.
I wanted a compact design for the mic, but I knew it was difficult to make it as small as the noisy mic shown above, due to the size of the RP2040 chip and mechanical design considerations. So I opted for a simple design with a reliable USB Type-A plug. I initially toyed with the idea of making the USB connector as part of the PCB, but that meant a thicker PCB and higher costs, so I dropped the idea. I also added an LED to the board for ease of testing.
The RP2040 needs very few extra components to get going, so Mico has a simple schematic.
I did some research on PDM microphones and chose MP23DB01HPTR which seems to have a good range. I chose a bottom-ported once because I wanted the top side of Mico to be bare for the title and logo.
Here’s the PCB design.
I adapted the firmware for Mico from Sandeep Mistry’s project mentioned earlier. The only minor addition I did is to add a PIO based blinky program and change some description strings.
Here’s Mico in action:
Here’s a comparison of the noisy mic and Mico in Audacity on Windows 10, with both recordings from the same distance.
You can see how low the sensitivity is for the first mic. Now let’s normalize the audio.
You can see the high level of noise in the first mic. The contrast tool in Audacity shows about 36 dB RMS foreground/background separation for Mico vs. 21 dB RMS for the other mic.
The audio quality from Mico is quite good, so I am very happy with this project.
This was a very quick project, and I was very happy that the PCB worked in the very first run. This project also reaffirmed my faith in Open Source projects. I could build on top of prior work, and in turn, I am open sourcing Mico so others can learn and adapt it for their projects.
I am grateful to Sivaprakash. S for the PCB design assembly of the Mico prototypes. I also thank Sandeep Mistry for open sourcing his RP2040 PDM microphone project, without which this project would have never taken off.
Mico is an Open Source Hardware Project. You can download design files and code for Mico from my github repo below: