Electronics > Beginners

Ran out of DACs - need ideas producing audio output from MCU

<< < (3/3)


--- Quote from: james_s on October 18, 2021, 10:36:15 pm ---Seems a bit silly to use a 555 if you've got a microcontroller. A digital pin on the micro can do pretty much anything a 555 can. On FPGAs I typically use a delta-sigma DAC but I don't know if that's feasible on a microcontroller.

--- End quote ---

Yes and no. It would free up the MCU from having to loop/interrupt while updating a screen at 10-20FPS, and instead I would just have an "enable" digital pin that would turn on/off sound.  But yeah, it's a bit simple and not what I really want.


--- Quote from: bitman on October 19, 2021, 04:46:44 pm ---
--- Quote from: ve7xen on October 18, 2021, 10:49:04 pm ---ESP32 has hardware PWM? I would use that.

HUB75 also seems to be a purely digital device so it likely wouldn't be hard to move it to other pins.

--- End quote ---

That's what I'm coming to too - the only drawback is that I would need to customize a "standard library" but that's not a biggie. I'll update here once I've done some testing.  That said, the onboard DACs may not really be an option if they are 8 bit only (according to specs they are).

--- End quote ---

8-bit is fine for basic sound effects; at least considerably better than the square wave that you were considering.

I believe the PWM peripheral offers up to 16-bit, but resolution will trade off against PWM frequency (which is typically the peripheral clock / <2^BIT_DEPTH>), and you probably don't have a fast enough clock available to run it at 20KHz. But maybe you can get 12-bit @ ~20KHz (80MHz / 2^12 = 19531) which should give you something like 8KHz of audio bandwidth depending on your filters etc.

If you want 'high fidelity' you will need a dedicated audio DAC. Either of the above options is probably fine for the use case you're describing though.

I've read that the ESP32 supports I2S (with DMA), so maybe you could use that and a I2S amp, e.g.:


Another option if you want something simple and versatile is one of those ICs that can play back digitized sounds. I think some of them will play MP3 or WAV files right off a SD card and they are controllable via a simple interface. Then you can use whatever sounds you want, and update them easily at any time.


[0] Message Index

[*] Previous page

There was an error while thanking
Go to full version