Contents
IoT Based Temperature Scan
COVID 19 pandemic is causing a global health epidemic. The most powerful safety tool is wearing a face mask in public places and everywhere else. The COVID 19 outbreak forced governments around the world to implement lockdowns to deter virus transmission.
According to survey reports, wearing a face mask at public places reduces the risk of transmission significantly. In this project, an IoT-enabled smart door that uses a machine learning model for monitoring body temperature and face mask detection.

The proposed model can be used for any shopping mall, hotel, apartment entrance, etc. As an outcome a cost-effective and reliable method of using AI and sensors to build a healthy environment. Evaluation of the proposed framework is done by the Face Mask Detection algorithm using the Tensor Flow software library.
Besides, the body temperature of the individual is monitored using a non-contact temperature sensor. This proposed system can detect the users from COVID 19 by enabling the Internet of Things (IoT) technology by using ESP 8266.
COMPLETE ESP 8266 CODE:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <Wire.h>
#include <Servo.h>
#include <Adafruit_MLX90614.h>
const char *ssid = "ECEENTRY"; // Enter your WiFi Name
const char *pass = "88888888"; // Enter your WiFi Password
ESP8266WebServer server(80); //Server on port 80
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
const int trigPin = D5;
const int echoPin = D6;
long duration;
int distance;
Servo myservo;
int pos;
int CLOSE_ANGLE = 80;
int OPEN_ANGLE = 0;
float TempReading;
const char MAIN_page[] PROGMEM = R"=====(
<!doctype html>
<html>
<head>
<title>SCAN ENTRY</title>
<h1 style="text-align:center; color:red;">IoT TEMPERATURE SCAN ENTRY</h1>
<h1 style="text-align:center; color:green;">SPC ECE PROJECT 2024</h1>
<style>
canvas
{
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
/* Data Table Styling*/
#dataTable
{
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
text-align: center;
}
#dataTable td, #dataTable th
{
border: 1px solid #000000;
padding: 8px;
}
#dataTable tr:nth-child(even){background-color: #f2f2f2;
}
#dataTable tr:hover {background-color: #ddd;}
#dataTable th
{
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
background-color: #3366ff;
color: white;
}
</style>
</head>
<body>
<div>
<table id="dataTable">
<tr><th>Time</th><th>Distance(CM)</th><th>Temperature(°C)</th></tr>
</table>
</div>
<br>
<br>
<script>
var Tvalues = [];
var Nvalues = [];
var timeStamp = [];
setInterval(function()
{
getData();
}, 1000); //5000mSeconds update rate
function getData()
{
var xhttp = new XMLHttpRequest();
{
{
var time = new Date().toLocaleTimeString();
var distance = this.responseText;
var obj = JSON.parse(txt);
Nvalues.push(obj.distance);
Tvalues.push(obj.Temperature);
timeStamp.push(time);
//Update Data Table
var table = document.getElementById("dataTable");
var row = table.insertRow(1); //Add after headings
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
cell1.innerHTML = time;
cell2.innerHTML = obj.distance;
cell3.innerHTML = obj.Temperature;
}
};
xhttp.open("GET", "TempReading", TempReading); //Handle readData server on ESP8266
xhttp.send();
}
</script>
</body>
</html>
)=====";
void handleRoot()
{
String s = MAIN_page; //Read HTML contents
server.send(200, "text/html", s); //Send web page
}
void setup()
{
Serial.begin(9600); // Initialise Serial Communication with the Serial Monitor
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
myservo.attach(D0);
mlx.begin();
WiFi.begin(ssid, pass); //Connect to your WiFi router
Serial.println("");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); //IP address assigned to your ESP
server.on("/", handleRoot); //Which routine to handle at root location. This is display page
server.on("/TempReading", temp_read); //This page is called by java Script AJAX
server.begin(); //Start server
Serial.println("HTTP server started");
}
void loop()
{
temp_read();
server.handleClient();
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.0340 / 2;
Serial.println("Distance");
Serial.println(distance);
if (distance <= 0)
{
temp_read();
}
delay(1000);
}
void temp_read()
{
TempReading = mlx.readObjectTempC();
Serial.println(TempReading);
Serial.print(",");
Serial.print("Ambient ");
Serial.print(mlx.readAmbientTempC());
Serial.print(" C");
Serial.print("Target ");
Serial.print(mlx.readObjectTempC());
Serial.print(" C");
delay(1000);
myservo.write(OPEN_ANGLE);
delay(3000);
myservo.write(CLOSE_ANGLE);
}



