***Question*** How can PicoW read MEMS digital microphone output? --- ***Answer*** *Update 2023jan04hkt1638* *0.1 Tone Generator and Frequency Counter Schematic* [![tone gen and freq ctr][1]][1] --- *0.2 MEMS PDM Digital Microphone MT34DT01 Test Setup V0.1* [![mt34dt01 v0.2][2]][2] --- *1. Introduction.* We can connect the MEMS microphone output pin to a PicoW GPIO pin and read signal, into a list for later processing. --- *2. Simulation* For prototyping, we can simulate the microphone output signal as a GPIO output pin connected blinking LED, and use another GPIO input pin to read the blinking LED pin. --- *3. Trying Blink rates 1kHz, 2kHx, to simulate 1kHz, 2kHz tones* [![1k, 1k led blinking tones][3]][3] [![1k, 2k tones 2][4]][4] --- *4. The OP wishes to connect the MEMS digital mic output to PicoW. So now I am looking at the real thing. [![ada fruit mems digi mic][5]][5] --- *5. MP34DT01-M MEMS audio sensor omnidirectional digital microphone* (5.1) [MP34DT01-M MEMS audio sensor omnidirectional digital microphone][6] - ST (5.2) [PDM Microphont: PDM Signal Definition - ST Video][7] [![pdm interface][8]][8] --- *6. MT34DT01 MEMS Digital Microphone* [![mt34dt01 mems digi mic][9]][9] --- *9. / to continue, ...* --- ***References*** (1) [Adafruit PDM Microphone Breakout 1][10] (2) [Adafruit PDM Microphone Breakout 2][11] (3) [AliExpress Digital MP34DT01 Microphone Module Simple Pulse Density Modulation Output PDM Digital MEMS Microphone Module - HK$27][12] (4) [TaoBao MP34DT01 MEMS PDM Microphone - ¥25][13] (5) [1000 Hz Test Tone - Sonic Electronix][14] (6) [Using a Digital Microphone (MT34DT01) on STM32 - Dario Petrillo, Hackster, 2022jul14][15] --- ***Appendices*** Appendix A - MicroPython program blinking two LEDs simulating two MEMS digital microphone output signals # Pico W Blink Two LEDs - tlfong01 2023jan01hkt1941 # *** Modules *** import machine from machine import Pin, Timer # *** Configuration*** redLed = Pin(0, Pin.OUT) greenLed = Pin(1, Pin.OUT) redFreq = 2 greenFreq = 4 redTimer = Timer() greenTimer = Timer() # *** Callbacks *** def blinkRedLed(dummy): redLed.toggle() return def blinkGreenLed(dummy): greenLed.toggle() return # *** Main *** redTimer.init(freq = redFreq, mode = Timer.PERIODIC, callback = blinkRedLed) greenTimer.init(freq = greenFreq, mode = Timer.PERIODIC, callback = blinkGreenLed) # *** End of program *** --- *Appendix B - Blinking LEDs Video* [PicoW blinking two LEDS][16] --- *Appendix C - MEMS Mic, PicoW GPIO Eval Brd Setup* [![gpio eval brd][17]][17] # PicoW GPIO Input Testing v7.0 - tlfong01 2023jan02hkt1410 # *** 1.0 Modules *** import machine import utime from machine import Pin, Timer # *** 2.0 Configuration and Functions *** # 2.1 Blinking LED Configurations and Functions redFreq = 6 # Red LED blinking frequency greenFreq = 3 # Green LED blinking frequency redLed = Pin(0, Pin.OUT, value = 1) # Create Red LED object, init On greenLed = Pin(1, Pin.OUT, value = 1) # Create Green LED object, init On redTimer = Timer() # Red LED timer, callback blinkRedLed greenTimer = Timer() # Greed LED timer, callback blinkGreenLed # 2.2 Blinking LED Callbacks def blinkRedLed(dummy): redLed.toggle() return def blinkGreenLed(dummy): greenLed.toggle() return # *** 3.0 GPIO Input Configurations and Functions *** readGpioPin2 = Pin(2, Pin.IN, Pin.PULL_UP) # Create GPIO input pin object readGpioPin3 = Pin(3, Pin.IN, Pin.PULL_UP) # Create GPIO input pin object def readRedLed(): ledStatus = readGpioPin2() if ledStatus == 1: return "High" else: return "Low" def readGreenLed(): ledStatus = readGpioPin3() if ledStatus == 1: return "High" else: return "Low" def readPrintRedGreenLedStatus(): redLedStatus = readRedLed() greenLedStatus = readGreenLed() print('RedLedStatus =', redLedStatus) print('GreenLedStatus =', greenLedStatus) return ### *** 4.0 / to continue, ... *** # *** 9.0 Main *** # 9.1 Run Red/Green Timer for 2 seconds redTimer.init(freq = redFreq, mode = Timer.PERIODIC, callback = blinkRedLed) greenTimer.init(freq = greenFreq, mode = Timer.PERIODIC, callback = blinkGreenLed) utime.sleep(2) redTimer.deinit() greenTimer.deinit() # 9.2 Set/Read/Print Red/Green LED status redLed.on() greenLed.on() readPrintRedGreenLedStatus() # *** End of program *** --- [1]: https://i.sstatic.net/MS0Jz.jpg [2]: https://i.sstatic.net/Di2xI.jpg [3]: https://i.sstatic.net/mofeV.jpg [4]: https://i.sstatic.net/W1qsp.jpg [5]: https://i.sstatic.net/otxJZ.jpg [6]: https://www.mouser.com/datasheet/2/389/mp34dt01-m-955068.pdf [7]: http://st-videos.s3.amazonaws.com/STM32_Microphone_Audio_Acquisition_Part2_PDM_Microphone.mp4 [8]: https://i.sstatic.net/fTW7z.jpg [9]: https://i.sstatic.net/5rfv8.jpg [10]: https://www.adafruit.com/product/4346 [11]: https://www.adafruit.com/product/2716?gclid=Cj0KCQiAtbqdBhDvARIsAGYnXBMlWo5Px8MPOsGz6mfOlcQTx8zKgi5kgOL-PCL5XbvoMZWBFNUa23UaAjYmEALw_wcB [12]: https://www.aliexpress.com/item/4001240664476.html?spm=a2g0o.productlist.main.11.391442abGc1Xty&algo_pvid=6a244fb2-b2ec-4056-9172-b6b7a664e1d8&algo_exp_id=6a244fb2-b2ec-4056-9172-b6b7a664e1d8-5&pdp_ext_f=%7B%22sku_id%22%3A%2210000015426511105%22%7D&pdp_npi=2%40dis%21HKD%2133.27%2126.32%21%21%21%21%21%40212248ba16725455499866162d0736%2110000015426511105%21sea&curPageLogUid=REzyejBWMWnE [13]: https://item.taobao.com/item.htm?_u=13thdsb1b52&id=626041686368 [14]: https://www.youtube.com/watch?v=TbPh0pmNjo8 [15]: https://www.hackster.io/dario_petrillo/using-a-digital-microphone-on-stm32-riot-os-1a3f44 [16]: https://youtu.be/SlbA8wIEvJY [17]: https://i.sstatic.net/GKznZ.jpg