This is the updated version of the MIC+ tutorial for MIC+ V2 this new version is 100% software compatible with the V1. The MIC+ V2 adds :
INSTALLATION
Hi here the updated guide !
Installing MIC+ Sound Card on current Raspberry Pi OS
-
Edit Config File:
You can edit the config.txt just by inserting your SD card in your desktop computer and make the following change with any file editor or make those changes within your PI OS :
- Open a terminal window and type in:
sudo nano /boot/firmware/config.txt
- Comment out the existing audio line by adding a
#
in front of to have:
#dtparam=audio=on
- Add the overlay for the sound card:
dtoverlay=googlevoicehat-soundcard
- Reboot Your System
- Playing Audio
- After rebooting, check if your sound cards are recognized. You should see the speaker icon on the desktop.
- To test, open a terminal window and type in:
speaker-test -l5 -c2 -t wav
You should hear “left” and “right” from your speakers.
- Recording Audio:
- Volume control is managed by PulseAudio in Raspberry Pi OS, serving as middleware between the hardware and software.
Enable Pulse audio in the Raspi-config menu in Advanced - Audio Config
sudo raspi-config
- To record audio on the Pulse device , type:
arecord -D pulse -f S16_LE -r 48000 -c 1 -d 10 test.wav
. - Play Your Recording:
- To play back the recording, use:
aplay test.wav
- To play back the recording, use:
-
Adjusting Volume :
You may notice that the recording volume is a bit low.
- To list devices, type:
pactl list short sources
it should return :
Where Device 0 is the output and device 1 is the microphone input.
- To increase recording volume type:
pactl set-source-volume 1 200%
then try to record again (see previous step) - For playback volume, type:
pactl set-sink-volume 0 100%
If you prefer a nice graphical interface install
- To install a nice graphical interface for volume control, type:
sudo apt-get install pavucontrol
then type this to launch GUI :
pavucontrol
Alsamixer is another way to control volume but it will just use the PulseAudio device to make volume change
-
An easily detachable microphone, you don’t have to breake anything as it uses standard 2.54mm cables you could extend it with wildely available male female 6
The pinout is lest to right as following :
- 3.3v
- GND
- BCLK
- DOUT
- WB
- SEL Used to select Left or Right (by default) so it is possible to add a microphone to have a stereo input. To select Left cut the tiny mark with on the PCB with a cutter.
This is compatible with the external microphone sold by adafruit
- The V2 also add a 32bit dac, this is the famous PCM5102A
How to turn off the speakers (V2 update):
It is possible to disconnect the hardware speakers to enable the jack only. To do so, locate the labels ‘JP3’ and ‘JP4’ on the back of the board. Using a sharp blade, carefully cut the track associated with these labels. If you need to revert the modification later, you can use a soldering iron to reestablish the connection.
Automatic version Pi OS LEGACY version 32bits only:
-Insert your Rapsberry Pi Shield in your Raspberry pI then turn it on
-Open a terminal (yes the black window thing) and type this to download the bash file and run it:
wget -O - mic.raspiaudio.com | bash
-Say yes for the reboot
-On the next reboot you have to run the test to finish the installation (it is an ALSA oddness):
before if you are on the PI OS desktop select the device on the top right corner (sorry for the bad picture) :
wget -O - test.raspiaudio.com | bash
Push the onboard button, you should hear “Front Left” “front Right” then the recorded sequence by the microphone.
It should sound like this:
If the volume is too low you can adjust the gain of the microphone by typing:
alsamixer
A gain at 50 is a good start:
For desktop vlume control under Raspbian:
First enable the audio control, you need to go on the desktop-preference-Audio Device settings then click on “Select Control” and check both “Master” an “Micro”, then if you want to change the volume from your desktop you need to make a right click on the bluespeake iconr to open Audi Device Setting and adjust the sliders. let me know if it helps,
Here is the script source for the test
.For references here is the script source updated for Raspbian Buster.
For Volumio:
We recently added Rapsiaudio in the dac selection, you will find it in the last version of Volumio!
Just select “Raspiaudio” in dac selection and it should work straight out of the box
For UBUNTU :
1- Edit the file /boot/firmware/config.txt
>>sudo nano /boot/firmware/config.txt
comment the following line (add a #):
(ligne 22) : dtparam=audio=on
by this one:
: #dtparam=audio=on
: dtoverlay=googlevoicehat-soundcard
2- copy the directory “overlays”
form /lib/firmware/4.15.0-1034-raspi2/device-tree
to /boot/firmware
>>sudo cp -r /lib/firmware/4.15.0-1034-raspi2/device-tree/overlays /boot/firmware
3- reboot
For the official Google AIY image:
-Downlowad the official Google AIY image here
-Write the image to an SD card using a card writing utility (Etcher.io is a popular tool for this)
-Insert your Rapsberry Pi Audio Shield in your Raspberry pI then turn it on
-Open a terminal (yes the black windows thing) and type:
sudo wget -O - aiy.raspiaudio.com | bash
-run the audio test “Check audio” on your desktop, reboot to allow volume control on the desktop
-Follow this guide to setup the credential to run Google’s examples here
For the references the script souce is here
For the Alexa voice assistant:
-Install a fresh version of RASPBIAN STRETCH WITH DESKTOP and follow the setup explain in the first section above “For raspbian user”
-Then follow this good instructable until the end
-You now have to setup the sound output type to edit:
sudo nano /etc/opt/AlexaPi/config.yaml
be sure that you have the following: sound section:
sound:
# Name of your microphone device: "raspberrypi"
# leave empty for default
input_device: ""
playback_handler: "vlc"
# you can go here with alsa, pulse or others
# keep blank for the best audio output selected by the underlying code
output: "alsa"
# output device: "raspberrypi"
# currently supports ALSA only
output_device: ""
# if left empty, won't be passed to the underlying library / command if it su$
# if it doesn't 100% will be used
default_volume: 80
# Means the same as above, but is used for media (playing music for example)
# Leave blank to use the same setting as for speech content
media_output:
media_output_device:
media_default_volume:
# Some device: "raspberrypi"
# value is the number of seconds of silence to pad the beginning and end of t$
# the sox handler supports this configuration option.
playback_padding: 0
Also change the GPIO setting for the trigger button and led:
raspberrypi:
# GPIO Pin with button connected
button: 23
# GPIO Pin for the playback/activity light
plb_light: 25
# GPIO Pin for the recording light
rec_light: 25
Then reboot, if you push on the button you can ask an important question to Alexa:
Pinout:
Please find the pinout on our friends at pinout.xyz: