scieee AI-readable full text Open interactive document viewer

A Low-Cost Control Occupancy Solution Using a Time-of-Flight Ranging Sensor Laser

Bartrés Jurado, Enric; Trilles, Sergio; Perez-Navarro, Antoni; Torres-Sospedra, Joaquín

Abstract

The pandemic situation has driven to several measures to prevent the spread of COVID-19. One of these measures is social distance and, as a consequence, limitation of capacity of indoor closed spaces. This makes necessary the deployment of systems that help to control occupancy of spaces. This work proposes a low-cost system to control access to an indoor closed space with a single door. The system is based in a two laser Time-of-Flight sensors VL53L0X over a HiLetgo UNO R3D1R32 ESP32 microcontroller. The system counts the occupancy of the room and share it with a database and a dashboard, using Node-RED. The tested prototype shows a 86.6% reliability that increases to a 100% reliability when users are informed to enter or exit one by one. The main contributions of this work are: to control capacity of one-entrance indoor closed space with a low cost open system; and to record occupancy of the room in order to analyse it behaviour with time.

Full text

A Low-Cost Control Occupancy Solution Using a Time-of-Flight Ranging Sensor Laser Enric Bartrés Jurado1,Sergio Trilles Oliver1,2,Antoni Perez Navarro1,3 and Joaquín Torres-Sospedra4 1Faculty of Computer Sciences, Multimedia and Telecommunication, Universitat Oberta de Catalunya, Barcelona, Spain. 2Institute of New Imaging Technologies, Universitat Jaume I, Castellón, Spain. 3Internet Interdisciplinary Institute (IN3), Universitat Oberta de Catalunya, Castelldefels, Spain. 4UBIK Geospatial Solutions S.L., Castellón, Spain. Abstract The pandemic situation has driven to several measures to prevent the spread of COVID-19. One of these measures is social distance and, as a consequence, limitation of capacity of indoor closed spaces. This makes necessary the deployment of systems that help to control occupancy of spaces. This work proposes a low-cost system to control access to an indoor closed space with a single door. The system is based in a two laser Time-of-Flight sensors VL53L0X over a HiLetgo UNO R3D1R32 ESP32 microcontroller. The system counts the occupancy of the room and share it with a database and a dashboard, using Node-RED. The tested prototype shows a 86.6% reliability that increases to a 100% reliability when users are informed to enter or exit one by one. The main contributions of this work are: to control capacity of one-entrance indoor closed space with a low cost open system; and to record occupancy of the room in order to analyse it behaviour with time. Keywords Occupancy control, Internet of Things, open-hardware, Sensor systems 1. Introduction Among the main measures applied to fight against COVID-19 is the use of mask, the closure of public spaces (children’s parks, sports venues, libraries, ...), restrictions on mobility (border control, perimeter restrictions,...) or occupancy restrictions [ 1 ]. Some of these measures are due to maintain social distancing since it has been one of the more successful measures to stop the pandemic [2]. Occupancy restriction in indoor spaces allows to maintain social distancing and also helps to keep those spaces well ventilated. To control that capacity of spaces is not exceeded, several techniques have been developed in a short time [ 3 ]. This rapid adaptation has been possible thanks to the high degree of advancement in the Internet of Things (IoT) paradigm and the availability of sensor devices [ 4 , 5 ]. This scenario has facilitated the deployment of devices capable of monitoring and acting remotely to control different established restrictions. Regarding occupancy control, several solutions had been applied to detect occupancy in buildings to reduce energy costs [ 6 ]. These technological solutions are based on RGB cameras IPIN 2021 WiP Proceedings, November 29 – December 2, 2021, Lloret de Mar, Spain ©2021 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings http://ceur-ws.org ISSN 1613-0073 CEUR Workshop Proceedings (CEUR-WS.org) [ 7 ], break-beam sensors, Ultrasonic sensors [ 8 ], temperature sensors, light sensors, WiFi sensing [ 9 ] or ultra-wideband (UWB). All these technologies are detailed and compared deeply in Section 2. In this work, we propose a solution to control occupancy in a closed space ( room ) with a single entrance and exit. The platform proposed is a low-cost system based on open-hardware and open software components, with a management control panel. The solution presented is not intrusive for users and allow to perform real-time control of room capacity. The system proposed has two parts: a hardware device, that is based on HiLetgo UNO R3 D1 R32 ESP32 and the Time-of-Flight (ToF) ranging laser distance sensors called VL53L0X ; a back-end platform, developed in Node-RED, that obtains the number of people in the room from the hardware and shows the information in a comprehensive way. Tests were performed in a hospital room located in Hospital de Mataró (Catalunya, Spain) is used as an experimentation scenario. In summary, the main contributions of this work are: (1) to develop a prototype capable of counting the people entering and leaving an enclosed space, thus allowing the control of capacity automatically; (2) propose a generic solution without any additional element for people; (3) define a low-cost solution using open hardware and open software; and (4) record and visualise the data of the occupancy for future research studies. 2. Background Occupancy control has been a topic of interest for different reasons: security, since it allows to control that the number of people in a space that not exceed capacity; traceability since it allows to know occupancy levels and thus making informed decisions; and finally, satisfying laws regarding regulate occupancy control systems, like law 11/2009 [ 10 ] of the Government of Catalonia. The most common tools for occupancy control are: (1) mechanical, like a clicker counter that counts +1 or −1 every time a human counter presses a button when a person enters or leaves the closed location, or the turnstiles; (2) electronic devices that automatically controls the number of people that enters or leaves a closed location, based on sensors, cameras or wireless signals; and (3) a reader that counts people reading single-person identifiers, such as bracelets. In the mechanical sensors category, turnstiles allow for counting without human intervention, and are very common in sports centres or theme parks [ 11 ]. However, they are an invasive system and with a very high cost. A recent technology is the pressure mats [ 12 ]. This device allows identifying the number of people going through it thanks to a series of pressure sensors that incorporates the same carpet. This technology is quite recent and its cost is very high compared to other technologies. Within the second category, there are many solutions and types of sensors that can detect people. These are divided into active, passive and mixed sensors [ 13 ]. There are several types of active sensors depending on the type of signals. The sensor sends a signal that must bounce on a surface at a known distance, if something interferes with the signal the sensor detects a change in the return time of the signal. The most commonly used signals are microwaves and ultrasounds [ 14 ]. In the same category, there are also reflective sensors, which use beams Table 1 Different technologies to control occupancy in a room Technology Feature Cost(e, sensors only) Privacy Scalability Deployment Ultrasonic/ Microwaves sensors Counting <10 High Moderate Moderate Break Beam sensors Counting <10 High Moderate Moderate PIR sensors Presence <10 High Moderate Moderate Turnstiles Counting < 20.000 High Low Difficult Pressure mats Counting High, depending the area to cover High Low Difficult RGB cameras Counting <100 Low Moderate Moderate Thermal cameras Counting <80 Moderate Moderate Moderate RFID Counting < 10 without tags/cards Low Moderate Moderate WiFi signals Counting <100 Low High Easy Our (ToF sensors) Counting <50 High High Moderate of light with an emitting device and a receiver, if this beam of light is crossed by an object, a person is detected [15]. Passive sensors are the most common in domestic security systems. These systems, also called Passive InfraRed (PIR), detect changes in movement or heat through infrared [ 8 , 16 ]. These sensors are called passive because they do not emit radiation, but receive them. They are composed of an electronic component designed to detect changes in the infrared radiation received. They generally incorporate a transistor that amplifies the electrical signal generated when this variation in radiation received occurs. RGB or thermal cameras are intended to count the number of people passing through a given place using the corresponding software [ 17 ]. Unlike thermal cameras, RGB cameras can be affected by lighting conditions. The main disadvantage for both types is the cost. WiFi signals have also been used to detect presence. The Received Signal Strength Indicator (RSSI) values generated by the WiFI signals have been used to count the number of people walking through the specific area [ 6 , 18 ]. Although this approach is not invasive, the user must have a device that generates WiFi signals. Finally, in the third category, Radio Frequency IDentification (RFID) readers are a system that uses tag or card devices [ 19 ]. This system could be used to count people and also identify them, but an RFID tag or card should be provided to all people who need to access it. Thus, this is a system that is more used to count objects with a tag, than people. Table 1summarises each technology applied in the field of occupancy control. It shows Technology; Feature, if counts people or detects their presence; Cost; Privacy, where Low means that is easy to know who a single person is, and High is that it is not possible to identify people; Scalability, where Low means that is difficult to increase the number of persons counted; and Deployment, where Easy means that the effort to deploy the system is low. This work focuses on devices in the second category, i.e, electronic devices that automatically control the number of people that enters or leaves a closed location. In the next section, the system proposed will be shown. 3. Method This section focuses in the design of the proposed solution. Figure 1shows a general overview with all the elements of the system. The system is based on two main parts: the IoT-physical and the Cloud/Clients cyber. Figure 1: General overview The Physical scope, on the right side of the dashed line (Figure 1), represents IoT devices from the hardware perspective. Two layers are included in this part: network and perception layers. These two layers cover the IoT devices and, depending on the capabilities of each device, how they can connect to count persons. Moving to the left part of the figure, for the Cyber scope, two layers are presented in two different environments, cloud and client. In the cloud part, it is formed by different components that we can classify into two distinct layers: Data and Services. One entry point to the service layer is a broker [ 20 ]. This component allows connecting with different IoT devices by using multiple protocols. It can support some well-known protocols, such as Message Queue Telemetry Transport (MQTT), Advanced Message Queuing Protocol (AMQP) and Simple (or Streaming) Text-Oriented Message Protocol (STOMP). This broker is used as a link to connect the software platform-logic with IoT devices. There is a double connection between the two sides, and it can receive data from the IoT devices, as well as send data to them. The broker offers a message queuing system. It provides some benefits such as delivery order and delivery guarantee, redundancy, interface decoupling, flexibility and scalability. The main component in the services layer is the Event-Driven-Application. It offers different capabilities or operations to fulfil all functional requirements. These capabilities have been divided into two distinct groups. The first group is the persistence layer to store permanent data from the perception layer and other generated data. These data are stared in the Data layer and are divided into two categories: counting data and auxiliary data. The first group consists of all the data provide by the IoT devices from the perception layer. The second group, auxiliary data, stores the maximum occupancy levels for each room to control. Finally, moving up to the top of the diagram, the software platform layer connects with the applications and business layer. This last layer will contain applications to visualise and interact with all the functionalities provided by software platform. This layer provides a productive and useful view for an end-user. 4. A technological solution This section provides a technological proposal to clarify the agnostic concepts detailed in Section 3. In this way, two main components have been developed, the IoT detection device and a software platform. The hardware device is built using a micro-controller where two ToF sensors are connected. These sensors count when someone enters or leaves the room and is responsible for knowing at all times the current occupancy, and sends it to the server-side. The software platform has two main components: a pub-sub server, and a dashboard. The pub-server, hereinafter Broker, used to transfer messages between the detection device (the micro-controller) and the server-side. The server is also responsible to send to the microcontroller the maximum value, which is stored in the database. Data of the occupancy of the room is also stored in the database, in order to know the evolution of occupancy of the room with time. The dashboard displays all information generated, including the occupancy values and allows to manage capacity. The following subsections describe at a technological level how each of the parts has been developed and the testing facilities. Figure 2presents a general summary of all technologies used to develop the system. 4.1. IoT detection device To create the prototype, we have opted to use an electronic board called HiLetgo UNO R3 D1 R32 ESP32 . This electronic board includes an ESP32 processor that has WiFi and Bluetooth and is compatible with Arduino. Two ToF active laser infrared sensors that allow precise distances called VL53L0 model are used. A first prototype was made with ultrasound sensors connected to an Arduino UNO. This prototype provided a solution to the problem, but in a noisy environment, these sensors give false positives and false negatives making it very difficult to control and considerably increase the margin of error and reducing reliability. For this reason, the solution is finally implemented with sensors VL53L0X which are laser ToF. The VL53L0X sensor is part of the new generation of ToF sensors. It offers accurate measurements regardless of the reflecting surface with a measuring range of 50 mm up to 2 m . The principle of operation of this sensor is similar to that of ultrasonic sensors: the sensor has a laser emitter that emits a beam of light from time to time. When the laser reflects in an object, the sensor can measure the time between the emission and detection of light and since the speed of light is a known value, the distance to the object can be obtained applying kinematics: Figure 2: A general overview of the full system from a technological point of view. 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒 =𝑐· 𝑡𝑖𝑚𝑒 𝑜𝑓 𝑓𝑙𝑖𝑔ℎ𝑡 2(1) where 𝑐 is the speed of light and 𝑡𝑖𝑚𝑒𝑜𝑓𝑓𝑙𝑖𝑔ℎ𝑡 is the time between the emission and the measure. It is divided by 2to take into account that the return trip of the beam. The VL53L0X chip has been designed to work even when the ambient light is high. This is important because to work with optical measurements the greater the light pollution of the environment, the more difficult it is to properly capture the rebound of the signal. The operation of the detection device is as follows: the micro-controller receives signals from both sensors when an object (a person) is placed in front of them. The first sensor that detects the obstacle gives information about if the person is entering or leaving the room. The micro-controller uses WiFi connectivity to establish a connection to the server-side. The pseudo-code for the behaviour of the device is shown below. When the microcontroler starts, makes a query to the database and obtains the maximum number of people allowed and the number of people inside the room. This makes the system robust to unexpected reinitializations. These checks are programmed within the setup() function, as can be seen in Algorithm 1. The cost for the implementation of the final prototype can be seen in Table 2. Algorithm 1 Operation of the micro-controller algorithm Declaration of required libraries Definition of variables and objects function Setup() Connecting the board to WiFi Connection of the board to the broker, at this point the topics to which you are subscribed are checked and the values in the database are retrieved, both of the people inside and the capacity of the room1. Sensors initialisation end function function Loop() Check sensor distances if If the sensor 1 distance is smaller than the width of the passage then It means that someone is entering end if if If during 5 seconds the sensor 2 distance is smaller than the width of the passage after passing sensor 1 then It means that someone has entered, a new person is counted and the total is sent to the broker. end if if If the sensor 2 distance is smaller than the width of the passage then It means that someone is entering end if if If during 5 seconds the sensor 1 distance is smaller than the width of the passage after passing sensor 2 then It means that someone has left, a person is subtracted to the total people and the total is sent to the broker. end if end function Table 2 Cost of hardware components Component Cost (e) HiLetgo UNO R3 D1 R32 ESP32 micro-controller 10.49e DuPont cables 6.99e VL53L0X ToF sensors 24.99e Total 42.47e 4.2. Software platform: Eclipse Mosquitto and Node-RED The micro-controller communicates via MQTT [ 20 ] with the server using the Broker. MQTT is a client-server message transport protocol based on publications and subscriptions called topics . This makes it suitable for IoT messages 2 , as is the case with the interaction of low-power sensors or plates with micro-controllers. Specifically, it implements Eclipse Mosquitto as a broker which is open source (licensed EPL/EDL) and works with versions 5.0, 3.1.1 and 3.1 of the MQTT protocol. The software used to deploy the even-driven application is Node-RED. It is a programming tool for interconnecting hardware devices, APIs, and online services. This tool allows to visually program a web browser-based workflow where nodes can be added or removed or connected to each other so that they can communicate among themselves in real-time. Figure 3shows a flow created with Node-RED. In the flow there are MQTT nodes that allow establishing a connection with the Broker, that manages the received and sent information; to establish a connection with the database, and to show and to collect information in the 2Grouping and interconnecting devices and objects over a network, where they can all be visible and interact. dashboard. Figure 3: Flow created with Node-RED for the device. To give consistency and traceability to the entire flow, the data collected by the electronic board through the sensors is stored in a database. This is a MySQL database and consists of two tables. The table ROOM where the name and the capacity of the room are stored and the table PERSON where the total people are stored ( peopleInside ) inside the room every time someone enters or leaves and the date and time ( dateTime ) at the time it passes. From Node-RED, records are inserted and consulted in the database. The following table shows the SQL statements 3 When the Broker reports the people inside the room, the counter and the dashboard graph are updated. The dashboard is the graphical interface that is also generated with Node-RED, as can be seen in Figure 4. The dashboard contains information about the name of the room, the maximum number of people and the number of people inside. It also shows graphically the percentage of the capacity and a graphic that shows the evolution with time of the occupancy. Since in this project all the software that has been used is open and free, in this aspect it is only necessary to take into account the expenditure on human resources. 4.3. A hospital room scenario Due to the restrictions caused by the pandemic, the system was tested simulating a waiting room of the Traumatology section of Hospital de Mataró (Catalunya, Spain). The waiting room could not be real since the limitations and restrictions caused by COVID-19 did not allow us to take 3It is a standard language of communication with relational databases. Figure 4: Dashboard created from the flux diagram of Node-RED the test in a real waiting room with real patients. Therefore, the prototype was deployed in the door of a private room without real patients and the people who participated were collaborators. Figure 5shows how the prototype was deployed. The dashboard was displayed on a screen installed at the entrance of the room. Thus, anyone who wants to enter the room can see if the level of occupancy grant access to it. A waiting room can contain any number of people between 0 and the maximum capacity. Patients or people can enter or leave the room at will, although they should not enter if the occupancy level does not allow it. It is understood that patients and/or people who use the room can understand what they will see on the dashboard screen and will be able to interpret whether they can access or otherwise have to wait for the room to be released. To analyse the data obtained in the experiment carried out, the methodology of the descriptive analysis is carried out that provides us with a vision that is made with the information provided by the data of a sample. That is, the purpose is to collect and order the information obtained and extract the most representative characteristics. To check the reliability of the system, the level of occupancy obtained is compared with two the true occupancy of the room. The waiting room is defined with a maximum capacity of 15 people and the entrance and exit of people are analysed normally, without applying any rules of access to the room.