Mozzi basics with ESP32

34 views
Skip to first unread message

Aranis Das

unread,
Jul 12, 2024, 3:39:46 PMJul 12
to Mozzi-users
Looking to run the example codes with an esp32 and an 8 ohm speaker connected to the dac pin (25). I am really confused on how to output sound aswell. I just want to run the basic sketches provided for now and understand how the library works.

Thanks!

Martin Gerken

unread,
Jul 12, 2024, 6:19:19 PMJul 12
to mozzi...@googlegroups.com
The ESP32 cannot drive a speaker directly (no MCU can do that); you need
an amplifier, i.e. those LM358 based modules from your favourite chinese
dealer. Better go for a DAC module with amplifier (and thus do not use
the ESP32-built-in DAC), like the MAX98357A.

Best, Martin

Aranis Das

unread,
Jul 14, 2024, 5:10:33 PM (13 days ago) Jul 14
to Mozzi-users
Thanks for the response. I actually had one laying around. I used a tutorial that uses some math to get a square wave output.
Now my question is, how exactly can i output via i2s with mozzi? I have tried running the basic example (sinewave) but it seems that it needs more configuration.
 is there a guide on how to configure mozzi with i2s? I think the documentation only shows that it is supported, but i cant seem to find something with an example program.

Thanks again
Aranis

tomco...@live.fr

unread,
Jul 19, 2024, 10:13:53 AM (8 days ago) Jul 19
to Mozzi-users
Hi,
Sorry for the delay.

Does the peculiar chip you are using is having an I2S dac onboard? Otherwise you will need an additionnal I2S DAC, connected to the ESP32 to make that mode work.

Best,
Tom

Aranis Das

unread,
Jul 19, 2024, 3:09:37 PM (8 days ago) Jul 19
to Mozzi-users
no. i'm using a max98357. This should work but i still hear nothing.
Mozzi: Mozzi on ESP32-based boards. (sensorium.github.io)
the link above is what i got from the website. I am quite confused on how to approach this. Could you give a brief explanation?
Im guessing I would need to configure to "MOZZI_OUTPUT_I2S_DAC". 

tomco...@live.fr

unread,
Jul 21, 2024, 9:40:37 AM (6 days ago) Jul 21
to Mozzi-users
Hi,
I do not experience with ESP32 but the link you gave is the correct approach normally.
If you are using Mozzi 2, you should add:
#define MOZZI_OUTPUT_I2S_DAC
#define MOZZI_I2S_PIN_BCK ... // (default: 26)
#define MOZZI_I2S_PIN_WS ... // (default: 15)
#define MOZZI_I2S_PIN_DATA ... // (default: 33)

(with the correct pin numbers w/r to how the DAC is connected to the ESP) and this should work.
Reply all
Reply to author
Forward
0 new messages