ESP32 ES8388 audio codec interfacing is a simple task. The PCB Artists ES8388 audio module or breakout board makes this task extremely easy. Just like any other audio codec that you would interface with the ESP32, the ES8388 has a basic I2C control port and an I2S audio port for writing and reading audio data. Other than these interfaces, there is an additional pin that accepts system clock from the ESP32 for all ES8288 internal operations.
ESP32 ES8388 Interface Connections
The pin connections between the ESP32 and ES8388 codec shown below are compatible with the Espressif Lyra board. This means that you can directly run ESP-ADF examples on this ES8388 module when you assign ESP32 GPIOs are listed in the diagram below.
The left side edge of the ES8388 module contains all the analog pins of the module. The left side also has a dedicated analog VDD and multiple analog GND pins for the best noise performance possible. The crosstalk between digital IOs, analog outputs and analog inputs has been minimized by design.
The right side edge of the ES8388 module exposes all the digital pins that you might need. These digital pins comprise of the I2C bus, the I2S bus and the system clock source lines.
Connections between the ESP32 and ES8388 are tabulated below for quick reference.
ES8388 Module Pinout Explained
If you are new to audio codecs, the pinout of the audio codec module may be a little confusing at first. However, it is easy to understand how audio codecs work when you note the sequence of operations required to use an audio codec:
- The host (ESP32 in this case) generates a system clock that the audio codec’s digital section needs to function.
- The host then uses the I2C bus to configure the codec. This step is needed in order to let the codec know what audio data stream firmat and type is going to be used.
- The host then starts generating the I2S bus signals that will move data to and from the audio codec.
Given the sequence of operations above, here is the pinout now listed with brief comments.
I2S bus pins:
- SCLK (I2S serial clock)
The serial clock pin that shifts data in and out on the I2S bus. The I2S master drives this line. - LRCLK (I2S left/right or word clock)
The word clock signals left or right channels by being high or low. The I2S master drives this line. - DIN (I2S data input to the codec)
The DIN pin clocks data into the ES8388 codec. The ESP32 needs to drive this line to send data to the ES8388. - DOUT (I2S data output from the codec)
The DOUT pin clocks data out of the ES8388 codec. The ES8388 drives this pin so ESP32 can read the data.
I2C bus pins:
- SCL (I2C serial clock)
The usual I2C serial clock line. This pin needs a pull-up of 4.7K ohms. - SDA (I2C serial data)
The usual I2C serial data line. This pin needs a pull-up of 4.7K ohms.
Master clock pin:
- MCLK (master clock input)
The host needs to provide a clock to this pin. The clock needs to be a fixed frequency clock that is a certain multiple of the audio sample rate. The frequency required on this clock is usually specified in the datasheet of the audio codec module.
ESP-ADF and ESP32-LyraT Codec Compatibility
The PCB Artists ES8388 breakout board or module is compatible with most examples within the ESP-ADF system. This is because the ESP-ADF contains board support package for the ESP32-LyraT audio board, which is also based on the ES8388 audio codec chip.
Here is a block diagram of the Espressif ESP32-LyraT, and the codec part is highlighted in the block diagram. The ES8388 is simply that codec sub-section in the form of a breakout board.
If you need to use amplifiers or other microphone interfaces, you will need to add additional circuits to the ES8388 module.
All ESP-ADF audio playback and recording examples meant for the ESP32-LyraT will therefore work with the PCB Artists ES8388 module.
Feel free to ask away via the Quick Contact form in the sidebar, or leave a comment below.
Change Log
- Initial Release: 10 April 2021
References
- Reference 1: ES8388 Datasheet
- Reference 2: ESP-ADF documentation
- Reference 3: ESP32-LyraT Documentation