i2s mic with RPi zero does not work

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ayberk_cakmak
 
Posts: 7
Joined: Mon Apr 26, 2021 5:58 am

i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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 ... iring-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...

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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?

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

aplay.png
aplay.png (5.59 KiB) Viewed 4730 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.

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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

arecord -f S16_LE -r 44100 --device="hw:0,0" demo.wav  

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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.

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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?

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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 4680 times

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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

arecord -D plughw:0 -c1 -r 48000 -f S32_LE -t wav -V mono -v file.wav

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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 pin connections
RPi pin connections
rpi.jpg (117.3 KiB) Viewed 4650 times

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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.

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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 4636 times
pins.jpg
pins.jpg (813.68 KiB) Viewed 4636 times

User avatar
Franklin97355
 
Posts: 23939
Joined: Mon Apr 21, 2008 2:33 pm

Re: i2s mic with RPi zero does not work

Post by Franklin97355 »

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.

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

Re: i2s mic with RPi zero does not work

Post by ayberk_cakmak »

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?

User avatar
mikeysklar
 
Posts: 14181
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s mic with RPi zero does not work

Post by mikeysklar »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”