Using the ESP32 DAC - Voltages, Waveforms & Sounds

  Рет қаралды 76,537

DroneBot Workshop

DroneBot Workshop

Күн бұрын

Oscilloscope Art, Musical Fruit - just a few of the things we’ll build with the ESP32’s built-in DAC (Digital to Analog Converter)!
Article with code: dronebotworkshop.com/esp32-dac
More articles and tutorials: dronebotworkshop.com
Join the conversation on the forum: forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/
One of the lesser known features of the ESP32 is that it has two Digital to Analog Converters, or DAC’s, as part of its architecture. Today we will see how to use them.
The ESP32 DACs are not audio-quality by any means (use I2S for that) but still very useful for producing DC voltages and complex waveforms. We’ll see how they work and how they can be used in three different modes.
We’ll do several experiments using a multimeter, an oscilloscope, and an audio amplifier. If you have the test equipment, you can follow along; everything we are doing today will work on just about any ESP32 module.
After we see how to program the DAC, we'll have a bit of fun with it!
First, we will create some “Oscilloscope Art.” Calling this "art" is a bit of a stretch; it’s an ellipse rotating on the scope screen, but you can use it as the basis of something much more artistic!
Then we will get creative and build a musical instrument that you can also eat for dessert! We’ll use the DAC and touch switch features of the ESP32 to make music with some apples and oranges!
Here is the Table of Contents for today's video:
00:00 - Introduction
01:50 - ESP32 DAC
05:59 - Hookup and DC Voltages
10:14 - Waveform Hookup and Sine Wave (Basic)
13:20 - Waveform using a Table
15:46 - Cosine Wave using a Library
19:59 - Oscilloscope Art
25:09 - Musical Fruit
32:09 - Conclusion
33:43 - Bonus - Mozart!
Hope you enjoy the video! For those who are willing to stick it out until the end, there is a second musical serenade at the conclusion of the video.

Пікірлер: 100
@Dronebotworkshop
@Dronebotworkshop 4 ай бұрын
Hi everyone - It's come to my attention that there has been someone masquerading as myself, responding to some comments here with a link to a Telegram chat to win a prize from me. THIS IS A SCAM, I am not holding a contest, nor do I have a Telegram account. PLEASE DO NOT RESPOND TO THESE MESSAGES!! It's happening on a lot of my videos, I'm taking steps to remove them manually, but as I have 162 videos, it will take some time. If you do run across a suspicious comment, I would appreciate you letting me know at info@dronebotworkshop.com. Thanks! Bill (The real one!)
@collinb5524
@collinb5524 Жыл бұрын
Its always a good day when Bill releases a new video. Hey Bill! Hope you're doing well sir
@frutt5k
@frutt5k Жыл бұрын
He ate his synth
@sobertillnoon
@sobertillnoon Жыл бұрын
The miscommunication line was the funniest thing I had heard all day. Granted my day is less than 2 hours old.
@gepetotube
@gepetotube Жыл бұрын
I'm still amazed by the quality of these videos. As usual, excellent work.
@gpTeacher
@gpTeacher Жыл бұрын
Terrific tutorial! Thanks for the insights to the DAC! Best wishes!
@rjinnh3933
@rjinnh3933 Жыл бұрын
As always, an excellent presentation of hi-value info. The Applesauce comment had me chuckling for several seconds.
@stefano.a
@stefano.a Жыл бұрын
Excellent video. A little note: the speaker (before the use of potentiometer) is always in saturaton, so the emitted sound is that of a sinusoid clipped
@EsotericArctos
@EsotericArctos Жыл бұрын
I hope you had a great "holiday season" and that the new year is being good to you so far. Stay happy and healthy! Look forward to seeing more this year.
@anurasenarathna1703
@anurasenarathna1703 Жыл бұрын
As always, an excellent tutorial video. Thank you very much.
@1_HighDuke
@1_HighDuke Жыл бұрын
Hi Bill, hope you had an excellent holiday season! Thank you for this in depth look at the ESP32 DACs
@tseckwr3783
@tseckwr3783 Жыл бұрын
thanks for putting all the hard work into your presentation.
@youssubernfissi5559
@youssubernfissi5559 Жыл бұрын
What a lucky day, I have been waiting for a new vide,plus I'm interested in the esp32 more than anything these days and I have been looking for a use of it's DAC , so this is by definition the perfect video for me
@electronics.unmessed
@electronics.unmessed Жыл бұрын
Thanks you very much for another great tutorial! Happy 2023 to you and your followers!
@jj74qformerlyjailbreak3
@jj74qformerlyjailbreak3 Жыл бұрын
We’re on the same wavelength today! I’m welcome in your workshop! Just about to fire mine up and play along at home.
@catchulater7483
@catchulater7483 Жыл бұрын
Hope you had a good holiday Bill. Thanks for the new video- very useful.
@alankinsella2948
@alankinsella2948 7 ай бұрын
You are so sweet. Thank you for your outstanding performances.❤
@ethzero
@ethzero Жыл бұрын
Excellent video on the not well exploited DAC feature, thanks!
@kylereed3577
@kylereed3577 Жыл бұрын
Thanks Bill, another great video
@thisoldjeepcj5
@thisoldjeepcj5 Жыл бұрын
Very good one. Informative, educational and entertaining.
@colormaker5070
@colormaker5070 Жыл бұрын
I found your channel and from the few videos I have viewed on ESP32 I am impressed with the easy to follow. I manufacture wireless radio controlled LED fixtures. My goto processor is the PIC and its a great platform but I want to share our technology with the DIY community and the ESP32 looks like a better fit for most DIY. my products use radios, sd card, flash, ram and OLED display all of which I will have to learn to use with the ESP32. Thank you
@sreekumarss
@sreekumarss 10 ай бұрын
@32:07 Informative and joyful at the same time.. keep going Bill.. your videos are amazingly good.. 👏👍😍
@paulblock1367
@paulblock1367 Жыл бұрын
Just one thing, the art forms or patterns on the oscilloscope are called Lisajou Patterns. Look them up online. They were also used for teletype mark/space alignment.
@sandrocavali9810
@sandrocavali9810 3 ай бұрын
amazing channel, here working on music and uCs
@Tony770jr
@Tony770jr Жыл бұрын
Great esp32 dac video!
@inductr
@inductr Жыл бұрын
Today I got "shocked" by the electricity bill - but the same day another Bill video! Thanks!
@warrenking1815
@warrenking1815 Жыл бұрын
Very good video , as usual.
@t1d100
@t1d100 Жыл бұрын
Good information = thank you.
@TheUnofficialMaker
@TheUnofficialMaker Жыл бұрын
very good, love the fruit piano!
@benbil100
@benbil100 Жыл бұрын
Great, really very helpful videos, thank's
@warrenking1815
@warrenking1815 Жыл бұрын
Great video about the esp32 thanks for the information
@akashaadi4533
@akashaadi4533 Жыл бұрын
Superb video 😍
@DeStoreholmskeBaner
@DeStoreholmskeBaner Жыл бұрын
That oscilloscope art makes me creazy. Looking at it, it sometimes turns left and a blink later, it turns right. It makes me crazy!!! :)
@tommieedwardberry
@tommieedwardberry 6 ай бұрын
Very well done
@jaroslawpiotrowski210
@jaroslawpiotrowski210 Жыл бұрын
Nice project!
@armansotude1474
@armansotude1474 Жыл бұрын
Sir, I have been waiting for you ❤
@vincentsteinmetz3726
@vincentsteinmetz3726 Жыл бұрын
very nice présentation ! very well done and cover every aspect.
@OcenaSoft
@OcenaSoft Жыл бұрын
Wow, this is a great video Bill, thanks for the time and energy you put into teaching. The ESP32 is an amazing little board and I love it. Q) have you ever done any work with the maple board? I purchased 20 of them some years back and not much luck with them and my Linux home! Thanks again ❤
@SaucemanSauceman
@SaucemanSauceman Жыл бұрын
New vid! I have some of those boards but have not delved into them yet.
@esmink32
@esmink32 Жыл бұрын
Again an amazing video, I will probably try to make this fruity keyboard myself in the future 😀
@TediumGenius
@TediumGenius Жыл бұрын
Due to a miscommunication the McIntosh were cut from the video LOL! I have a lot of evil musician ideas now! Another great video!!
@oldarchillies163
@oldarchillies163 Жыл бұрын
Good fun, thanks! Now I love fruity music. :)
@retgo
@retgo Жыл бұрын
Good ideas 💡
@tin2001
@tin2001 Жыл бұрын
The DAC on the ESP32 might not be high end audio quality, but I used it just over a year ago to create a little device as a joke for my new electric car.... I stuck the ESP32 inside an old set of USB powered (but analog input) computer speakers, and had it play the old clip from The Simpsons where they saw the electric cars or tomorrow... "Hello. I'm an electric car. I can't go very fast, or very far. And if you drive me, people will think you're gayyyy". Shoved the speakers into the glovebox, ran the USB power cable out to a standard USB phone charger cigarette lighter socket adaptor, and it would play the clip when you start the car up.... Several hours of fiddling with electronics and libraries and stuff for a 20 second joke for when my brother visited for Christmas 🤣
@Firefox991gaming
@Firefox991gaming Жыл бұрын
Commenting for the algorithm, cheers!
@user-xq9li4qx8l
@user-xq9li4qx8l Жыл бұрын
Like this from Kenya
@geethabharathi2019
@geethabharathi2019 Жыл бұрын
hey bill very nice .... god bless u..
@buddhimaamarasinghe9997
@buddhimaamarasinghe9997 Жыл бұрын
Excellent video sir.Thanks you very much for another great tutorial.If possible, make a video on how to make an MPPT solar charger using ESP32. Thanks.
@brianchen1163
@brianchen1163 8 ай бұрын
Fantastic video! Can you do one demonstrating TDM?
@jlucasound
@jlucasound Жыл бұрын
I'll never see my Candy Apple Red Gibson Guitar the same! I'll have to be careful when I am plucking the strings with my teeth! 🤣 🍏🎸 At the end I had my lighter lit and in the air and I was swaying back and forth! Bravo! 🍎🟠 🤘😂
@Yuehanlad
@Yuehanlad 6 ай бұрын
Great video. Can you do a video of how to control the DAC voltage output with a rotary encoder.
@tubeDude48
@tubeDude48 Жыл бұрын
Bill, how about doing a video on the various ESP32's, since it's so confusing on which one to purchase!
@tin2001
@tin2001 Жыл бұрын
Do you mean the chips now that there's different flavours, or do you mean the different types of development boards?
@tubeDude48
@tubeDude48 Жыл бұрын
@@tin2001 - Which chip does what?
@ezzeldin101
@ezzeldin101 Жыл бұрын
we missed you Bill
@venkatyalamati3285
@venkatyalamati3285 6 ай бұрын
Great work as always.... I wish you need to make videos without having even a little amount of tension in your face... Be happy and confident about yourself... Don't try to be 100% perfect... That makes you to be more tensed 😊
@drmosfet
@drmosfet Жыл бұрын
If you ever want to see a mechanical version of a DAC just find a video on how a IBM Selectric Typewriter works, it's the DAC that rotate and tilt's the ball with the letters on it.
@jeremyjedynak
@jeremyjedynak 9 ай бұрын
Great video! You mentioned that a DAC can be used as a digital potentiometer. Where can one find more details on how to do that?
@tpobrienjr
@tpobrienjr Жыл бұрын
Enjoyed the applesauce
@gamingdevils216
@gamingdevils216 Жыл бұрын
Sir please release video on remote sensing using aurduino....means how we can drive motor through remote.......Your videos are very informative sir. LOVE FROM INDIA
@dot_dot_pwn2650
@dot_dot_pwn2650 8 ай бұрын
could you use a microphone as an adc input ,record the outputs from the microphone, and replay it thru the speakers via dac?
@coricorgi2801
@coricorgi2801 Жыл бұрын
At 9:13 into the video, you mention not using an external reference. I was hoping the esp32 would allow that but the datasheet says the reference can only be the power supply voltage. That is regrettable. I was hoping you were right since I need an 8 volt reference. Nice video nonetheless. You put a lot effort into it. It is appreciated!
@bertbrecht7540
@bertbrecht7540 Жыл бұрын
Excellent tutorial on what the ESP32 DAC can do, however, I have been looking everywhere for a way to build a high quality music player without I2S (your I2S video was awesome) considering the ESP32 is the only hobbyist microcontroller with I2S support. They have been building great sounding CD players, for example, since the early 80s and since modern microcontrollers are so much better than what they had available then, there must be a way to do this.
@mc.the_machine
@mc.the_machine Жыл бұрын
The RP2040 also has I2S support with PIO, RE: hobbyist microcontrollers. In fact, you could even do a bunch of channels on one if you wanted to.
@taham6757
@taham6757 Жыл бұрын
so is the fruit project can be done with the development board version of the esp 32 cause i m confused
@NLGeebee
@NLGeebee Жыл бұрын
Ironically, no Adafruit libraries were used in the DroneBot Workshop Orchestra project ;)
@omnianti0
@omnianti0 Жыл бұрын
is possible the dac was destroyed or something interfere because i canot more get variable output using dacwrite(17,150); strangely it randomly vary from 3.4v to 4v instead of 3.3v i tryed to get a 1.450V for adc potentiometer as recommanded for best accuracy
@fnot804
@fnot804 Жыл бұрын
Funny, I was just thinking about using esp32 for vinyl player repairs.
@summerfun6114
@summerfun6114 Жыл бұрын
good job! my compiling for ESP32 S3 got ERROR: undefined reference to `dacWrite' , how can fix that? thanks.
@mhavock
@mhavock Жыл бұрын
Orange you glad you watched this video? He took a byte out of his project! That was a real Apple computer! 🤣🤣🤣
@Pippo.Langstrumpf
@Pippo.Langstrumpf Жыл бұрын
Haven't heard from Music by Moose-Art before.
@thang19o9
@thang19o9 Жыл бұрын
I have a question. Does the Musical Fruits also need an oscilloscope? Thanks!
@shakuntalaharnale8110
@shakuntalaharnale8110 27 күн бұрын
At 12:13 What is the logic behind the int value of 128 + 64*sin(deg*(pi/180)). I mean what is the significance of 128 and 64? Is 128 the base value of sine wave and 128+64 the max value. So 64 is the amplitude. If that is the case can we not start at 0?
@IceMetalPunk
@IceMetalPunk Жыл бұрын
Interesting how when you play the sinusoidal waves through the speaker in the first experiments, it still sounds sawtoothy. Is that a limitation of the speaker, the amp, or the signal generated from the ESP32?
@TheOleHermit
@TheOleHermit Жыл бұрын
Yes. Sounds to me as though it is clipping.
@gunaseelamanikandanv2319
@gunaseelamanikandanv2319 Жыл бұрын
HI SIR WE NEED TO HAVE OUTPUT OF 2 DAC OUTPUT TO ACTIVATE 25 &26 PIN OF ESP32 TO PLAY THE TWO DIFF AUDIO SIGNALS PLEASE HELP ME IN THIS SEGANEL
@AJB2K3
@AJB2K3 4 ай бұрын
Musical fruit and no baked beans!
@deveshshevde-cp8xq
@deveshshevde-cp8xq Жыл бұрын
SIR PLS MAKE A VIDEO ON AS5600 MAGNETIC ENCODER WITHOUT USING THE LIBRARY
@BlondieSL
@BlondieSL Жыл бұрын
Hmmmm.... As I watched this and got to the sine wave experiment, I wondered if an ESP32 could be used to convert a "modified sine wave" inverter (12V to 120VAC) to a "Pure sine wave" inverter (12V to 120VAC) I've seen some videos of this conversion, but they've usually built a circuit to produce a true sine wave. For those who are unfamiliar with inverters, they come in 2 types (basically). A "modified" sine and pure sine wave. The "Modified" sine is actually a very messy square wave that tries to appear like a stair step square wave. The Pure sine wave inverter produces a very stable, solid and true sine wave. This is what one needs to power most equipment. Sadly, many if not most people get fooled by "modified sine" thinking that it's a sine wave and ok for sensitive equipment. IT IS NOT! So there have been those out there who have come up with modifications to these cheap ModSine devices to remove the garbage wave generator and replace it with a pure, proper, 60Hz sine wave. So now, seeing this ESP32 in action and producing such a clean sine wave, I wonder how difficult it would be to use these to mod one of those inverters. I have several inverters. My 2 main ones are pure sine, while one that I keep in the car for emergencies, is a modified sine. I actually don't use it due to the damage it can cause to electronics. Hmmm...
@lokergames7058
@lokergames7058 Жыл бұрын
cool one question( Now) background music i hear so many in youtube. i notice different. with your voice. NOw now now XD software? where come from.
@lokergames7058
@lokergames7058 Жыл бұрын
Gpo pin how work over 20 to 30 . which object can swap in apple? bio cell and electron mate sensor or fiber can touch?
@chitlitlah
@chitlitlah Жыл бұрын
I stopped playing piano because I always get hungry after a session. Now I know I just need to trade in the Yamaha for a Granny Smith.
@dvhx
@dvhx Жыл бұрын
DAC doesn't work when wifi is on (at least on my esp32-cam)
@MahBor
@MahBor Жыл бұрын
Where's DB1? We miss her :(
@JosSSMr
@JosSSMr Жыл бұрын
…and eat at last, hahaha
@dhultgren1
@dhultgren1 Жыл бұрын
Probably could have used beans for the "Musical Fruit" segment 🤭
@Ajaykrishna97_
@Ajaykrishna97_ Жыл бұрын
13:00 at 86hz it sounds like a trimmer 🤣. If anyone wants to simulate trimmer sound just play a sine wave at 86 hz.
@mikejones-vd3fg
@mikejones-vd3fg Жыл бұрын
mmm edible instrument
@labandrick9240
@labandrick9240 Жыл бұрын
Third 🥉
@d.athegreat3947
@d.athegreat3947 Жыл бұрын
Second
@BwsboyPlayGames
@BwsboyPlayGames Жыл бұрын
First 😀
@kellydon2294
@kellydon2294 Жыл бұрын
I see you removed part of my comment so I removed the entire thing and unsubscribed.... all the info I need is on the website I linked to so I won't be needing the help of your haphazard videos after all.
@procactus9109
@procactus9109 Жыл бұрын
Omg, still using that embarrassing music
@chrisw1462
@chrisw1462 Жыл бұрын
Synchronous. Sin-kron-us. There is no 'i' or 'i' sound in there.
ESP32 Sound - Working with I2S
46:04
DroneBot Workshop
Рет қаралды 316 М.
ESP32 Audio: I2S & Built-In DACs Explained
6:06
atomic14
Рет қаралды 43 М.
Заметили?
00:11
Double Bubble
Рет қаралды 3,6 МЛН
В ДЕТСТВЕ СТРОИШЬ ДОМ ПОД СТОЛОМ
00:17
SIDELNIKOVVV
Рет қаралды 3,8 МЛН
ВЫКИНУЛА МОЙ АЙФОН?? #shorts
00:33
Паша Осадчий
Рет қаралды 2,2 МЛН
Op-Amps  - Using Operational Amplifiers
44:21
DroneBot Workshop
Рет қаралды 268 М.
Play MP3 Files on ESP32 Without Codec Chip: Easy Guide
8:51
atomic14
Рет қаралды 79 М.
Building a Digital Music Player with I2S?! What is I2S! EB#45
10:24
#419 ESP32 Audio Tutorial with lots of examples
13:48
Andreas Spiess
Рет қаралды 229 М.
ESP32 Guide 2024 | Choosing and Using an ESP32 Board
41:06
DroneBot Workshop
Рет қаралды 232 М.
ESP-NOW - Peer to Peer ESP32 Network
43:02
DroneBot Workshop
Рет қаралды 336 М.
ESP32 DAC: generate high frequency waveform outputs (up to 100kHz)
8:59
Philip Giacalone
Рет қаралды 1,8 М.
XIAO ESP32S3 Sense - Tiny ESP32 Camera
45:28
DroneBot Workshop
Рет қаралды 70 М.
06 Wave form ( Sine wave, Square, Triangular and sawtooth wave form) generate  with ESP32 DAC
5:46
Diodes  - A Practical Guide
40:10
DroneBot Workshop
Рет қаралды 28 М.
APRENDA operar com mais SEGURANÇA
0:12
Wall Street Invest
Рет қаралды 15 МЛН
Yellov Diet 💛
0:41
Sushi Monsters
Рет қаралды 2,8 МЛН
Мужик вырастил огромный КЕДР, который всем мешает
0:17
Собиратель новостей
Рет қаралды 14 МЛН
Нашли ЗОЛОТО в МЕШКЕ с РИСОМ 😱 #shorts
0:59
Лаборатория Разрушителя
Рет қаралды 2,5 МЛН
Подкожные Импланты 🤯
0:23
MovieLuvsky
Рет қаралды 2 МЛН
Quick Wire Twisting Tool ##❗️❗️
0:13
ToolBox Talk 20
Рет қаралды 5 МЛН