Person counter for the 3D + Robo Lab

Introduction

Hello! Our team consists of four students who worked together on a project for our 3D and Robotics course at Haaga-Helia. Although the four of us come from different backgrounds, we managed to combine our strengths to work together to get this project done.

In our team we have Markus who is a student at Haaga-Helia and he is very passionate about 3D printing.

Sara is a second year Business Information Technology student from Haaga-Helia. Her major is in digital services and design, but she studies Front-end programming as her minor. She has had some prior experience in robotics, mostly in working with Arduino Uno, ESP32 and different kinds of sensors.

Youmna is also a second-year student in Haaga-Helia’s business Information Technology program. Her major is Digital services. She has worked with Arduino and ESP32 on a previous course, but working with sensors was a new experience for her.

Alisa is a fourth semester student in the same program majoring in software development. She had some basic knowledge of robotics and no experience of 3D printing, so that was quite an interesting journey for her.

Ideas

The idea of building a device that tracks the number of people present in the lab was suggested by our teacher. The device would assist the teacher to stay informed on lab occupancy and send timely updates about the number of people present at a given time.

This project is an opportunity to enhance our knowledge regarding ESP32, C programming language and it will allow us to acquire an understanding regarding sensors, photoresistors and 3D printing.

The scope of this project is to build a system using ESP32 that keeps track of lab occupancy. The system will be developed using laser-based sensors and photoresistors which will be designed to count the number of people entering and exiting the lab in real time. The project will consist of calibrating sensors to catch accurate movements, design and 3D print hardware for sensor placement, developing a code as well as testing the functionality of the whole system.

The goal is to build a system using sensors and photoresistors compatible with ESP32 and calibrating them to ensure that any disruptions in light due to movement is measured accurately. A code will be developed to communicate with the sensors and store data based on light changes that will accurately count and display the number of people present in the lab. Rigorous testing will be conducted in a controlled environment initially to ensure that the readings from the sensors are reliable before installing it at the entrance of the lab.

Beyond the main goal of building a reliable lab occupancy system, the aim is to work effectively in a team and overcome any challenges of the project together. We aim to have clear and effective communication within the group while ensuring that all the tasks are completed, and deadlines are met.

The building phase

The beginning phase of the project was initiated by wiring two HC- SR04 ultrasonic sensors to the Arduino Uno board. Both sensors on Arduino Uno were tested followed by discussions on how the system should function eventually. Initially, the plan for the device was to attach sensors to the ceiling pointing down to the floor. The sensors would have been placed just outside the classroom door and one would be located just inside the classroom. Meanwhile, we continued working and testing the code for the device. One of the biggest challenges for us was to figure out how to catch the movement of people entering and exiting the lab.

First test device
First test device

To determine which sensor was triggered first we used the millis() function that we saved into a variable for each sensor in the loop and after that, we compared them to each other to find the smallest value as the first triggered sensor.

To increase the device accuracy, a decision to switch from using ultrasonic sensors to photoresistors was made by the group. This plan consisted of having laser pointers directed at photoresistors to provide a consistent amount of light exposure. Each time the light was disrupted by any movement, it could be assumed that a person was either leaving or entering the lab.

The process of building a testing environment for the device was initiated. This consisted of a simple cardboard box and tape to hold the sensors in place so that the light from lasers was pointed directly at photoresistors and would catch any movement.

Our initial goal was to switch to esp32 and after testing the sensors we decided that it is time to do that as it has built-in Wi-Fi capabilities, low power consumption, and higher processing power compared to the Arduino Uno.

Version 2
Version 2 with lasers

The next part was to edit the code so that the device would reset after 4 hours of no activity for it to not measure the distance all the time when everyone left. After testing the code in the environment, we started working on moving the device with sensors to the entrance of the classroom to test how it’s going to work there and if it’s able to count people.

For the lasers and photoresistors, we had to print holders so that we could attach them to walls. Printing took quite a long time as not always the results of printing were solid enough or sometimes, we had to adjust the size multiple times and reprint the holders. Also attaching it to the walls was a struggle as our solution was to attach it with a strong tape, which was not enough for a quite heavy laser as it was moving a bit after a while, and the laser was not centered anymore, so the photoresistor was not getting the light and it was impossible to count the movement.

Another problem was that photoresistors kept breaking and we had to place it approximately 4 times as the only value it would give to us was 0.

3D printed laser mounts
3D printed laser mounts

Extensive testing was carried out to ensure that the movement of a person walking in was captured by the sensors accurately and the person did not have to speed up or slow down.

In the final stage of testing with sensors set at the place, we found out that there is a latency problem that makes it impossible to count people walking at the average speed. For the photoresistor to establish the change it requires an object to stay at that for a second, which means that each student has to stop twice in front of each sensor. To battle latency issues, our teacher found laser sensors that provided more accurate readings and were not sensitive to daylight. Also, the sensor placement was changed to give more space between the sensors

The code for Wi-Fi and database connection was provided by the teacher and it was implemented in the code at the end stages so that the data collected could be sent to a server.

The outcome

In the process of creating a system that detected the movement of people entering and leaving the lab, our team gained valuable learning experiences and overcame various hurdles. Pivoting from the initial idea of using ultrasonic sensors and photoresistors towards a more accurate solution of working with laser-based sensors was a major turning point of the project. The tests regarding the readings had to be conducted in a controlled environment and multiple iterations were made to achieve the desired outcome. 3D printing the holders was also a time-consuming task that required designing and several attempts to build a stable and secure fit that could withstand the weight of the sensors. Implementing the code to ensure the accurate functionality of the system and installing the device at the entrance of the lab required several iterations. This part was essential to the project as the movement caught by sensors and the readings had to be accurate for the project to be successful.

Despite the challenges at every step of the project, the team succeeded in achieving the goal of building a device that accurately counts the number of people present in the 3D lab at a given time. This was possible due to continuous hard work and enthusiasm from team members.

The process of completing this project was collaborative and exciting. We acquired problem-solving skills, group communication skills and valuable teamwork skills and used everyone’s strengths to reach the end goal successfully.

This project not only gave us the opportunity to understand this specific dialect of C programming language, the functionality of ESP32, different sensors and photoresistors but also sparked our interest to take further courses that will strengthen and deepen our knowledge in the area.

From the conception to the implementation of the idea, we are pleased with the result of our project, but with every project there is room for further improvement here too. Due to time constraints, we were not able to perform extensive testing after implementing the Wi-Fi and database connection in the code. The sensors had to be reconstructed and their placement had to be changed towards the end of the project, which left no time for us to make changes to the code that was commented out. The feature that if the sensors have not been triggered for 4 hours the people sum should be changed to 0 needs to be reintroduced. The project works but it is incomplete so the points mentioned would need to be done for it to become a usable, reliable system.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.