Implementing SCATD to Social Distancing Monitoring

Download Full-Text PDF Cite this Publication

Text Only Version

Implementing SCATD to Social Distancing Monitoring

Norlela Ishak, Suzi Seroja Sarnin, Norsahida Binti Kamal Discipline of Systems School of Electrical Engineering College of Engineering Universiti Teknologi MARA (UiTM) Shah Alam, Selangor

AbstractThis study aims to provide a solution to ease people in the retail industry to comply with the Standard Operating Procedure (SOP) by implementing Smart Counter and Temperature Detector (SCATD) in their premises. Two Infrared (IR) sensors are connected to Arduino UNO to detect people entering and exiting the premise. The counter counts the people in the premise based on the reading of the IR sensor. Digital non- contact Infrared temperature sensor (MLX90614) and APDS- 9960 digital RGB, ambient light, gesture and proximity sensor are also connected to Arduino UNO for the temperature detector. By using APDS-9960 sensor, temperature will be taken only if the object is in front of the sensor. The temperature detector will also function according to the IR sensor. If the IR sensor at the entrance door detects a person entering the premises, it is compulsory for that person to screen their body temperature. If not, the alarm will be activated to let the customer know that they have not screened their body temperature yet. This is to prevent people from entering the premises without screening their body temperature. The temperature data from Arduino UNO is transferred to the ESP8266 server through serial communication. Then, from the ESP8266 server, the temperature data is sent to the ESP8266 client that is located at the counter cashier so that the worker can monitor the temperature data of every customer coming into the premises. If the customer's body temperature exceeds 37.5 °C, the alarm is activated to notify the worker and prevent the customer from entering the premises. This system has demonstrated that it indeed can help ease the process of complying with the SOP.

KeywordsInfrared sensor; IR; ESP8266; mlx90614; APDS- 9960 sensor; RGB sensor; serial communication; HTTP;


    COVID-19 pandemic is known to be the most threatening pandemic the world ever experienced. In the retail industry, to avoid crowds and make sure customers follow the SOP, managing and monitoring customers coming to the premises are extremely compulsory in order for them to operate as usual during the pandemic. A system that can manage and monitor customers is very important as a preventive mechanism to prevent the spread of COVID-19 virus [1].

    Researchers have suggested different methods for human monitoring and detection. Thus far, several studies have used

    Infrared (IR) radiation detection for human monitoring,detection and counting. In [2], an IR sensor is used to detect and count the person inside a room. The sensor is placed in the hallway. When a person entering or exiting the room passes through the sensor, the counter will increment or decrement by one, thus automatically updating the number of people present inside the room. By applying this method, person counting can be done without human intervention.

    Additionally, a temperature sensor is used in this project for screening customers body temperature. To design non- contact temperature detector, several studies have been taken into consideration. Data from several studies suggest that infrared temperature measurement is the most relevant method for non-contact temperature measurement. A recent study by

    [3] involved a non-contact infrared temperature measurement method. The researchers state that infrared temperature measurement is very helpful in developing a non-contact thermometer. Non-contact temperature measurement can measure the temperature of a moving object and can do the measurement without interacting with the measuring object. In [4], it was stated that non-contact infrared temperature can provide valid readings within seconds.

    Data transmission needs to be done for monitoring purposes in this project. It is widely known that data or information is transferred through a transmission system. The data can be transmitted by using wireless transmission and ESP8266 WiFi module is suggested to be used [10].

    To make a two-way communication between the ESP8266 module, HTTP client-server protocol is used [11]. According to [12], an Internet extended client-server application inherits an open design that supports the HTTP protocol, allowing the developer to construct a client-server application that runs well over the Intranet/Internet without worrying about network operations.

    The need to limit customer's entry into the premise has become a challenge because each individual entering and exiting the premise needs to be counted in order to avoid crowds in the premise. Furthermore, customers coming to the premises often forgot to check their body temperature before entering the store. Therefore, customer counting needs to be done automatically and the temperature detector device needs

    to function accordingly to each customer entering the premise so that they do not forget to check their body temperature.

    In line with the retail SOP, the goal of this project is to create a system that can support people in the retail industry in complying with the SOP thus, presenting a Smart Counter and Temperature Detector system implementation to monitor the compliance of SOP.

    This paper is divided into four sections; the first section introduces the problem and its solution, the second section elaborates the methods utilized to accomplish the desired outcome, the third section discusses the project's implementation and results, and the fourth section concludes the work.


    1. Block diagram

      This system used two microcontrollers, the Arduino UNO and ESP8266 module. Figure 1 shows the block diagram for Arduino UNO. Based on the block diagram, this system has five inputs and three outputs. The inputs are 4×3 keypad, IR sensor 1, IR sensor 2, IR temperature sensor and APDS-9960 sensor. The outputs are buzzer, OLED display and I2C LCD display.

      ESP8266 server is also connected to Arduino UNO for serial communication. Block diagram for ESP8266 module client is shown in figure 2. The input comes from the ESP8266 server and the outputs are an OLED display and buzzer.

      Fig. 1. Block diagram of Arduino UNO configuration

      Fig. 2. Block diagram of ESP8266 client configuration

    2. Flowchart

      Smart Counter and Temperature Detector is a system that monitors the occupancy of a premise and temperature detector routine. As shown in the flowchart in figure 3, users will need to enter the occupancy limit of their premise. After that, IR sensor 1 and IR sensor 2 started to detect individuals passing through the entrance and exit door. The counter increments by one when IR sensor 1 detects an individual passing through it and decrements by one when individual passes through IR sensor 2. The counter is updated and displayed on an LCD display.

      Temperature detector started to measure body temperature every time the counter is incremented and then displayed it on an OLED display. If the IR temperature sensor does not start to measure body temperature after the counter is incremented or if body temperature exceeds 37.5 , the buzzer turns ON as an alarm. The temperature data is then sent to the ESP8266 server using serial communication. The ESP8266 client requested the temperature data from the server and then displayed the data on the OLED display. If the temperature data is more than 37.5 , the buzzer turns ON.

      Fig. 3. Flowchart of the server

      Fig. 4. Flowchart of the client/p>

    3. Wiring diagram

      Figure 5 and figure 6 shows the schematic diagram for the server and client respectively.

      Fig. 5. Wiring diagram for the server

      Fig. 6. Wiring diagram for the client

    4. Hardware setup and implementation

      Figure 7 shows the illustration of the hardware setup for the counting system. One of the IR sensors is placed at the entranced door and the other one is placed at the exit door. They are placed at the height of 30 inches from the ground to avoid the IR sensor from detecting unwanted objects passing through the door. LCD display that will display customer occupancy is placed at the entrance door facing outside the premise. The temperature detector is placed at the entrance door near the IR sensor. Figure 8, figure 9 and figure 10 shows the hardware implementation of the system.

      For monitoring purposes, an OLED display and buzzer is placed at the cashier counter. The hardware setup is shown in figure 11.

      Fig. 7. Hardware setup for smart counter system

      Fig. 8. Hardware implementation of the counting device (interior)

      Fig. 10. Hardware implementation of temperature detector

      Fig. 11. Hardware implementation of the monitoring device

    5. Working principle

      1. Smart counter mechanism

        Type of IR sensor used in this project is diffuse-reflective mode. When an object passes in front of the IR sensor, it will emit a signal. The transmitter's IR rays hit the object, reflect, and are then received by the receiver, generating an indication [6].

        Fig. 9. Hardware implementation of the counting device (exterior)

        As indicated in figure 7, a person entering the premises will pass through IR1 and will pass through IR2 when exiting the premises. At first, the counter is set to zero. The counter is incremented by one when the individual enters the premises and decremented by one when the person exits the premises. The counter is counted based on userinput.

      2. Body temperature detector

        1. Measurement of body temperature

          For the temperature detector, APDS-9960 gesture and proximity sensor is interfaced with a digital non-contact Infrared temperature (IR) sensor (MLX90614) so that the temperature sensor only screens temperature when there is an individual in front of it. The temperature detector is also

          Programmed to function only when the counter value Increments.

          Non-contact infrared temperature sensors monitor human body temperature without needing interaction. This is because IR thermometers detect infrared energy, which is emitted by any material or object with a temperature higher than absolute zero (0 °K) [5]. IR thermometers use a lens to focus the infrared light emitted by an object onto a thermopile detector. The thermopile is simply a series or parallel connection of thermocouples.

          The MLX90614's specialized infrared thermopile detects the amount of infrared energy released by materials in its field of view (FOV) and generates an electrical output proportional to that amount. The FOV of this sensor is 90 degree. The sensor will detect all objects in the FOV. The sensor returns the average of all objects in the FOV. It is important that the object completely fills the FOV. Figure 12 shows the image representation of the FOV.

          When infrared radiation hits the surface of a thermopile, it is absorbed and converted into heat. The voltage output is proportional to the amount of incident infrared radiation. This Output is used by the detector to determine the temperature, which is displayed on the OLED display.

          Fig. 12. Field of view of the sensor

        2. Accuracy adjustment

          Temperature data from an armpit thermometer and IR temperature sensor is taken and compared as shown in table I in order to self-calibrate the reading of the IR temperature sensor. The average of the difference between the two readings are taken as an error value to be added with the IR temperature sensor reading so that it becomes more accurate.



          Armpit thermometer ()


          temperature sensor ()

          Difference ()

          Person A




          Person B




          Person C




          Person D






      3. Serial communication

        ESP8266 does not have enough pins to connect two IR sensors, an MLX90614 sensor, an RGB sensor, a 4×3 keypad matrix, LCD display and an OLED display on the microcontroller. Thus, Arduino UNO is used to configure all of the sensors and components in this project as an alternative.

        MLX90614 sensor data from Arduino UNO is sent to the ESP8266 through serial communication. Serial communication is a type of communication in which data is transferred one bit at a time through a communication channel in a sequential order. It's the most common method of exchanging data between data processing equipment and peripherals [7]. TTL logic levels are used for serial communication on pins TX/RX.

        The devices should be connected as shown in figure 13 to establish serial communication between them. This is because the data sent by the Arduino UNO should be received by the ESP8266. Pins 4 and 3 are used as RX/TX on the Arduino UNO. The SoftwareSerial library can be used to utilize the GPIO pins for serial communication. The SoftwareSerial library was created to provide serial communication on other Arduino digital pins by replicating the functionality using software. Pins D6 and D5 on the ESP8266 are used for RX/TX.

        Fig. 13. Serial communication connection

      4. WiFi communication (HTTP protocol)

    The HTTP client-server protocol is used to establish two- way communication between two ESP8266 [8]. Clients and servers send and receive individual messages. Requests are messages sent by the client, while responses are messages sent by the server in response to the client's request.

    The ESP8266 server is configured as an access point, allowing additional Wi-Fi devices to join the network. The ESP8266 client is set as a station in order to connect to the wireless network of the ESP8266 server. To obtain sensor data, the client sends an HTTP GET request to the server. It only needs to make a request on a specific route, which in this case is temperature, using the server's IP address. The server assesses incoming requests and responds with the temperature readings. The readings are received by the client and displayed on the OLED display.

    The server ESP8266 is connected with the Arduino UNO to receive serial data while the ESP8266 that acts as a client is placed at the cashier counter.


    1. Counting system

      The counting system counts according to the user input inserted using a 4×3 keypad matrix as shown in figure 14.

      Table II shows how the counter works based on the IR sensor detection. When IR1 detects an object passing through it, the counter value is incremented by one; when IR2 detects an object passing through it, the counter is decremented by one. When both IR1 and IR2 detected an object at the same time, the counter value did not change.

      Fig. 14. Entering user input to set the counter













      No change

      Figure 15 show how the customer occupancy is displayed. When the counter reached the occupancy limit that has been set, the LCD displayed Full, please wait text on the LCD display. Through this, the occupancy of the premises is updated in real-time thus, it will be easier for the workers and customers to keep track of the current occupancy of the premises.

      Fig. 15. Displaying customer occupancy on LCD display

      However, there are certain drawbacks associated with the use of IR sensors. The IR sensors detect objects within a range of 2cm to 14cm. The doors of small premises are usually small, thus IR sensors can work well within the range. Unfortunately, for larger premises with large doors, the sensor can not detect anything if the person walking past it is not within the sensor's range. This is an important issue for future work recommendations.

    2. Temperature detector

      The temperature detector started to screen body temperature whenever the counter system is incremented by one. Counter value increments indicate that there is a person entering the premises and it is compulsory for that person to screen body temperature before proceeding to enter the premises. The temperature data is displayed on an OLED display as shown in figure 16. Buzzer turned on when the temperature sensor did not detect body temperature. This is to make sure that people do not forget to screen their body temperature when entering the premises. As shown in figure 17, the buzzer also turned ON and displayed PLEASE SCREEN YOUR TEMPERATURE! on an OLED display

      when the temperature exceeds 37.5 .

      Fig. 16. Temperature data display on OLED display

      Fig. 17. Text display when temperature exceed 37.5

      1. Temperature detector measurement accuracy

        After calibrating the IR temperature sensor to adjust the readings, a series of measurements were taken. It can be seen that there was not much difference with the measurement taken using IR temperature sensor and the armpit thermometer as shown in the graph in figure 18. IR temperature sensor measures temperature on the forehead therefore the slight difference is acceptable because the temperature measurement can be affected by the environment factor.

        Fig. 18. Target temperature measurement after calibration

        Five temperature measurements have been done on a single person to compare the accuracy of the IR temperature sensor with the widely used armpit temperature sensor. The IR temperature sensor obtained expected results and as stated in [9], the performance of IR temperature sensor in terms of the accuracy and measurement range is comparable to similar commercial products.

        Based on the graph in figure 19, the results showed that the IR temperature sensor has consistent accuracy, making it a reliable device for measuring human body temperature without the need for human interaction. This is a crucial aspect in this project since it prevents people entering the premises from interacting with one another.

        Fig. 19. Performance comparison of armpit thermometer and IR temperature sensor

      2. Effect of field of view to the accuracy of temperature measurement

        For most IR thermometers, target size and distance are also important factors in accuracy. Every infrared instrument has a field of view (FOV), which is the angle of vision through which it averages all of the temperatures it sees. Therefore, a series of temperature measurements was taken based on the distance of the users forehead and the IR temperature sensor to determine the accuracy.

        The target temperature T(C) is compared with reference temperature T(F) that were taken using an armpit thermometer. This is because, for an armpit thermometer the target needs to be in close contact with the thermometer for the thermometer to start reading the temperature thus resulting in having constant reading.

        Based on the graph shown in figure 20, the error started to increase by 1 degree Celsius at 6cm of distance and the error keeps increasing when the distance is greater. This is because IR temperature sensors detect every object that emits infrared energy that is in its FOV. That is why it is important for the forehead to completely fill the FOV. If not, the sensor can detect objects that are not supposed to be measured resulting in incorrect measurement. The most appropriate and acceptable distance is between 2cm to 4cm from the sensor.

        Fig. 20. Graph of distance vs temperature

        Figure 21 illustrates how the position of the forehead should be in front of the sensor to get good readings. The forehead should completely fill the FOV so that the sensor only measures the forehead temperature. Meanwhile, in figure 22, the forehead shares the same FOV with the object at the background which affects the accuracy of the temperature readings.

        Fig. 21. Forehead completely fill the FOV

        Fig. 22. Forehead not completely fill the FOV

    3. Sending and transferring temperature data

    To monitor the body temperature screening process, IR temperature sensor data was transferred from Arduino UNO to the ESP8266 server so that the server can send the data to the ESP8266 client located at the cashier counter. After testing the program, the temperature data from Arduino UNO was successfully transferred to the ESP8266 server through serial communication and when the ESP8266 client requested the temperature data from the ESP8266 server, it gave the response by sending the data to the client. The temperature data is displayed as shown in figure 23.

    If the temperature data of a person received by the ESP8266 client exceeds 37.5 , a buzzer at the counter cashier turns on to alert and a message WARNING! will be displayed on an OLED display as shown in figure 24. the workers to prevent the person from entering the premises. Through this process, there is no need for a worker to guard the entrance door in order to monitor the whole process.

    Fig. 23. Temperature data requested from the server

    Fig. 24. Text display on OLED when temperature exceed 37.5

  4. CONCLUSION AND RECOMMENDATION The proposed Smart Counter and Temperature Detector

(SCATD) system can help to monitor the occupancy limit of the premises and also capture the temperature simultaneously. This system can also be easily implemented as all the components used are relatively cheap. As a whole, this system demonstrated how it can be very helpful in helping to ease all the people in the retail industry to comply with the SOP.

As for recommendation, future work may start to focus on developing a system that would work for all premises in retail industries, not just small premises. Instead of using IR sensor and IR temperature sensor for the system, thermal cameras can be considered to be used in the future. This project notified customers and also the workers about the temperature data by using a buzzer. To make it more technical, it is recommended that the system consider giving notification about the temperature data through an app.


The authors gratefully acknowledge the financial support given by Research Management & Innovation (IRMI) UiTM via LESTARI (Reference Code: 600-RMC/MYRA 5/3/LESTARI (034/2020). The authors would also like to credit the School of Electrical Engineering, UiTM Shah Alam, Selangor, Malaysia, for providing the research facilities.


  1. A. Rahmatulloh, F. M. S. Nursuwars, I. Darmawan and G. Febrizki, "Applied Internet of Things (IoT): The Prototype Bus Passenger

  2. Monitoring System Using PIR Sensor," 2020 8th International Conference on Information and Communication Technology (ICoICT), Yogyakarta, Indonesia, 2020, pp. 1-6, doi: 10.1109/ICoICT49345.2020.9166420.

  3. S. Vishwarup et al., "Automatic Person Count Indication System using IoT in a Hotel Infrastructure," 2020 International Conference on Computer Communication and Informatics (ICCCI), Coimbatore, India, 2020, pp. 1-4, doi: 10.110/ICCCI48352.2020.9104195.

  4. B. Ning and Y. Wu, "Research on Non-Contact Infrared Temperature Measurement," 2010 International Conference on Computational Intelligence and Software Engineering, Wuhan, 2010, pp. 1-4, doi: 10.1109/CISE.2010.5677034.

  5. D. Santoso and F. Dalu Setiaji, "Non-contact portable infrared thermometer for rapid influenza screening," 2015 International Conference on Automation, Cognitive Science, Optics, Micro Electro- Mechanical System, and Information Technology (ICACOMIT), Bandung, 2015, pp. 18-23, doi: 10.1109/ICACOMIT.2015.7440147.

  6. "Principles of Non-Contact Temperature Measurement",, 2021. [Online]. Available: of-non-contact-temperature-measurement.htm. [Accessed: 19- Jun- 2021].

  7. A. Javed, H. Tariq and A. Khalid, "Implementation of IR sensors in thru-beam and diffuse-reflective modes for obstacle detection," 2017 International Symposium on Wireless Systems and Networks (ISWSN), 2017, pp. 1-5, doi: 10.1109/ISWSN.2017.8250013.

  8. G. S, "Serial Communication between NodeMCU and Arduino", ENGINEERING PROJECTS HUB, 2021. [Online]. Available: between- nodemcu-and-arduino/. [Accessed: 19- Jun- 2021].

  9. "An overview of HTTP – HTTP | MDN",, 2021. [Online]. Available: US/docs/Web/HTTP/Overview. [Accessed: 19- Jun- 2021]

  10. J. Thati,P. V. Kumari and Y. V. Narayana, "Controlling of home appliances through Internet," 2017 International Conference on Energy, Communication, Data Analytics and Soft Computing (ICECDS), Chennai, 2017, pp. 2142-2148, doi: 10.1109/ICECDS.2017.8389831.

  11. P. Agarwal, "ESP8266 to ESP8266 communication without a router", Zairza, 2019.

  12. Duo Li, Y. Serizawa and M. Kiuchi, "Extension of client-server applications to the Internet," 2002 IEEE Region 10 Conference on Computers, Communications, Control and Power Engineering. TENCOM '02. Proceedings., 2002, pp. 355-358 vol.1, doi: 10.1109/TENCON.2002.1181287

Leave a Reply

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