WEBVTT

00:00.080 --> 00:03.500
And let's add the Pir sensor to our circuit.

00:03.500 --> 00:06.230
So for now we have the three LEDs and one push button.

00:06.230 --> 00:14.570
We are going to add this Pir sensor and also one resistor that's also going to be one kilo ohm resistor

00:14.600 --> 00:15.080
okay.

00:15.110 --> 00:17.960
So I'm going to put my sensor here on the left for now.

00:17.960 --> 00:20.090
And you see we have three pins.

00:20.090 --> 00:22.880
So when the sensor here this is on.

00:22.910 --> 00:24.830
So the sensor is on the top of the board.

00:24.830 --> 00:28.790
You see the one on the left here is going to be ground.

00:28.790 --> 00:33.680
So the first thing we do is we connect the ground with the ground of our circuit.

00:33.680 --> 00:35.330
So I'm going to do this.

00:35.360 --> 00:40.460
And then what I'm going to plug it here for example okay.

00:40.490 --> 00:44.270
And again I'm going to make it look nicer for the image.

00:44.270 --> 00:46.160
So I put it in black.

00:46.910 --> 00:47.270
All right.

00:47.300 --> 00:51.710
You can see I can plug the ground anywhere in the ground line okay.

00:51.740 --> 00:55.400
Because as you know everything here is connected.

00:56.420 --> 00:59.180
Then we have so we have three pins.

00:59.180 --> 01:02.300
We have the data pin that we're going to plug to a Gpio here.

01:02.300 --> 01:06.680
But then we have on the right we have a VCC pin.

01:06.680 --> 01:09.170
So we need to power these components.

01:09.200 --> 01:09.410
Okay.

01:09.440 --> 01:13.220
We need to connect it directly to a power source.

01:13.220 --> 01:19.790
And the precision is that this component is actually powered by five volt.

01:19.820 --> 01:20.240
Okay.

01:20.270 --> 01:25.640
So we will connect this to a five volt pin in the Raspberry Pi.

01:25.640 --> 01:29.150
And you can see here we have two five volt pins.

01:29.180 --> 01:33.620
Okay so on the image as well you can see that we have two five volt.

01:33.650 --> 01:33.860
Okay.

01:33.890 --> 01:37.250
So all the pins on the Raspberry Pi here are 3.3V.

01:37.250 --> 01:40.100
But those two here are five volts.

01:40.100 --> 01:42.290
So you can connect to any of those pins.

01:42.290 --> 01:45.530
So for example the first one and make sure you connect to that one.

01:45.530 --> 01:48.890
And I'm going to use a red wire here.

01:48.890 --> 01:52.130
So red for power.

01:52.160 --> 01:56.720
Let's make it look a bit nicer maybe like that.

02:00.080 --> 02:04.400
And actually well as you know we can connect the ground to anything.

02:04.400 --> 02:06.670
So maybe I can just do that here.

02:07.450 --> 02:15.640
As you see here, I can just connect this one here just to show you that we can do any configuration

02:15.640 --> 02:16.780
for the ground here.

02:17.080 --> 02:18.490
It's just going to be the same.

02:20.290 --> 02:20.680
Okay.

02:20.710 --> 02:23.530
For example, that looks better.

02:23.530 --> 02:25.180
And this is the same thing okay.

02:25.210 --> 02:32.920
And now that we have the ground connected to the whole circuit and the five volt here power for the

02:32.920 --> 02:36.040
component, we can connect this output.

02:36.040 --> 02:38.740
So that's the data pin to a Gpio okay.

02:38.770 --> 02:44.650
So very important distinction here is that the Gpio here this output is 3.3V.

02:44.650 --> 02:49.480
But the voltage you give to the component for the VCC is five volt okay.

02:49.510 --> 02:51.850
Then it's going to handle everything by itself.

02:51.850 --> 02:55.930
But the again the Gpio here is going to be 3.3V.

02:55.930 --> 02:57.610
So the data pin is 3.3V.

02:57.610 --> 02:59.200
But the power pin is five volts.

02:59.200 --> 03:01.090
So that's the important difference.

03:01.090 --> 03:05.380
And what we could do is we could directly plug this to a Gpio.

03:05.380 --> 03:07.570
But I'm going to add a resistor.

03:07.570 --> 03:09.040
So this one kilo ohm resistor.

03:09.070 --> 03:14.230
Just like I did for the push button so that we can reduce a bit the current.

03:14.230 --> 03:19.240
And what I'm going to do is, well, you see we haven't used any of those dots here.

03:19.240 --> 03:23.170
So I'm just going to plug my resistor for example right here.

03:23.470 --> 03:29.290
And then I'm going to plug this wire to one leg of the resistor.

03:29.320 --> 03:34.570
And I'm going to choose for example a what color do we have.

03:34.600 --> 03:35.350
Brown.

03:37.900 --> 03:38.380
Okay.

03:38.380 --> 03:42.310
So for example like that and this here.

03:44.650 --> 03:45.100
Okay.

03:45.130 --> 03:47.680
And the other side of the resistor okay.

03:47.710 --> 03:52.450
So the connection starts here from the component to the resistor going through the resistor.

03:52.450 --> 03:56.470
And the other side of the resistor is going to go to the Gpio here.

03:56.500 --> 03:57.760
Number four.

03:58.360 --> 04:01.630
That's just on the left of the ground okay.

04:01.660 --> 04:05.710
So you see if you have correctly placed the ground then on the right you have these three LEDs.

04:05.710 --> 04:08.260
And on the left you have the Pir sensor.

04:08.440 --> 04:12.630
And I'm just going to make it look a bit nicer.

04:12.660 --> 04:13.320
Okay.

04:13.380 --> 04:16.530
And with this, the circuit is now complete.

04:16.530 --> 04:19.800
So we don't plug directly this component on the breadboard.

04:19.830 --> 04:20.280
Okay.

04:20.310 --> 04:22.500
We just plug here the ground.

04:22.500 --> 04:24.780
Then the power supply goes to five volts.

04:24.810 --> 04:25.410
This one.

04:25.410 --> 04:32.220
And then we have the data pin that goes through the resistor one kilo ohm resistor to the Gpio number

04:32.220 --> 04:35.400
four which is just next to the ground.

04:35.430 --> 04:35.910
All right.

04:35.910 --> 04:38.580
And now let's switch to the real circuit.

04:39.750 --> 04:43.650
And so of course as always make sure that you power off the Raspberry Pi if needed.

04:43.650 --> 04:45.930
You take the SD card out.

04:45.960 --> 04:47.700
With this case it's going to be fine.

04:47.700 --> 04:50.340
So I have my pi sensor okay.

04:50.340 --> 04:51.750
And I'm going to use.

04:51.750 --> 04:57.150
So here I'm going to use a male to female wire for the ground.

04:57.180 --> 05:01.710
As you can see I'm not using a black one because well simply I didn't have a black one at this time.

05:01.710 --> 05:06.960
And just to show you that if you are missing a black wire for the ground, well, it's okay.

05:06.960 --> 05:09.570
You don't need to go to the shop and buy a new one right now.

05:09.600 --> 05:11.250
You can use another wire.

05:11.280 --> 05:11.700
Okay?

05:11.730 --> 05:16.620
Nothing's going to happen as long as you make sure that you know which wire is going where.

05:17.280 --> 05:20.100
So we have the sensor like this.

05:20.130 --> 05:20.610
Okay.

05:20.640 --> 05:25.290
And the ground is going to be the first on the left so I can plug the ground here.

05:26.100 --> 05:26.640
Okay.

05:26.640 --> 05:29.430
So if you put it like this, you see you have the jumper on the left.

05:29.430 --> 05:31.920
And the ground also is going to be on the left side.

05:32.880 --> 05:35.160
So first of all I'm going to just plug the three wires.

05:35.160 --> 05:40.920
And then we're going to put the wires in the right place for the power supply.

05:40.950 --> 05:46.950
Also you will need a female to female wire and better to have a red one.

05:46.950 --> 05:49.680
But as you can see I also don't have a red one like this.

05:49.680 --> 05:54.780
So I just use the white one and I'm going to plug it to the other side here.

05:55.230 --> 05:55.890
Okay.

05:55.890 --> 05:59.130
And finally I have a brown cable.

05:59.130 --> 06:04.530
So I'm going to take male to female and plug it in the middle.

06:06.090 --> 06:09.870
So here I plug it in the middle right.

06:09.870 --> 06:14.670
We have the power that is fully connected.

06:14.670 --> 06:16.440
Now we need to connect those three wires.

06:16.440 --> 06:17.730
So the gray one.

06:17.760 --> 06:20.040
So the gray one here are the black one.

06:20.040 --> 06:24.720
Well the ground here that goes here on the ground line.

06:24.840 --> 06:25.080
Okay.

06:25.080 --> 06:27.900
So any pin will do.

06:27.930 --> 06:30.210
Just make sure you connect it on the ground line.

06:30.210 --> 06:33.120
Then the power pin.

06:33.150 --> 06:34.200
That's five volts.

06:34.200 --> 06:34.920
So five volts.

06:34.920 --> 06:39.810
We connect it to the first one on the top left.

06:40.200 --> 06:45.120
It should be easy to find and make sure you connect to the right one because we need five volts.

06:46.050 --> 06:49.230
So the top left corner the first pin.

06:50.220 --> 06:54.120
And then I'm going to connect this data wire here.

06:54.120 --> 07:02.970
So the one that goes to the Gpio I'm going to connect it to any part here for example that one okay.

07:03.480 --> 07:10.320
So here I can take my one kilo ohm resistor and plug it.

07:10.320 --> 07:16.290
So maybe I will do that here and plug this here okay.

07:16.320 --> 07:17.340
It doesn't really matter here.

07:17.340 --> 07:18.800
We have lots of space.

07:19.190 --> 07:20.930
You can take all the space you want.

07:20.960 --> 07:27.710
Just make sure you see, I make sure that I place my components as far as possible from the other ones.

07:27.710 --> 07:34.250
Because if you put this resistor too close to that one, and if they touch each other, well, bad things

07:34.250 --> 07:35.000
can happen.

07:35.000 --> 07:39.080
And now I have my so wire that goes through the resistor.

07:39.080 --> 07:45.440
And then I take the other leg of the resistor here on that side and make sure it's the right one.

07:45.440 --> 07:53.120
And I plug it to the Gpio number four which is on the left directly off the ground that we have plugged

07:53.120 --> 07:54.020
before.

07:55.580 --> 07:56.090
Okay.

07:56.660 --> 08:04.010
So that should be the fourth pin on the bottom left here of the Gpio panel.

08:04.760 --> 08:05.360
All right.

08:05.360 --> 08:08.150
And with this so the circuit is finished.

08:08.150 --> 08:11.840
And I have put it here on the left just on purpose.

08:11.840 --> 08:15.230
So that you see I can put it like that.

08:15.620 --> 08:21.110
And then I can detect movement on this side of the desk or the side of the room.
