how does UART work??? (explained clearly)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm gonna explain to you a little bit about serial communication specifically something called you art so UART UART as an acronym for Universal asynchronous receiver and transmitter but people just call it UART for obvious reasons right so why would you use serial communication or UART this is what allows you to have two devices perhaps two computers or I'll show you my setup in a little while that want to communicate some data back and forth and this is done over wires so it's important to know you are is not like Wi-Fi you don't send it over the air so specifically here I have an Arduino Uno that I'm using for this demonstration and there's three wires coming off of the Arduino Uno and so one wire that you pretty much always have and any type of communication is the ground wire this is just there for keeping both devices at the same reference voltage so I'm gonna redraw these two devices except I'm gonna put the wires between them now so here's device one here is device two and we can call this this is the Arduino and the other one is a laptop cuz that's what I've done alright so I said there's three pins the first pin or the first wire that's connecting is ground which abbreviate G and D the second one is th it's called TX which is short for transmission but it's actually not TX the whole way across because on the laptop side it's actually called Rx for receiving or reception and they're connected together so basically what this means is the pin on the Arduino that's transmitting will be received that data is received by the laptop so in order for the laptop to send data back like in our diagram it's the exact same thing except going the other way rx TX to rx on the Arduino now of course you'll see on the actual Arduino there's a USB cable which is a little bit different than you are but before it gets to the USB it actually is starting out as UART before it goes into this chip here that converts it into USB data which yeah that's that's a different topic but essentially this is happening except somewhere in between the Arduino and the laptop there is a USB chip that's converting it but that's out of the scope of this video so how does you are actually transmit and receive data what is data well it it's binary that's how computers like to communicate and like to think so binary is ones and zeroes in this case you think of on and off if we have a wire that can be in two states the Arduino runs on about 5 volts so I'm gonna make this diagram like this I'm just going to draw two lines and then I'm gonna draw I say if I draw a graph that goes between these two lines that goes up to five and then down to zero and then up to five this is just representing what the voltage is doing going from 0 to 5 volts ok so just keep that in mind as I draw some of these and show the pins turning on and off ok so what does it look like whenever we want to transmit some data we'll start with something simple to transmit as our message the character capital o now I'm using the character capital o because it's pretty easy to pick out visually what the binary looks like and that's because it's code is 0 1 0 0 1 1 1 1 ok so it has 4 group has a group of 4 ones which is going to make it easy for us to see this happening when we take a look at the second part of the demo I'm going to have on an oscilloscope so we want to transmit this thing so we're gonna start I'm gonna do my zero to five thing the Arduino pin is going to actually start out at five volts and then it's gonna drop down to zero for an instant that's called your start condition whenever that happens five volts 0 and now anything that happens after this is data coming through and then if we were for example transmitting this you always start from the right side and then work your way to the left so it would be four ones and so we start but then how do we actually tell it that it's four ones in a row what's gonna end up just being one extra long period of time up here at five volts and the reason that that is because something called baud rate and baud rate is another term for that would be bit rate but it's how quickly both devices are sending and receiving the bits so a practical example 9600 baud rate means 1600 bits per second what that means is every nine thousand six hundredths of a second the receiving device is going to check this transmitted pin and see if it's zero volts or 5 volts so it's actually going to check it four times during this period and the Arduino that's transmitting it knows this and so it's going to hold the this pin at 5 volts until 4 9600 of a second have passed or basically it holds it high for 4 cycles you might call it and let's finish this out so we have 1 2 zeros so we can draw our imaginary dotted line there after a cycle has passed back up to 5 volts for that guy there and then back to zero for our final one and then to finish everything off go back to 5 and it stays like that so this would transmit the character oh so now I'm going to show you a live example of this on the oscilloscope so yeah this Arduino here is transmitting the character oh and you can look at the screen here and we can see this is our start condition this is 5 volts down to 0 and then you imagine you daunted lines in there it's like four thick one two three four and then backed down to zero one two a little bit wider and then back up to five volts for just one cycle and then back down to zero for the final bit back to five that's our end condition and there you have it the letter O so I hope that helps to kind of demystify you art hope you learned something thanks for watching
Info
Channel: Continuous Load
Views: 175,256
Rating: 4.7691088 out of 5
Keywords: uart explanation, explain uart communication protocol, uart communication explained, explain uart in detail, explanation of uart, explain uart with diagram, uart tutorial, uart tutorial arduino, usart tutorial arduino
Id: V6m2skVlsQI
Channel Id: undefined
Length: 10min 51sec (651 seconds)
Published: Fri Sep 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.