ESP32 Sound - Working with I2S

Тәжірибелік нұсқаулар және стиль

Build an Internet Radio, an MP3 Player, and display microphone waveforms with an ESP32 and some I2S peripherals. Learn to use the I2S sound protocol with the ESP32.
Article with code: dronebotworkshop.com/esp32-i2s
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/
You might have seen the term “I2S” on the spec sheet for the ESP32 and may have just assumed that it was a form of I2C. Well, you would be mistaken - I2S is a protocol for manipulation of digital audio, and today we will be using it with the ESP32.
After a short primer on I2S and digital audio fundamentals, we will use an I2S microphone module with an ESP32. We’ll display the microphone output as a waveform on the Arduino IDE Serial Plotter.
After that, we will grab a library from GitHub, and we’ll use it to build an MP3 player with an I2S amplifier module. We’ll then use the same library and the ESP32 WiFi to create an Internet Radio.
Finally, we will convert our simple Internet Radio into a stereo device, with a volume control.
Here is what is in today's video:
00:00 - Introduction
01:27 - I2S & Digital Audio Intro
08:25 - I2S Peripherals
10:18 - Using an I2S Microphone
18:37 - I2S MP3 Player
28:31 - Simple I2S Internet Radio
33:41 - Stereo Internet Radio
43:56 - Conclusion
Remember, if you need any of the code used here, you'll find it on the DroneBot Workshop website at dronebotworkshop.com\esp32-i2s.
Hope you enjoy the video!
Bill

Пікірлер: 276

  • @Dronebotworkshop
    @Dronebotworkshop2 жыл бұрын

    WARNING - This video contains a very bright shirt and may be harmful to your eyes! I'll have to remember not to film wearing that one again, sorry, I didn't realize how intense the color was until KZread rendered the video. Otherwise, I hope you enjoy the video! Bill

  • @carelhaasbroek1575

    @carelhaasbroek1575

    2 жыл бұрын

    That shirt is brighter than my future.

  • @sinjhguddu4974

    @sinjhguddu4974

    2 жыл бұрын

    No! The color is great. It brightens up everything.

  • @billmckillip1561

    @billmckillip1561

    2 жыл бұрын

    My wife is in charge of fabric colours around here and says your shirt is good. So there you go.

  • @TheOleHermit

    @TheOleHermit

    2 жыл бұрын

    No problem, Bill. Didn't even notice.😎

  • @AndersJackson

    @AndersJackson

    2 жыл бұрын

    Did notice, but it doesn't change the contents. Which still is of excellent quality and pedagogic, as usual.

  • @usefulelectronics
    @usefulelectronics2 жыл бұрын

    I always wanted to learn about I2S and here is all in one theoretical / practical tutorial !!. Thank you for your awesome work.

  • @yuchoy1
    @yuchoy1 Жыл бұрын

    You are setting the standard for excellence in tutorial videos; on KZread and elsewhere! Well done! The content is very interesting and useful. Thank you so much!

  • @waltermartinez5907
    @waltermartinez59072 жыл бұрын

    Your videos are so excellent! I tought stuff like this for 20years and was losing interest, but after seen the qualty and content of your videos and teaching methods I am back at experimenting. Love it! thanks!

  • @D_isco_D_ancer
    @D_isco_D_ancer Жыл бұрын

    This is an amazing channel. One of the few with thorough explanations for people like me with no background in electronics but eager to learn and hopefully complete some projects.

  • @sinjhguddu4974
    @sinjhguddu49742 жыл бұрын

    WOW! Sir, with this one you simply have over excelled yourself. I have been craving this tutorial. And it covers everything. Thank you and be blessed.

  • @marcdraco2189
    @marcdraco21892 жыл бұрын

    Cool tutorial. Great to hear someone knowledgeable on this weird protocol.

  • @matthewbal1
    @matthewbal1 Жыл бұрын

    Thank you so much for this video, I just spent literally hours trying to navigate the world of I2S libraries to try and get a simple microphone + speaker to work. This video helped so much for the background knowledge and hopefully I'll be able to figure it out now 🙏

  • @fathicoltd6774
    @fathicoltd6774 Жыл бұрын

    You are awesome sir, i am truely honored to find you. Thank u for all of your perfect tutorials. Love from Iran

  • @ivovass195
    @ivovass1952 жыл бұрын

    Excellent explanation and demonstration on the I2S protocol with the esp32. I'm planning to make an Internet radio and this is exactly the detailed information I needed, thank you.

  • @90FF1

    @90FF1

    Жыл бұрын

    Did you build the radio? I did works great. I'm stumped at the volume control. My 'no brand' 38 pin dev board has no pin GP39 nor can I find ADC03 on any of the ESP Vroom 32 pins. Any help here would be appreciated.

  • @Algardraug
    @Algardraug2 жыл бұрын

    You are very pedagogical and yet concise. Very good!

  • @TheUnofficialMaker
    @TheUnofficialMaker2 жыл бұрын

    I really like how you present your projects, I know it's alot of passionate work.

  • @your_utube
    @your_utube2 жыл бұрын

    Thanks for your dedication to sharing your expertise. Really inspiring!

  • @home-lab
    @home-lab2 жыл бұрын

    What a clear en extended explanation of this subject. Thanks !

  • @CTCTraining1
    @CTCTraining12 жыл бұрын

    Excellent bundle of projects - much appreciated, plus thx for the latest newsletter! 👍 Also, testing internet radios is safer (from copyright hits) tuning into talk stations... but we trust you. 😀

  • @rodneytapit5636
    @rodneytapit563629 күн бұрын

    Outstanding tutorial, great section on I2S and common configurations. Describes everything I wanted to know THANK YOU!

  • @tpobrienjr
    @tpobrienjr2 жыл бұрын

    Thanks for a nice compact tutorial on i2s and internet radio.

  • @rhandynastor4866
    @rhandynastor48666 ай бұрын

    what I like about this channel is the very good explaination from theory to actual. Lot to learn from this channel

  • @eto38581
    @eto38581 Жыл бұрын

    Now this is called quality content. Subscribed!

  • @ianbertenshaw4350
    @ianbertenshaw43502 жыл бұрын

    Excellent video Bill! Didn’t notice the shirt until I read your comment ! Copy write does make it difficult to show how well audio projects work , I see a lot of it with vintage radio channels and they don’t seem to have a problem as long as it is very brief - less than 2 seconds and usually they try to stick to stations that only play instrumental stuff like classical .

  • @craigstephenson9036
    @craigstephenson9036 Жыл бұрын

    Thank you for more excellent content. I think this channel is amazing and you have quickly become my go to guy when researching my ideas. I'm currently trying to use both ESP32-CAM and Wrover boards to build CCTV cameras for my home and wondering how to record audio with the video. This tutorial though now has me thinking of how I can add some totally custom sound systems to both my bar and my camper van. Thank you so much.

  • @ernandofranco8448
    @ernandofranco84482 жыл бұрын

    Thank you very much!! You are a good teacher. Thank you for sharing your time and knowledge with everyone!!!

  • @zarigata
    @zarigata2 жыл бұрын

    Awesome idea! As always a super described tutorial and nice explanation

  • @sczygiel
    @sczygiel2 жыл бұрын

    Great video. It covered a lot of what I was looking for! Thank you!

  • @DataJanitor
    @DataJanitor2 жыл бұрын

    Just a note: The wiring diagram for the INMP441 at 13:04 doesn't immediately match the code download on your page: Specifically, GPIO pins 32 and 33 are switched. Easy fix, thanks for the clear explanation.

  • @hatimy

    @hatimy

    3 ай бұрын

    Thankyou...I was disappointed it didn't work the first time but changed the pins and it works great!

  • @inlywang8157
    @inlywang81572 жыл бұрын

    Bill, thanks for your hard working and good sharing, so many details

  • @attyberecz
    @attyberecz2 жыл бұрын

    Very good tutorial, clear and extended explanation of this subject ! Respect !

  • @Podemosllegaralossubs-ty7bq

    @Podemosllegaralossubs-ty7bq

    2 жыл бұрын

    I'm using the Teensy 4.1 as a waveform synthesizer, outputting 5 discrete signals (X, Y, red, green, & blue) to a laser projector. There is a total of 17 waveforms being generated, including 4 * X/Y pairs for the basic image, 2 pairs for AM pulsing, 2 triples for RGB color modulation, and one for intensity modulation.

  • @armansotude1474
    @armansotude14742 жыл бұрын

    Your channel is a treasure for me Thank you

  • @anurasenarathna1703
    @anurasenarathna17032 жыл бұрын

    My favorite area!. Thank you Bill.

  • @hoangleminh2424
    @hoangleminh24242 жыл бұрын

    Thanks DroneBot Workshop for your tutorial

  • @alexxustube
    @alexxustube10 ай бұрын

    Thank you, Bill! Very informative video, as always. 👍🙂

  • @BlondieSL
    @BlondieSL Жыл бұрын

    This was an amazing video! I do have 2 ESP32 modules, each with different pin counts. I haven't even opened them up yet. LOL I will have to get my butt into gear and learn the ESP32. It is so much more powerful than any Arduino board and it seems to be just as easy to use... maybe even easier.

  • @P.A.T.
    @P.A.T.2 жыл бұрын

    You are fantastic! You just opened the door to many ideas for me! Thank you very much!

  • @TheOleHermit

    @TheOleHermit

    2 жыл бұрын

    Yes, same here. Bill; Andrew Spiess, the guy with the Swiss accent; Christopher Barnatt, from Explaining Computers; and others have had the same impact on myself. I'm currently building a laser show system for my living room.😎

  • @deslomeslager
    @deslomeslager2 жыл бұрын

    Thanks for letting me know about 0nradio. It was a very good project, thank you for making a decent video about it!

  • @jimbooth2010
    @jimbooth20102 жыл бұрын

    Very very good video. Great job! Might try to build the internet audio for my grandson.

  • @roycejacobs9682
    @roycejacobs96822 жыл бұрын

    Love the esp 32 content!

  • @andrzejpopowski7745
    @andrzejpopowski77452 жыл бұрын

    You create great videos. Thanks.

  • @garypaulson5202
    @garypaulson52022 жыл бұрын

    Great video Bill! Going to try an internet radio

  • @tscann8
    @tscann82 жыл бұрын

    Very good guide for I2S Thank you

  • @nobuohayashi9431
    @nobuohayashi9431Ай бұрын

    ありがとうございます! こんなに分かりやすい解説に出会って、ラッキーです。

  • @Dronebotworkshop

    @Dronebotworkshop

    Ай бұрын

    Thank You!

  • @heldersantana9145
    @heldersantana91452 жыл бұрын

    Awesome work, thanks for sharing!

  • @ronaldcollins9618
    @ronaldcollins9618 Жыл бұрын

    Watching a few months late. Outstanding tutorial as usual!

  • @flashcorp76
    @flashcorp762 жыл бұрын

    Excellent,as usual 😁👍🏻

  • @rohangupta8414
    @rohangupta84142 жыл бұрын

    Thanks for posting on this topic sir.... I was looking for it 😉😉

  • @AMatroskin
    @AMatroskin Жыл бұрын

    Thank you too much! despite on my low level in English, i have understood nearly 100 percent, really useful video!

  • @mroxidation4854
    @mroxidation48542 жыл бұрын

    clear, concise, thank you!

  • @thomasseverino9351
    @thomasseverino93516 ай бұрын

    Thanks! This is perfect! Your videos are so helpful!

  • @Dronebotworkshop

    @Dronebotworkshop

    6 ай бұрын

    Thank you, glad you found it useful!

  • @user-qz6gf9bn3u
    @user-qz6gf9bn3u2 жыл бұрын

    There is a small mistake at 2:08, I2S works with PCM (pulse code modulation), not pulse width modulation. Love your videos! Thx for this great tutorial.

  • @Sound_Stable

    @Sound_Stable

    2 жыл бұрын

    I immediately went looking for this comment. lol

  • @tezzrexx
    @tezzrexx5 ай бұрын

    Super helpful for my project, thank you!

  • @gepetotube
    @gepetotube2 жыл бұрын

    Great video, ...as always.

  • @md.teacher9413
    @md.teacher94132 жыл бұрын

    I love your work

  • @Really2950
    @Really29502 жыл бұрын

    Great video, thanks

  • @jps99
    @jps99 Жыл бұрын

    Great tutorials, earned my Sub!

  • @user-gm1bv2zm6j
    @user-gm1bv2zm6j Жыл бұрын

    I learned a lot trough this video, thanks so much... You're amazing

  • @partouelectric2353
    @partouelectric2353 Жыл бұрын

    Hi Bill. Thanks for the great video. You teach better than most people. with all due respect to Andreas, your videos are more comprehensive than his. I think his work should not stop you from doing what you do better. I need to learn how to send audio streaming from one ESP to another through Bluetooth. or ESP now, Would you shed some light on this, please? Thanks

  • @nicoladellino8124
    @nicoladellino81242 жыл бұрын

    Very nice video, TNX.

  • @electronic7979
    @electronic79792 жыл бұрын

    Very helpful video 👍

  • @iae32
    @iae32 Жыл бұрын

    Thank you , great video

  • @electronics.tinker
    @electronics.tinker Жыл бұрын

    Thanks for this video. It was helpful. One thing to consider: the Adafruit SD breakout contains a voltage regular to convert 5V to 3.3. You connected the input of this regulator to 3.3V instead of 5V. This (usually?) works because the regulator has a very low voltage drop, but it still has a drop. You will be running the SD card at 3.2 or 3.1V rather than 3.3V. Maybe it is better to connect the SD breakout 5V pin to the ESP32 VIN (5V) rather than the ESP32 3.3V. The SD breakout uses a 4050 hex buffer that is powered from the 3.3V rail. So, it causes the signal outputs to be 3.3V. regardless of the voltage supplied to the SD breakout via its 5V input. This works for 5V systems (e.g. Arduino boards, not ESP32s) because 3.3 is more than 2.5V, and the 4050 tolerates 5V inputs. If for some reason one must drive the SD breakout with 3.3V, I think it would be OK to connect a 3.3 supply to the SD breakout's 3.3V pin. This bypasses the regulator.

  • @vp.3125

    @vp.3125

    3 ай бұрын

    excellent point! Thank you

  • @Bianchi77
    @Bianchi77 Жыл бұрын

    Nice info, thanks for sharing :)

  • @rguifa
    @rguifa2 жыл бұрын

    Awesome channel!

  • @PatnaikUC
    @PatnaikUC2 жыл бұрын

    Excellent explanation as expected. Thanks a lot. Can a robotic project be made using these devices to work on voice commands without depending upon Google home , Alexa and several other 3rd party applications?

  • @gregorymccoy6797
    @gregorymccoy67972 жыл бұрын

    Nice video. I have a bunch of things to try now... 😀

  • @geethabharathi2019
    @geethabharathi2019 Жыл бұрын

    Bill ur awsome .... very well presented....

  • @robrita
    @robrita2 жыл бұрын

    great Tutorial!! 👍👍

  • @rubialugattimoreira1978
    @rubialugattimoreira19782 жыл бұрын

    simply perfect! Tks

  • @gabrielgaby5840
    @gabrielgaby58406 ай бұрын

    Thanks!

  • @TheAstronomyDude
    @TheAstronomyDude11 ай бұрын

    It is absolutely maddening how little you discussed choosing the correct speaker.

  • @applepiede876
    @applepiede8769 ай бұрын

    Wonderful tutorial. Exactly what I needed. Thank you so much. The only thing I don't understand is the fact that you only seem to own one Micro SD card. 🙂

  • @TheOleHermit
    @TheOleHermit2 жыл бұрын

    Great video, Bill! I'm one of those myriad of other I2S users/makers. But, I chose the Teensy 4.1 for my project, because of it's great Audio library, which was forked by Adafruit on github. Thanks to your great explanation, now I understand why the 2 libraries are incompatible, because of different DIN pin assignments. I'm using the Teensy 4.1 as a waveform synthesizer, outputting 5 discrete signals (X, Y, red, green, & blue) to a laser projector. There is a total of 17 waveforms being generated, including 4 * X/Y pairs for the basic image, 2 pairs for AM pulsing, 2 triples for RGB color modulation, and one for intensity modulation. The waveform generators are pushing the galvos to their 1kHz limits and can be mixed between sine, square, or variable sawtooth waveforms. Each of the image generators have envelopes with commonly controlled ADSR to avoid snapping the galvos while changing preset frequencies and/or waveforms. All of these + mixing gains are controllable via usbMIDI from an Akai APC40 MIDI desk, Cakewalk's DAW, and/or Pure Data's GUI on a 22" touchscreen monitor, for additional controls. Speaking as an old Laserium laserist, I can vouch that the Teensy 4.1's audio library is rivaling the capabilities of their show system, for only ~$100 + ~$850 RGB laser projector + ~$250 MIDI controller. IOW, I have a laser show in my living room for ~ the same price as my 5.2 Polk/Denon sound system. That blows away my previous expectations for any MCU. Can't praise PJRC enough for producing such a great range of products, with great documentation, a node red-like GUI audio design tool, and welcoming support forums. Okay, I'm finished with gushing my joy all over everyone. Only wanted to share my I2S experience. If anyone is interested in the details, our pal Dave, on Notes and Volts has great step by step DIY synth tutorials on YT for both the Teensy and Arduino MCUs. kzread.info/head/PL4_gPbvyebyHi4VRZEOG9RKOYq5Hre3a1 😎

  • @hewitt10ish
    @hewitt10ish2 жыл бұрын

    Thanks Bill! Did you have a chance to do the experiments on PlatformIO? Just curious about the stability of the library.

  • @Mingming_Studio
    @Mingming_Studio2 жыл бұрын

    Thank you very much I'm just trying it since 2 weeks ago

  • @gregersn
    @gregersn2 жыл бұрын

    Very informative and interesting video. Wonder if there are any good modules that output line level audio signal, to use with external amplifiers.

  • @batmunkhenkhbaatar9061
    @batmunkhenkhbaatar90619 ай бұрын

    thank you very much

  • @lucienrapilly6407
    @lucienrapilly6407 Жыл бұрын

    Note that some SD card breakout boards do need to be powered with 5v, and have a built-in voltage regulator for 3.3v operation.

  • @manikantaam5967
    @manikantaam59672 жыл бұрын

    Hi, thank you so much for the excellent video. May you please help me by answering the question below. What are the most common real time examples in which SOC is used as Target ( i.e other peripheral is giving SCK and WS signals ). Would you also please mention the devices which can be used as master. Thank you

  • @Jungmin_Seo
    @Jungmin_Seo Жыл бұрын

    Fantastic!

  • @TheDradge
    @TheDradge Жыл бұрын

    My only complaint is your workshop is too neat and tidy and it puts mine to shame. Although, if mine was that tidy I'd never find anything! Keep up the good work.

  • @cloviscareca
    @cloviscareca2 жыл бұрын

    I love you man

  • @marceloap140
    @marceloap140 Жыл бұрын

    Thanks from 🇧🇷

  • @robert574
    @robert5742 жыл бұрын

    Good Job, good job, good job...

  • @joselu90
    @joselu902 жыл бұрын

    Good video. I want to learn how to have an i2s source sending stereo sound to the esp32 and a decoder playing it back using DMA, at the same time.

  • @josphat.Karanja
    @josphat.Karanja2 жыл бұрын

    very good lesson, God bless..........

  • @johnburgess2084
    @johnburgess20845 ай бұрын

    Thanks for the great description of working with audio. It all looks pretty straightforward, but I haven't gotten around to getting any I2S peripherals yet. BTW, I like the looks of those jumper wires you use -- can you tell me where you got them? I also heard about a VS1053 MP3 decoder on another ESP32 channel -- is that similar to what you're using? What are the differences? (It would be handy to have links to the hardware you use accompanying the video.) Thanks!

  • @GiC7
    @GiC72 жыл бұрын

    Thank you.

  • @octopro8937
    @octopro8937Ай бұрын

    Works for me!

  • @KJ7JHN
    @KJ7JHN Жыл бұрын

    Very neat video. Im thinning ill put one of these into an old vintage rca radio. Suggestions on power supply?

  • @Cadmandu2000
    @Cadmandu20002 жыл бұрын

    Since you demonstrated microphone input, and speaker output, one assumes that creating something that will both record and play back sound is possible with an I2S device and the proper modifications, correct? I look forward to playing around with this at some point. It will make a nice addition to my tricorder project.

  • @rommiei
    @rommiei Жыл бұрын

    Great video and useful for my next project. Although my first try failed due to missing PSRAM. My ESP may not have it . Can I tweak the sketch to use available flash for memory buffering?. Thanks

  • @ivanz9324
    @ivanz93247 ай бұрын

    Super video lesson. Thank you so much. So for the next step, would you please try to transfer sound (i2s protocol) by radio? 4 different cases possible: 1)Esp32 has built-in wifi/bt module, so its possible to make kind of walkie-talkie through standard protocol. 2) esp-now 3) external radiomodule (barely lora modules fit for streaming signal, but maybe a short audio messages?) otherwise nrf24l01 are good. 4) through the internet server (existing or just a custom homemade server on orange-pi or etc) Would be very helpful. Thanks!

  • @corkscrewify
    @corkscrewify2 жыл бұрын

    You could use VLC to stream DRM free music from your computer over the network. That'd provide a safe web radio for recording.

  • @TheOleHermit

    @TheOleHermit

    2 жыл бұрын

    Yes, great suggestion. I attempted building a poor man's SONOS multi room sound system, by streaming audio from VLC to RPi 'receivers', with audio HATs. Unfortunately, I was too stupid to figure out how to keep them all in sync. BTW, now I prefer VLC for recording video, but use Audacity for recording audio. Just discovered Animotica for video editing, but not convinced that it is the best free editor. BR😎

  • @the__Ultraviolet
    @the__Ultraviolet Жыл бұрын

    I am somewhat sure that the size argument in i2s_read() function is the size in byte(how many bytes you wish to read) and as you are using 16bit samples the bufferLen should be multiplied by 2 or more correctly sizeof(sBuffer[0]). As you used only the bufferLen only half of sBuffer will be filled with samples.

  • @jj74qformerlyjailbreak3
    @jj74qformerlyjailbreak32 жыл бұрын

    I think your SD card got a 5v shot. But thanks for teaching your know how’s about I2s. As always great Video. God Bless

  • @gabrielgaby5840
    @gabrielgaby58406 ай бұрын

    Happy New Year Bil..❤ All the best with the Projects. Still on my Ard'o R4 Minima Data. Might like some advice on some old technology. Cheers..❤😂 🎄🐻🎄🛍️🔬

  • @destinobaracoa8363
    @destinobaracoa8363 Жыл бұрын

    Hello from Cuba teacher.

  • @arniep740
    @arniep7402 жыл бұрын

    Thanks for this video. Very intriguing. Where do you get the URL's for the music sources? Thanks!

  • @EmreYasinAlbayrak
    @EmreYasinAlbayrak7 ай бұрын

    nice shirt. great contents. I would also like to see a bluetooth speaker project.

  • @dbjindian
    @dbjindian Жыл бұрын

    Pls make complete videos on individual video on ,MP3 player with buttons and internet radio with tune option

  • @markvanhorne3276
    @markvanhorne32762 жыл бұрын

    Looks like the Adafruit stereo board highlighted at 9:46 is discontinued. They have a "replacement" board, but it's not stereo.

  • @hans-dieterjung4026
    @hans-dieterjung40262 жыл бұрын

    Thank you for your awesome work. What abour soundtransfer over WiFi, like remote microphone

Келесі