IQaudio Codec Zero Audio I/O HAT
on
Are you looking for a small and compact sound card for a Raspberry Pi? Check out the IQaudio Codec Zero (Figure 1), which has a Zero form factor.
Enter the IQaudio Codec Zero
If you only need a digital sound output via HDMI, you don’t need a sound card. A sound card becomes interesting if you want to output analog audio in good quality or if you also want to process analog signals with the Raspberry Pi. The A and B models of the Raspberry Pi still have a 3.5-mm jack connector that can output analog audio; however, the quality is not the best and not really suitable for listening to music.
The IQaudio Codec Zero offers an integrated 1.2 W amplifier for an 8 Ω speaker, an integrated MEMS microphone and an analog AUX input and output with line level. This makes projects such as a smart speaker, a VoIP phone, or a custom jukebox quite easy to implement. Figure 2 shows the hardware and the included mounting hardware. The heart of the IQaudio Codec Zero is the DA7212 from Dialog Semiconductor. Figure 3 shows the blocks and signal routing within the DA7212. The IC is a 24-bit codec with up to 96 kHz sample rate. Integrated is a 5-band equalizer as well as an ALC and a noise gate. The documentation for the IQaudio Codec Zero can be found on the page of the Raspberry Pi Foundation.
Almost Plug & Play
The IQaudio Codec Zero has an EEPROM according to the Raspberry Pi HAT specification, so a Raspberry Pi should automatically recognize the board and set it up appropriately. On a Raspberry Pi 3B+ this works fine; the current Raspberry Pi OS (32 bit) recognizes the board and sets it up appropriately. Figure 4 shows the IQaudio codec in the sound settings.
However, there are still a few steps necessary that are not directly described in the IQaudio Codec Zero manual. First, the output volume should be reduced to a minimum. After the internal audio codec of the Raspberry Pi has been deactivated according to the instructions, the IQaudio now remains in the system as the default sound card. If a terminal is opened now, a speaker test can be started with speaker-test -t wav -c 1. However, the speaker remains mute. It is necessary to adjust a few parameters in the Advanced Linux Sound Architecture (ALSA) settings. The fastest way is to reload the provided settings from IQaudio. To do this, a Git repository is cloned via terminal with git clone https://github.com/iqaudio/Pi-Codec.git. In the terminal change to the created folder Pi-Codec and execute the command sudo alsactl restore -f IQaudIO_Codec_Playback_Only.state. After that, speaker-test -t wav -c 1 should make a front left sound from the speaker. From now on all sounds will be output via IQaudio Codec Zero. A quick and easy installation!
Microphone, AUX-In and AUX-Out
With the built-in microphone, the Raspberry Pi can record audio. This way, a smart speaker can be realized — e.g., with voice2json. Or you can use the Raspberry Pi in conjunction with Edge Impulse to record data. The MEMS microphone on the board won’t win any awards in the “recording quality” category, but it does its job. If you are unhappy with the sound, you can connect an external microphone. The predefined .state files in the cloned Pi codec folder help to get the appropriate settings for recording via microphone. Using sudo alsactl restore -f IQaudIO_Codec_OnboardMIC_record_and_SPK_playback.state selects the microphone as the recording source. For a test recording, arecord --device=hw:1,0 --format S16_LE --rate 44100 -c2 test.wav can be used in the terminal to start a test recording with the microphone and end it with CTRL+C. This can then be played back with aplay test.wav. If you want to connect an external audio source, you can solder suitable jacks to the IQaudio Codec Zero. Figure 5 shows AUX In with RCA jacks.
To select AUX In as recording source, you have to type the following in a terminal:
sudo alsactl restore -f IQaudIO_Codec_AUXIN_record_and_HP_playback.state
You can also see the AUX Out on the picture, which allows the IQaudio Codec Zero to act as a feed to an amplifier or active speakers.
New Life for an Old Radio
Something that has been on my to-do list for too long is an old Philips radio (Figure 6 and 7). All that’s left of the interior is the speaker, and there’s room for new hardware. Inside, a low-power Raspberry Pi would do well, but an amplifier is needed for the speaker. It’s a good thing that the IQaudio Codec Zero has an integrated 1.2 W amplifier, so that a small office can be sounded wonderfully.
For music playback, anything can be used that outputs sound in the direction of ALSA under Linux. But if the MPD or a special distribution like Volumio will be used, is not decided yet. So I don’t have a completely finished concept for the radio yet, but one of the hurdles, a codec with a small amplifier, is already out of the way. So with time the inner workings will fill up piece by piece with hardware. There is still a lot to do and plan for this project.
A Solid Base
The IQaudio Codec Zero offers Aux IN, Aux Out as well as an integrated microphone and can drive a small speaker with 1.2 W. For the price of about €20, this is a compact solution that can be used on a Raspberry Pi Zero as well as on a Raspberry Pi 3B or Raspberry Pi 4B. For streaming players, VoIP phones or smart speakers, the IQaudio Codec Zero provides a solid base. If you want to experiment with audio and streaming on the Raspberry Pi and Linux, you should consider the IQaudio Codec Zero.
Questions About the IQaudio Codec Zero?
Do you have technical questions or comments about this article? Email the author.
Discussion (0 comments)