---+ !I2S and sound ---++ Introduction In order to play audio files we need: * the audio file itself, which we expect to be in uncompressed wav format * a file system from which to read the file. This is available in !MicroPython either in its internal flash or on an SD card * a fast 16 bit DAC to convert the audio data into an analogue form that can be consumed by a loadspeaker * an amplifier to get enough signal power needed for the loadspeaker * a software driver implementing the !I2S protocol The digital data must be transferred to the DAC, which is done through the [[https://diyi0t.com/i2s-sound-tutorial-for-esp32/][I2S protocol ]]invented by Philips in the end 1980 ies. There are two cheap !I2S boards converting digital audio data to an analogue audio signal and communicating through the !I2S protocol: * the ! [[https://datasheets.maximintegrated.com/en/ds/MAX98357A-MAX98357B.pdf][MAX98357A]], a mono converter board with integrated amplifier to which we can directly connect a loadspeaker * the [[https://www.ti.com/lit/ds/symlink/pcm5102a.pdf?ts=1611472691830&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FPCM5102A][PCM5102a]], a stereo converter board with a connector for head phones. If we want to connect a loudspeaker to this board we have to pass through an audio amplifier. ---++ Connecting the !MAX98357A Here is a table showing how I connected the !MAX98357A to the ESP32 board: | !MAX98357A pin | pin on ESP32 CPU card | signification | | GND | GND | | | Vcc | 3.3V | | | SD | n.c. | | | Gain | GND | | | Din | D2: GPIO 21 | audio data | | BCLK | D3: GPIO 17 | bit clock | | RC (LRCLK) | D1: GPIO | left/right clock | -- %USERSIG{UliRaich - 2021-01-24}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
max98357a.png
r1
manage
203.5 K
2021-01-24 - 16:23
UliRaich
png
pcm5102.png
r1
manage
127.0 K
2021-01-24 - 16:23
UliRaich
This topic: IoT_Course_English
>
WebHome
>
Exercises
>
I2SAndSound
Topic revision: r1 - 2021-01-24 - UliRaich
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback