The ESP32-C3 is a great little MCU for low power audio applications. It is just like the ESP8266 – with with a better architecture, enhanced peripherals, better documentation, and firmware support for audio applications. In this article, I go through the important aspects of connecting ES8388 with ESP32-C3 to develop audio applications.
Why should you use ESP32-C3?
There are many use cases that strongly favor the ESP32-C3 over other ESP32 versions like the PICO-D4. Here are some considerations that you need to make before picking the ESP32-C3 over other variants:
- Do you need PSRAM for buffering audio?
As far as I know, ESP32-C3 does not fully support PSRAM within ESP-IDF like regular ESP32 variants do. However, the ESP32-C3 does have an SPI interface that you can use to connect to a PSRAM and use DMA for buffering data. The difference would be that you cannot allocate memory directly on the PSRAM because the address range will not be remapped.
- Do you need too many other GPIOs?
If you have a GPIO constrained application, the ESP32-C3 is probably not for you. There is a shortage of GPIOs and you will need to use them wisely. I have useful notes on ESP32-C3 GPIOs here.
- Do you need low power and mostly use Bluetooth?
The ESP32-C3 can burn very little power when you are using BT most of the time. Power cosumption is definitely lower than dual core ESP32 variants with a ton of peripherals that you may not always use. So if your application primarily uses Bluetooth and audio – go for ESP32-C3.
Audio Hardware for Using ES8388 with ESP32-C3
Unfortunately, there is no official development kit from Espressif (as of writing this article) that contains an audio codec on board along with an ESP32-C3. There may be other solutions out there, but I used a simple and easy-to-use setup to interface ES8388 with ESP32-C3.
Our PCB Artists ES8388 module exposes every analog IO you need for your prototyping needs and also lets you connect the ES8388 audio codec to any MCU devkit. All you need is breadboard for connections.
The ES8388 codec contains two power domains, analog and digital. The digital domain signals are meant to carry digital audio data (PCM audio over I2S, codec configuration commands over I2C, etc). You can read more about the audio codec interface here.
The only difference between connecting the codec module to ESP32 and ESP32-C3 is the GPIO assignments. The ESP32-C3 has different strapping pins and does not have all the IOs present on the other ESP32 variants. Therefore, you will need to modify the hardware and codec driver code to match ESP32-C3 GPIOs.
In this case, I connected the ES8388 with ESP32-C3 using the following GPIOs:
- ES8388 SCLK to ESP32-C3 GPIO 4
- ES8388 LRCLK to ESP32-C3 GPIO 5
- ES8388 DIN to ESP32-C3 GPIO 6
- ES8388 DOUT to ESP32-C3 GPIO 7
- ES8388 MCLK to ESP32-C3 GPIO 3
- ES8388 SCL to ESP32-C3 GPIO 8
- ES8388 SDA to ESP32-C3 GPIO 9
Firmware needs to be written and added to add support for ES8388 when using ESP32-C3. Espressif’s audio devkits like Lyra-T already supported ES8388 and had proper drivers built into the ESP-ADF – but used regular ESP32 modules.
With the ESP32-C3, you need to select a custom audio board in menuconfig and then build ESP-ADF applications using your own driver code. The custom ES8388 drivers will soon be available for use in our GitHub. The library is still a work in progress and needs to be tested before being made public.
If you would rather want to change existing ES8388 drivers within the ESP-ADF yourself, you can do so. It is easy – all you need to do is take care of the differences between ESP32 and ESP32-C3. I have a short article noting how to port code to ESP32-C3.
Feel free to ask away via the Quick Contact form in the sidebar, or leave a comment below.
- 30 January 2023
– Initial Release