If you are using the Raspberry Pi 3, one of the option is to use I2S (Inter-IC Sound) Micropones
This is diferent to I2C which is for the control of devices and will be covered at a later date.
If you haven't already i suggest reading the Installing MRL on a Raspberry Pi3 for NOOB's
ok first log into your Raspberry Pi 3 and lets begin
run the command
sudo nano /boot/config.txt
This starts the Nano text editor, opening the boot configuration file.
Scroll through until you find the line below
#dtparam=i2s=on
The # makes the line a comment, so remove the # to activate the line.
Pressing Ctrl-O will write out the changes and Ctrl-X will leave the editor
Next we need to add into the modules file the reference for the SOC chip on the Raspberry Pi 3 the handles the I2S
so execute
sudo nano /etc/modules
Now add on it own line the following
snd-bcm2835
To make those changes take effect we now have to re-boot the Raspberry Pi 3
Do this by typing
sudo reboot
Run the command:
lsmod | grep snd
lsmod lists all the modules running on the Raspberry Pi.
The | part pipes the result to the grep utility which filters each line looking for snd
We are looking for snd_soc_bcm2835_i2s
Ok we will have to do soe compileing, for this we need some more libraries and source files, so run
sudo apt-get -y install bc libncurses5-dev
Since we need to run the rpi-source, we will need to change the permissions on the file
sudo chmod +x /usr/bin/rpi-source
Now we can run it :-), lets get an update.
/usr/bin/rpi-source -q --tag-update
and then run the program
rpi-source
All going well, we need to mount the developent system debugger
sudo mount -t debugfs debugs /sys/kernel/debug
execute
sudo cat /sys/kernel/debug/asoc/platforms
Look for the module 3f203000.i2s is present,
if it isn't then go through the log of the previous sections to see what went wrong.
You may have to repeat a step, most of the time a problem will be caused by a typo.
Download the module, written by Paul Creaser
git should have been installed as part of Installing MRL on a Raspberry Pi3 for NOOB's
run the command:
git clone https://github.com/PaulCreaser/rpi-i2s-audio
Change into the directory
cd rpi-i2s-audio
make -C /lib/modules/$(uname -r )/build M=$(pwd) modules
if all went well with the ake command, we need to insert the new module into the kernel.
sudo insmod my_loader.ko
Verify that the module was loaded:
lsmod | grep my_loader
dmesg | tail
Now you can set it up so the module is loaded every time you boot the Pi
sudo cp my_loader.ko /lib/modules/$(uname -r)
echo 'my_loader' | sudo tee --append /etc/modules > /dev/null
sudo depmod -a
sudo modprobe my_loader
Once that is all done, you will need to re-boot the Raspberry Pi
sudo reboot
Assuming you have done the hardware connections, the microphones should now work.