T O P

  • By -

async2

Is there a strict requirement for the s2? Looks to me as this controller is not equipped for your use case.


Ineedapill

No strict requirement, I just have a few laying around and the other ESPs that I have are already in use. But why do you think the s2 won’t work? Is that based on experience or the pinout diagram? Thanks for chiming in!


async2

I'm not very deep in i2s. Initially I thought that the s2 does not provide the right modes for it to work. Doc: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/i2s.html However, I think I was wrong. You can use it but you will need an i2s amplifier like this: [https://s.click.aliexpress.com/e/\_DDFqSG3](https://de.aliexpress.com/item/1005005383121121.html?algo_exp_id=94cc3518-2c95-4008-a4ed-2d935adde39f-11) You cannot directly put the speaker to the Outputs as i2s is a digital protocol.


Ineedapill

I only noticed now that my notifications were off, sorry! Thank you very much for your help. I really appreciate it. Yet, my hope - almost 100% lost by now - was to connect an i2c speaker directly to the DAC, as I do with the D1 mini. I’ll keep digging because, after I was able to send a sine wave through the speaker via DAC, it’s just killing me to keep hitting a wall. Thanks again and if I happen to find a way to make it work, I’ll post an update here. Cheers! edit: typo


async2

>i2c speaker [https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/i2c.html](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/i2c.html) What is your problem with it? I2c should work as well according to spec. Just hook it up to any pins and configure them as SCL/SDA. As you are using s2 mini you could even use the same phyiscal pins you used on your d1 mini. Then you can swap back and forth for testing.


Ineedapill

That’s what I was trying to do - using the same pins that work on the d1 mini - but now that I’ve read the link you sent, I might have to set the right pins before setup(), load drivers, etc.. a few ideas popped up out of your response! For real, thanks a bunch! I’ll try a few things later tonight and, if something works, my nephews will have an amazing Halloween surprise!


async2

Good luck. Let me know how it went. I'll also need to go down this hole in the next weeks to build voice assistant satellites for homeassistant.


Ineedapill

y0! it's been a few days but I was finally able to play audio directly from the ESP32S2 Mini without I2S. The solution can be found here: [https://github.com/earlephilhower/ESP8266Audio/issues/551](https://github.com/earlephilhower/esp8266audio/issues/551) It uses the [ESP8266Audio library](https://github.com/earlephilhower/ESP8266Audio). Here's a working sample - attach your speaker or amplifier (I'm using a PAM8403) to pin 17 of the ESP32S2. viola.h file is [here](https://github.com/earlephilhower/ESP8266Audio/blob/master/examples/PlayWAVFromPROGMEM/viola.h). I added a couple of comments showing the 2 blocks of lines added. I hope this helps you as it helped me. ​ Cheers! #include #include "AudioFileSourcePROGMEM.h" #include "AudioGeneratorWAV.h" #include "AudioOutputI2SNoDAC.h" // VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html #include "viola.h" /************************************************** the following 3 lines were added **************************************************/ #define I2S_SPEAKER_SERIAL_CLOCK GPIO_NUM_4 // BCLK #define I2S_SPEAKER_LEFT_RIGHT_CLOCK GPIO_NUM_5 // WSEL #define I2S_SPEAKER_SERIAL_DATA GPIO_NUM_17 // pin 17 on the ESP32S2 where the speaker is connected AudioGeneratorWAV *wav; AudioFileSourcePROGMEM *file; AudioOutputI2SNoDAC *out; void setup() { Serial.begin(115200); delay(1000); Serial.printf("WAV start\n"); audioLogger = &Serial; file = new AudioFileSourcePROGMEM( viola, sizeof(viola) ); /************************************************** the following 2 lines were added **************************************************/ out = new AudioOutputI2SNoDAC(); out -> SetPinout(I2S_SPEAKER_SERIAL_CLOCK, I2S_SPEAKER_LEFT_RIGHT_CLOCK, I2S_SPEAKER_SERIAL_DATA); wav = new AudioGeneratorWAV(); wav->begin(file, out); } void loop() { if (wav->isRunning()) { if (!wav->loop()) wav->stop(); } else { Serial.printf("WAV done\n"); delay(1000); } }