Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

i2s mic with RPi zero does not work
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

i2s mic with RPi zero does not work

by ayberk_cakmak on Mon Apr 26, 2021 6:09 am

I have bought an Adafruit I2S MEMS Microphone Breakout - SPH0645LM4H lately to use it with raspberry pi zero w to record audio. I followed the instructions given on the adafruit website https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test. I reached the "test and record" step. I started recording with arecord, the interface with the VU meter appears. Here is the problem: the VU meter does not react as I speak to the mic. It stays at 0%, and after some time I get the "oversize" error, and the recording terminates. What may be the problem? Thanks in advance...

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Mon Apr 26, 2021 7:07 pm

Not getting picking up any audio for recording is usually an issue of selecting the wrong card. Can you post the output of aplay -l?

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Mon Apr 26, 2021 8:56 pm

aplay.png
aplay.png (5.59 KiB) Viewed 2750 times

Thank you for replying in short time. Here is the output. Note that the microphone module is the same one as in the documentation on the given site.

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Tue Apr 27, 2021 4:16 pm

The mic looks good.

If you let this run for 30 second and hit ^C do you have a demo.wav you can work with?

Code: Select all | TOGGLE FULL SIZE
arecord -f S16_LE -r 44100 --device="hw:0,0" demo.wav 

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Tue Apr 27, 2021 10:49 pm

When I executed the command, I got a "arecord: set_params:1345: Channels count non available" error. So, I tried the same code without "--device="hw:0,0", and a 30s empty wav file was created.

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Wed Apr 28, 2021 8:59 am

Seeing the device and being able to produce an empty WAV file are still good signs that you are on the right track. At this point I think we should look at the mic you are using, recording levels and the device you are playing back through.

Are you able to hear hte audio from existing WAV / MP3 files on your RPi?

What is the mic input set to when using alsamixer?

What mic model/brand are you using or are you using the recommended headphone rub during recording?

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Wed Apr 28, 2021 5:24 pm

I dont play the wav files on my RPi, I send them to my PC and open them there. However, when I play the wav files, I hear no audio or whatsoever, just complete silence. I dont use alsamixer. The microphone im using is Adafruit I2S MEMS Microphone Breakout - SPH0645LM4H
Attachments
mic.jpg
mic.jpg (620.06 KiB) Viewed 2700 times

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Thu Apr 29, 2021 12:48 pm

Thank you for the clarification. I was mixing up your i2s mic with some voice bonnet threads I've been responding to this week.

Let's go back to the basics and make sure everything looks right.

Please post a photo of your wiring to the i2s mic and the Pi.

Make sure your Pi OS instlalation is up to date and re-download and execute the i2smic.py script.

https://learn.adafruit.com/adafruit-i2s ... -3066866-9

After a reboot give the recording a try again with this syntax and see if vumeter is showing anyoutput during recording and if you can hear anything more than silence on the machine you playback the WAV file on.

Code: Select all | TOGGLE FULL SIZE
arecord -D plughw:0 -c1 -r 48000 -f S32_LE -t wav -V mono -v file.wav

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Thu Apr 29, 2021 8:50 pm

So I did as you told me. I updated RPi, deleted the i2s.py file, reinstalled it, and executed it. After reboot, I executed the line of code you posted. VU meter still does not react to sound, the created wav file is completely silent again. I wonder whether there might be a problem with the hardware.
Attachments
rpi.jpg
RPi pin connections
rpi.jpg (117.3 KiB) Viewed 2670 times

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Fri Apr 30, 2021 12:33 pm

The i2s mems mic does jump around in terms of which card it is located on inbetween reboots.

Please run arecord -l so we can verify you are running the command on the right port.

Also, the wiring schematic you provided from our guide is the one to follow, but I need to see your actual implementation of the wiring so we know that you are not "off by one pin" which is common.

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Fri Apr 30, 2021 3:28 pm

Here are the results. I just want to add, I also tried recording audio using pyAudio in python, and plotting it. The plot consists of nothing but 0s.
Attachments
aplay.png
aplay.png (3.31 KiB) Viewed 2656 times
pins.jpg
pins.jpg (813.68 KiB) Viewed 2656 times

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by franklin97355 on Fri Apr 30, 2021 5:03 pm

The jumpers should be soldered to the ports in order to make good connections between the boards but the pi need headers rather than pins to keep it from shorting to the breadbord.

franklin97355
 
Posts: 21882
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: i2s mic with RPi zero does not work

by ayberk_cakmak on Fri Apr 30, 2021 6:09 pm

I wanted to try it first and then solder the cables since I don't have a soldering station. But shouldn't I observe some fluctuations at the output at least? Also, isn't the microphone communicating with RPi, meaning that despite the jumper connections the RPi picks some signals?

ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

Re: i2s mic with RPi zero does not work

by mikeysklar on Mon May 03, 2021 2:14 pm

You don't yet have a reliable connection to test this. You will need to solder the connections just like @franklin97355 or if a soldering solution and learning curve are not in the cards then you could consider our hammer headers.

https://www.adafruit.com/product/3662

You will also need to pickup some female to male jumpers.

https://www.adafruit.com/product/1954

mikeysklar
 
Posts: 4559
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.