ESP8266 Wemos D1 mini - connecting speaker with Max98357

Hello all

I have bought this chip from Aliexpress
https://www.aliexpress.com/item/32705466032.html

I want to connect to speaker via Max98357 chip

When i connect it to ESPhome it is detected as this type in yaml:

esp8266:
  board: esp01_1m

I try to define the i2s_audio component, but the yaml validation says i2s requires esp32 component - not sure what that means.

here is the complete yaml

esphome:
  name: esp32-wemos-d1-microusb1
  friendly_name: ESP32_Wemos_D1_MicroUsb1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "####"

ota:
  - platform: esphome
    password: "###"

wifi:
  ssid: KEDEM7
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.0.21
    gateway: 192.168.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "KEDEMESPD1W1"
    password: "####"

captive_portal:

web_server:
  port: 80

# Enable I2S audio output
# the below section gives yaml validation error
#
# i2s_audio:
#   dac_type: external
#   i2s_lrclk_pin: GPIO5   # LRCLK (e.g., D1)
#   i2s_bclk_pin: GPIO04   # BCLK (e.g., D2)
#   i2s_dout_pin: GPIO13   # DOUT (e.g., D7)

anyone can help? do i need to force change the type of device or download other ESP components ?

Removed as incorrect

I2S audio requires esp32 chip, esp8266 is not powerful enough. So, your esp board is wrong, you must buy esp32 model.

hi thanks for the reply
i was googling for this and saw several guids with youtube and posts in these forums suggesting it can be used with 8266

example:

For that project you need to follow that post to setup the device.

I still have 2 working esp8266’s that uses the original code that was setup several years ago, working as doorbell’s and timed messages blaster.

Yeah, but that’s not esphome then, it’s arduino, if i see correctly…

Correct. The original code and project is compiled on Arduino IDE.

OK so it’s not an issue with the hardware of 8266 just not supported currently with 8266 under esphome, correct?

Correct, and i strongly doubt it will ever be. All is leaning towards esp32, which is way more powerfull and almost same priced. Esphome is going towards esp-idf framework, which is more powerfull and more resource friendly thatn arduino, but it’s available only for esp32.
Esp8266 is a great “beginner chip”, but you soon run out of pins. I have quite a number of these, too, but now i only buy and use esp32. For audio speakers i use THESE tiny devils.

1 Like

Correct.
I seem to remember some folks trying to do the same on esphome but hitting hardware limitation of the esp8266.

OK I have some esp32 super mini I’ll try it with them
Thanks!

The D1 mini got two onboard DAC. But 8 khz 8 bit mono. Not really half decent sound quality. So yes a esp32 is a good idea.

Hi
So i tried configuring esphome with ESP32 super mini with speaker

this is the configuration

esphome:
  name: esp32-c3-super-mini1-speaker
  friendly_name: esp32-c3-super-mini1-speaker

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "####

ota:
  - platform: esphome
    password: "###"

wifi:
  ssid: KEDEM7
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.0.44
    gateway: 192.168.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "KEDEMESP1"
    password: "###"

captive_portal:

web_server:
  port: 80
 
light:
  - platform: status_led
    name: "Status LED"
    id: esp_status_led
    icon: "mdi:alarm-light"
    pin:
      number: GPIO8
      inverted: true
    restore_mode: ALWAYS_OFF

i2s_audio:
  i2s_lrclk_pin: GPIO10
  i2s_bclk_pin: GPIO4

media_player:
  - platform: i2s_audio
    name: "ESP32 Audio Player"
    dac_type: external
    i2s_dout_pin: GPIO5
    mode: mono
    id: media_out

the esphome config validation syas it valid
but i get build errors

Compiling .pioenvs/esp32-c3-super-mini1-speaker/libb0f/WiFiClientSecure/ssl_client.cpp.o
Compiling .pioenvs/esp32-c3-super-mini1-speaker/lib2f0/HTTPClient/HTTPClient.cpp.o
Archiving .pioenvs/esp32-c3-super-mini1-speaker/libb0f/libWiFiClientSecure.a
Compiling .pioenvs/esp32-c3-super-mini1-speaker/lib681/ESP32-audioI2S/Audio.cpp.o
.piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp: In member function 'void Audio::processWebStream()':
.piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp:3033:65: error: no matching function for call to 'min(uint32_t&, size_t)'
         availableBytes = min(availableBytes, InBuff.writeSpace());
                                                                 ^
In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/algorithm:62,
                 from /data/cache/platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:162,
                 from .piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.h:15,
                 from .piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp:11:
/data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~

am i missing some include or components ?

Did you try clean build?

yes
i hit “clean build files”
then install again

getting similar error

Compiling .pioenvs/esp32-c3-super-mini1-speaker/lib2f0/HTTPClient/HTTPClient.cpp.o
Archiving .pioenvs/esp32-c3-super-mini1-speaker/libb0f/libWiFiClientSecure.a
Compiling .pioenvs/esp32-c3-super-mini1-speaker/lib681/ESP32-audioI2S/Audio.cpp.o
.piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp: In member function 'void Audio::processWebStream()':
.piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp:3033:65: error: no matching function for call to 'min(uint32_t&, size_t)'
         availableBytes = min(availableBytes, InBuff.writeSpace());
                                                                 ^
In file included from /data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/algorithm:62,
                 from /data/cache/platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:162,
                 from .piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.h:15,
                 from .piolibdeps/esp32-c3-super-mini1-speaker/ESP32-audioI2S/src/Audio.cpp:11:
/data/cache/platformio/packages/toolchain-riscv32-esp/riscv32-esp-elf/include/c++/8.4.0/bits/stl_algo.h:3456:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
     min(initializer_list<_Tp> __l, _Compare __comp)

i also checked my esphome version is up todate

seems like this ESP32 super mini board does not support audio lib…

board: esp32-c3-devkitm-1

If i replace it with regular esp32 board its compling