WEBVTT

00:00.110 --> 00:05.360
Here is the complete pinout for the Raspberry Pi five, but it's also the same as for the Raspberry

00:05.360 --> 00:07.130
Pi four, three and two.

00:07.160 --> 00:13.370
The Gpios haven't changed with the latest evolution of the board, so as you can see we have some pins

00:13.370 --> 00:16.070
in black which represent the ground.

00:16.250 --> 00:17.660
We've already used one.

00:17.690 --> 00:20.060
All those pins are connected together.

00:20.060 --> 00:22.190
Then we have what we call power pins.

00:22.190 --> 00:28.430
So we have two pins for 3.3V in yellow and two pins for five volts in red.

00:28.430 --> 00:30.860
Then we have the Gpio in orange.

00:30.860 --> 00:34.940
So again Gpio means general purpose input output.

00:34.940 --> 00:37.760
And each Gpio has a number.

00:37.760 --> 00:43.160
That's the number you will use in your Python code to interact with that Gpio.

00:43.160 --> 00:49.040
And a quick reminder here is that Gpio supports 3.3V, not five volt.

00:49.070 --> 00:51.770
We only have two pins here that support five volt.

00:51.770 --> 00:55.130
So now how are Gpios controlled?

00:55.130 --> 00:57.200
Well, it's pretty simple.

00:57.230 --> 01:02.840
A Gpio will be set as either an input pin or an output pin.

01:02.840 --> 01:06.140
Input will be used when you want to read some data.

01:06.140 --> 01:11.870
For example, with a push button you want to read, the state of the button and output will be used

01:11.910 --> 01:13.950
when you want to write some data.

01:13.980 --> 01:18.990
For example, you want to set an LED, so you want to turn on or off an LED.

01:18.990 --> 01:23.730
So once the mode for the Gpio is set, you can use it.

01:24.120 --> 01:27.390
If it is set as an input, you can read a value.

01:27.420 --> 01:30.810
The value has only two states high and low.

01:30.810 --> 01:32.460
So this is a binary state.

01:32.460 --> 01:37.290
And high and low here correspond to the voltage which was read from the pin.

01:37.290 --> 01:44.310
If the voltage is high enough and close to 3.3V, then the value will be high, otherwise it will be

01:44.310 --> 01:44.670
low.

01:44.670 --> 01:49.650
And if you have set the Gpio as output, you can then write a value to it.

01:49.650 --> 01:52.920
And it's also going to be high or low for an LED.

01:52.920 --> 01:58.920
If you want to turn on the LED, the Gpio state will be high, so close to 3.3V.

01:58.920 --> 02:05.790
And if you want to turn off the LED, the Gpio state will be set as low so close to zero volts.

02:05.790 --> 02:08.730
And that's basically how a Gpio works.

02:08.760 --> 02:08.910
Okay.

02:08.940 --> 02:10.140
It's not that complicated.

02:10.140 --> 02:14.520
And in the code we will use a Python library that takes care of all that for you.

02:14.520 --> 02:17.550
So basically we won't have to deal directly with this.

02:17.550 --> 02:20.820
And you can just then focus on your application.

02:20.820 --> 02:27.730
But with what you've seen here in those few minutes, at least you understand the basics of how it works

02:27.730 --> 02:28.570
under the hood.

02:28.600 --> 02:34.630
Now, if we come back to the Raspberry Pi pinout image, you can see that the Gpios are not set in any

02:34.630 --> 02:37.810
specific order and some numbers are missing.

02:37.840 --> 02:39.280
And that's totally okay.

02:39.310 --> 02:40.810
And it's nothing to worry about.

02:40.810 --> 02:46.390
You just have to be extra careful when finding the Gpio number corresponding to the Pin number.

02:46.420 --> 02:47.830
Okay, so you can see the pin number.

02:47.830 --> 02:50.380
We have numbers from one until 40.

02:50.380 --> 02:52.990
So those are the gray pins and they are ordered.

02:52.990 --> 02:55.570
But we are not going to use those numbers.

02:55.570 --> 02:59.050
We are going to use the Gpio numbers directly.

02:59.050 --> 03:00.790
And then what else do we have.

03:00.790 --> 03:05.110
You can see that we also have two reserved pins in gray.

03:05.110 --> 03:06.940
So you should not use those.

03:06.940 --> 03:11.380
Then we have two pins in green that are used for Uart communication.

03:11.380 --> 03:16.060
You also have alternate functions with I to C and SPI communications.

03:16.060 --> 03:18.970
So all those are more advanced communications.

03:18.970 --> 03:22.030
And in this course we are just going to focus on the Gpio.

03:22.030 --> 03:26.620
But if you want to learn more about those communications that can be a nice thing to research after

03:26.620 --> 03:27.220
this course.

03:27.250 --> 03:27.670
All right.

03:27.700 --> 03:34.690
And now that you have an overview of how Gpio work, let's actually use one to power on our first LED.
