Тёмный

We don't need a DAC - ESP32 PDM Audio 

atomic14
Подписаться 44 тыс.
Просмотров 11 тыс.
50% 1

The ESP32-S3 doesn't have a DAC - that's no problem for us! Thanks to PCBWay www.PCBWay.com/?from=atomic for sponsoring the channel.
I've been using I2S to output PCM data to an amplifier - but recently I've been using a board that only has a buzzer. Can we get audio to come out of it? Of course we can!
Sample code is here: github.com/atomic14/esp32-pdm...
---
If you'd like to help support the channel and help me buy more nonsense - I have a Patreon page: / atomic14
We've also got a shop now! shop.atomic14.com
And if you're shopping on AliExpress or Amazon then if you click on these links I will get a little bit of affiliate money:
Aliexpress - s.click.aliexpress.com/e/_Ac05mF
Amazon - www.amazon.com/?tag=atomic14-20
You can also join us on Discord here: / discord
There's also the Atomic14 newsletter here: atomic14.substack.com/
And don't forget about the MakerNews newsletter - makernews.substack.com/

Наука

Опубликовано:

 

3 янв 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 55   
@atomic14
@atomic14 5 месяцев назад
If you'd like to help support the channel and help me buy more nonsense - I have a Patreon page: www.patreon.com/atomic14 We've also got a shop now! shop.atomic14.com And if you're shopping on AliExpress or Amazon then if you click on these links I will get a little bit of affiliate money: Aliexpress - s.click.aliexpress.com/e/_Ac05mF Amazon - www.amazon.com/?tag=atomic14-20 You can also join us on Discord here: discord.gg/h2DDnDdjD2 There's also the Atomic14 newsletter here: atomic14.substack.com/ And don't forget about the MakerNews newsletter - makernews.substack.com/
@devcybiko
@devcybiko 5 месяцев назад
Wow... another stunning video. I had known about PWM but PDM is news to me. Looks like I've got some light reading to do before bed tonight. Thanks for this - continued Success!
@atomic14
@atomic14 5 месяцев назад
Thanks! Hopefully the code on GitHub is understandable. It was knocked together pretty quickly.
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 5 месяцев назад
Uxed to use this in the 80's in small audio warning devices, if I remember correctly there was a chip that took the one bit serial stream and produced an audio output. You could get a longer message in the small capacity eproms available at the time, no micro controllers about then.
@atomic14
@atomic14 5 месяцев назад
Reminded me of the old 8 bit comouter crappy speakers. The things people managed to get out of them was quite impressive.
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 5 месяцев назад
there was a program on the PET that played polyphonic music on one gpio pin. was very impressive for the time. one day i'll look through all my disc's and see if i've still got it.
@atomic14
@atomic14 5 месяцев назад
@@TheEmbeddedHobbyist I still remember being amazed by the Manic Miner intro screen on the ZX Spectrum. Compared to what I could do with the BEEP command it was incredible.
@any123-og
@any123-og 3 месяца назад
Are you talking about a CVSD Modulator chip?
@TheEmbeddedHobbyist
@TheEmbeddedHobbyist 3 месяца назад
@@any123-og delta sigma rings a bell. it's been a long time. but i still have a board somewhere, if i find it i'll see what the chip was.
@azyfloof
@azyfloof 5 месяцев назад
Class D amplifiers do something very similar to this :D I've used this technique too with an LCD screen and an Arduino Uno to adjust the contrast. It's very handy :D
@atomic14
@atomic14 5 месяцев назад
Yeah, it's very similar to what Class D amplifiers do which is why you can just drive a speaker directly from a PDM signal (with the right driver of course!)
@karaniii
@karaniii 3 месяца назад
I have a question on this, If I use a class D amplifier on a pwm signal will it be able to drive a speaker?
@_xano
@_xano 5 месяцев назад
It still is a DAC, in final result u have analog signal reconstructed from digital code. There is whole branch of audio equipment which use 1bit sampling, it is commonly known as DSD. Sony and Philips used it for Super Audio CD, sample rates are around 2,5 to 6 MHz. There are even digital audio mixing consoles that use DSD, but this technology is pretty niche, as its having superior quality to PCM is mostly a marketing mambojambo.
@UnexpectedMaker
@UnexpectedMaker 5 месяцев назад
That's awesome! Yay for not needing a DAC !!!!!
@youssefelbadri4371
@youssefelbadri4371 4 месяца назад
Thank you for sharing this awesome feature. Is it possible to make a video in which you discuss the code implementation? because I find it hard to understand
@NicksStuff
@NicksStuff 5 месяцев назад
That's quite cool! What project do you use it in?
@m1geo
@m1geo 4 месяца назад
Nicely done!
@SebastianKrzyszkowiak
@SebastianKrzyszkowiak 4 месяца назад
Worth noting that since ESP-IDF 5.0 and its new I2S driver you don't have to waste a pin on clock signal if you don't use it, and you can also output stereo PDM channels separately (see the `line_mode` parameter).
@kissingfrogs
@kissingfrogs 5 месяцев назад
Awesome video. thanks for sharing.
@OMNI_INFINITY
@OMNI_INFINITY 3 месяца назад
Thanks for posting that! Confirms something I saw on greatscott channel. So basically. a DAC is essentially a fancy overhyped RC filter?
@jarkkoaitti287
@jarkkoaitti287 4 месяца назад
I used pdm with esp32 few years back in my game project.I had some trouble making it sound nice. Also tried the 8bit DA and was not happy. Finally made things easy for me and used some 2 euro 1 watt i2s amplifier boards from aliexpress.
@DanielSallros
@DanielSallros 5 месяцев назад
Hi, You mention @8:40 that GPIO 45 and 46 can't be used for anything but in the datasheet for the ESP32-S3 on page 23 it explains how these pins together with GPIO 0 and 3 are the strapping pins and that "...the pins are freed up to be used as regular IO pins after reset."
@atomic14
@atomic14 5 месяцев назад
They tend to be disconnected on a lot of boards and designs because the danger of interfering with the boot process is so high.
@OMNI_INFINITY
@OMNI_INFINITY 3 месяца назад
Seems both were connected to same wall outlet, so the shared ground made it function seeminlgy
@rayleon
@rayleon 5 месяцев назад
It sounds very good, thanks.
@atomic14
@atomic14 5 месяцев назад
Thanks - it’s not bad at all. With a better filter than a simple RC you can get even better results.
@teippiviritykset
@teippiviritykset 5 месяцев назад
nice! How do you generate that audio file with audacity? could there be 3 buttons that each play out separate short wav in esp32 ?
@atomic14
@atomic14 5 месяцев назад
I wrote a little python script to simulate PDM and wrote it out as a WAV file - I'll clean it up and put it into the GitHub repo. Playing multiple WAV files should be pretty straight forward. The main limitation is how much you can fit in the SPIFFS filesystem - which will depend on how much flash you have on your module.
@norr2596
@norr2596 4 месяца назад
Great intro to PDM, thanks. What's happened to your microphone signal though? Distorted for most of it, and lots of compression artefacts (warbling) in the closing comments. I thought you were going to reveal it had all gone through the PDM, but I guess it wasn't that?
@atomic14
@atomic14 4 месяца назад
Had all sorts of issues with the recording, lots of variable audio levels that needed fixing. Turned into a complete nightmare. Realised that I'd forgotten to connect my mic a few times.
@TheTurmanDreams
@TheTurmanDreams 5 месяцев назад
Great !!!
@winstonsmith478
@winstonsmith478 5 месяцев назад
What is the software used at 5:32?
@atomic14
@atomic14 5 месяцев назад
It’s a tool called Audacity - it’s a great free tool for dealing with audio files.
@asderiner2468
@asderiner2468 5 месяцев назад
What is theoretical maximum frequency/sample rate for s3's pdm?
@atomic14
@atomic14 5 месяцев назад
I think 48KHz - according to this GitHub issue - github.com/espressif/esp-idf/issues/10420
@edkemp6287
@edkemp6287 5 месяцев назад
Esp32 users have bitbanged 3d animated video signals with audio direct to a uhf tv. Theres also a great basic interpreter for it
@JoshFisher567
@JoshFisher567 5 месяцев назад
The rumour is that the DAC took up a lot of die space and there wasn’t enough room which might explain why the S3 is the fastest ESP32 chip available granted it doesn't have the radios the C6 and H series have. For most use cases PWM or PDM is sufficient. For more complex cases you are probably looking for some very specific performance characteristics and an external IC probably makes more sense. This video just points out that you don't need a DAC on the S3 for an audio use case and can use a discreet RC. You can do the same with the Pi Pico which doesn't have a DAC either.
@james2396
@james2396 5 месяцев назад
I can't listen to this song without thinking of the "Logan you are my hero" cover 🤣
@atomic14
@atomic14 5 месяцев назад
I had to go and search for it didn’t I - and now I can’t get it out of my head!
@AppliedCryogenics
@AppliedCryogenics 5 месяцев назад
I usually use a PWM for this on AVR MCU's, since it also works through a low pass and needs minimal CPU intervention. Does the ESP32 not offer PWM?
@atomic14
@atomic14 5 месяцев назад
Yes, you can do that - but then you’ll need a timer that fires on every sample to get audio output. With this we can use the I2S peripheral and use DMA to send the data out.
@AppliedCryogenics
@AppliedCryogenics 5 месяцев назад
@@atomic14 ahh, I see what you mean. Needing to load new waveform points individually in a timer ISR can be expensive.
@dingus-dingus
@dingus-dingus 5 месяцев назад
Out of the blue a mention of "Delta-Sigma Modulation". What's that. What's that got to do with anything? How does that tie to the video?
@atomic14
@atomic14 5 месяцев назад
Sorry - that should have been more clear. It's how PDM signals can be generated - en.wikipedia.org/wiki/Pulse-density_modulation
@tenlittleindians
@tenlittleindians 5 месяцев назад
Why not just add a separate DAC integrated circuit chip to the design? They are very cheap to buy and take up very little area on a circuit board.
@iluvyunie
@iluvyunie 5 месяцев назад
Thats really cool, considering you could build something thats value far exceeds its worth
@zyxwvutsrqponmlkh
@zyxwvutsrqponmlkh 4 месяца назад
Need a doomsday mesh radio network with voice calls for like $2.50 each. Give it a solar panel but no battery. Hella swag.
@Really2950
@Really2950 5 месяцев назад
Please break out all esp32 pins, even if in use, so others can extend your good work
@piconano
@piconano 5 месяцев назад
Why use the S3 for this application? I would use the I2S on the original ESP32 and use DMA to send the data out. Very interesting tho...
@atomic14
@atomic14 5 месяцев назад
The DAC on the original ESP32 was pretty noisy. In theory with PDM output you can get good quality output.
@piconano
@piconano 5 месяцев назад
@@atomic14 I've never tried it. Thanks for the free knowledge.
@crosswick
@crosswick 5 месяцев назад
Original ESP32 doesn’t have DMA, does it?
@atomic14
@atomic14 5 месяцев назад
@@crosswick I think all the versions have DMA. I've certainly used DMA with I2S on the original ESP32.
@zombockerman
@zombockerman 5 месяцев назад
Ok nerd
Далее
Using the ESP32 DAC - Voltages, Waveforms & Sounds
34:46
ЧТО ЭТО, БРАВЛ СТАРС?!😱
1:40:09
Просмотров 1,7 млн
Flagship DIY DAC by IanCanada. USB I2S Coax. No RPI
37:25
What defines the quality of a DAC?
14:06
Просмотров 30 тыс.
ESP32 Video Over SPI
2:15
Просмотров 8 тыс.
Forget WiFi! This Wireless Method is WAY Better?
12:14
Просмотров 414 тыс.
AM Radio Transmitter on ESP32
6:20
Просмотров 171 тыс.
Try these 16 Brilliant ESP32 projects!!!
11:18
Просмотров 532 тыс.
ESP32 Audio Input Using I2S and Internal ADC
10:43
Просмотров 120 тыс.
Battle of the Zeros
19:44
Просмотров 42 тыс.
КЛИЕНТ СЛОМАЛ НАУШНИКИ ? 😳
0:51
How charged your battery?
0:14
Просмотров 3,6 млн