I2S (Inter-IC Sound) Interface

I2S is a serial bus interface for connecting audio devices. The Raspberry Pi features the MCLK-less variant.

By default the interface is disabled. The easiest way to enable it is to download and execute the i2samp.sh script as root:

$ curl -sS https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh | bash

This is based on: https://learn.pimoroni.com/tutorial/phat/raspberry-pi-phat-dac-install

This script may modify the following files

$ cat /etc/asound.conf 
pcm.speakerbonnet {
   type hw card 0
}

pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_perm 0666
   slave {
     pcm "speakerbonnet"
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
     channels 2
   }
}

ctl.dmixer {
    type hw card 0
}

pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control.name "PCM"
    control.card 0
}

ctl.softvol {
    type hw card 0
}

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}

The following table shows the relevant pins from the Pi’s header. For sound output only 3 pins are needed:LRCLK, BCLK and DOUT

Description BCM Pin Pin BCM Description
01 02
02 03 04
03 05 06
04 07 08 14
09 10 15
17 11 12 18 I2S BCLK
27 13 14
22 15 16 23
17 18 24
10 19 20
09 21 22 25
11 23 24 08
26 07 26
00 27 28 01
05 29 30
06 31 32 12
13 33 34
I2S LRCLK 19 35 36 16
26 37 38 20 I2S DIN
39 40 21 I2S DOUT

I2S Boards with Built-in Amplifiers

A number of I2S boards are available that combine a DAC with an amplifier allowing speakers to be attached directly.

Adafruit’s Mono Board

This is based on the MAX98357A chip with a 3W Amplifier

Note:

Adafruit’s Stereo Bonnet

This has about the same size as a Pi Zero and attaches like a shield covering all 40 pin.

Hifiberry’s Amp2

This is a high end device. It is about 80% of the size of a Raspberry Pi and attaches like shield. All 40 pins are passed through. A a separate 12-24V power supply is required which will also power the Pi.