2021-EFREI-M1-SmartCount
This project has for objective to create a counter for shops. The counter will be at the entrance of a shop and count how many people are inside the shop by inscreasing when the entrance captor detect someone and decreasing when the exit captor detect someone. It will print on an web interface the number of people inside and if it's a "green", "orange" or "red" value.
Slides & Videos
Members
Name | Contribution |
---|---|
Elise Boudjema | With my partner, we did almost all the same part together. But if we need to be more specific, I worked more on the algorithm of the ESP32, and on the web interface. I also helped to fill this report, especially technical parts. |
Justine Lam | With my partner, we did almost all the same part together. First, having the idea, then finding and assembly the materials, after that make the program work. But I mainly took care of the operation of the circuit with the two sensors and try to make it the more optimal as possible. Finally we fill the slides and report. |
State of the Art
Business Aspect
How does it work ?
It's a simple counter. It counts every person that enters in a room.
One of the two devices must be placed on one side of the door and the other on the other side.
There are even other solutions for this :
thermal cameras : very precise, works with thermal detection and can detect human forms.
Infrared captors : they are very discret and can be installed on the ceiling of the shop. It detect movements of customers.
Manual count : hire a staff member specialy for counting entrance and manage the number of people inside. A lot of stores actually use it. It's reliable and efficient but not very cheap.
How much does it cost ?
This system is expensive. In fact, only for a simple counter, you may plan from 100e to 400e in average.
For cameras and infrared captors, you may count around 500e to cover your shop. It's very expensive.
For the manual count, you must pay someone at least the minimum salary which is, in france around 10e/hour : it's very expensive !
The ultrasonic sensors are the cheaper solution but not the most accurate.
Differences and similarities with our project :
With our project, you can detect if it is an entrance or an exit. The people counter that already exists, permit only to detect if a person is crossing the door.
Our project is performant because it detects people that are entering and people that are leaving, and it prints the numer of people inside the shop in a real time.
Cameras are really performant, and as our project, it can detect the entrance and the exit of people.
The manual count too. But these two solutions are really expensive compared to the SmartCount.
Infrared captor are usually not very efficient in situations of two people entering or going out at the same time, and usually there are optimal for two-doors shops and not for unique door shops.
Technical Aspect
Project Description
Problem Definition
Challenges & Motivation
The main challenge was to create a counter that will work on a unique door. It is very easy to place a captor on the entrance door and another on the exit door. The challenge was to have the same door for entrance and exit and to have a prototype that could count accurately the number of people inside. I think that we made it work pretty good.
Real and Complete Usecases
Main use case :
The principal use case of our project is to count the exact number of people that are inside a shop. In fact, with covid-19, shops have now a restriction in the number of people inside. Our project can count, for a low price, the number of people inside a shop, and print it into a web interface.
We also progammed a color indicator to see if the number is close to its limit or not. In facts, we programmed it to be green between 0 to 7 people, orange between 7 to 9 and red for 10 or more people. But we can change this very easily in the code. This indicator allow staff members of the shop to see very quiclky if there are too many people in their shop, or if it is still okay.
With that, they can regulate more easily the number of people. They can also change the limit of the different colors very easily in the web interface code.
Technical Description
Creation of the circuit and programmation of the card
The first step was to decide what component we were going to use for this project. We decided to use the HC SR04 ultrasonic captors to measure the distance between them and the fist obstacle encountered. So we tried it on a arduino card and understand how it was working.
The Trigger terminal is used to send the signal which will allow the distance between the sensor and the obstacle encountered to be measured.
Echo when it allows it to return the value containing the distance between the sensor and the obstacle encountered. So we need both of it
The second step was to find a way to know who was entering in the shop and who was going out. For that, we added a second ultrasonic sensor and make it work with the first. We had to find an algorithm that detects which one of the two sensor was being activated in first, to increment or decrement the counter.
For this, we find this algorithm :
if(distance1 < 100 && distance2 > 100) { // si le capteur 1 réagit en premier
visitor = visitor + 1; // ALORS on ajoute +1 a la variable visitor
}
if(distance1 > 100 && distance2 < 100) { // si le capteur 2 réagit en second
visitor = visitor – 1; // ALORS on enleve 1 a la variable visitor
}
How does it works ?
For the incrementation : we need the captor 1 to be closer from the obstacle than the captor 2. When the captor 1 detects a person before the captor 2 (that means that the distance between the obstacle and the captor 1 will be smaller than the distance between the obstacle and the captor 2 at the same time), that means that someone is entering in the shop and the counter of visitors get +1.
At the opposite, if the distance between the obstacle and the captor 2 is smaller than the distance between the obstacle and the captor one, that means that someone is going out and so the counter is getting -1.
For more performance, we can place the two captor with a small angle and not at 180°. If we place them at like 200°, the difference of distance will be even more accurate. Sadly, with our material, we couldn’t do it.
Programmation of the web interface and connecting the two sides
Being not really good programmers, we decided to use a web interface. We know how to print elements in a web page using HTML, CSS and Javascript for some functions. Our interface is very simple, but it works well.
HTML file : Permit to link css file and javascript file
Introduces simple text and the image of the counter.
Css file : handles only the style (color, shape and size of elements)
Javascript file : here we have most important part of the interface. The javascript file collects the data from the ESP card every 1500 ms and print it on the interface.
We also implemented the function to print the color of the led : ledColor().
This function check the value of NbPersonnes and in function of the value, set the color to green, orange, or red (as I explained it before).
These three files are the construction of the web interface.