1
00:00:00,990 --> 00:00:09,150
Lesson eight project for people counting with ultrasonic sensors, specifically theory and data collection.

2
00:00:10,110 --> 00:00:16,350
In this article, we will create a people accounting system by using Real Terminal, an ordinary ultrasonic

3
00:00:16,350 --> 00:00:18,780
ranger and special deep learning saws.

4
00:00:18,810 --> 00:00:26,940
To top it off and actually make it to work, we will also utilize Microsoft Azure IoT Central Service

5
00:00:26,940 --> 00:00:31,500
to store the real occupancy data, the cloud and visualize it on ABC.

6
00:00:31,860 --> 00:00:33,480
Now that sounds interesting, right?

7
00:00:34,350 --> 00:00:40,020
The first thing we need to do is learn about the data we can get from the ultrasonic sensor and how

8
00:00:40,020 --> 00:00:42,420
we can use it to figure out the direction of things.

9
00:00:43,650 --> 00:00:48,810
This grow ultrasonic ranger is a module that doesn't need to be touched to measure distance.

10
00:00:49,560 --> 00:00:51,420
It works at 40 hertz.

11
00:00:52,170 --> 00:00:58,140
We then send a pulse signal through the signal pin that last more than 10 us through signal pin.

12
00:00:59,100 --> 00:01:05,640
Then the global supersonic ranger will send out eight cycles of 400 cycle level and listen for the Echo.

13
00:01:06,390 --> 00:01:10,200
The pulse width of the Echo signal changes as you get closer.

14
00:01:10,620 --> 00:01:14,310
If you want to know how to do this, here is what you need.

15
00:01:14,610 --> 00:01:22,980
Reflection time multiplied by sound speed The sound speed is equivalent to 340 meters per second squared.

16
00:01:24,240 --> 00:01:29,830
Now it is important to take note that do not hot block growth ultrasonic ranger.

17
00:01:29,850 --> 00:01:32,360
Otherwise, it will damage the sensor.

18
00:01:32,730 --> 00:01:37,020
The measured area must be no less than 0.5 square meters and smooth.

19
00:01:37,930 --> 00:01:44,310
Now, after installing, girls will just like Ranger Library for the Arduino HD and connecting ultrasonic

20
00:01:44,310 --> 00:01:47,640
ranger to wheel Terminal D one or two.

21
00:01:48,600 --> 00:01:54,150
We can upload this simple script with a terminal connected to growth will just like Ranger and then

22
00:01:54,150 --> 00:01:56,100
walk in and walk out of the room.

23
00:01:58,930 --> 00:02:06,160
Then after that, we can immediately see that for walking it, we can get relatively high values, which

24
00:02:06,160 --> 00:02:13,060
are corresponding to the distance from the object first, which then decrease, and for walking out,

25
00:02:13,060 --> 00:02:15,070
we get completely the opposite of it.

26
00:02:16,060 --> 00:02:21,730
It's possible that we could write an algorithm by hand that could help us figure out the right way to

27
00:02:21,730 --> 00:02:22,030
go.

28
00:02:22,570 --> 00:02:26,110
As it turns out, real life is it as simple as it looks?

29
00:02:26,770 --> 00:02:30,640
We have people who walk quickly and people who walk slowly.

30
00:02:31,150 --> 00:02:34,660
We have dinner people and people who aren't so thin.

31
00:02:35,230 --> 00:02:42,610
So our handwritten algorithm has to take all of this into an account, which will make it very complicated

32
00:02:43,090 --> 00:02:45,220
and hard to figure out at the same time.

33
00:02:45,910 --> 00:02:51,580
We have a project that needs to be done, but inferencing, not processing in a lot of noisy data.

34
00:02:51,760 --> 00:02:52,840
Big differences.

35
00:02:53,230 --> 00:03:01,240
Now there is a way to do this, which is called deep learning install ultrasonic reader library, Arduino

36
00:03:01,240 --> 00:03:01,930
IEEE.

37
00:03:02,350 --> 00:03:09,700
Step one is that download the Ultrasonic Ranger Library from GitHub, step to extract the archive and

38
00:03:09,700 --> 00:03:15,460
place it inside the Libraries folder and make sure we are terminal and ultrasonic sensor with screws

39
00:03:15,820 --> 00:03:17,680
to wooden or 3D printed frame.

40
00:03:18,070 --> 00:03:22,960
For example, to put the frame of the wall through metal, velcro strips were used.

41
00:03:23,530 --> 00:03:28,030
Additional options include using phone data, screws or nails.

42
00:03:28,750 --> 00:03:34,420
Now let's start a new project in the edge embossed dashboard and get ready to get the data from it.

43
00:03:35,200 --> 00:03:42,580
We can use the data for our tool from Edge impulsively to get the data, since we don't need very high

44
00:03:42,580 --> 00:03:43,690
sampling frequencies.

45
00:03:44,080 --> 00:03:48,510
We can just use this tool if you have already installed Edge impulsively.

46
00:03:48,910 --> 00:03:51,220
Follow these steps to upload the API.

47
00:03:51,220 --> 00:03:56,080
People counter data collection that inner script to the wheel terminal.

48
00:03:56,740 --> 00:04:00,850
Now this is the same script that was repeated above in this script.

49
00:04:01,180 --> 00:04:08,500
We set all the values above 200 centimeter to negative one, so we can see them actually not for your

50
00:04:08,500 --> 00:04:09,190
application.

51
00:04:09,460 --> 00:04:13,870
You might need to set this value lower or higher, depending on the setup.

52
00:04:14,440 --> 00:04:15,310
Start walking.

53
00:04:16,030 --> 00:04:19,570
You should try walking in and now try walking up.

54
00:04:21,300 --> 00:04:27,480
Now, try walking near the device, not getting closer or further away from you.

55
00:04:27,990 --> 00:04:34,950
For this lesson, we recorded one minute and 30 seconds of data for each class, each time we recorded

56
00:04:34,950 --> 00:04:40,350
five thousand millisecond samples and then cut them down to get one thousand five hundred millisecond

57
00:04:40,350 --> 00:04:40,920
samples.

58
00:04:41,490 --> 00:04:44,850
Make sure you have the samples where you or other people walk fast.

59
00:04:45,120 --> 00:04:47,130
Slow run and so on.

60
00:04:47,560 --> 00:04:49,140
Now try again for walking in.

61
00:04:49,710 --> 00:04:55,770
Then after that, try observing when walking out now for the non category.

62
00:04:56,220 --> 00:05:01,890
Apart from samples that have nobody in front of the device, it is a good idea to include samples that

63
00:05:01,890 --> 00:05:08,790
have a person standing close to the device and walking beside it to avoid any movement being falsely

64
00:05:08,790 --> 00:05:10,830
classified as in or out.

65
00:05:11,580 --> 00:05:17,370
Then lastly, try to change the position of the ultrasonic sensor, installing it lower or higher,

66
00:05:17,940 --> 00:05:20,310
or possibly near another door frame.
