IoT based Smart Parking System

by Jun 20, 2020Projects

Hello everyone! Today we are going to make an IoT based Smart Parking System. We will work with the entire code, connect it to the cloud as well. For User Interface, we will create a Web page and will send the data yo our database. Now, let us begin with the project.

Contents:

The Traditional System of Parking

The old way of Parking

Poorly managed parking resources have a substantial negative impact on cities — one that has been well-documented. According to industry studies, poorly managed parking:

  • Increases Traffic Congestion
  • Increases Pollution
  • Frustrates Drivers

The causes are large in number. But is there any solution for it? Definitely, yes. IoT offers a unique method of Smart parking which we have successfully implemented and that is what we are going to do today.

About the Project

Smart Parking System

The project is a real world’s application which can be incorporated to any parking management system. First of all, we will fix the proximity sensors as per the number of slots for parking. These sensors will tell whether any area is empty or not. This will be know to the authority in charge. It can have the report of it’s complete management on tips. On the other hand, if the user wants to avail the service at XYZ parking area. Then he will first book his slot at the parking. However, this depends on the availability as well.

Once the user books the slot with the date and time, he will be the owner of that area for the set period of time. To authenticate whether the user who is entering with the car has his pre booked slot or not, we will use RFID tags. These contain the information of the type of permit that the particular vehicle has been granted. The person enforcing it is equipped with a hand reader that captures the information of the vehicle, such as expiration time and corresponding spot location.

In this way, both the user as well as the owner will have an easy implementation without any fuss.

Hardware Required

  • IR sensors (3 in this model)
  • Microcontroller (2 arduino boards)
  • WiFi module (ESP8266)
  • RFID tag
  • Servo motor
  • LCD display (optional)

The hardware includes both the main system and the authentication system too. RFID, servo and an Arduino board will be required for verification at the gate. However, the rest of items are required for the main Parking management.

Arduino Code for Parking System

Basically, there will be two systems, one controlling the parking system and other the authentication system at the gate. Here we will discuss the prior part.

The IR sensors will be connected in different pins and will give the status of the area (1 for occupied and 0 for empty). This data will be uploaded to ‘ThingSpeak‘ server. There you will see the proper visualization of the inputs given by the sensor. This will be uploaded byusing the ESP8266 wifi module. Below is the code.

#include <SoftwareSerial.h>    //Software Serial library
const int ProxSensor1=5;
const int ProxSensor2=6;
const int ProxSensor3=7;

int inputVal = 0;
SoftwareSerial mySerial(12, 13);
SoftwareSerial espSerial(2, 3);   //Pin 2 and 3 act as RX and TX. Connect them to TX and RX of ESP8266      
#define DEBUG true
String mySSID = "ram";       // WiFi SSID
String myPWD = "ramnath123$"; // WiFi Password
String myAPI = "I3SMDXSR4EMUK7CR";   // API Key
String myHOST = "api.thingspeak.com";
String myPORT = "80";
String myFIELD1 = "field1";
String myFIELD2 = "field2";
String myFIELD3 = "field3"; 
int sendVal1; int sendVal2; int sendVal3;
int k=0;


void setup()
{
  Serial.begin(9600);
  mySerial.begin(115200);
  espSerial.begin(115200);
  pinMode(ProxSensor1,INPUT);    //Pin 2 is connected to the output of proximity sensor
  pinMode(ProxSensor2,INPUT); 
  pinMode(ProxSensor3,INPUT); 
 
  espData("AT+RST", 1000, DEBUG);                      //Reset the ESP8266 module
  espData("AT+CWMODE=1", 1000, DEBUG);                 //Set the ESP mode as station mode
  espData("AT+CWJAP=\""+ mySSID +"\",\""+ myPWD +"\"", 1000, DEBUG);   //Connect to WiFi network
  /*while(!esp.find("OK")) 
  {          
      //Wait for connection
  }*/
  delay(1000);
  
}

  void loop()
  {
    
    
    sendVal1=digitalRead(ProxSensor1);
    sendVal2=digitalRead(ProxSensor2);
    sendVal3=digitalRead(ProxSensor3); 
    String sendData1 = "GET /update?api_key="+ myAPI +"&"+ myFIELD1 +"="+String(sendVal1);
    String sendData2 = "GET /update?api_key="+ myAPI +"&"+ myFIELD2 +"="+String(sendVal2);
    String sendData3 = "GET /update?api_key="+ myAPI +"&"+ myFIELD3 +"="+String(sendVal3);
    espData("AT+CIPMUX=1", 1000, DEBUG);       //Allow multiple connections
    espData("AT+CIPSTART=0,\"TCP\",\""+ myHOST +"\","+ myPORT, 1000, DEBUG);
    espData("AT+CIPSEND=0," +String(sendData1.length()+4),1000,DEBUG);  
    espSerial.find(">"); 
    espSerial.println(sendData1);
    espData("AT+CIPMUX=1", 1000, DEBUG);       //Allow multiple connections
    espData("AT+CIPSTART=0,\"TCP\",\""+ myHOST +"\","+ myPORT, 1000, DEBUG);
    espData("AT+CIPSEND=0," +String(sendData2.length()+4),1000,DEBUG);  
    espSerial.find(">"); 
    espSerial.println(sendData2);
    espData("AT+CIPMUX=1", 1000, DEBUG);       //Allow multiple connections
    espData("AT+CIPSTART=0,\"TCP\",\""+ myHOST +"\","+ myPORT, 1000, DEBUG);
    espData("AT+CIPSEND=0," +String(sendData3.length()+4),1000,DEBUG);  
    espSerial.find(">"); 
    espSerial.println(sendData3);
    Serial.print("Value to be sent: ");
    Serial.println(sendVal1);
    Serial.print("Value to be sent: ");
    Serial.println(sendVal2);
    Serial.print("Value to be sent: ");
    Serial.println(sendVal3);
    if(k==0&&sendVal1==1&&sendVal2==1&&sendVal3==1)
    {
      SendMessage();
      k=1;
    }

 if (mySerial.available()>0)
   Serial.write(mySerial.read()); 
    espData("AT+CIPCLOSE=0",1000,DEBUG);
    //delay(100);
  }

  String espData(String command, const int timeout, boolean debug)
{
  Serial.print("AT Command ==> ");
  Serial.print(command);
  Serial.println("     ");
  
  String response = "";
  espSerial.println(command);
  long int time = millis();
  while ( (time + timeout) > millis())
  {
    while (espSerial.available())
    {
      char c = espSerial.read();
      response += c;
    }
  }
  if (debug)
  {
    //Serial.print(response);
  }
  return response;
}

}

In the code, we have just used different digital pins for different IR sensors. They will be giving the input to the controller. Subsequently, the data will be sent to the cloud and based on that we will do proper visualization of the data.

Integrating with Cloud

Now, the data is being sent to the cloud based on whether the slot is occupied or not. Then using this data, we are making field charts so that we can have a look on the time span and other things. However, this is the feature of ThingSpeak cloud only so we need not worry much. Here, you can see the video below to better understand how the ThingSpeak server will respond to various inputs.

Cloud’s View

Making a web page for UI

By now, we have done one end of our project. But how will the user book a slot? For that, we will make a web page. It will contain features like booking, feedback, booking history etc. So, let us begin.

Registration

SIGNUP PAGE:The user will enter the details such as first name,last name,email address and password.These details will be used for login into our website.

<?php
require_once('config.php');
?>
<!DOCTYPE html>
<html>
<head>
	<title>User Registration | PHP</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>

<div>
	<?php
	
	?>	
</div>

<div>
	<form action="registration.php" method="post">
		<div class="container">
			
			<div class="row">
				<div class="col-sm-3">
					<h1>Registration</h1>
					<p>Fill up the form with correct values.</p>
					<hr class="mb-3">
					<label for="firstname"><b>First Name</b></label>
					<input class="form-control" id="firstname" type="text" name="firstname" required>

					<label for="lastname"><b>Last Name</b></label>
					<input class="form-control" id="lastname"  type="text" name="lastname" required>

					<label for="email"><b>Email Address</b></label>
					<input class="form-control" id="email"  type="email" name="email" required>

					<label for="phonenumber"><b>Phone Number</b></label>
					<input class="form-control" id="phonenumber"  type="text" name="phonenumber" required>

					<label for="password"><b>Password</b></label>
					<input class="form-control" id="password"  type="password" name="password" required>
					<hr class="mb-3">
					<input class="btn btn-primary" type="submit" id="register" name="create" value="Sign Up">
				</div>
			</div>
		</div>
	</form>
</div>
<style>
h2{
	text-align:center;
}
body
{background-color:lightblue;
}
.row
{
	position:relative;
	left:400px;
	top:60px;
}	
.col-sm-3
{
	height: 700px;
	width: 1050px;
	margin-top: auto;
	margin-bottom: auto;
	background: #f39c12;
	position: relative;
	display: flex;
	justify-content: center;
	flex-direction: column;
	padding: 10px;
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	border-radius: 5px;
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<script type="text/javascript">
	$(function(){
		$('#register').click(function(e){

			var valid = this.form.checkValidity();

			if(valid){


			var firstname 	= $('#firstname').val();
			var lastname	= $('#lastname').val();
			var email 		= $('#email').val();
			var phonenumber = $('#phonenumber').val();
			var password 	= $('#password').val();
			

				e.preventDefault();	

				$.ajax({
					type: 'POST',
					url: 'process.php',
					data: {firstname: firstname,lastname: lastname,email: email,phonenumber: phonenumber,password: password},
					success: function(data){
					Swal.fire({
								'title': 'Successful',
								'text': data,
								'type': 'success'
								})
							
					},
					error: function(data){
						Swal.fire({
								'title': 'Errors',
								'text': 'There were errors while saving the data.',
								'type': 'error'
								})
					}
				});

				
			}else{
				
			}

			



		});		

		
	});
	
</script>
</body>
</html>

Configuration

The database user id password and the database name is given here.

<?php 
$db_user = "root";
$db_pass = "";
$db_name = "useraccounts";

$db = new PDO('mysql:host=localhost;dbname=' . $db_name . ';charset=utf8', $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Processing to Database

We are getting the details from the user posting the data into our database.

<?php
require_once('config.php');
?>
<?php

if(isset($_POST)){

	$firstname 		= $_POST['firstname'];
	$lastname 		= $_POST['lastname'];
	$email 			= $_POST['email'];
	$phonenumber	= $_POST['phonenumber'];
	$password 		= $_POST['password'];

		$sql = "INSERT INTO users (firstname, lastname, email, phonenumber, password ) VALUES(?,?,?,?,?)";
		$stmtinsert = $db->prepare($sql);
		$result = $stmtinsert->execute([$firstname, $lastname, $email, $phonenumber, $password]);
		if($result){
			echo 'Successfully saved.';
		}else{
			echo 'There were erros while saving the data.';
		}
}else{
	echo 'No data';
}
Sign Up page

Login

LOGIN PAGE:The user is redirected the login page.The user will be filling the details such as email id and password.

<?php 

	session_start();
	
	if(isset($_SESSION['userlogin'])){
		header("Location: index.php");
	}


?>
<!DOCTYPE html>
<html>
<head>
	<title> Login</title>
	<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
	<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<style>
body,html{
	margin: 0;
	padding: 0;
	height: 100%;
	background: lightblue !important;
}
h1{
	position:relative;
	top:60px;
	text-align:center;
}
h2{position:relative;
	top:60px;
	text-align:center;
}	

.user_card{
	height: 460px;
	width: 350px;
	margin-top: auto;
	margin-bottom: auto;
	background: #f39c12;
	position: relative;
	display: flex;
	justify-content: center;
	flex-direction: column;
	padding: 10px;
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	border-radius: 5px;
}



.form_container{
	margin-top: 100px;
}

.login_btn{
	width: 100%;
	background: DodgerBlue !important;
	color: white !important;
}

.login_btn:focus{
	box-shadow: none !important; 
	outline: 0px !important;
}
.login_container{
	padding: 0 2rem;	
}
.input-group-text{
	background: #c0392b !important;
	color: white !important;
	border: 0 !important;
	border-radius: 0.25rem 0 0 0.25rem !important;
}
.input_user,
.input_pass:focus{
	box-shadow: none !important;
	outline: 0px !important;
}

.custom-checkbox .custom-control-input:checked~.custom-control-label::before{
	background-color: #c0392b !important;
}
</style>
<body>
<div class="container h-100">
	<div class="d-flex justify-content-center h-100">
		<div class="user_card">
			<div class="d-flex justify-content-center">
				<div class="brand_logo_container">
					<h1>Parking App</h1>
					<h2>Login</h2>
				</div>
			</div>	
			<div class="d-flex justify-content-center form_container">
				<form>
					<div class="input-group mb-3">
						<div class="input-group-append">
							<span class="input-group-text"><i class="fas fa-user"></i></span>					
						</div>
						<input type="text" name="username" id="username" class="form-control input_user" required>
					</div>
					<div class="input-group mb-2">
						<div class="input-group-append">
							<span class="input-group-text"><i class="fas fa-key"></i></span>					
						</div>
						<input type="password" name="password" id="password" class="form-control input_pass" required>
					</div>
					<div class="form-group">
						<div class="custom-control custom-checkbox">
							<input type="checkbox" name="rememberme" class="custom-control-input" id="customControlInline">
							<label class="custom-control-label" for="customControlInline">Remember me</label>
						</div>
					</div>
				
			</div>
			<div class="d-flex justify-content-center mt-3 login_container">
				<button type="button" name="button" id="login" class="btn login_btn">Login</button> 
			</div>
			</form>
			<div class="mt-4">
				<div class="d-flex justify-content-center links">
					Don't have an account? <a href="registration.php" class="ml-2">Sign Up</a>
				</div>
				<div class="d-flex justify-content-center">
					<a href="#">Forgot your password?</a>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="http://code.jquery.com/jquery-3.3.1.min.js"
			  integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
			  crossorigin="anonymous"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script>
	$(function(){
		$('#login').click(function(e){

			var valid = this.form.checkValidity();

			if(valid){
				var username = $('#username').val();
				var password = $('#password').val();
			}

			e.preventDefault();

			$.ajax({
				type: 'POST',
				url: 'jslogin.php',
				data:  {username: username, password: password},
				success: function(data){
					alert(data);
					if($.trim(data) === "1"){
						setTimeout(' window.location.href =  "index.php"', 1000);
					}
				},
				error: function(data){
					alert('there were erros while doing the operation.');
				}
			});

		});
	});
</script>
</body>
</html>

And here is the Output of the following code.

Login Page

Welcome Page

Once the user enters the correct email id and password it is redirected the welcome page.This is the welcome page which contains 4 options those are booking(booking the parking slot),booking history,feedback and logout.

<?php 

session_start();
	if(!isset($_SESSION['userlogin'])){
		header("Location: bookings.php");
	}

	if(isset($_GET['logout'])){
		session_destroy();
		unset($_SESSION);
		header("Location: login.php");
	}

?>
<html>
<body>
<div class="first">
<p>Welcome to parking system</p>
<button class="button1"><a href="bookings.php">booking</a></button>


<button class="button2"><a href="booking1.php" >booking history</a></button>
<button class="button4"><a href="feedback1.php" >Feedbacks</a></button>
<button class="button3"><a href="index.php?logout=true">Logout</a></button>
</div>
</body>
</html>
<style>
.first{
	height: 460px;
	width: 350px;
	margin-top: auto;
	margin-bottom: auto;
	background: #f39c12;
	position: relative;
	display: flex;
	justify-content: center;
	flex-direction: column;
	padding: 10px;
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	border-radius: 5px;
	position:relative;
	left:600px;
	top:200px;
}
body
{background-color:lightblue;
}
p
{
	font-size:29px;
	font-weight: bold;
	position:relative;
	top:-70px;
}
.button1
{border: white;
  padding: 18px;
  color: white;
  background-color:#4CAF50;
  text-align: center;
  cursor: pointer;
  width: 77%;
  font-size: 20px;
  position:relative;
  top:-10px;
  left:37px;
  

}
.button2
{border: white;
  padding: 18px;
  color: white;
  background-color:#4CAF50;
  text-align: center;
  cursor: pointer;
  width: 77%;
  font-size: 20px;
  position:relative;
  top:-0px;
  left:37px;

}
.button3
{border: white;
  padding: 18px;
  color: white;
  background-color:#4CAF50;
  text-align: center;
  cursor: pointer;
  width: 77%;
  font-size: 20px;
  position:relative;
  top:20px;
  left:37px;

}
.button4
{border: white;
  padding: 18px;
  color: white;
  background-color:#4CAF50;
  text-align: center;
  cursor: pointer;
  width: 77%;
  font-size: 20px;
  position:relative;
  top:10px;
  left:37px;

}
</style>
This is how the Welcome page will look like after sign up.

Booking Page

By choosing the booking link the user is redirected to the bookings page.The user has to give the details such as start time ,stop time,start date and stop date. Below is the code.

<?php 
$db_user = "root";
$db_pass = "";
$db_name = "booking";
$db = new PDO('mysql:host=localhost;dbname=' . $db_name . ';charset=utf8', $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

if(isset($_POST['search']))
{
	$carnumber 	= $_POST['carnumber'];
	$txtstartdate =$_POST['txtstartdate'];
	$txtlastdate =$_POST['txtlastdate'];

	$stime =$_POST['stime'];
	$etime=$_POST['etime'];
	$sql="INSERT INTO bookings(carnumber,txtstartdate,txtlastdate,stime,etime)VALUES(?,?,?,?,?)";
	$stmtinsert =$db->prepare($sql);
	$result=$stmtinsert->execute([$carnumber,$txtstartdate,$txtlastdate,$stime,$etime]);
	
}



?>

<!DOCTYPE html>
<html>


<div class="first">
<form action="bookings.php" method="post">
<h1>BOOKING</h1>


<div class="row">
<label for="carnumber"><b>Enter Your Car Number </b></label>
<input class="form-control" id="carnumber" type="text" name="carnumber" >
</div>
<p1><b>start date</b></p1>
<input class="startdate" input type="date" name="txtstartdate" >

<p2><b>lastdate</b></p2>
<input class="lastdate" input type="date" name="txtlastdate" >

<p3><b>starttime</b></p3>
<input class ="starttime" input type="time" name="stime" >

<p4><b>end time</b></p4>
<input class ="endtime" input type="time" name="etime" >
<button input class ="sub" input type="submit"  id="register" name="search" value="submit">Submit</button>
</form>
</div>

<style>
body
{background-color:lightblue;
}
h1{
	position:relative;
	top:-110px;
	left:100px;
}
.first{
	height: 560px;
	width: 350px;
	margin-top: auto;
	margin-bottom: auto;
	background: #f39c12;
	position: relative;
	display: flex;
	justify-content: center;
	flex-direction: column;
	padding: 10px;
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	border-radius: 5px;
	position:relative;
	left:600px;
	top:100px;
}
.row{
	position:relative;
	top:-120px;
left:70px;
font-size:20px;}
.form-control
{position:relative;
top:0px;
left:-40px;
	width: 80%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;}
p1{
	position:relative;
	top:-110px;
left:20px;
font-size:25px;
}
.startdate{
	position:relative;
top:-115px;
left:40px;
padding:8px;}
p2{
	position:relative;
	top:-80px;
left:20px;
font-size:25px;
}
.lastdate{
	position:relative;
top:-85px;
left:55px;
padding:8px;}
p3{
	position:relative;
	top:-50px;
left:20px;
font-size:25px;
}
.starttime{
	position:relative;
top:-55px;
left:55px;
padding:8px;}
p4{
	position:relative;
	top:15px;
left:-190px;
font-size:25px;
}
.endtime{
	position:relative;
top:-25px;
left:155px;
padding:8px;}
.submit{
position:relative;
left:100px;

}
.sub{background-color: #4CAF50;
  border: none;
  color: white;
  padding: 16px 32px;
  text-decoration: none;
  margin: 4px 2px;
  cursor: pointer;
  position:relative;
  top:0px;
  left:30px;
  width:80%;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<script type="text/javascript">
$(function(){
	$('#register').click(function(){
	Swal.fire({
		'title':'booking success',
		
		'type':'success'
	})
	});	
})
</script>
</html>
Output

Feedback System

The users are encouraged to give feedback. Using their feedback we can improve our system.

<!DOCTYPE html>
<html>
<head>
	<title>User Registration | PHP</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>



<div>
	<form action="registration.php" method="post">
		<div class="container">
			
			<div class="row">
				<div class="col-sm-3">
					<h1>Feedback</h1>
					<hr class="mb-3">
					<label for="firstname"><b>Name</b></label>
					<input class="form-control" id="firstname" type="text" name="firstname" required>
					<label for="email"><b>email</b></label>
					<input class="form-control" id="email"  type="text" name="email" required>
					<label for="Review"><b>review</b></label>
					<textarea rows="6" cols="40" placeholder="Your review" ></textarea>
					<div class="button">
					<input class="btn" type="submit" id="register" name="create" value="submit">
					</div>
				</div>
			</div>
		</div>
	</form>
</div>
<style>
h2{
	text-align:center;
}
body
{background-color:lightblue;
}
.row
{
	position:relative;
	left:1000px;
	top:60px;
}	
.col-sm-3
{
	height: 520px;
	width: 1050px;
	margin-top: auto;
	margin-bottom: auto;
	background: #f39c12;
	position: relative;
	display: flex;
	justify-content: center;
	flex-direction: column;
	padding: 10px;
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	border-radius: 5px;
	position:relative;
	left:300px;
	top:60px;
}
h1{
	position:relative;
	top:10px;
left:40px;}
.btn
{
	padding: 15px 32px;
	width:250px;
	background-color:DodgerBlue;
	 font-weight: bold;
	
}

.button
{
position:relative;
	left:10px;
	top:20px;
	
	
	

}

</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
<script type="text/javascript">
	
	
</script>
</body>
</html>
The feedback message

These all will be the options available. However, you can also add as per your convenience. Now, the information entered will be stored in the database as coded. Below are the snaps depicting the same.

REGISTRATION
BOOKING

You can also have a look at this video depicting how this Web page will be used.

UI

Authentication System

Now, we shall be continuing with the Authentication system which will be equipped at the gate. This will be done using RFID tags. Firstly, below is the Arduino code of it. Secondly, there is a demo video about how RFID works.

/* * Typical pin layout used:
 * -----------------------------------------------------------------------------------------
 *             MFRC522      Arduino       Arduino   Arduino    Arduino          Arduino
 *             Reader/PCD   Uno/101       Mega      Nano v3    Leonardo/Micro   Pro Micro
 * Signal      Pin          Pin           Pin       Pin        Pin              Pin
 * -----------------------------------------------------------------------------------------
 * RST/Reset   RST          9             5         D9         RESET/ICSP-5     RST
 * SPI SS      SDA(SS)      10            53        D10        10               10
 * SPI MOSI    MOSI         11 / ICSP-4   51        D11        ICSP-4           16
 * SPI MISO    MISO         12 / ICSP-1   50        D12        ICSP-1           14
 * SPI SCK     SCK          13 / ICSP-3   52        D13        ICSP-3           15
 */
#include<MFRC522.h>
#include<LiquidCrystal.h>
#include<SPI.h>
#include<Servo.h>
#define rs A0
#define en A1
#define d4 4
#define d5 5
#define d6 6
#define d7 7
int pos=0;


MFRC522 mfrc522(10,9);
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
Servo myservo;
Servo myservo2;
//void up(int i){
//  for (pos = 0; pos <= 180; pos += i) { // goes from 0 degrees to 180 degrees
//    // in steps of 1 degree
//    myservo.write(pos);              // tell servo to go to position in variable 'pos'
//    delay(50);                       // waits 15ms for the servo to reach the position
//  }}
//  
// void down(int i){ for (pos = 180; pos >= 0; pos -= i) { // goes from 180 degrees to 0 degrees
//    myservo.write(pos);              // tell servo to go to position in variable 'pos'
//    delay(50);                       // waits 15ms for the servo to reach the position
//  }}

void setup()
{
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  Serial.begin(9600);
  SPI.begin();
 lcd.begin(16,2);
  myservo.attach(8);
  myservo.write(140);
  myservo2.attach(3);
  myservo2.write(140);
//  Serial.print("#ACCESS CONTROL#");

  mfrc522.PCD_Init();
//  Serial.println("Scan Tag");
}

void loop()
{  lcd.setCursor(0,0);
   lcd.print(" PLEASE!   SCAN ");
   lcd.setCursor(0,1);
   lcd.print(" TAG  TO  ENTER ");
  if(!mfrc522.PICC_IsNewCardPresent())
  {
    return;
  }
  if(!mfrc522.PICC_ReadCardSerial())
  {
    return;
  }
  String uid="";
  Serial.println();
  Serial.print("UID=");
  for(int i=0;i<mfrc522.uid.size;i++)
  {
    Serial.print(mfrc522.uid.uidByte[i]<0x10 ? "0" : "");
    Serial.print(mfrc522.uid.uidByte[i],HEX);
    uid.concat(String(mfrc522.uid.uidByte[i]<0x10 ? "0" : ""));
    uid.concat(String(mfrc522.uid.uidByte[i],HEX));
  }
  uid.toUpperCase();
  if(uid=="D10DCA73")
  {
//    Serial.println("ravi");
    lcd.clear();
    delay(300);
    lcd.setCursor(0,0);
    lcd.print(" ACCESS GRANTED!");
    lcd.setCursor(0,1);
    lcd.print(" WELCOME Patel");
     myservo.write(40);
      myservo2.write(40);
//    digitalWrite(2,HIGH);
   
  }
  else if(uid=="44070C05")
  {
//    Serial.println("ravi");
    lcd.clear();
    delay(300);
     lcd.setCursor(0,0);
    lcd.print(" ACCESS GRANTED!");
    lcd.setCursor(0,1);
    lcd.print(" welcome Ravi");
//    digitalWrite(2,HIGH);
    myservo.write(40);
     myservo2.write(40);
  }
  else if(uid=="D5B1E261")
  {
   lcd.clear();
   lcd.setCursor(0,0);
    delay(300);
    lcd.print(" ACCESS DENIED!");
    
//    digitalWrite(3,HIGH);
    
    myservo.write(140);
    myservo2.write(140);
  }
  else
  {lcd.setCursor(0,0);
    lcd.print(" ACCESS DENIED!");
    lcd.clear();
//    lcd.print("  ACCESS DENIED!");
//    digitalWrite(3,HIGH);
    myservo.write(140);
    myservo2.write(140);
  }
  delay(3000);
  myservo.write(140);
  myservo2.write(140);
//  digitalWrite(2,LOW);
//  digitalWrite(3,LOW);
  lcd.clear();
//  Serial.println("    Scan Tag");
  return;
}

RFID

So, with this we end the project. Since we have implemented it in prototypical level, but it can be used in an industrial system too. I hope you were able to implement the same. If you face any sort of doubt, then feel free to ask in the comment section. Happy Learning!

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

How to Simulate IoT projects using Cisco Packet Tracer

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

How to design a Wireless Blind Stick using  nRF24L01 Module?

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

How to implement Machine Learning on IoT based Data?

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....

How to build a Safety Monitoring System for COVID-19

How to build a Safety Monitoring System for COVID-19

It is expected that the world will need to battle the COVID-19 pandemic with precautious measures until an effective vaccine is developed. This project proposes a real-time safety monitoring system for COVID-19. The proposed system would employ an Internet of Things...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....