MAX98357 - Was ist eigentlich I2S?

No write error, not i2c (or I²C = inter-integrated circuit), but actually i2s (or i²s = inter-ic sound).

This is a serial interface developed by Fa. Philips, but only for the transmission of digital audio data.

Looking for possible new products for the assortment of AZ-Delivery I came across a small breakout board named "Max98357 Amplifier Breakout Interface I2s Class D Module for ESP32 Raspberry Pi".

Meanwhile, the parts (except for the Raspberry Pi, which can not be delivered production) are available in the range of AZ-Delivery. Therefore here the list with the hardware used:


Raspberry Pi, e.g. 3 b +


Max98357a-breakout boards


3W speaker


(Mini)-Breadboard, jumper cable

Back to the first try. As always with orders from the Far East, I have set myself on a multi-week delivery time and further support such as wiring diagram, program library and demo program will be searched elsewhere on the internet. And found: as so often at the colleagues of the US Fa. Adafruit, who sell a balanced board.

On the Adafruit page I find, u.a. The explanation, why in the product name of the MAX98357 board only EP32 and Raspberry Pi stand: The microcontrollers with Atmega328 have no I2S interface. I decide for the first attempts for the Raspberry Pi and episode of the instructions From Lady Ada and her team, which is unfortunately no longer up to date, but nevertheless helped me well.

On the small breakout board, the terminal block for the speaker connections, as well as a seven-pin pin bar are initially soldered on the small breakout board.

Important NOTE: exit not Switch to an amplifier input! Connection only for speakers with 4 to 8 ohms, output power is about 3 watts.

Connection to the Raspberry Pi with 2x20 J6 header as follows:

Vin on pin 2 (5V) for maximum output power
GND on pin 6
DIN to GPIO 21 (PIN 40)
BCLK to GPIO 18 (pin 12)
LRC to GPIO 19 (pin 35)

The connections for GAIN and SD remain inexpressed first. The default settings are then gain = 9 dB, speaker output has (L + R) / 2, so both stereo channels as a mono output.

To activate the I2S interface, we must make some additions and changes to the Raspberry Pi OS. There is no choice in the configuration menu as for the other interfaces. Instead, in the subdirectory / boot / file Config.txt edited, of course with superuser rights.

 sudo nano /boot/config.txt

In this editor you can not work with mouse click, with me but the scroll wheel works. Otherwise click with the cursor keys up to the line with


This line is commented out. Then we complement

 # dtparam = audio-on

with Ctrl + O and Enter we save the file config.txt, with Ctrl + X Exit the editor.

After that, the Raspberry Pi must be restarted, e.g. with

 sudo reboot

If we click on the speaker icon with the right mouse button, the selection options for the sound output are displayed, before the changes HDMI and AV Jack, according to the changes HDMI and snd_rpi_hifiberry_dac. When we select Hifiberry, the music comes from the speaker at the breakout board Max98357a, if everything is properly connected.

Here are two screenshots of the Raspberry Pi, the first the redesigned configuration menu for the interfaces - I2s is not included. Then the text editor nano with the file config.txt.

Now the first test with a MAX98357A and mono output is nothing in the way. And - Heureka - it worked right away. We have not dealt with the I2S signals in detail.

Here is a picture of my experimental setup with an old PC speaker, the new 3W speakers from AZ-Delivery unfortunately not arrived at the time. About the quantum leap in the sound quality with the new 3W speakers I will be reported in the end.

So far we had not used two connections, but the then available presets (default) used. In the case of GAIN, this was a reinforcement of 9 dB. The other possibilities of 3 dB to 15 dB are achieved by connecting the gain connection directly or via a 100 kOhm resistor with GND or with VIN. In detail:

  • 15dB with 100K resistance Between Gain and GND
  • 12dB with gain directly to GND
  • 9dB ​​if gain is not connected (default)
  • 6dB with gain directly to Vin
  • 3DB with 100K resistance Between Gain and Vin

I did not trying out these settings because the other connection has me much more irritated:

Labeled with SD is more of a selection of fashion, at a voltage below 0.16 V (eg associated with GND) is the chip / amplifier in shutdown (hence the SD), with voltages between 0.16 and 0.77 V are output both channels (Left + Right) / 2. This is the default, since the built-in pull-down resistance of 100 kOhm with the SMD resistance of 1 mohm visible on the breakout board gives a voltage in this area.

At a voltage at SD between 0.77 V and 1.4 V, the right stereo channel is output, with voltages above 1.4V of the left stereo channel. Then you need of course two Max98357a modules.

But where do you get the right tension to SD?

For the investigation, we start with the two built-in resistors:

For VIN = 5 V, the voltage divider gives a voltage of about 0.45 V to SD; This is in the area for (L + R) / 2, ie mono output of both stereo channels.

In principle, the voltage divider can only be changed by a parallel resistance between SD and GND or between SD and Vin. A series connection with the built-in resistors is not possible.

To get the shutdown mode, a direct connection of SD with GND is sufficient.

Anyone who wants to hear his music in stereo initially requires two MAX98357A, where the connections used in the first part are parallel. Then we switch resistances between SD and VIN, so parallel to the SMD resistor with 1 mohm. For example, for example, for example 1 V is applied to the module with the right channel approx. 400 kohm, for the left channel, a resistance of approx. 150 kohm would be suitable for about 2 V to SD. After this overshading calculation, I'm looking for suitable resistors in my assortment.

With a (measured) 394 Kohm resistance on the right channel I trade at VD a voltage of 1.2 V, at 153 Kohm on the left channel 2.0 V. And I now hear the music in stereo.

In the following picture from the data sheet with the waveform you can see very nice that the LRCLK significantly slowly clocks than the BitClockTo send 16 data bits either on the right or left channel:

In every English final report is: "There is Always Room for Improvement". This also applies here. Weak points with my experimental setup are certainly the bad speakers from ancient PCs, which should actually only make Beep on. And disturbances through the power supply could certainly be mitigated with a large capacitor.

All in all, for me, an exciting attempt to develop one of the (expensive) straight-on sound cards with two MAX98357A.

After I got the new parts from the range of AZ-Delivery in the meantime, here the result of the renewed attempts. As expected, everything worked right away. Pin strips and terminal blocks in two Max98357 Amplifier Breakout Interface I2S Class D modules soldered and exchanged in the breadboard circuit, the new 3W speaker Connected and stereo music plays with the VLC media player. As I said: a quantum leap in sound quality, in any case better than my speaker in the monitor (not to be silent from the old PC speakers).

Here is a photo of the experimental setup with parts from the assortment of AZ-Delivery:

Projects for beginnersRaspberry pi


Bernd Albrecht

Bernd Albrecht

Gute Nachrichten für alle ESP32 Fans. Unser eBook-Schreiber hat es hin bekommen. Demnächst hier sein Sketch für Internet-Radio mit I2S.

Bernd Albrecht

Bernd Albrecht

@ Dieter: Warum Raspberry Pi und nicht ESP? Weil Programm und Musik-Daten Platz auf der gleichen µSD-Karte haben. Für den ESP bräuchte man einen Kartenleser. Dann kann man aber gleich ein kombiniertes Sound-SD Card-Modul nehmen wie das folgende:
Wer weitere Informationen wünscht zu I2S auf dem ESP32:

Andreas Wolter

Andreas Wolter

wenn Sie durch den Beitrag inspiriert wurden, fühlen Sie sich frei und nutzen ihn als Vorlage für solche Erweiterungen. Lassen Sie uns gerne wissen, was daraus geworden ist.

Andreas Wolter
AZ-Delivery Blog

Olaf Stolle

Olaf Stolle

Hallo das finde ich total interessant.

Eine Steigerung wäre jetzt noch ein Cam module mit gegen Sprechanlage da würde ich mich sehr drüber freuen.



Das gleiche jetzt noch mit dem ESP!

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN