ESP32 I2S Internet Radio. Full Tutorial & explanation of I2S. For PCM5102 & MAX98357A I2S Decoders.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to historical in this full tutorial we're going to look at as where this and how to create an internet radio using just an sp30 and a square this decoder and a speaker you can hear it in the background if I turn open the lips I'm going to put tunes as well as chips and Mac's 93,000 is PCM 5.0 to grow titles is that it this video is longest around 24 minutes of your convenience there are some time cause on screen now you got to jump to the section you want or have also put some time chords in the description below lastly long I squared s stands for inter I see sound I would develop back in the mid eighties by affiliate semiconductor it used unique a digital audio data between integrated circuits if you see my videos on producing digital sign from ESP 32 or just know how it works anyway then you'll know that raw digital sound is stored as a number which represents the amplitude of a sound wave at that point so for example if we have a single byte a bit holding our amplitude value we can have any value between 0 and 255 in fact as waveforms can be both positive and negative this value actually represents a value to a minus 128 and plus 1 to 7 this is a single sample of the waveform at that point in time by having tens of thousands or more of these samples we can in fact build up the full waveform representing the sound this digital data is sent to a digital to analog converter or DAC for short and this special chip or circuitry converts it back into a voltage again it is sent as you can see as eight bits or a byte at a time and many many bytes are sent per second to give a reasonable silent this is how Mike de corredor library works on the SP 32 it has a built in duck and I simply on the careful time and of course send the bytes of same data to the duck and the unlock waveform comes out on one of its special pins eight bits or a byte is not very high fidelity saying though it's a little coarse lacking resolution we need to move up to 16 24 or 32 bits and to three or four bytes per sample if you want more quality same rendition the SP 32 is not careful by default of these higher values back in the day it was realized that for excess or say needed to bags to give something that was reasonable and this was for use in CDs primarily in addition the number of these individual samples required per second was set to 44100 per second or force 44100 hertz 44 put 1 kilohertz they needed his death to get from a circuit reading a CD to the DAX which are producing the initial same day pods each of those 16 bits will need its own track to the DAC the duck itself will need a minimum of 16 pins just for the import data as well all this costs money and adds complication to the circuit of design so it was decided to send this data down one wire serially along with a couple of control lines keeping synchronized to a special DAC decoding chip so to keep things simple I'm going to omit the two main control ng quietly to keep things synchronized and we'll just pretend that sync it just stood automatically 16-bit data is ready for a pause it's sent one bit at a time down the line to a special I squared s D chord shape this reassembles the data and outputs the analog value it represents on - it's a poop in it then aways the next value but I hear you cry you did did you what about the stereo sound well of course Philips thought of that too and the specification includes details on how that is achieved we basically send first one channel for example left and then the second channel 16 bits of data for one channel followed by sixteen bits of data for the over the decoder chip happily sauce this out into two outputs one for left I want right it knows which ton of data is present by the use of those special extra control lines that we omitted for simplicity for a demo of a squared s we are going to use internet radio what's that I hear you ask you may say I didn't ask it and I would say that for the purposely soon-to-come brief explanation you did internet radio is where audio is streamed over the Internet similar in the I squared s or sometimes referred to as PCM format as those two lots of 16 bits one for the left channel and one for the right quite often these audio streams are rebroadcast of traditional radio stations hence the term internet radio but it can be any audio that is streamed in real time across the Internet with just our simple decoder chips and access to the Internet we can get this audio back out into the real world from its digital stream what's the difference between these two chips the PCM five one or two is a stereo decoder and we'll take the stereo stream and output it as an analog audio signal on these two pins here womper left want to write but it's not capable of driving a speaker directly and so you need to pull an amplifier just here or just use the provided 3.5 millimeter jack plug for earphones the MUX 1935 seven air is a mono decoder ie cannot output stereo sound but crucially it includes an audio amplifier and so can drive as long as a form speaker and up to three was directly so what's the point of a modern recorder who wants mono sound losses that's who but hold on there the designers thoughts of that these chips can be used in tandem to produce stereo sound you can feed two with the same stream set one to output the left channel and want to I put the right and hey presto stereo Billy if you really are a loser then you can actually set one of these to mix the stereo stream down to just mono and I put both channels out of the same one speaker okay this mailer complex but it's not these wires here are for the other mono chip that we're going to show the wine for shortly when you're interested in these buyers here as you can see connected to the chip they all use the same I squared s boss which is why they connect here make sure you connect up your power and ground rails this capacitor here is just to solve a problem with some of the duet boards link in the top corner if you're interested now getting both these chips where gods look at actually working was challenging for various reasons the documentation I found either emitted crucial information wasn't clear or is just wrong if you want exactly as I've shown it's here and do two libraries I will be showing you then you should have no problems starting at the top and working down get the VCC and the 3.3 volts to your power rail and grind to ground FLT DMP SEL to remain unconnected bck the yellow line is the bit clock the main clock for sync in the data connect this to pin 27 GI n or tin the blue wire is the serial data for the science even remember if you watch the equation of a squared s it will be sixteen bits one channel followed by sixteen bits for the other connect it to pin 25 lck the green wire is the left/right clock a very crucial control wire that allows the chip to nor whether the current data is for the left channel or the right connect that to pin 26 next we have some pins that control functions of the PCM 500 or - FM t is the data format we walk went in detail but we connected to ground to pollute law to use the I squared s data format XM t is a mute control but lost mute high for getting sang out obviously we've kept it too high otherwise we won't hear anything but you could connect this to a switch for Hardware control of the outputs or to the output pin of the SP 32 first software control mute I'm going to cover the wiring of the max nine eight three five seven ere next user fast-forward or look at the time code on screen now to jump to that part coming the libraries if you want taps they miss out the nine eight three five seven description if you've watched the wiring of the PCM five-10 - you'll know that these wires here are for that chick I've left it mean so I can easily pop both boards in and out to demonstrate them both make sure you kept up your power and ground rails this capacitor here is just to solve a problem with some of these do it boards link in the description below one thing to note with these particular boards is that the output pins for speaker are not a standard pitch they won't fit into a standard breadboard so when you are soldering the pins onto these you want to make sure that they are soldered to face upwards and just connect some DuPont wires onto them for your speaker or you could solve some screw terminals on there from top to bottom the green wire is a left right clock a very crucial control wire that allows a chip to know whether the current date is for the left channel or the right connect it to pin 26 bck the yellow wire is the bit o'clock the main clock for syncing the data click this it's a pin 27 CIN the blue wire is the serial data for the signs if you remember if you watch the expression of a squared s it will be 16 bits for one channel followed by 16 bits for the other connect it to pin 25 next is the game this says how much amplification the chick is by default you can change the overall volume in the software to we'll show you that later the oceans for this pin are on screen now these are from the official spark from website and they are wrong leaving the pin unconnected will cause you as you can see in the table that's an option will cause you not end of problems with the iPod seriously don't do it connect it in any one of the other ways Shawn but for goodness sake do not leave it unconnected can I say this anymore I mean this is electronics 101 do not leave import pins floating and I don't know what's going on here perhaps the board was changed after this documentation or not designed with some sorts of pull-up pulldown resistor whatever but don't leave it as it is it gave me no end of headaches because obviously I kept checking the wiring it was perfect it was right I was correct according to the documentation but I was having some real problems so I've connected it to grain but it gives again of 12 decibels next is s T stands for shutdown pull or to shut down the chip kind of like a mute left when connected is fine for this one so I guess it pulls high or something on the board if you have problems try pulling it high but I had none leaving it unconnected and then we've got the usual ground and VCC connect top your speaker to these two pins any speaker as low as four arms will be fine and it should be able to handle around three watts of power this setup will mix poor stereo channels together to give you mono sound I'll explain how to get stereo sound out of these a little later okay [Music] libraries then usually I just gave up the tools i'ma go manage libraries and we'd actually get the live in install it from the actual Arduino library manager however at the time of videoing this this library that I would use is not available on the library's major so I would have to do a little bit more of a manual way way so if you go to this website here on github and I say a website I mean that's a good hope for this project page and you can say even if you just type in that into google that should find you to this page and this is the library we're going to use for a squared s it says usually somewhere that its player mp3 files from this TV as well as which it can do I am NOT going to demo that today we are looking at just internet radio and in fact the example that they show in the readme file is all about internet video so to get hold of this library we click porno gang Lord and we'll just click download zip and when that's done go back to our Arduino and then we'll go to tools sorry sketch include library add zip library now I have already got this in store but I'll take you through the process of what you would do to get it installed and then you go to your downloads your dangles go on your machine there it is you double click that and that would install it into the Arduino IDE but I'm not going to do that because as I said I've already got it installed with that installed I'm gonna show you another example that I've done that is based heavily on the example in the readme file I've just actually stripped out things that you don't need just to keep a little bit shorter you'll find this on my website and you could use the one in the readme file but it's a little bit more complex in my example as well I've actually set to talk to actually play from a British radio station English as my foreign language ability is not good but you'll find I think most of these are possibly German I think I think I listened to one that was definitely German but you can see you'll get a selection and I'll leave that selection in on this on my website oh I just realized that once a week and there was an extra on that had got moved you've got a selector you could choose from I need to do to listen to on is just to commentate the appropriate line so if you wanted to swap it for the one I've got to comment that out and maybe comment that eating or whatever anybody make a comment and then you quit the out and you'll be able to listen to that one but I'm going to go back to the english-speaking one and these streams these internet radio streams are over all over the Internet I think I just typed see nothing for mine the capital F Emma is here in the UK I think I just tap that Younce trainer and I find a website or something that had that address on it I just need to pop in there simple dimples in the main loop I mean that is it to be honest that is all you need to do you can see that I blurred out this part here because you need to put your on SSI and password in there obviously not mine - don't want to reveal for the entire internet and then down in the loop all that's doing is printed out the information of the current song core whatever's happening in the radio station so I've already uploaded that I'll plug it in and we'll have a look at what we get out on the serial monitor and what we can act on the radio now I will be filtering this or I will you start recording this bit when there is not musical music on because obviously I don't want to get any copyright strikes so as you can see I'm shooting it's a little bit rough already on my kitchen table or do apologize for that it's all going it's all working I can't hear anything because we need to get some sort of speaker on here which if he wants you to speaker on this particular one so it's not the camera on this particular one we'd have to put in this one sort of audio amplifier for the left and right channels coming out and this is a PM 8 403 amplifier which you could add on there and Alison speaks on if you want to this demo I'm just going to plug in headphones when we pop them in and we'll just have a quick look and see what is playing so we're going to tools and serial monitor as tell us a song that's currently playing I can have a quick listen on my earphones as well to us put it and it's good boys PC for half and the moment it's actually not actually playing on my headphones I'll just give it a quick reboot there we go he's now playing on my earphones I can see all the information like the radio station on there now if I was to put these earphones to the microphone you would be able to hear this so I'm going to pause recording name I'll let us wait for some talking to come on and there it goes actually conveniently letting the official big sexy tape so there you go you can hear very good quality and that's the audio streaming from like a so we'll stop on that their time away from the microphone and that will actually move on to demoing the max nine eight three five seven a mono a squared s decoder and then if just was a demo for the PCM five one or two you'll see that I've still got it set up and in fact I could plug it in are not be able to listen to it on these ear forms if you've watched all the video you'll realize that I said when I was buying these up this is just the actual boss the I squared s Bostick we're running through so it goes through this chip and then I also fed it on here for when I was doing the wiring for the max nine eight three five seven eight all I need to do this demo stuff wears the same I've just uploaded on the demo for this not changed anything so worden still played all I need to do to get this working put that into the same boss so I'll just take out off the power or I do that and just plot that in there it's now connected that I square this boss with all the proper control and power lines it needed let's play our speaker in and we should get some sign that now if there is music on this and we'll be muting it just to avoid any copyright issues a map but you listen to a very quick half a second assault and then I'll bring it back on when there is some actual speaking some just voice although if you have an evil them of the following symptoms the high-temperature the new continuous curve loss of taste or smell you can now get tested do not leave home for any reason other than to get tested so the next thing we're gonna look at is how we can get stereo sound out of this chip at the moment by default when you buy them set up in sparked form they come set up as mono so we need to add another one in and it's a really simple process but there is some alterations you need to do on the other side of the board to actually get them do stereo so I'll come with that next okay to make stereo out of these or just one plug this for now but don't need that I'm not talking about that one we've got our a squared a square this Bulls coming right along here to this chip that's always doing I don't what's complicated that's gotta the chip was intercepting that bus there as well but the boss a squared comes right on here and this is our entire set up just here for this chip ignoring all these carbons here so if I study Albany to and it's got the things you need to do so I'll turn it over and I'll cut toys still of this board now you can see that if this connection is connected then it's going to be mono you can see there's a trace going from that side to that side so it is set to Mono at the moment so what we need to just get ASCAP and through that and cut that but looking up here you also need to select which one whether it's going to them play left or right so if you sold in the middle pin to the L cross that way you'll become the left channel then we saw the middle pin to the right oh they come the right channel so I'll go off and do those alterations and I'll have a girl okay so this is powered up or working on stereo this positive speakers again do let the close of the sound down it is much better looking here on these feats in the background just to prove it stereo I want to plug one speaker still got sound and put that one Nam put that one back in and sang that song okay so that's it for this episode in quite one get so bit hot with a full detail of everything your nails to get internet where you're working and an explanation what a squared s is and how you may be able to use it yeah song came on just as I was finishing off but you liked the video appreciate the like on the video subscribe if you're not already subscribe you like see more and thank you very much my patrons and thank you very much for watching til next time hope you manage to stare till the end [Music]
Info
Channel: XTronical
Views: 30,907
Rating: undefined out of 5
Keywords:
Id: 3ao87AgZ7Bc
Channel Id: undefined
Length: 24min 28sec (1468 seconds)
Published: Sat May 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.