[HN Gopher] Mico: A PDM to USB Microphone Based on the Raspberry...
       ___________________________________________________________________
        
       Mico: A PDM to USB Microphone Based on the Raspberry Pi RP2040
        
       Author : rcarmo
       Score  : 110 points
       Date   : 2021-12-26 11:51 UTC (11 hours ago)
        
 (HTM) web link (electronut.in)
 (TXT) w3m dump (electronut.in)
        
       | diimdeep wrote:
       | Instead of Pi it could have been a dozen different IC, but
       | interesting part in this kind of project is audio theory, and
       | MEMS microphone performance.
       | 
       | MEMS microphone used here is mp23db01hp
       | 
       | https://www.st.com/en/mems-and-sensors/mp23db01hp.html
       | 
       | and it looks like better than ICS 43434 that I stumbled on before
       | 
       | https://invensense.tdk.com/wp-content/uploads/2016/02/DS-000...
       | 
       | For theory about how microphone works and performs interesting
       | read is
       | 
       | https://www.analog.com/en/analog-dialogue/articles/understan...
        
         | m0lecules wrote:
         | 64dB SNR is pretty standard these days for MEMS - you will pay
         | a lot more to get up in the 70s. Good studio mics will be in
         | the 80dB+ range.
         | 
         | Here's the highest performing one today:
         | https://www.digikey.com/en/products/detail/tdk-invensense/IC...
        
         | nyanpasu64 wrote:
         | Today I learned that there are now MEMS microphones which rely
         | on fabricated silicon, not conventional electrical coils or
         | electrostatic/electrets/magnet pickups, to pickup sound waves.
        
           | NavinF wrote:
           | I believe this is the most common type of microphone today.
           | There's just not enough space in devices like phones and
           | smart watches for anything else. My SM7B is probably the only
           | non-MEMS mic I own.
        
       | danbr wrote:
       | Neat!
       | 
       | I'm curious if one could design a usb type A plug/port that is
       | reversible such that the PDM is always facing up. I know there
       | are some flexible/thin pcb that allow for this, although not sure
       | how robust that design is (otherwise I'd assume we'd never have
       | to worry about rotating the USB cable three times before getting
       | it right side up. Maybe I just described usb type C :))
        
         | fortysixdegrees wrote:
         | Interesting. You would have to invert the voltage on D+ and D-
         | when it's in backwards. Or flip the lines somehow. Nice little
         | puzzle that one
        
           | RF_Savage wrote:
           | One could just have the contacts wired differently on the
           | otherside of the board. The larger problem would be the
           | contacts in the "backside" of the plug getting shorted by the
           | USB connector shield. Outside of that it does sound doable.
           | Maybe with a thin pcb and a USB-A shell it'd be doable...
        
           | jrockway wrote:
           | Why not just put two plugs on the board, one in each
           | orientation (and put the mic and rp2040 in the middle)?
        
       | th3h4mm3r wrote:
       | I've used the same microphone you used in your first experiment
       | and yes... it sucks!
       | 
       | Really happy to see now your project, I'm only wondering how to
       | had one of that.
        
       | karmicthreat wrote:
       | My only complaint about the RP2040 is that it doesn't have an
       | external SPI ram interface.
        
         | R0b0t1 wrote:
         | That's usually a niche feature. Core IP and fabrication have
         | become so cheap that it is preferred to get a Cortex-A part and
         | real DRAM. What usecase do you have for larger memories on an
         | embedded controller?
        
           | kevin_thibedeau wrote:
           | QSPI memory _is_ real DRAM without the profusion of pins,
           | routing density, and signal integrity issues of traditional
           | devices. Lots of memory poor micros can benefit from
           | expandability. Running a network stack in conjunction with
           | other app code on 100K is challenging. Throw in a few
           | megabytes of expansion and it becomes a more manageable task.
        
       | robotbikes wrote:
       | So how would someone go about purchasing this ? Would it require
       | custom ordering the PCB ? Seems like a very cool way to make
       | affordable cheap USB microphones.
        
         | tverbeure wrote:
         | Yes, you'd need to do exactly that.
         | 
         | The PCBs can be ordered dirt cheap at Chinese shops like JCPCB.
         | They are associated with LCSC, a cheap component supplier of
         | Digikey, that also provides the RP2040 microcontroller (though
         | currently out of stock, as expected with today's supply chain.)
         | They even provide cheap PCB assembly services.
        
           | baybal2 wrote:
           | JCPCB is not a PCB shop. They get the order, and then run to
           | an actual PCB shop of their choosing.
        
             | tverbeure wrote:
             | Does it matter who they subcontract it to? At the end of
             | the day, you as a customer only interact with them.
             | 
             | It's like pedantically correcting somebody that Acer isn't
             | a monitor maker because their monitors are produced by an
             | ODM like Qisda...
        
             | krasin wrote:
             | 1) It's JLCPCB, not JCPCB: http://jlcpcb.com/
             | 
             | 2) What is the source of this information? (honest
             | question)
        
               | baybal2 wrote:
               | 2. Worked in electronics. Been in, and out of Shenzhen
               | since 2009
        
               | krasin wrote:
               | Got it, thanks. Btw, have you followed their SMT Assembly
               | service offering? I've assembled 40+ designs with them
               | this year, and it does seem like they do it on their own
               | instead of delegating. Nobody comes close to their prices
               | and assembly time.
        
       | severino wrote:
       | I found the article, and the linked one, about audio recognition
       | on a Raspberry using ML, very interesting. Now, if only you could
       | buy these microphones assembled... :-)
        
         | linsomniac wrote:
         | Earlier this year I got a ReSpeaker mic for video conferencing,
         | and it's been working great! I did have to upload the latest
         | firmware once I got it. I then combined it with NoiseTorch for
         | a basically perfect video chatting experience.
         | 
         | NoiseTorch detects speech and mutes the mic when you aren't
         | speaking. I had tried Hushboard, which mutes the mic when you
         | are typing, but sometimes I talk when I type. ReSpeaker is a
         | microphone array, and it has a speaker output and can do noise
         | cancelling on the mic from what is sent to the speaker. It was
         | about $60.
         | 
         | https://www.seeedstudio.com/ReSpeaker-USB-Mic-Array-p-4247.h...
         | https://github.com/lawl/NoiseTorch
         | https://www.kryogenix.org/code/hushboard/
        
         | nmstoker wrote:
         | Yes, I'd love something simple like this that is cheap, you
         | plug in and it "just works" without any faffing.
         | 
         | Microphones on computers can be such a source of pain - maybe
         | not quite such a nightmare as printers, but it seems like you
         | can never get them to work reliably for any period of time. I'd
         | be willing to pay in an instant if I knew it would save me the
         | hassle!
        
         | marcodiego wrote:
         | Possible interesting fun project: voice recognition on a USB
         | device that emulates a keyboard that types what it hears.
        
         | [deleted]
        
       | baybal2 wrote:
       | FYI, there are already microphones with PCM, I2S, or even
       | complete SoundWire protocol support.
        
       | stavros wrote:
       | Hmm, why use the RP2040 over something like an ESP8266? The
       | author mentions a few advantages, but can someone elaborate?
        
         | HALtheWise wrote:
         | This project makes heavy use of the RP2040 "Programmable IO"
         | PIO subsystem to do precise timing of input signals without
         | needing to keep the cpu in a busy loop. No other
         | microcontroller has that same subsystem, although other
         | microcontrollers have differently-designed systems that allow
         | similar results. The audio library would need to be rewritten
         | though.
        
           | stavros wrote:
           | Ahh, thanks! That makes sense.
        
           | dmitrygr wrote:
           | i've used spi modules to interface with pdm mics aplenty. no
           | weird r-pi stuff needed.
        
         | [deleted]
        
         | jepler wrote:
         | The goal here is to have a USB peripheral, so that this little
         | device can plug in on USB and identify to the host system as an
         | audio source (likely without even needing to install a driver,
         | since audio sources & sinks are part of the USB spec). The
         | RP2040 has built-in support for being a USB peripheral in its
         | hardware, plus good support in the SDK for it.
         | 
         | By contrast, the ESP8266 is not designed to be a USB
         | peripheral. Usually it's used with a USB-to-serial converter
         | when you need to connect it to a host computer. This allows,
         | well, serial transfers. It can't appear to a host computer as
         | an audio source. There might be ways to do it, such as bit
         | banged USB or custom drivers on the host computer that treat a
         | serial port as an audio source, but by using a microcontroller
         | with built in USB support, a lot of headaches can be avoided.
         | 
         | If you are particularly "into" the Espressif ecosystem, the
         | ESP32-S2 and ESP32-S3 microcontrollers both have native USB
         | support which would make them potential candidates for a
         | similar project.
        
           | trasz wrote:
           | It is possible to do USB on microcontrollers that lack
           | hardware USB support: https://github.com/obdev/v-usb
        
           | [deleted]
        
         | jrockway wrote:
         | The RP2040 is $1 in quantities of 10, so it's really the
         | perfect choice for this application. Personally, I only
         | consider other microcontrollers if I must have some feature the
         | RP2040 is missing (usually hardware floating point).
        
           | stavros wrote:
           | That's slightly more expensive than an ESP32, isn't it? I
           | should get a few RP2040 boards to play with, though I really
           | love the integrated wifi on the ESP...
        
       | mastax wrote:
       | Is there a difference between pulse-density modulation and sigma-
       | delta modulation? I've seen the sigma-delta hardware in STM32s
       | and wanted a project to use them.
        
       | marcodiego wrote:
       | PDM: pulse-density modulation:
       | https://en.wikipedia.org/wiki/Pulse-density_modulation
        
         | tverbeure wrote:
         | I wrote a series of blog posts about how to convert a PDM
         | signal to traditional PCM values:
         | https://tomverbeure.github.io/2020/10/04/PDM-Microphones-
         | and....
        
       ___________________________________________________________________
       (page generated 2021-12-26 23:01 UTC)