Raspberry Pi Linux LESSON 25: GPIO Pinout for the Raspberry Pi 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is pulmicort er with top tech boy comm and we are here with lesson number 25 on using the Raspberry Pi micro controller now if you've been with us through the most excellent first 20 lessons we have taken you from the point that you can install the operating system and get the thing booted up in the terminal window all the way through sort of an overview of Linux so you can kind of get comfortable with the Linux system and then finally in lesson 24 we went all the way to writing your first Linux writing your first Python program from the Linux terminal and so at this point which sort of taking you to the point that you can write a Python program now if you're not familiar with Python I'm not going to be actually teaching you how to run Python but if you go back and look at our earlier lessons shown here at top tech boy comm using Python with Arduino we sort of show you the in a little bit of the ins and outs of Python so if you need to learn Python I recommend you go back and take that series of lessons ok but we are now ready to start doing some neat things we've sort of learned the basics of the raspberry pi we know how to get around we're ready to start doing some projects well if you remember the Arduino this is an Arduino Nano that really the whole thing about using the Arduino is the ability to control voltages apply voltages to or revolta jiz from all of these different pins ok and that's sort of what distinguishes the Arduino from like your desktop computer you actually have pins that you can do something with you can send signals to them you can read signals from them ok then we step up to the Raspberry Pi and it has a whole lot of pins ok so if we're going to start doing projects we got to kind of figure out what those pins are so in this lesson what we're going to do is kind of understand the pin out of the Raspberry Pi it's a little bit more complicated than the than the Arduino and so what I want to do is I just want to spend one lesson just kind of getting you up to speed on the on the pin out for the Raspberry Pi ok to follow along with me why don't you go to top tech boy comm because you place see it better on the website than on the screen if you go to Raspberry Pi line-x lessons and then you come down to lesson number 25 what I have done is I put together a nice pin out if I can click on that get it to come up bigger all right and that's probably pretty good right there hopefully you can see it if not just go to the website now I made this chart myself I didn't just go copy and paste from you know something on the internet no I made this custom just for you so let's see how this thing goes the first thing that you see is is that there is a lot of pins on here let's see it looks like there are 40 pins altogether 20 rows and 2 columns and so on the Raspberry Pi model 2 we have 40 pins I think on some of the earlier ones we might just have 26 but what I do believe is I do believe that they are numbered the same that they have the same function and then just if you have the model 2 or a newer model you get these extra pins but this this pin out should I believe work for most of your raspberry PI's okay first of all let's kind of look this is this is kind of busy and so let's uh let's get a feel for it again you see two rows and you see 20 columns well first of all you can see that there's a couple of old friends that you're going to be needing if you look first of all I guess I should say how are these things numbered they're numbered like this the physical numbering is the upper left is pin 1 pin 2 then you come back 3 4 then you come back 5 6 then you come back 7 8 and you can see that here 1 2 3 4 5 6 7 8 so these two columns are just a picture of this with the physical pins listed and those fiscal pins go one through 40 over here on my raspberry pi therefore you could see that configured like this this would be pin 1 right up here in the corner and then this one over here would be pin 2 and then pin 3 and then pin 4 and on down like that so it's a little got to think a little bit because they are not numbered at least on the more recent raspberry PI's there is no number alongside the pins you've got to kind of do this if you go to my website and you're going to be working through these projects it might be good to just sort of click on this and then print it out and you'll tape it on your wall so you've got it handy okay so we have physical pins 1 through 40 that's 1 through 40 there are two ways remember in Arduino when we did our pin modes we sort of set up the pins using pin mode well there's kind of analogous commands that we're going to learn in Python for doing that same type of thing but what we've got to do in the configuration and our Python program is we've got to figure out or we've got to decide what numbering system we're going to use there's the physical pin numbering system where this would be pin 1 2 3 4 and you just give it a physical number or you can configure it to what's called BCM which is like Broadcom something or another which is a different way of configuring them and then what this would be is this would be GPIO - for general purpose input output - GPIO 3 4 and you can see that there's this kind of different configuration if you use the BCM numbering as opposed to if you use the physical numbering and in the next lesson when we go in and start writing a Python program we'll show you how to show you a little bit more detail about that but for right now what you just need to know is there's two different numbering systems which one you use will be defined at the top or sort of the set up part of your Khaitan program now let's look at some of the useful things that we first of all you can see our old friend a 5 volt rail you can get 5 volts off the PI from pen 2 or pin for physical pins that is you can get 3.3 volts from pin 1 or pin 17 okay that's kind of useful and then you can see pin 25 as a ground pin 34 as a ground 20 as a ground and 14 as a ground so we have got a lot of different grounds and power supplies or you know power power points that we can get off of these time off of these pins okay what I would say is these GPIO pins are sort of like your your aunt your your Arduino digital pins you can write a high or a low to them or you can read a higher low from them so their general purpose input and output they tend to be more digital we'll get into this a little bit more a little bit more later but you can see that these are your GPIO pen so you've got a whole lot of pins a whole lot more than you do on the Arduino ah the thing is what I need you to see though is some of the pins are multifunction so if you look near pins 29 through 37 they're just GPIO pins they're just general purpose input or output pins but if we look at 10 3 & 5 you could use those as GPIO pins or you could use them for I to C similarly pins 8 and 10 you could use for GPIO 4 pins 14 or 15 or you could use them as TX and rx for a UART okay if you wanted to do serial communication also you can see that 19 21 23 24 and 26 can be used for SPI okay and and they also could be used for a general purpose input output this is what I like to do if I'm just going to turn an LED on or I just want a 0 or a 5 volt signal I try to use one of these that is not a that is not a GPIO is not a multi-purpose okay I try to use one that is not a multi-purpose and the reason is is that if I wanted to come back later and let's say I got something neat going on and wanted to come back later and do TX and rx I don't want to have those thing figured for something that could be done on other pins and so I tend to kind of hold these back and hold my SP I and i2c pins back if I can because you never know if you might need them in the future okay let's see here I don't see anything else here that I probably I probably just need to stop here and then start covering the next thing that we'll do is in lesson 26 we'll come in and start building a circuit and start seeing how can we do something simple with these pins like like input and output what I will say though is is that one thing that you will notice which tends to be kind of a brick wall that were that were that we're going to hit here these are all digital input output pins now we can load some libraries and we can get them to do PWM which can kind of act like an analog output and that's really the same thing the Arduino does on those pins that have the squiggly that's not true analog output what that really is is it's pulse width modulation where you're just sort of controlling the timing that you leave the pulse up and down and create an average value that works for that works for most things and so that's the way the Arduino works you can load libraries where you can do pulse width modulation kind of simulate analog output on these cheap at GPIO pins however and this is kind of a biggie what we are missing on the Raspberry Pi is we are missing the analog input pins we don't have a way to do analog input like if you want to measure a voltage between 0 and 5 volts you don't have a way of doing that on the Raspberry Pi and so what they do in Raspberry Pi projects is they sort of show oh you can use this chip and then you run the things into the chip and then you talk to that chip with the Raspberry Pi Wow at that point I would probably just plug a Arduino in and have the Arduino do the analog input and then just talk have the Raspberry Pi control the Arduino because you can get some of these Arduino 'z for probably under 10 bucks and so if I'm really going to need to do something like analog input what I usually do is I usually just tack up I on there write a simple program in PI and then have I mean in Arduino write a simple program in Arduino and then have the Arduino interacting with the Raspberry Pi and control with Raspberry Pi so first major kind of roadblock or brick wall we're going to run into with the Raspberry Pi for all the things we absolutely love about it it doesn't have analog inputs ok tune in for lesson number 26 where we'll actually go in and start writing some writing some code writing some Python programs that will start interacting with these pins pulmicort top tech boy comm if you like these love lessons give us a thumbs up think about sharing them or subscribing to the channel we will talk to you guys later
Info
Channel: Paul McWhorter
Views: 38,930
Rating: undefined out of 5
Keywords: Raspberry Pi (Computer), General-purpose Input/output, GNU/Linux (Operating System), Tutorial
Id: oJfCcz2Ka0Y
Channel Id: undefined
Length: 11min 7sec (667 seconds)
Published: Mon Jun 01 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.