WEBVTT

00:00.110 --> 00:04.220
Before we start using the Pir sensor, we actually need to tune it.

00:04.220 --> 00:09.590
So there are a few things here we will need to do on the hardware, and it's quite important that we

00:09.590 --> 00:15.470
do it actually even before we do the circuit, because if we're going to touch stuff directly on the

00:15.470 --> 00:22.370
hardware and actually metallic parts, well, as you guess, it's better to have the sensor outside

00:22.370 --> 00:26.510
of the circuit and especially not in the circuit and powered on.

00:26.510 --> 00:32.180
So as you can see on the Pir sensor we have here, we have first this is called a jumper.

00:32.180 --> 00:36.830
So this yellow thingy here with three wires here.

00:36.830 --> 00:38.750
So it might be in either position.

00:38.750 --> 00:40.520
You can just take it out for now.

00:40.610 --> 00:45.410
So we have this jumper and then we have two potentiometers here okay.

00:45.440 --> 00:51.800
So I'm going to explain to you what to do with those three things here and what that means.

00:51.800 --> 00:53.810
So first of all you can take the jumper.

00:53.810 --> 00:56.720
And if you look carefully here at the back.

00:56.720 --> 01:04.930
So if I orientate the Pir sensor so like this you can see that we have L and H so low or high.

01:04.960 --> 01:08.980
Basically what you can also just take it like that and it's going to be on the left.

01:08.980 --> 01:17.320
So take the jumper and you connect the two pins on to the two legs on the left on the high position.

01:17.320 --> 01:19.600
And I'm going to come back to this in just a minute.

01:19.600 --> 01:22.660
Then you can orientate the Pi like that.

01:22.660 --> 01:24.190
So it depends on how you orient it.

01:24.190 --> 01:29.830
I'm going to follow the instructions with the sensor that's on the bottom here.

01:29.830 --> 01:31.660
And you have two potentiometers.

01:31.660 --> 01:34.900
So to move those you see I have some screwdrivers.

01:34.900 --> 01:42.310
So you can find any screwdriver and try to see if you can actually turn the potentiometer okay.

01:42.310 --> 01:43.570
So with this one it works.

01:43.570 --> 01:45.520
I also have a flat one.

01:45.850 --> 01:50.440
Well you can also try with your finger okay I don't have much nail here.

01:50.440 --> 01:50.920
You can see.

01:50.920 --> 01:55.840
But I can still manage to turn the potentiometer here.

01:55.840 --> 02:02.150
So you will find a way to turn this, and the first potentiometer on the left here will correspond to

02:02.180 --> 02:03.350
the range.

02:03.350 --> 02:06.650
So how far the sensor can detect movement?

02:07.010 --> 02:09.170
The minimum is going to be three meters.

02:09.200 --> 02:09.440
Okay.

02:09.470 --> 02:15.590
So it can detect up to one up to three meters in front with a with a with a range.

02:15.590 --> 02:18.140
Imagine here you have an angle here.

02:18.140 --> 02:20.510
That's I think it's about 110 degrees.

02:20.510 --> 02:23.150
And it's going to detect movement up to three meters.

02:23.150 --> 02:24.260
That's the minimum.

02:24.260 --> 02:33.260
So if you will go counterclockwise at the minimum like like that.

02:35.060 --> 02:36.050
Let's see okay.

02:36.080 --> 02:42.170
All the way here that's going to be three meters if you go all the way up here.

02:43.040 --> 02:46.250
So clockwise is going to be seven meters okay.

02:46.250 --> 02:52.490
So from 3 to 7m and it's well I'm just going to put it in the middle.

02:52.490 --> 02:55.800
So it's going to be somewhere around five metres.

02:55.800 --> 02:58.140
This one is not the most important setting.

02:58.170 --> 02:58.380
Okay.

02:58.410 --> 03:03.870
And it's going to basically depend on where you place the sensor and what you want to detect.

03:03.900 --> 03:07.050
So for this example we don't need any precise range.

03:07.050 --> 03:10.110
You could leave it to three meters or five whatever.

03:10.110 --> 03:11.610
And then the second one.

03:11.610 --> 03:16.680
So with the sensor on the bottom here the potentiometer on the right.

03:16.680 --> 03:23.970
This one is more important because this one is the delay or basically how long the output of the sensor

03:23.970 --> 03:25.920
will stay high.

03:26.370 --> 03:27.990
Because how does the sensor work?

03:27.990 --> 03:32.400
Well, when the movement is detected it's going to output high okay.

03:32.430 --> 03:33.870
By default it's going to be low.

03:33.870 --> 03:36.660
When the movement is detected it's going to output high.

03:36.660 --> 03:38.520
And you can read that in your code.

03:38.520 --> 03:45.690
But what you have to know is that when the sensor output high, it will stay high for a certain amount

03:45.720 --> 03:46.530
of time.

03:46.560 --> 03:46.830
Okay.

03:46.860 --> 03:51.000
And this amount of time you can modify it with this potentiometer.

03:51.000 --> 03:52.440
If I go on the minimum.

03:52.440 --> 03:54.740
And actually we're going to go to the minimum here.

03:55.820 --> 03:58.070
So I put this potentiometer to the minimum.

03:58.070 --> 04:04.580
This is going to be about so well depends on which datasheet you find on the internet.

04:04.850 --> 04:07.730
Because it seems like nobody can agree on this.

04:07.730 --> 04:11.180
But what I found is values between 3 to 5 seconds.

04:11.180 --> 04:16.370
And with this potentiometer here, this hardware that I have, I found it's about three seconds.

04:16.370 --> 04:17.870
So that's going to be the minimum.

04:17.870 --> 04:23.360
Which means that when the movement is detected it's going to be like if it were detected for the next

04:23.360 --> 04:26.030
three seconds, even if there is no movement.

04:26.030 --> 04:28.790
So I put my hand here.

04:28.790 --> 04:31.340
It's going to detect the movement and stay high.

04:31.370 --> 04:34.610
So stay as detected for three seconds.

04:34.640 --> 04:39.980
If you put all the way to the top so clockwise it will go up until 300 seconds.

04:39.980 --> 04:41.660
So five minutes.

04:41.690 --> 04:42.170
All right.

04:42.200 --> 04:45.440
So for this application we want the minimum we want to have the minimum.

04:45.440 --> 04:47.540
So 3 to 5 seconds okay.

04:47.570 --> 04:50.270
So we have the first potentiometer here.

04:50.270 --> 04:53.870
Whatever value it's the range between 3 to 7m.

04:53.900 --> 05:00.290
This potentiometer here, the minimum counterclockwise which is going to be about five.

05:00.290 --> 05:01.670
So 3 to 5 seconds.

05:01.670 --> 05:05.270
And then I'm coming back to this jumper here.

05:05.300 --> 05:07.640
And I told you to put it in a high position.

05:07.670 --> 05:13.250
Because if you put it in the low position and for example here it's going to detect the movement for

05:13.250 --> 05:13.970
three seconds.

05:13.970 --> 05:17.090
Then after three seconds it's going to go low again.

05:17.090 --> 05:22.280
So it's going to say that there is no movement detected even if you continue to move, for example,

05:22.280 --> 05:24.620
your hand in front of the sensor.

05:24.650 --> 05:25.160
All right.

05:25.190 --> 05:31.940
With the high position, basically every time you make a movement, you kind of reset this delay.

05:31.940 --> 05:37.400
So as long as you make movement in front of the sensor, the output is always going to be high.

05:37.400 --> 05:42.350
Plus an additional, let's say 3 to 5 seconds after the last movement.

05:42.380 --> 05:42.830
Okay.

05:42.830 --> 05:48.590
So that's the settings that we're going to use for this circuit and for the activities and also for

05:48.590 --> 05:50.270
the project of this course.
