A real-time people counting system using ultrasonic sensors
Visit PEOPLE INSIDE »
3. How To Use
4. Performance
5. Components
6. Developers
7. Paper
8. License
University students takes classes according to the fixed timetable. At the meal time, too many people crowd into a cafeteria. Sometimes we must go to another cafeteria because there are no enough table. To take matters worse, we don't have much time, because another class begins soon. To have lunch, we have to wait for a seat in the cafeteria or go out to look for another cafeteria. After all, it's a fool's errand. From now we want to avoid this, We want to check the number of indoor people in advance. So, we made it, PEOPLE-INSIDE.
PEOPLE INSIDE is a real-time people counting system using ultrasonic sensors. It uses only four inexpensive ultrasonic sensors to determine the number of indoor personnel. And you can see this number in real time through the application.
In other words, our system aims to measure indoor congestion metrics. This can be apply to all indoor rooms as well as university cafeterias.
We are focusing on main purposes.
We have three things to aim for :
You don't have to waste any more of your time by checking the number of indoor people with an application.
PEOPLE-INSIDE can be used for various purposes. The use of it is yours.
Only use four inexpensive ultrasonic sensors to determine the number of people.
git clone https://github.com/PEOPLE-INSIDE/people-inside
\projects\arduino
- Include two type of our Arduino source code (Classification / Random Forest)
\projects\mobile_app
- Include our Android mobile application for display the number of people.
\projects\3d_modeling
- Include our 3d model chassis for Arduino and ultrasonic sensors.
\projects\dataset
- Include our all signal dataset for training decision trees.
Before you use our system, make sure the environment fits perfectly. This is a list of necessary things.
- Arduino UNO
UNO
becomes the main body to connect the sensors. - Ultrasonic sensors You need four ultrasonic sensors. And these must positioned parallel aligned in two pairs. Prepare inexpensive one which like
HC-SR06
we used. - Batteries If you want to connect wirelessly, you need a battery to supply power.
- Wifi Shield & Server It is necessary to send data to the application. The server can use what you want.
- Application To view the processed data directly.
We prepared a picture of the architecture. It will help you understand the system.
And this picture depicts our actual test environment.
On the right is the arduino case we made. We recommend you using a 3D printer when making your own.
There is one thing you need to know when you make a case. The ultrasonic sensor sends sound waves and measure the time when sound waves bounce against the wall. Then use the time and the speed of ultrasonic waves to calculate the distance. The case should also act as a barrier to reflecting sound waves. Therefore, make sure that you do not only fills arduino, but also acts as a wall. The following figures were 3D modelling captures of a case with 3D printing.
We also provide 3D model file for making arduino chassis. You can use this model if you have 3D printer. Below images are some snapshots 3D models that we provide.
The basic principle what PEOPLE-INSIDE used, is to distinguish between IN and OUT of the person or people.
Suppose the sensors in the following figures, A and B. If the A sensor detects a person first, it means IN. And the reverse, of course it means OUT.
The right-hand side is actually a graph of the serial data that the sensor recognizes. x axis is time and y axis is measured distance. The blue one is the serial data of the A sensor and the yellow one is the B sensor's. You can figure the measured distance of the A sensor decreased first.
So, if you interpret the graph, you can see that the person initially did IN. And then he or she did OUT.
Before you use PEOPLE-INSIDE software, you have two options. Both methods are suggested, so you just pick what you want.
- Classification Algorithmㅡ Classification algorithm that classifies Serial datas which one is IN and OUT.
- Random Forestㅡ Machine Learning with data sets what we collected.
Did you choose?
Only one software tool is needed.
- Sketchㅡ To use Classification Algorithm,
the sketch
tool must be installed.
Once the tool installation has been completed, begin explaining the algorithm. Leave nothing between doors after initial installation. Because the algorithm begins with measuring distance N times between the door.
why? Knowing the distance between the doors sets the standard. Then, calculate the average of the measured distances. And obtain a standard deviation as six sigma from the average. In other words, if the measured distance between the upperbound and the lowerbound, nothing passes. The reason for judging like this is because the measured distances by ultrasonic sensors are very sensitive and accurate. From the graph, you can see that the measured distances are not represented like linear line.
Upperbound & Lowerbound = Average of distance1,2,3,4 ± 6σ
So, if the graph deviate from the bound, you realize something goes past the door.
Let me explain why we used four ultrasonic sensors, not two. Initially, two sensors were used in the system. However, when the only two sensors were analyzed and compiled, unexpected events occurred. A typical example is that the measured distances by the two sensors go off at the same time. Without a single error. In this case, the count is an error. And if the count continues to accumulate, this small error becomes unacceptably large. So we increased the number of sensor to four to correct these errors. With four sensors, even one sensor's data is missing, system listens to the others. Increased the number of sensors to increase the accuracy of the system.
After all, if we formulate the Classification algorithm in the way we describe, it looks like the following picture.
𝒕_𝑨𝟏,𝒕_𝑩𝟏,𝒕_𝑪𝟏,𝒕_𝑫𝟏 = Time when distance of sensor decreases below lowerbound
𝒕_𝑨𝟐,𝒕_𝑩𝟐,𝒕_𝑪𝟐,𝒕_𝑫𝟐 = Time when distance of sensor increases above lowerbound
𝐑=|𝒕_𝑨𝟏−𝒕_𝑩𝟏|/(𝒕_𝑨𝟏−𝒕_𝑩𝟏)+|𝒕_𝑪𝟏−𝒕_𝑫𝟏|/(𝒕_𝑪𝟏−𝒕_𝑫𝟏)+|𝒕_𝑨𝟏−𝒕_𝑫𝟏|/(𝒕_𝑨𝟏−𝒕_𝑫𝟏)+|𝒕_𝑪𝟏−𝒕_𝑩𝟏|/(𝒕_𝑪𝟏−𝒕_𝑩𝟏 )
+|𝒕_𝑨𝟐−𝒕_𝑩𝟐|/(𝒕_𝑨𝟐−𝒕_𝑩𝟐)+|𝒕_𝑪𝟐−𝒕_𝑫𝟐|/(𝒕_𝑪𝟐−𝒕_𝑫𝟐)+|𝒕_𝑨𝟐−𝒕_𝑫𝟐|/(𝒕_𝑨𝟐−𝒕_𝑫𝟐)+(|𝒕_𝑪𝟐−𝒕_𝑩𝟐|)/(𝒕_𝑪𝟐−𝒕_𝑩𝟐 )
If R>0, IN and if R<0, OUT
And there is one more reason for using four ultrasonic sensors. That is to measure multiple people. Usually one person passes by between the doors, but two dry men can pass by, and several people can pass by. We used width to solve this problem.
𝒅_𝒘= 𝒅_𝑻−(𝒎𝒊𝒏(𝒅_𝑨 )+𝒎𝒊𝒏(𝒅_𝑪 ))
𝒅_𝒘 is width of passing people
The second method is classificate using Random Forest (RF) which is one of machine learning algorithm. RF is ensemble method of decision trees. It gives pretty high performance. We provide 2800(1400 each class) dataset, and already implementated in example code our pre-train RF model by this dataset. Pre-train model was trained by Treebagger function of MATLAB software, and the number of trees are 50.
The model that we provide is perfect adapted in our environment, so it might shows bad performance in your testbed. Therefore, if you don't want to use our RF model, then you can collect your own dataset and train model.
The environment for our performance testing is as follows :
room 306-B, IT building, Gachon University, Republic of Korea
We set 200 times as a test case and tested it several times. And the test results of one person passing door, the average error rate is 0.01. In other words, there are 1 to 3 errors in one test case (200 times). And test results of several people passing door, the average error rate is 0.06. You can also expect similar accuracy if you set the environment properly and apply the software.
If the error rate is too high, it is recommended that the position of the ultrasonic sensors be well set again. This is because ultrasonic sensors are very sensitive.
Click to link detail Specification.
- Arduino UNO X 1
- HC-SR04 Ultrasonic Sensor X 4
- PHPoC Wi-Fi Shield X 1
- Jumper Cable (as much as you need)
- Arduino Chassis (3D printed)
- Battery X 1
- Android Mobile Phone
Click to Download software.
- Arduino 1.8.2 (Arduino IDE Sketch)
- Android Studio 2.3.2 (Android programming IDE)
- MATLAB R2017a (License needed)
For signal processing - Web Server
Hosting - Hostinger
PHP
MySQL
-
Arduino
Open-source electronic prototyping platform enabling users to create interactive electronic objects. -
PHPoC
PHPoC Shield for Arduino connects Arduino to Ethernet or Wi-Fi networks. -
NewPing
NewPing is Arduino IDE library for easy control ultrasonic sensors. -
SPI
Serial Peripheral Interface (SPI) is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices quickly over short distances. -
Sketchup
SketchUp is 3D modeling software that's easy to learn and incredibly fun to use.
We have a core project team composed of:
Amber Cho - Founder/Lead
westbro00@naver.com
Amber is a Software Engineer and UI Designer. She always wants to be a competent developer than now, so she is coding today as well. And that her effort are contributing to the team.
Chris Yang - Founder/Lead
ysm0622@gmail.com
Chris is a Software Engineer and Data Scientist. He loves everything related to computers and data science. His goal of his life is to make small changes in human lives with use of the knowledge he knows.
Martin Kim - Founder/Lead
skins346@naver.com
Martin is a Software Engineer. He oversees the project direction, maintenance and organizes the planning and development efforts of the team.
- A Real-Time People Counting Algorithm using Ultrasonic Sensors (2016), [pdf]
- Design and Performance Comparison of Machine Learning Model for Time Series Data Classification (2017), [pdf]
- This project is licensed under the MIT License - see the LICENSE.md file for details.
MIT License
Copyright (c) 2017 PEOPLE-INSIDE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.