{"id":524,"date":"2024-04-16T16:27:28","date_gmt":"2024-04-16T14:27:28","guid":{"rendered":"https:\/\/www.hh3dlab.fi\/blog\/?p=524"},"modified":"2024-04-16T16:34:31","modified_gmt":"2024-04-16T14:34:31","slug":"524","status":"publish","type":"post","link":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/524\/","title":{"rendered":"Person counter for the 3D + Robo Lab"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>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.<\/p>\n<p>In our team we have Markus who is a student at Haaga-Helia and he is very passionate about 3D printing.<\/p>\n<p>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.<\/p>\n<p>Youmna is also a second-year student in Haaga-Helia&#8217;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.<\/p>\n<p>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.<\/p>\n<h1>Ideas<\/h1>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<h1>The building phase<\/h1>\n<p>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.<\/p>\n<figure id=\"attachment_526\" aria-describedby=\"caption-attachment-526\" style=\"width: 225px\" class=\"wp-caption alignnone\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-526\" src=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload1.png?resize=225%2C300&#038;ssl=1\" alt=\"First test device\" width=\"225\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload1.png?resize=225%2C300&amp;ssl=1 225w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload1.png?w=298&amp;ssl=1 298w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><figcaption id=\"caption-attachment-526\" class=\"wp-caption-text\">First test device<\/figcaption><\/figure>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<figure id=\"attachment_527\" aria-describedby=\"caption-attachment-527\" style=\"width: 532px\" class=\"wp-caption alignnone\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-527\" src=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload2.jpg?resize=532%2C340&#038;ssl=1\" alt=\"Version 2\" width=\"532\" height=\"340\" srcset=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload2.jpg?resize=300%2C192&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload2.jpg?resize=768%2C492&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload2.jpg?w=886&amp;ssl=1 886w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><figcaption id=\"caption-attachment-527\" class=\"wp-caption-text\">Version 2 with lasers<\/figcaption><\/figure>\n<p>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\u2019s going to work there and if it\u2019s able to count people.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<figure id=\"attachment_528\" aria-describedby=\"caption-attachment-528\" style=\"width: 225px\" class=\"wp-caption alignnone\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-528\" src=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload3.png?resize=225%2C300&#038;ssl=1\" alt=\"3D printed laser mounts\" width=\"225\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload3.png?resize=225%2C300&amp;ssl=1 225w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload3.png?w=313&amp;ssl=1 313w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><figcaption id=\"caption-attachment-528\" class=\"wp-caption-text\">3D printed laser mounts<\/figcaption><\/figure>\n<p>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.<\/p>\n<p>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<\/p>\n<p>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.<\/p>\n<h1>The outcome<\/h1>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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\u2019s strengths to reach the end goal successfully.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,3,17,19,39,20,38],"tags":[],"class_list":["post-524","post","type-post","status-publish","format-standard","hentry","category-3d","category-3d-robo-lab","category-3d-printing","category-arduino","category-blog","category-esp32","category-ultrasonic-ranging"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":5,"url":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/tervetuloa-haaga-helian-3d-robo-labiin\/","url_meta":{"origin":524,"position":0},"title":"Haaga-Helia 3D + Robo Lab equipment","author":"Heikki Hietala, lab admin","date":"13.3.2022","format":false,"excerpt":"Haaga-Helia 3D + Robo Lab is the 3D, robotics and IoT research lab at our University. 3D is a family of technologies that can be seen to affect every field of business today. Virtual reality, augmented reality, mixed reality, 3D modeling, scanning and printing open new business opportunities every day.\u2026","rel":"","context":"In &quot;3D + Robo Lab&quot;","block_context":{"text":"3D + Robo Lab","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/3d-robo-lab\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":268,"url":"https:\/\/www.hh3dlab.fi\/blog\/madrid-2022\/team-5-introduction\/","url_meta":{"origin":524,"position":1},"title":"Team 5 &#8211; Introduction","author":"Madrid Team 5","date":"30.3.2022","format":false,"excerpt":"Hello all, this is an introduction post to Team 5 for Madrid seminar 2022. Our group of students from Haaga-Helia UAS will go to Madrid seminar to teach other students how to build an IoT device that sends GPS, temperature etc. data to the server and displays the information on\u2026","rel":"","context":"In &quot;ESP32&quot;","block_context":{"text":"ESP32","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/esp32\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20220328_161500-2-scaled.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":388,"url":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/3d-robotics-mum8ta004-dat-nguyen\/","url_meta":{"origin":524,"position":2},"title":"3D + Robotics MUM8TA004 \u2013 Dat Nguyen","author":"Heikki Hietala, lab admin","date":"12.11.2022","format":false,"excerpt":"Introduction Hi, my name is Dat, second-third year student at Haaga-Helia. My goals for the course are to get broad understanding of 3D Robotics and to benefit myself, as well as to satisfy my curiosity. The only challenge I have at the moment is I didn't have that much experience\u2026","rel":"","context":"In &quot;3D + Robo Lab&quot;","block_context":{"text":"3D + Robo Lab","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/3d-robo-lab\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/11\/image.png?fit=1004%2C753&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/11\/image.png?fit=1004%2C753&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/11\/image.png?fit=1004%2C753&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/11\/image.png?fit=1004%2C753&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":481,"url":"https:\/\/www.hh3dlab.fi\/blog\/uncategorized\/irrigation-project\/","url_meta":{"origin":524,"position":3},"title":"Irrigation project","author":"Heikki Hietala, lab admin","date":"1.6.2023","format":false,"excerpt":"Group members: Sara, Youmna, Anna, Olympe Introduction Hello! We are four students who worked together for five months on an interesting project for our Innovation and Prototyping course at Haaga-Helia. We all have different backgrounds, but we managed to combine our strengths to work together and to get this project\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2023\/06\/image-21.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":396,"url":"https:\/\/www.hh3dlab.fi\/blog\/blog\/moon-phases-matrix\/","url_meta":{"origin":524,"position":4},"title":"Moon Phases Matrix","author":"Heikki Hietala, lab admin","date":"12.12.2022","format":false,"excerpt":"by Aliisa Myllym\u00e4ki Introduction Hello, I\u2019m a second-year student at Haaga-Helia, named Aliisa. I have no previous experience with robotics, so I started this course as a blank canvas, open to learn anything and everything. I took this course to see if robotics were something I would feel drawn to,\u2026","rel":"","context":"In &quot;blog&quot;","block_context":{"text":"blog","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/12\/image.png?fit=639%2C922&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/12\/image.png?fit=639%2C922&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/12\/image.png?fit=639%2C922&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":533,"url":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/iot-space-adventure-developing-a-retro-arcade-style-handheld-gaming-device-with-esp32-and-fun-controls\/","url_meta":{"origin":524,"position":5},"title":"IoT Space Adventure: Developing a retro arcade style handheld gaming device with ESP32 and fun controls.","author":"Heikki Hietala, lab admin","date":"16.4.2024","format":false,"excerpt":"Introduction Video demonstration: https:\/\/www.youtube.com\/watch?v=9Bk4u3yt4mI GitHub repository: https:\/\/github.com\/Gianou\/Haaga-Helia-IoT-Experimental-Project Our team consisted of three students: David, Isabelle, and Sara. We have diverse backgrounds and sets of skills within IT. 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\u2026","rel":"","context":"In &quot;3D&quot;","block_context":{"text":"3D","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/3d\/"},"img":{"alt_text":"Idea lists","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/04\/upload-4-205x300.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/comments?post=524"}],"version-history":[{"count":4,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/524\/revisions"}],"predecessor-version":[{"id":532,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/524\/revisions\/532"}],"wp:attachment":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/media?parent=524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/categories?post=524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/tags?post=524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}