And let's add the Pir sensor to our circuit.
So for now we have the three LEDs and one push button.
We are going to add this Pir sensor and also one resistor that's also going to be one kilo ohm resistor
okay.
So I'm going to put my sensor here on the left for now.
And you see we have three pins.
So when the sensor here this is on.
So the sensor is on the top of the board.
You see the one on the left here is going to be ground.
So the first thing we do is we connect the ground with the ground of our circuit.
So I'm going to do this.
And then what I'm going to plug it here for example okay.
And again I'm going to make it look nicer for the image.
So I put it in black.
All right.
You can see I can plug the ground anywhere in the ground line okay.
Because as you know everything here is connected.
Then we have so we have three pins.
We have the data pin that we're going to plug to a Gpio here.
But then we have on the right we have a VCC pin.
So we need to power these components.
Okay.
We need to connect it directly to a power source.
And the precision is that this component is actually powered by five volt.
Okay.
So we will connect this to a five volt pin in the Raspberry Pi.
And you can see here we have two five volt pins.
Okay so on the image as well you can see that we have two five volt.
Okay.
So all the pins on the Raspberry Pi here are 3.3V.
But those two here are five volts.
So you can connect to any of those pins.
So for example the first one and make sure you connect to that one.
And I'm going to use a red wire here.
So red for power.
Let's make it look a bit nicer maybe like that.
And actually well as you know we can connect the ground to anything.
So maybe I can just do that here.
As you see here, I can just connect this one here just to show you that we can do any configuration
for the ground here.
It's just going to be the same.
Okay.
For example, that looks better.
And this is the same thing okay.
And now that we have the ground connected to the whole circuit and the five volt here power for the
component, we can connect this output.
So that's the data pin to a Gpio okay.
So very important distinction here is that the Gpio here this output is 3.3V.
But the voltage you give to the component for the VCC is five volt okay.
Then it's going to handle everything by itself.
But the again the Gpio here is going to be 3.3V.
So the data pin is 3.3V.
But the power pin is five volts.
So that's the important difference.
And what we could do is we could directly plug this to a Gpio.
But I'm going to add a resistor.
So this one kilo ohm resistor.
Just like I did for the push button so that we can reduce a bit the current.
And what I'm going to do is, well, you see we haven't used any of those dots here.
So I'm just going to plug my resistor for example right here.
And then I'm going to plug this wire to one leg of the resistor.
And I'm going to choose for example a what color do we have.
Brown.
Okay.
So for example like that and this here.
Okay.
And the other side of the resistor okay.
So the connection starts here from the component to the resistor going through the resistor.
And the other side of the resistor is going to go to the Gpio here.
Number four.
That's just on the left of the ground okay.
So you see if you have correctly placed the ground then on the right you have these three LEDs.
And on the left you have the Pir sensor.
And I'm just going to make it look a bit nicer.
Okay.
And with this, the circuit is now complete.
So we don't plug directly this component on the breadboard.
Okay.
We just plug here the ground.
Then the power supply goes to five volts.
This one.
And then we have the data pin that goes through the resistor one kilo ohm resistor to the Gpio number
four which is just next to the ground.
All right.
And now let's switch to the real circuit.
And so of course as always make sure that you power off the Raspberry Pi if needed.
You take the SD card out.
With this case it's going to be fine.
So I have my pi sensor okay.
And I'm going to use.
So here I'm going to use a male to female wire for the ground.
As you can see I'm not using a black one because well simply I didn't have a black one at this time.
And just to show you that if you are missing a black wire for the ground, well, it's okay.
You don't need to go to the shop and buy a new one right now.
You can use another wire.
Okay?
Nothing's going to happen as long as you make sure that you know which wire is going where.
So we have the sensor like this.
Okay.
And the ground is going to be the first on the left so I can plug the ground here.
Okay.
So if you put it like this, you see you have the jumper on the left.
And the ground also is going to be on the left side.
So first of all I'm going to just plug the three wires.
And then we're going to put the wires in the right place for the power supply.
Also you will need a female to female wire and better to have a red one.
But as you can see I also don't have a red one like this.
So I just use the white one and I'm going to plug it to the other side here.
Okay.
And finally I have a brown cable.
So I'm going to take male to female and plug it in the middle.
So here I plug it in the middle right.
We have the power that is fully connected.
Now we need to connect those three wires.
So the gray one.
So the gray one here are the black one.
Well the ground here that goes here on the ground line.
Okay.
So any pin will do.
Just make sure you connect it on the ground line.
Then the power pin.
That's five volts.
So five volts.
We connect it to the first one on the top left.
It should be easy to find and make sure you connect to the right one because we need five volts.
So the top left corner the first pin.
And then I'm going to connect this data wire here.
So the one that goes to the Gpio I'm going to connect it to any part here for example that one okay.
So here I can take my one kilo ohm resistor and plug it.
So maybe I will do that here and plug this here okay.
It doesn't really matter here.
We have lots of space.
You can take all the space you want.
Just make sure you see, I make sure that I place my components as far as possible from the other ones.
Because if you put this resistor too close to that one, and if they touch each other, well, bad things
can happen.
And now I have my so wire that goes through the resistor.
And then I take the other leg of the resistor here on that side and make sure it's the right one.
And I plug it to the Gpio number four which is on the left directly off the ground that we have plugged
before.
Okay.
So that should be the fourth pin on the bottom left here of the Gpio panel.
All right.
And with this so the circuit is finished.
And I have put it here on the left just on purpose.
So that you see I can put it like that.
And then I can detect movement on this side of the desk or the side of the room.