sonocotta / esp32-audio-dock

Audio docks for ESP32 mini (ESP32, ESP32C3, ESP32S2 and ESP8266 mini modules from Wemos)
https://sonocotta.github.io/esp32-audio-dock/
Apache License 2.0
45 stars 7 forks source link

ESP32 Audio Docks and Louder ESP

Open Source Hardware Open Source Software I sell on Tindie
Dev Chat

ESP32 Audio Docks is a range of extension boards (i.e. docks) that allow you to develop Audio solutions based on ESP32 chips. These were created to make Audio development entry as easy and inexpensive as possible.

image DSC_0019

Table of Contents

Motivation

I spent the last few years developing different solutions based on ESP devices. It all started with ESP8266, where CPU power is not really sufficient to do real-time decoding, so you're limited to a rather simple ding-dong business. Then ESP32 came, bringing two much more capable cores, so you have a powerhouse to handle communication and decoding at the same time. Perhaps most importantly it also came with SPIRAM, so you can do decent buffering (essential for streamed content).

Now new ESP32 C-Series and S-Series chips are entering the market, and their potential is mostly unrealized as of today.

I created those docks, to be able to quickly prototype for the whole range of ESP8266 and ESP32 chips, starting with the simplest finger-sized toys and going all the way up to full-sized speakers.

Features

ESP Audio Solo ESP Audio Duo Hifi ESP Louder ESP Louder ESP (Rev H) Louder ESP32-S3 (Rev J)
Image image image image image DSC_0013 DSC_0012
Docks with ESP8266, ESP32C3, ESP32S2 Mini modules ESP32 Mini Module ESP32 Mini Module ESP32 Mini Module ESP32-WROVER-N16R8 onboard ESP32-S3-WROOM-N16R8 onboard
DAC Single I2S DAC (MAX98357) with built in D-Class amp Dual I2S DAC (MAX98357) with built in D-Class amp PCM5100A 32bit Stereo DAC
-100 dB typical noise level
Stereo I2S DAC (TAS5805M) with built in D-Class amp Stereo I2S DAC (TAS5805M) with built in D-Class amp Stereo I2S DAC (TAS5805M) with built in D-Class amp
Output (4Ω) 3W 2x 3W Non-amplified stereo output 2x 32W (4Ω, 1% THD+N) 2x 32W (4Ω, 1% THD+N) 2x 32W (4Ω, 1% THD+N)
Output (8Ω) 1.5W 2x 1.5W Non-amplified stereo output 2x 22W (8Ω, 1% THD+N) 2x 22W (8Ω, 1% THD+N) 2x 22W (8Ω, 1% THD+N)
Adds 8MB PSRAM (4MB usable) 8MB PSRAM (4MB usable) 8MB PSRAM (4MB usable) 8MB PSRAM (4MB usable) 8MB PSRAM (all usable, and use faster interface)
Connectivity WiFi (ESP8266, ESP32S2)
WiFi + BT5.0 (ESP32C3)
WiFi + BT4.2 + BLE WiFi + BT4.2 + BLE WiFi + BT4.2 + BLE
Ethernet
WiFi + BT4.2 + BLE
Ethernet
WiFi + BT4.2 + BLE
Ethernet

Onboard PSRAM

Audio streaming requires proper buffering to work, even with ESP32 500K of RAM it is a challenging task. For that reason, most of the projects will require WROVER modules that have onboard PSRAM chips.

All ESP32 Docks have an 8MB PSRAM chip onboard, connected via a high-speed SDIO interface. This effectively turns your regular WROOM module into WROVER module with no effort required. Any code using PSRAM with just work out-of-the box.

Boards Pinout

ESP Audio Solo

I2S CLK I2S DATA I2S WS
ESP8266 15 3 2
ESP32-C3 5 20 6
ESP32-S2 12 37 16

ESP Audio Duo

I2S CLK I2S DATA I2S WS PSRAM CE PSRAM CLK
ESP32 26 22 25 16 17

HiFi-ESP

I2S CLK I2S DATA I2S WS PSRAM CE PSRAM CLK
ESP32 26 22 25 16 17

Louder ESP

I2S CLK I2S DATA I2S WS PSRAM CE PSRAM CLK TAS5805 SDA TAS5805 SCL TAS5805 PWDN TAS5805 FAULT
ESP32 26 22 25 16 17 21 27 33 34
ESP32-S3 14 16 15 - - 8 9 17 18

Starting from revision E, Louder ESP exposes an Ethernet header, compatible with the popular W5500 module

SPI CLK SPI MOSI SPI MISO SPI CS SPI HOST/SPEED ETH INT ETH RST IR IN RGB OUT
ESP32 18 23 19 05 2/20MHz 35 14 - -
ESP32-S3 12 11 13 10 SPI2/20MHz 6 5 7 36

Software samples

In the software section two firmware examples are provided.

Platformio IDE

All samples are provided as Plarformio IDE projects. After installing it, open the sample project. Select the proper environment based on your dock. Run the Build and Upload commands to install necessary tools and libraries, and build and upload the project to the board. Communication and proper upload method selection will be handled by IDE automatically.

Arduino IDE

Follow the ESP8266Audio library guide. Default settings will work out of the box with ESP8266 and ESP32 boards. For ESP32C3 and ESP32S2 board please adjust the pinout according to the above section

ESPHome and Home Assistant

Being an ESP32-based device, you can easily integrate it into your Home Assistant using ESPHome. Start with esphome web installer, which will give you ESPHome base install and WiFi configuration in minutes. Some S2/S3 boards have issues with we-installer, you may need to use Adafruit flasher instead with binaries pulled from the HA.

image image

Next, navigate to your Home Assistant (assuming you have your ESPHome integration installed), and adopt the newly created node

image

ESPHome will give you ESPHome configs for Solo board running with ESP32-S2/S3, as well as Duo/HiFi-ESP and Louder ESP working with ESP32.

Few words of explanation.

Bonus - automation example

The true power of the native speaker in the eHA is the use of automation. One example that I find useful. This simple automation will be pronounced every hour between 8 AM and 9 PM. Another one is used to pronounce bedtime, you get the point...

image

Squeezelite-ESP32

Squeezelite-ESP32 is a multimedia software suite, that started as a renderer (or player) of LMS (Logitech Media Server). Now it is extended with

And LMS itself

All ESP32-based boards are tested with Squeezelite-ESP32 software, which can be flashed using nothing but a web browser. You can use Squeezelite-ESP32 installer for that purpose.

How to flash and configure ("ESP Audio Duo", "HiFi-ESP" and "Louder ESP")

Use Installer for ESP Audio Dock to flash firmware first. It has been preconfigured to work with ESP Audio boards and will configure all hardware automatically.

Select the correct device first image
Connect the device to the USB port and select it from the list image
Press Flash and wait around 2 minutes image
(Optional) You may enter the serial console to get more information image
Device is in recovery mode. Connect to squeezelite-299fac wifi network with squeezelite password (your network name suffix will be different) image
When redirected to the captive portal let the device scan wifi network and provide valid credentials
You can use provided IP address (http://192.168.1.99/ on the screenshot) to access settings page image
(Optional) You may change device names to something close to your heart image
Exit recovery image
You can use it now Bluetooth Spotify Connect AirPlay LMS Renderer
image image image image

Hardware

image

Please visit the hardware section for board schematics and PCB designs. Note that PCBs are shared as multi-layer PDFs.

ESP Audio Solo

Image Legend
image image MAX98357 DAC
image Speaker Terminal

ESP Audio Duo

Image Legend
image image MAX98357 DAC
image Speaker Terminals
image 8MB PSRAM IC

HiFi-ESP

Image Legend
image image PCM5100A DAC
image Speaker Terminals
image 8MB PSRAM IC
image Ultra-Low noise LDO 3V3 Voltage regulator

Louder ESP

Image Legend
image image TAS5805M DAC
image Speaker Terminals
image 8MB PSRAM IC
image 3V3 Drop-Down voltage regulator (powers ESP32)
image Input Voltage terminal
image (REV B, C, D) image TAS5805M DAC
image Speaker Terminals
- 8MB PSRAM IC (Hidden under ESP32 module)
- 3V3 Drop-Down voltage regulator (powers ESP32, hidden under ESP32 module)
image Input Voltage terminal

Louder ESP32 (rev H)

Image
DSC_0013_small JPG-mh

Louder ESP32-S3 (rev J)

Image
DSC_0012_small JPG-mh

Louder Optional SPI Ethernet module

Image Legend
Optional Ethernet header is exposed on the bottom side of the PCB image
Use popular W5500 based module as displayed on the picture image

BTL and PBTL mode

TAS5805M DAC Allows 2 modes of operation - BTL (stereo) and PBTL (parallel, or mono). In Mono amp will use a completely different modulation scheme and basically will fully synchronize output drivers. Jumpers on the board allow both output drivers to connect to the same speaker. The most important step is to inform the Amp to change modulation in the first place via I2C comman. In the case of sqeezelite DAC controlsset value is the following:

dac_controlset: `{"init":[{"reg":3,"val":2},{"reg":3,"val":3},{"reg":2,"val":4}],"poweron":[{"reg":3,"val":3}],"poweroff":[{"reg":3,"val":0}]}`

compared to default:

dac_controlset: `{"init":[{"reg":3,"val":2},{"reg":3,"val":3}],"poweron":[{"reg":3,"val":3}],"poweroff":[{"reg":3,"val":0}]}`

One can test audio with single speaker connected between L and R terminals (plus on one side and minus on the other). Optionally, jumpers on the board will effectively connect second driver in parallel doubling the current capability.

Important point, this will send only one channel to the output, that’s just how the DAC works. True mono as (L+R)/2 is possible via more in-depth configuration (very poorly documented), but I haven’t managed to configure that on the stand. I’m still working on that. (Along with a few more really cool DSP features that this DAC has, like EQ, subwoofer mode and tone compensation settings)

BTL PBTL
Descriotion Bridge Tied Load, Stereo Parallel Bridge Tied Load, Mono
Rated Power 2×23W (8-Ω, 21 V, THD+N=1%) 45W (4-Ω, 21 V, THD+N=1%)
Schematics image image
Speaker Connection image image

Starting from Rev E, an additional header is exposed to allow datasheet-speced connectivity

Image Legend
Stereo Mode - leave open image
Mono (PBTL) Mode, close horisontally image

Louder ESP power considerations

Barrel jack used is spaced at 6mm hole/2mm pin, which is typically 5.5/2.5mm jack on the male side.

image

The screw terminal is connected parallel to the barrel jack, you can use either interchangeably.

The power adapter specs depend on the speaker you're planning to use. DAC efficiency is close to 100%, so just take the power rating of your speaker (say 2x10w), and impedance (say 8 ohm) and you'd need at least 9 volts rated at 1.2 amps per channel, round up to 3 total amps.

It is not recommended to go beyond the voltage your speakers can take, otherwise amp will blow your speakers in no time.

Case

Louder-ESP32 is mechanically compatible with Raspberry Pi 3/4 cases, tested with transparent ones. Also, community members created a few 3-D printable designs that can be found here and here

DSC_0001

Where to buy

You may support my work by ordering these products at Tindie and Elecrow