Esparagus Media Center is a series of ESP32-based media center devices. They all run Squeezelite-ESP32 software and have similar media capabilities, but are aimed at different use cases. They share a similar look, and compared to my earlier designs, they have a great-looking aluminum case.
Our Crowd Supply campaign for backing the manufacturing of Esparagus series boards is currently underway. If you have any interest, please consider subscribing to receive updates on the campaign.
- Esparagus Media Center
ChatGPT made me call it that way. I only asked if there is a fruit or vegetable that is phonetically close to ESP32, which is the heart of this device.
I did few audio projects in the past, some using ESP32, some using larger Orange Pi and Raspberry Pi devices. Each has its pros and cons, and with each iteration, I'm trying to focus on the details that were working best for me, while actually using them.
What I like about ESP32 is how lightweight it is. It barely draws power, so you may not care to turn it off at all. It boots in seconds and is ready for use in a snap. Still, it is capable and works at par with Linux SBC solutions for audio applications, while costing a fraction of their price. Combined with a proper Hi-Fi DAC you would not tell a difference to commercial devices standing side by side and costing much more.
Over the last few years, I have seen a few amazing software products created to deliver audio on the ESP32, like squeezelite-esp32 or euphonium. Esparagus media center devices are designed specifically to run these great pieces of software and bring a new life into aging audio equipment that most of us have at home but do not use that much these days, since it is not working with Spotify and the family.
Esparagus HiFi MediaLink is a handy low-cost media device that will upgrade your legacy audio system with cutting-edge internet streaming capabilities and enhance your audio experience. It exposes line-level output that you can plug into a stereo amplifier. It uses the legendary PCM51 series DAC with supreme audio quality.
Loud Esparagus is aimed to be paired with small-to-medium-sized speakers in a small room. It uses a dual MAX98357 Hi-Fi DAC that will output 3W per speaker. Admittedly not much, but well enough for a kid's room or workplace. Due to the D-class amp, it barely uses power and can be paired with a standard USB wall charger.
Louder Esparagus is a top-of-the-range model that uses modern highly capable TAS5805M DAC and is aimed to be paired with medium-to-large speaker systems. With 25W per channel stereo output, it packs a punch and can easily enlive living quarters or dorm rooms. It is highly efficient, but much more demanding for power when cranked, therefore it uses USB-C Power Delivery to pull up to 65W from the wall power adapter. It can be used both with Wi-Fi and Ethernet (to make sure bad Wi-Fi would not interrupt the stream)
Hifi ESP | Esparagus HiFi MediaLink | Loud ESP | Loud Esparagus | Louder ESP | Louder Esparagus | |
---|---|---|---|---|---|---|
Image | ||||||
Docks with | ESP32 Mini Module | ESP32-WROVER Module Onboard | ESP32 Mini Module | ESP32-WROVER Module Onboard | ESP32 Mini Module | ESP32-WROVER Module Onboard |
DAC | PCM5100A 32bit Stereo DAC | PCM5100A 32bit Stereo DAC -100 dB typical noise level |
Dual I2S DAC (MAX98357) with built in D-Class amp | Dual I2S DAC (MAX98357) 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 |
Power | 3x LP5907 3.3 V Ultra-Low-Noise LDO | 3x LP5907 3.3 V Ultra-Low-Noise LDO | 5V from Mini-USB | 5V from USB-C | Up to 26V from external PSU | Up to 20V from USB-C PD |
Output | 2.1 VRMS Line-level stereo output 3.5mm jack | 2.1 VRMS Line-level stereo output 3.5mm jack | 2x 3W | 2x 3W | 2x 23W at 22V Vin | 2x 22W at 20V over USB-PD |
PSRAM | 8MB PSRAM (4MB usable) | 8MB PSRAM (4MB usable) Onboard |
8MB PSRAM (4MB usable) | 8MB PSRAM (4MB usable) Onboard |
8MB PSRAM (4MB usable) | 8MB PSRAM (4MB usable) Onboard |
Peripheral | External WiFi Antenna WS2812B RGB Led SSD1306 128x64 OLED screen (optional) |
External WiFi Antenna WS2812B RGB Led SSD1306 128x64 OLED screen (optional) |
External WiFi Antenna WS2812B RGB Led SSD1306 128x64 OLED screen (optional), IR receiver, W5500 SPI LAN |
|||
Size | 80 x 50 x 20mm | 80 x 50 x 20mm | 100 x 80 x 38mm |
Audio streaming requires proper buffering to work, even with ESP32 500K of RAM it is a challenging task. All Esparagus boards are based on WROVER modules that have an onboard PSRAM chip.
I2S CLK | I2S DATA | I2S WS | PSRAM CE | PSRAM CLK | |
---|---|---|---|---|---|
ESP32 | 26 | 22 | 25 | 16 | 17 |
SPI HOST | SPI CLK | SPI MOSI | SPI MISO | OLED DC | OLED CS | OLED RST | WS2812 RGB LED | RELAY EN | |
---|---|---|---|---|---|---|---|---|---|
ESP32 | 2 | 18 | 23 | 19 | 4 | 5 | 32 | 33 | 21 |
I2C CLK | I2C DATA | PWDN | FAULT | |
---|---|---|---|---|
ESP32 | 27 | 21 | 33 | 34 |
SPI HOST | SPI CLK | SPI MOSI | SPI MISO | LAN RES | LAN CS | LAN INT | OLED DC | OLED CS | OLED RST | |
---|---|---|---|---|---|---|---|---|---|---|
ESP32 | 2 | 18 | 23 | 19 | 14 | 5 | 35 | 4 | 15 | 32 |
USB-PD EN | USB-PD POWER GOOD | IR INPUT | WS2812 RGB LED | |
---|---|---|---|---|
ESP32 | 13 | 36 | 39 | 12 |
In the software section two firmware examples are provided.
- esp32-i2s-bare is base I2S implementation based on ESP-IDF implementation directly.
- esp32-i2s-esp8266audio is based on excellent ESP8266Audio library (it works with the whole ESP range, don't get fooled by the name), providing minimum code implementation.
- esp32-i2s-web-radio is based on the same library, providing minimum web-readio stream player. It expects a playlist as an input in the 'data' folder.
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.
Follow the ESP8266Audio library guide.
There is a number of ways Esprargus Media Center devices can be integrated into the Home Assistant setup. Each of them gives a unique feature, losing some other in return. As usual, there is no perfect solution for everyone, but perhaps there is one for you. Below is the summary table of the methods known to me and tested by me.
Integration type | Tested | Description | Pros | Cons |
---|---|---|---|---|
LMS/Airplay | Yes | Connect to Music Assistant as external protocol device. Can play your media library and internet radio | Still can use squeezelite, i.e. use Spotify Connect and Apple Airplay when HA is not using the device | No native integration into HA, only works with Music Assistant |
ESPHome way | Yes | Connect as HA media device. Can be used with any HA integration, including Music Assistant, Text-to-Speach announcements, alarms, etc | More integrations with HA, more flexibility in use case | No longer works as Spotify, Airplay, etc. |
Snapcast way | Yes | Connect to Music Assistant as snapcast protocol device. Can play your media library and internet radio. | Perfect for multiroom sync (Sonos-like, perhaps even better). Can be used with other Snapcast servers around the house | No longer works as Spotify, Airplay, etc. No native integration into HA only works with Music Assistant |
Below are specific steps that you need to follow to spin up Esprargus Media Center in the Home Assistant
I prefer to use HA with the Music Assistant. This way you can integrate both your media library and internet radio and have a nice UI/UX at the same time (including mobile).
Generally, you need to have supported HA (native) installation and follow these steps. I will place here a short version to have a reminder for future myself
Step | Screenshot |
---|---|
Add SSH Addon Navigate to Settings > Addons > Add Addon Search for SSH and install it. Enable Show in sidebar switch while you there |
|
Start SSH Addon SSH addon won't start until you add at least one SSH public key to it. So navigate to SSH Addon Settings and add a key (or password) to the config It should be able to start now |
|
Install Community Store Run this command in the Terminal session wget -O - https://get.hacs.xyz | bash - You need to restart your HA after that |
|
Add HACS Navigate to Settings > Devices as Services > Integrations > Add Integration, search for HACS, and add it to the HA You'll need to authorize your extension to your GitHub account |
|
Install Music Assistant via HACS From the HACS menu search for Music Assistant and press the Download button You need to restart HA again In the Settings > Addons you should be able to see MA and enable sidebar navigation for it. |
|
Configure Music Assistant Before you enable Integration (that will in turn add speaker devices) you need to enable MA providers Go to MA > Settings > Providers and enable both Music providers and Player providers that interests you. If not sure, enable all of them, you can disable them later on. |
|
Add Music Assistant Integration Navigate to HA Settings > Devices & services > Integrations. Click the big + ADD INTEGRATION button, look for Music Assistant, and click to add it. It should discover and add media devices based on the providers you're enabled in the previous step |
|
Add Music Devices discovered by MA You should be able to add and use discovered devices. More details in below sections |
When you have squeezelite-esp32 installed on your Esparagus device (either stock or manually going through steps), it will announce itself by multiple protocols in the network:
- Bluetooth
- LMS or slimproto - auto-discovered by HA
- Apple Airplay - auto-discovered by HA
- Spotify Connect
The power of this method is that you can use all four ways outside of HA, for example using your smartphone and Spotify app, and still have it integrated into HA at the same time.
Make sure your MA Slimproto provider is disabled, it will conflict with the native HA integration
Disable SlimProto integration in the HA if you want to go the MA way. If you enabled SlimProto and AirPlay providers in the MA, you should find your device as both a Slimproto device and an Airplay device. It is up to you which protocol to use, generally, they both work perfectly well.
Step | Screenshot |
---|---|
Add ESPHome Addon Navigate to HA Settings > Addons > Add Addon Search for SSH and install it. Enable Show in sidebar switch while you there |
|
Prepare Esparagus for ESPHome onboarding Use Web Flasher to flash stock ESPHome into device |
|
Onboard Esparagus ESPHome device into HA Go to the HA ESPHome page and you should be able to find a new device. You need to onboard it with the below config (feel free to change names) This will take a moment or two |
|
Validate device in the ESPHome | |
Add ESPHome Integration Navigate to HA Settings > Devices & services > Integrations. Click the big + ADD INTEGRATION button, look for ESPHome, and click to add it. It should discover and add ESPHome media devices based on the previous step |
|
Use your media device in the HA | |
Use your media device in the MA Add Music Assistant HA MediaPlayers provider to discover new Media device |
substitutions:
name: esphome-web-e002d0
friendly_name: loud-esparagus
long_devicename: "Loud Esparagus"
esphome:
name: "${friendly_name}"
name_add_mac_suffix: false
comment: "${long_devicename}"
on_boot:
priority: 800
then:
- media_player.volume_set:
id: loudesp32
volume: 10%
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
wifi:
ssid: !secret esphome_wifi_ssid
password: !secret esphome_wifi_password
ap:
ssid: "$name"
password: password
captive_portal:
psram:
mode: octal
speed: 80MHz
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26
media_player:
- platform: i2s_audio
name: $long_devicename
id: loudesp32
dac_type: external
i2s_dout_pin: GPIO22
mode: stereo
substitutions:
name: esphome-web-e002d0
friendly_name: louder-esparagus
long_devicename: "Louder Esparagus"
esphome:
name: "${devicename}"
name_add_mac_suffix: false
comment: "${long_devicename}"
includes:
- louderesp32.h
platformio_options:
lib_deps: "Wire"
on_boot:
priority: 800
then:
## Set a volume limit just to be safe...
- media_player.volume_set:
id: louderesp32
volume: 10%
esp32:
board: mhetesp32minikit
wifi:
ssid: !secret esphome_wifi_ssid
password: !secret esphome_wifi_password
ap:
ssid: "$devicename Fallback Hotspot"
password: !secret esphome_ap_password
captive_portal:
### Optional if you want ethernet (then remove all wifi config) ###
#ethernet:
# type: W5500
# clk_pin: GPIO18
# mosi_pin: GPIO23
# miso_pin: GPIO19
# cs_pin: GPIO05
# interrupt_pin: GPIO35
# reset_pin: GPIO14
logger:
level: DEBUG
api:
encryption:
key: !secret esphome_api_key
ota:
password: !secret esphome_ota_password
psram:
mode: octal
speed: 80MHz
switch:
- platform: custom
lambda: |-
auto tas5805 = new TAS5805();
App.register_component(tas5805);
return {tas5805};
switches:
name: "Enable Amp"
i2c:
sda: GPIO21
scl: GPIO27
scan: True
id: i2c_component
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26
media_player:
- platform: i2s_audio
name: $long_devicename
id: louderesp32
dac_type: external
i2s_dout_pin: GPIO22
mode: stereo
For the last one to work you also need to place this file under /config/esphome/louderesp32.h
//###########################################################################
//## ESPHome custom component for the Louder ESP32 ##
//## Get it here: https://www.tindie.com/products/sonocotta/louder-esp32/ ##
//## Check the blog article on https://www.espthings.io/louder-esp32 ##
//###########################################################################
#include "esphome.h"
#include <Wire.h>
#define DEVICE_CTRL_2_REGISTER 0x03
#define PWDN_PIN 33
#define I2C_ADDR 0x2D
class TAS5805 : public Component, public Switch {
public:
void setup() override {
pinMode(PWDN_PIN, OUTPUT);
digitalWrite(PWDN_PIN, LOW);
delay(200);
digitalWrite(PWDN_PIN, HIGH);
Wire.begin();
Wire.beginTransmission(I2C_ADDR);
if (Wire.endTransmission() != 0) {
ESP_LOGE("TAS5805", "TAS5805 not found at address 0x2D");
return;
}
Wire.beginTransmission(I2C_ADDR);
Wire.write(DEVICE_CTRL_2_REGISTER);
Wire.write(0x02);
Wire.endTransmission();
delay(50);
Wire.beginTransmission(I2C_ADDR);
Wire.write(DEVICE_CTRL_2_REGISTER);
Wire.write(0x03);
Wire.endTransmission();
ESP_LOGI("TAS5805", "TAS5805 initialized.");
}
void write_state(bool state) override {
uint8_t value = state ? 0x03 : 0x00;
Wire.beginTransmission(I2C_ADDR);
Wire.write(DEVICE_CTRL_2_REGISTER);
Wire.write(value);
Wire.endTransmission();
publish_state(state);
}
};
Snapcast is a multi-room audio player that synchronizes playback across multiple devices, ensuring that audio streams play simultaneously in perfect sync. It consists of a server, which distributes audio streams, and clients, which receive and play the audio. There is a snapcast fork that was created to implement Esparagus specific configuration on top of the ESP32 Snapcast client. This allows us to build flexible and extendable setups connected to various sources, like Mopidy, MPD or Home Assistant.
Step | Screenshot |
---|---|
Flash Snapcast to the Esparagus board using web-flashing tool |
|
Enable Snapcast in the MA Got to the Ma and enable Snapcast provider. Your speaker will be discovered automatically, as long as it is running |
|
Use your media device in the MA Play your audio into new device |
|
Use a group of speakers for multi-room setup In the MA settings > Players create a new group player and add as many Eparagus players as you need. Use that group speaker to get a synced audio |
Squeezelite-ESP32 is a multimedia software suite, that started as a renderer (or player) of LMS (Logitech Media Server). Now it is extended with
- Spotify over-the-air player using SpotifyConnect (thanks to cspot)
- AirPlay controller (iPhone, iTunes ...) and enjoy synchronization multiroom as well (although it's AirPlay 1 only)
- Traditional Bluetooth device (iPhone, Android)
And LMS itself
- Streams your local music and connects to all major online music providers (Spotify, Deezer, Tidal, Qobuz) using Logitech Media Server - a.k.a LMS with multi-room audio synchronization.
- LMS can be extended by numerous plugins and can be controlled using a Web browser or dedicated applications (iPhone, Android).
- It can also send audio to UPnP, Sonos, Chromecast, and AirPlay speakers/devices.
All Esparagus boards are tested with Squeezelite-ESP32 software. It can be flashed using nothing but a web browser. You can use Squeezelite-ESP32 installer for that purpose.
Use Esparagus Squeezelite-ESP32 installer to flash the firmware. It has been preconfigured to work with Esparagus boards and will configure all hardware automatically.
Select correct device first | |
Connect the device to USB port and select it from the list | |
Press Flash and wait around 2 minutes |
|
(Optional) You may enter the serial console to get more information, like device IP and boot logs | |
Device is in recovery mode. Connect to squeezelite-299fac wifi network with squeezelite password (your network name suffix will be different) |
|
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 | |
(Optional) You may change device names to something close to your heart | |
Exit recovery |
You can use it now
Bluetooth | Spotify Connect | AirPlay | LMS Renderer |
---|---|---|---|
Esparagus HiFi MediaLink | Loud Esparagus | Louder Esparagus |
---|---|---|
Please visit hardware section for board schematics and PCB designs. Note that PCBs are shared as multi-layer PDFs as well as Gerber archives.
Esparagus HiFi MediaLink | Loud Esparagus | Louder Esparagus |
---|---|---|
Esparagus HiFi MediaLink | Loud Esparagus | Louder Esparagus |
---|---|---|
Some boards of the Esparagus series have internal drivers for external relays. It has a back-facing diode to shunt any coil-inducted currents. Driver is an open-drain output with the following states
Driver Pin State (IO21) | Output state | Relay connected between OUT and +5V |
---|---|---|
Floating (pulled low with 100K resistor) or LOW |
High impedance | INACTIVE (switched OFF) |
HIGH | Pulled to GND | ACTIVE (switched ON) |
External relay can be connected directly between OUT and +5V pins (1st and 3rd pins, mid pin being GND)
You may support our work by ordering this product at Tindie
- Esparagus HiFi MediaLink
- Loud Esparagus
- Louder Esparagus (coming soon)