earlephilhower / ESP8266Audio

Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
GNU General Public License v3.0
2.04k stars 434 forks source link

ESP32 : Feedback for "wemos D1 mini 32" and "doit esp32 devkit v4" #465

Open schmurtzm opened 2 years ago

schmurtzm commented 2 years ago

Hi,

I figure that there is different behavior depending the ESP32 board used :

For both when you use the internal DAC you can put your speaker between ping 25 and GND.

I wasn't able to use "no DAC" option. It works on my esp8266 but not on my ESP32, I have only crackling sounds. For what I understand that's a shame because the sound quality could be better comparing to the internal DAC. The output pin is Rx too on ESP32 ?

I presume that I could have better results with an external DAC. The flash frequency will have an impact too with external dac ?

Thanks for this awesome project ;)

softhack007 commented 2 years ago

For both when you use the internal DAC you can put your speaker between ping 25 and GND.

Did you directly connect the speaker? Because usually it's not good to draw more than 10-15mA from a PIN. The cracking could actually be a reset, or some protection circuit that tries to limit output power. I'd always put a resistor between then PIN and speaker, like 220 Ohms depending on the size of the speaker. Do you see better results with a resistor in the line?

FedericoBusero commented 2 years ago

The default pin for NoDAC on ESP32 is pin 22. Sound quality is really good with the standard oversampling 32. And even better with oversampling 64.

softhack007 commented 2 years ago

Another observation - it seems that the I2S "internal DAC" driver is broken in https://github.com/espressif/arduino-esp32 version 2.0.1 (based on ESP-IDF 4.4). On my ESP32 I only get loud noise when compiling with the latest arduino-esp32. It sounds somehow like what is described in this bug report: https://github.com/espressif/esp-idf/issues/7951.

The solution for me was to downgrade the esp32 package to version 1.0.6. Recompiled and uploaded - clear sound from PIN 26+PIN25 👍

FedericoBusero commented 2 years ago

I2S implementation for ESP32 worked well until version 2.0.0rc2. But in that version I2S for ESP32C3 didn´t work.

In 2.0.1 i2s doesn´t work on ESP32 but works for ESP32C3

softhack007 commented 2 years ago

see also https://github.com/espressif/arduino-esp32/issues/5938 - and a few other related ones.

schmurtzm commented 2 years ago

Thank you for all these information. I hope they will repair internal dac quickly for ESP32 !

@softhack007 you're right : I have to use pin 22 for internal DAC, I don't know why I had sound on the I2S pins too 😅

I've made some progress on my "doit esp32 devkit v4" :

And I also have a few failures :

Now I have a problem which is common to all my boards with ESP8266Audio (including esp8266/esp32) : as on this issue #395, it hang each time it finish to play Google TTS.

Any idea is welcome :)

thanks 😃

ensingerphilipp commented 2 years ago

Hi @schmurtzm - how exactly did you manage to get internal DAC on esp32 devkit v4 to work?

Im having the same problem and im using platformio.

Would be nice if you could ellaborate :)

FedericoBusero commented 2 years ago

Do not confuse internal DAC with NoDac, which is something different.

Internal DAC

NoDac

schmurtzm commented 2 years ago

@ensingerphilipp Hi, I've synthetised what I learned in this example : https://github.com/earlephilhower/ESP8266Audio/issues/469

I also have converted a project to platformio (it's an audio player controlled by MQTT which is based on esp8266audio) here : https://github.com/schmurtzm/MrDiy-Audio-Notifier

The plateformio.ini of this project can work for ESP8266 and ESP32 and you can switch between external DAC, internal DAC and no DAC directly from the web UI (in previous versions it was set in the code (based on my issue code proposition above), not in the web UI).

In this project there's also a batch script for windows which allows to flash your ESP with pre-compiled firmware quickly (without compiling the firmware by yourself ).

Precompiled firmwares are available for ESP8266 (Wemos D1 Mini) and ESP32 (esp32doit-devkit-v4). To flash it, plug your ESP in USB port, download this full repo and then run _Schmurtz_ESP_Flasher\Schmurtz_ESP_Flasher.bat (Windows only).

It is a quick way to test if your wiring is OK. And the wiring is described in my issue and in my code in comments.

It should help 😉

ensingerphilipp commented 2 years ago

Thank you @schmurtzm @FedericoBusero

In the end i was able to easily get to ESPCore Version 1.0.6 by specifying

platform = espressif32@3.3

in the platformio.ini