More Information

Submitted: June 08, 2024 | Approved: July 09, 2024 | Published: July 10, 2024

How to cite this article: Akingbade FS, Afolabi SA, Alani Olowosebioba AW. Design and Construction of Automatic Facemask and Body Temperature Scanning Entry Barrier Machine. Int J Phys Res Appl. 2024; 7(2): 093-099. https://dx.doi.org/10.29328/journal.ijpra.1001091

Copyright License: © 2024 Akingbade FS, et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Keywords: Raspberry Pi; IR-temperature sensor; Facemask; Communicable diseases

FullText PDF

Design and Construction of Automatic Facemask and Body Temperature Scanning Entry Barrier Machine

Fatai Sunday Akingbade*, Sodiq A Afolabi and Abdul-Wasiu Alani Olowosebioba*

Department of Science Laboratory Technology, Physics with Electronics Unit, Ogun State Institute of Technology, Igbesa, Ogun State, Nigeria

*Address for Correspondence: Fatai Sunday Akingbade, Department of Science Laboratory Technology, Physics with Electronics Unit, Ogun State Institute of Technology, Igbesa, Ogun State, Nigeria, Email: fattyakins@gmail.com

Abdul-Wasiu Alani Olowosebioba, Department of Science Laboratory Technology, Physics with Electronics Unit, Ogun State Institute of Technology, Igbesa, Ogun State, Nigeria, Email: olowosebioba2014@gmail.com

In the context of the global pandemic, public health screening has become paramount as the whole world including developed countries is going through a health crisis. A face mask prevents transpiration and protects against airborne transmitted bacteria or viruses. In the previous scenario of coronavirus, it was critical to eradicate this sickness and preserve our lives. Hence, prevention is better than cure becomes true. Accordingly, many precautionary measures were taken to reduce the spread of the virus. One such method of prevention is wearing a mask and regular monitoring of body temperature. This research dealt with the design and construction of an automatic entry barrier machine that integrates both facemask detection and scanning of individuals exhibiting elevated body temperature functionalities without any human interference. This was accomplished by simulating and synergizing a microprocessor (Raspberry Pi 3 Model B+), a Pi camera, an Infrared Non-contact Temperature sensor, a servo motor, and other components. The barrier arm opens and allows entrance at normal temperature by indicating a green light, displaying ‘allow’ on the LCD, and signaling once or preventing entrance at an elevated unacceptable temperature by indicating a red light, displaying ‘not allowed’ on the LCD, and signaling five (5) times.

People’s welfare becomes the major objective in times of pandemics. With the arrival of the coronavirus, measures to stop the spread of the disease among the population were taken. Confinement, facemasks and gloves usage, controlling temperature while entering public places, and social distancing are some of the measures that were put in place [1]. Authorities have also ordered the population to use wearable devices that comply with the quarantine measures, while telecommunications data was used to monitor crowds. Corporations are working on applications that are capable of alerting in situations in which a person might have come in contact with newly diagnosed COVID-19 patients [2]. For this reason, smart mobile applications have been recently proposed for monitoring purposes, such as for employees in industrial environments [3].

The pandemic has been a race against time, in which the effectiveness of the aforementioned measures has been verified along the way. To avoid a massive contagion in public places, a protocol to measure body temperature has been established, isolating those people with symptoms of COVID, such as fever [4].

Currently, humans are employed for temperature screening and mask identification in public places to prevent the spread of diseases. There are temperature testing systems for all scanning entrances, but manual temperature scanning has several drawbacks. The staff isn’t well-versed in the use of temperature scanners. When reading values, there are spaces for human error. People are often allowed entry despite higher temperature readings or the lack of masks. For large crowds, a manual scanning device is ineffective. Hence, there arises a need to have an automatic system that checks for temperature and mask [5]. Face masks allow the insertion of breathing sensors that allow the person to carry out their usual activity despite the discomfort of the usage. The mandatory use of face masks to prevent the spread of coronavirus through the air has led to the adoption of smart masks equipped with sensors. The widespread use of the mask allows us to think of other applications, and its uses are different from those expected in medical or hospital environments for remote monitoring or in industrial environments [6].

Public health emergencies during an outbreak of communicable diseases may cause fear and anxiety, social isolation, and stigma leading to prejudices against people and communities. Such behavior may culminate in increased hostility, chaos, and unnecessary social disruptions. For the prevention of the spread of COVID-19, people are currently screened for body temperature and are identified with masks in public places [7]. The purpose of this research work is to design and construct an automatic facemask and body temperature scanning entry barrier machine for the prevention of the spread of COVID-19 and other diseases in order to permit entrance only with compliance and vice-versa.

Hardware descriptions

Raspberry Pi: It has a 1.2-GHz quad-core chipset BCM2387 with a GPU support of a dual-core and a video core multimedia co-processor and GPU, which includes dual-core multimedia co-processor (Figure 1).


Download Image

Figure 1: Raspberry Pi 3B+.

Raspberry Pi camera (Pi Cam): An 8-megapixel sensor Pi Camera of Raspberry (Figure 2) was used for the pictures taken. This camera module consists of 1080p30 video support and support resolution of 3270 × 2444 pixels resolution. It also makes use of the specialized CSI Gui, which is specifically made for camera connectivity [8].


Download Image

Figure 2: Pi Camera with CSI connector.

Temperature sensor: The temperature sensor (Figure 3) acts as an infrared contactless temperature reader that reads the temperature without contacting them. The sensor does have a digital System Management Bus (SM Bus) output, with PWN which has been factory calibrated and prepared.


Download Image

Figure 3: Infrared Temperature sensor (MLX90614).

Servo motor: A servo motor (Figure 4) is used to demonstrate the opening and closing of the main barrier gate. It also works as a part of a closed-loop system providing velocity and torque as commanded from the servo controller with a feedback device to close the loop.


Download Image

Figure 4: Servo motor.

Liquid Crystal Display (LCD): Figure 5 shows a 2×16 LCD using an I2C communication interface. 4 pins for the LCD display are VCC, GND, SDA, and SCL which will save at least 4 digital/analogue pins on the microprocessor.


Download Image

Figure 5: 2×16 I2C_LCD display

Buzzer: A buzzer or beeper (Figure 6) is an audio signaling device, which may be mechanical, electromechanical, or piezoelectric (piezo for short).


Download Image

Figure 6: Buzzer.

Light-Emitting Diode (LED): Figure 7 is a semiconductor light-Emitting Diode (LED) that emits light when current flows through it. An RGB LED is a red, green, and blue light-emitting diode. That is, only a specific colour was assigned from the program on the microprocessor.


Download Image

Figure 7: RGB LED Module.

Block diagram

Figure 8 is the block diagram of the automatic Facemask and Body Temperature Scanning entry machine. Raspberry Pi Camera and MLX90614 temperature sensor are the inputs that were connected to the RASPBERRY PI 3B+ microprocessor. The output was received on the LCD, speaker and servo motor.


Download Image

Figure 8: Block diagram of mask and body temperature detector.

Software and libraries description

The software used for planning and scheduling involved the set of instructions, or programs used to operate computers and execute specific tasks. The technologies used in this Project are as follows:

Python: The Raspberry Pi 3B+ model uses programming based on Python. Python is a general-purpose programming language that can be used for a variety of applications. It includes high-level data structures, dynamic typing, dynamic binding, and many more features that make it as useful for complex application development as it is for scripting that connects components together [9]. In addition, it will import and explore a dataset to fit your requirement, pre-process it to remove noise, implement the model using SKLearn, train it on the training dataset, and finally test it on the test dataset.

OpenCV: For the purpose of the images being captured on the camera we use the algorithm from the Python OpenCV’s (Open-Source Computer Vision Library) is an open-source computer vision and machine learning software library [10]. These algorithms can be used to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, extract 3D models of objects, etc.

TensorFlow: TensorFlow is a machine learning software library that is open source and free. It was created to perform large numerical computations without regard for deep learning. This TensorFlow can be used for a variety of activities, but it is primarily focused on deep neural network inference and training. TensorFlow also supports traditional machine learning [11].

Keras: Keras gives fundamental reflections and building units for the creation and transportation of ML arrangements with high iteration velocity. It takes full advantage of the scalability and cross-platform capabilities of TensorFlow [12].

Implementation of programs

Software implementation: The software implementation utilized requires working with microprocessors and sensors and writing programs in Python. Deep knowledge in areas such as Artificial Intelligence, Machine Learning, Deep Learning, and OpenCV is introduced for the implementation of the programming language. To obtain a face mask detector, temperature checking, alert system, and gate barrier, the project must be divided into four unique stages which are the model description.

Face recognition: Face detection is a sort of computer vision technology software used for the identification and recognition of human faces in digital images/photographs or video frames. 

Facial recognition involves recognizing the face in a picture as belonging to person X rather than person Y. It is frequently used for biometric applications, like unlocking a Smartphone. 

Facial analysis attempts to learn something about people based on their facial features, such as their age, gender, or the emotion they are displaying.

Facial tracking technique is commonly used in video analysis and attempts to follow a face and its features (eyes, nose, and lips) from frame to frame [13].

Detection of face mask

Data at source: OpenCV was used to increase the size of the images. At the time, the images were titled “cover” and “no veil.” The images available were of various sizes and goals and were most likely extracted from various sources or from machines (cameras) of various goals [14].

Data processing: Ventures, as indicated below, were applied to all the raw data images to convert them into clean forms that could be handled by a neural organization AI model [15].

  1. Resizing the information picture (256 x 256).
  2. Applying the shading sifting (RGB) over the channels (maskNet.predict).
  3. Scaling/Normalizing pictures utilizing the standard mean of PyTorch work in loads.
  4. Center trimming the picture with the pixel estimation of 400.
  5. Finally converting them into tensors (Similar to Numpy exhibit).
  6. Training and,
  7. Deployment.

The model was trained using tensor-flow retrain which captures the essential differentiating features between the classes of images. The differentiating features are saved in the form of a graph. It is trained once and reused to classify the input images into categories for which it is trained. Later, this trained graph is used by the Image classification algorithm for authentication.

Detection of body temperature: Although no thermal cameras can sense or analyze anyone with coronavirus, FLIR cameras can be used as an additional screening method for existing body temperature in high-traffic public venues to identify higher skin temperature through swift distinct screening (Thermal Imaging Cameras and Infrared Temperature Sensors). If the temperature of the skin of an individual in perilous places (particularly the corner of the eye, hand, and forehead) is higher than normal, such an individual may be selected for extra screening. The microprocessor was used to communicate with it through its I2C interface. Being an I2C device it was simply connected to the SDA, SCL, a suitable GND and VIN was chosen. The VIN used for the non-contactless infrared thermometer was 3.3v.

Alert system, speaker, and gate barrier: The buzzer, speaker, and servo motor were connected to the microprocessor. If the temperature threshold is surpassed and the face mask is not spotted, the alarm, speaker, and red LED will be triggered (Figure 9a). If both the face mask and the temperature are set to normal, the speaker, green LED will be triggered and the automatic gate barrier will open (Figure 9b). Figure 10 displays the image of multiple faces detection and their output response on individual.


Download Image

Figure 9: a: Image output without facemask. b: Image output with facemask.


Download Image

Figure 10: Image output of facemask and no facemask.

Program code and circuit diagram

Figures 11,12 are the Circuit Diagram of the automatic Facemask and Body Temperature Scanning entry machine and the program code respectively.


Download Image

Figure 11: Circuit Diagram of automatic Facemask and Body Temperature Scanning entry machine.


Download Image

Figure 12: Program code of automatic Facemask and Body Temperature Scanning entry machine.

System flow and results

When connections were completed on a Veroboard, a suitable casing was provided for the purpose of protecting the circuit from weather conditions and moisture. The plastic casing (Figure 13a) was designed by making holes for the circuit with components taken into consideration. The complete construction was packaged within a plank stand as shown in Figure 13b.


Download Image

Figure 13: (a): Components enclosed in casing. (b): Complete construction for detector.

The pre-trained model that was trained using web images provided by the OpenCV framework was utilized for the identification of faces. The facemask data spotted by the system’s camera will be sent to the Raspberry Pi 3B+ for processing. Thereafter, the temperature will also be checked with the aid of the MLX90614 sensor. Then, the collated data will be processed within the Central Processing Unit (CPU) – Raspberry Pi. If the concerned individual wears the mask and the temperature of such person is detected below the threshold point the green light turns ON and the beeper alerts once. Therefore, the barrier will be unlocked. Conversely, if the concerned individual fails to wear a facemask and/or the body’s temperature is higher than normal. Then, the red light will turn ON. Therefore, the beeper signals five (5) times to prepare the security agents for the breach of protocols. The speaker also serves as a means of sending an audio output of the display text on the LCD for the concerned personnel to be able to listen to it.

The study dealt with reducing the spread of virus transmission using technologies such as machine learning and computer vision. The people who are not abiding by the protocol stimulate this work. In this system deep learning, algorithm is used to distinguish the person wearing a mask from the one who is not wearing it, and the model is trained using a dataset containing images of people with masks and without masks. It also helped to detect the temperature of every individual without any human interference. The results were analyzed at various levels. The face mask and body temperature detection python file were run in a Raspberry Pi 3b+ model along with the components so the images are obtained and the identification of persons wearing and not wearing face masks is processed.

Figures 9ab,10 show the input images fed to Raspberry Pi. Two conditions are primarily detected. Firstly, if the individual is wearing a mask and the temperature of the body is normal as shown in Figure 9b, the green light indicator turns on for both mask and normal or regulated temperature detection. Therefore, the machine triggers an alarm once and the gate is then automatically opened to indicate permission to enter. Secondly, if the individual is not wearing a mask or the temperature is beyond the threshold or normal conditions as shown in Figure 9a, the red-light indicator turns on for either not wearing a mask or temperature beyond normal or threshold conditions. Therefore, the suggested machine learning algorithm will forecast and trigger the alarm five (5) times and also the gate remains closed indicating permission to enter through the gate is not granted. This is the output response of the two conditions displayed on the LCD display and the PC screen.

It is important to note that a manual scanning system is not suitable and also laborious for large crowds at entry points [16]. At some times, the supervisors may not watch and people at risk of high-temperature readings and no mask may not barred from entering but with this entry detector, the gate remains permanently locked until all conditions are fulfilled.

A working real-time Automatic Facemask and Body Temperature scanning entry barrier has been successfully implemented and achieved from the construction of the device. The system first detects the percentage of ‘cover or unveil’ with the Raspberry Pi Camera while the MLX90614 non-contact temperature sensor reads the person’s body temperature and then sends the data to the RASPBERRY PI 3B+ microprocessor. The barrier arm opens and allows entrance at normal temperature by indicating a green light, displaying allow on the LCD, and alerting once or preventing entrance at an elevated unacceptable temperature by indicating a red light, displaying not allowed on the LCD, and alerting five (5) times.

  1. Türker GF, Tanyeri K. Evaluation of Parameters Affecting the Risk of Contagion of COVID-19 Virus with Fuzzy Logic. Eur J Sci Technol. 2022;42:52-60.
  2. Gupta M, Abdulsalam M, Mittal S. Enabling and enforcing social distancing measures using smart city and its infrastructures: a COVID-19 use case. 2020. Available from: https://arxiv.org/abs/2004.09246
  3. Kaiser MS, Mahmud M, Noor MBT, Zenia NZ, Al Mamun S. iWorksafe: Towards healthy workplaces during COVID-19 with an intelligent P. health app for industrial settings. IEEE. 2021;9:13814-13828. Available from: https://ieeexplore.ieee.org/abstract/document/9317697/authors
  4. Ray PP. An IR sensor based smart system to approximate core body temperature. J Med Syst. 2017;41(8):123. Available from: https://pubmed.ncbi.nlm.nih.gov/28695440/
  5. Pan L, Wang C, Jin H, Li J, Yang L, Zheng Y, et al. Lab-on-Mask for Remote Respiratory Monitoring. ACS Mater Lett. 2020;2:1178-1181. Available from: https://pubmed.ncbi.nlm.nih.gov/34192277/
  6. Kim N, Wei JLJ, Ying J, Zhang H, Moon SK, Choi J. Customized smart medical mask for healthcare personnel. In: Proceedings of the 2020 IEEE International Conference on Industrial Engineering and Engineering Management (IEEM); 2020;581-585. Available from: https://ieeexplore.ieee.org/abstract/document/9309863
  7. Yildirim H, Işik K, Aylaz R. The effect of anxiety levels of elderly people in quarantine on depression during COVID-19 pandemic. Soc Work Public Health. 2021;36(2):194-204. Available from: https://doi.org/10.1080/19371918.2020.1868372
  8. Mikami K, Kurebayashi R, Shi X, Inoue N, Matsuo Y, Yamasaki I. High-resolution multi-camera analysis infrastructure to support future smart cities. NTT Tech Rev. 2022;20(4):21-25. Available from: https://doi.org/10.53829/ntr202204fa3
  9. Furr M, An JHD, Foster JS. Profile-guided static typing for dynamic scripting languages. ACM SIGPLAN Not. 2009;44(10):283-300. Available from: https://dl.acm.org/doi/abs/10.1145/1640089.1640110
  10. Lyons KR, Margolis BWL. AxoPy: A Python library for implementing human-computer interface experiments. J Open Source Softw. 2019;4(34):1191. Available from: https://joss.theoj.org/papers/10.21105/joss.01191.pdf
  11. Syed MA. Overview on Open-Source Machine Learning Platforms-TensorFlow. J Innov Dev Pharm Tech Sci. 2020;11-14. Available from: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3732837
  12. Hoskins BL. Formation of flow units during high-rise building evacuations. Transp Res Procedia. 2014;2:385-393. Available from: https://www.sciencedirect.com/science/article/pii/S235214651400074X?via%3Dihub
  13. Saeed U. Facial micro-expressions as a soft biometric for person recognition. Pattern Recognit Lett. 2021;143:95-103. Available from: https://www.sciencedirect.com/science/article/abs/pii/S0167865521000179
  14. Sharma G, Bohara V, Balai LN. Simulation based performance analysis of histogram shifting method on various cover images. Int J Trend Sci Res Dev. 2018;2(4):907-911. Available from: https://www.ijtsrd.com/papers/ijtsrd14139.pdf
  15. Pereira M, Velosa N, Pereira L. dsCleaner: A Python library to clean, preprocess and convert non-instructive load monitoring datasets. Data. 2019;4(3):123. Available from: https://www.mdpi.com/2306-5729/4/3/123
  16. Ranjan V, Aishwarya Jyothi MP, Shamaa M, Vaishnavi AN, Smruthi BS. Intelligent barrier for face mask and body temperature detection. Int J Eng Res Comput Sci Eng (IJERCSE). 2022;9(6):12-18. Available from: https://www.technoarete.org/common_abstract/pdf/IJERCSE/v9/i6/Ext_94068.pdf