This guide will help you create an IoT-based Temperature and Mask Scan Entry System. The system will monitor body temperature and detect mask usage to control access to restricted areas based on the health and safety parameters.
Components Required
- Arduino (Uno or similar)
- Temperature sensor (e.g., MLX90614 or DS18B20)
- Mask detection camera (e.g., an AI-enabled camera or image processing module)
- Relay module (for controlling entry access)
- LCD or LED display (to show status messages)
- Wi-Fi module (ESP8266 or similar)
- Connecting wires and breadboard
- Power supply (for Arduino and sensors)
- Cloud service account (for real-time monitoring and alerts)
Setting Up the Hardware
Follow these steps to set up the hardware:
-
Connect the Temperature Sensor
Attach the temperature sensor to the Arduino to measure body temperature. Ensure proper wiring and connections for accurate readings.
-
Integrate the Mask Detection Camera
Install the mask detection camera or image processing module to identify whether a mask is being worn. Connect it to the Arduino or a dedicated processing unit.
-
Set Up the Relay Module
Connect the relay module to control entry access based on the temperature and mask detection status. Ensure that it can handle the load for your access control system.
-
Install the Display
Connect an LCD or LED display to show status messages, such as "Access Granted" or "Temperature High/Mask Not Detected."
-
Connect the Wi-Fi Module
Attach the Wi-Fi module to the Arduino for communication with a cloud service to send data and receive alerts.
-
Power the System
Ensure all components are properly powered using the appropriate power supply.
Programming the Arduino
Program the Arduino to handle temperature readings, mask detection, and control the relay based on the input from sensors. Here’s a basic outline of the code:
#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <ESP8266WiFi.h>
#include <LiquidCrystal.h>
#define TEMP_SENSOR_ADDR 0x5A
#define RELAY_PIN D1
#define LCD_RS D2
#define LCD_E D3
#define LCD_D4 D4
#define LCD_D5 D5
#define LCD_D6 D6
#define LCD_D7 D7
Adafruit_MLX90614 tempSensor = Adafruit_MLX90614();
LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
WiFiClient client;
const char* ssid = "your_ssid";
const char* password = "your_password";
const char* cloud_url = "http://your-cloud-service-url";
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
tempSensor.begin();
pinMode(RELAY_PIN, OUTPUT);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected to Wi-Fi");
}
void loop() {
double temperature = tempSensor.readObjectTempC();
bool maskDetected = checkMask(); // Implement mask detection logic here
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print(" C");
if (temperature > 37.5 || !maskDetected) {
lcd.setCursor(0, 1);
lcd.print("Access Denied");
digitalWrite(RELAY_PIN, LOW);
sendAlert("Access Denied");
} else {
lcd.setCursor(0, 1);
lcd.print("Access Granted");
digitalWrite(RELAY_PIN, HIGH);
sendAlert("Access Granted");
}
delay(5000); // Check every 5 seconds
}
bool checkMask() {
// Implement mask detection logic
return true; // Placeholder
}
void sendAlert(String message) {
if (client.connect(cloud_url, 80)) {
client.print("GET /update?api_key=your_api_key&field1=");
client.print(message);
client.println(" HTTP/1.1");
client.println("Host: your-cloud-service-url");
client.println("Connection: close");
client.println();
}
}
This code handles temperature measurement, mask detection, and entry control based on the input from sensors. It also sends status updates to the cloud service.
Setting Up the Cloud Service
Configure your cloud service to receive and display data from the IoT system. Here’s a basic overview:
-
Create an Account
Sign up for a cloud service that supports HTTP requests and data visualization (e.g., ThingSpeak, Blynk).
-
Set Up Data Fields
Create data fields to store temperature readings and mask detection status. Set up alerts and notifications as needed.
-
Integrate with IoT Device
Use the provided API key and endpoint in your Arduino code to send data to the cloud service.
Testing and Calibration
Test the system in a controlled environment to ensure accurate temperature readings and mask detection. Calibrate the sensors and adjust the system settings as needed for optimal performance.
Conclusion
The IoT Temperature & Mask Scan Entry System provides a reliable solution for controlling access based on health and safety parameters. By integrating temperature monitoring and mask detection with IoT technology, this project enhances entry management and safety protocols.