Anda di halaman 1dari 15

BAG SECURITY SYSTEM

(By using Arduino uno & Web server connect


with phone.)

OBJECTIVE

• To design the project so that we can prevent intruders from coming into the building.

• By using RFID, that have the details of the bag owner to prevent the bag lost or stolen.
STEP 1 : LIST ALL THE EQUIPMENT.

- Bread board
- Resistor 1k, 10 k
- LED
- Diode
- Transistor
- Jumper/wire
- Dc motor
- IR sensor
- WIFI module
- Rfid reader & card
- Arduino uno
STEP 2 : MAKING THE CIRCUIT

This is the rfid circuit


This is the WIFI module circuit

This is the IR sensor and dc motor circuit


STEP 3 : PROJECT CODING.

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
#include <SoftwareSerial.h>

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

SoftwareSerial espSerial = SoftwareSerial(2,3);

String apiKey = "K2INA5VB4S7N06IR"; // replace with your channel's


thingspeak WRITE API key

String ssid="VHDV"; // Wifi network SSID


String password ="77777777"; // Wifi network password

boolean DEBUG=true;
int motorPin = 5;

void showResponse(int waitTime){


long t=millis();
char c;
while (t+waitTime>millis()){
if (espSerial.available()){
c=espSerial.read();
if (DEBUG) Serial.print(c);
}
}

boolean thingSpeakWrite(float value1, float value2){


String cmd = "AT+CIPSTART=\"TCP\",\""; // TCP connection
cmd += "184.106.153.149"; // api.thingspeak.com
cmd += "\",80";
espSerial.println(cmd);
if (DEBUG) Serial.println(cmd);
if(espSerial.find("Error")){
if (DEBUG) Serial.println("AT+CIPSTART error");
return false;
}

String getStr = "GET /update?api_key="; // prepare GET string


getStr += apiKey;
getStr +="&field1=";
getStr += String(value1);
getStr +="&field2=";
getStr += String(value2);
// getStr +="&field3=";
// getStr += String(value3);
// ...
getStr += "\r\n\r\n";

// send data length


cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
espSerial.println(cmd);
if (DEBUG) Serial.println(cmd);

delay(100);
if(espSerial.find(">")){
espSerial.print(getStr);
if (DEBUG) Serial.print(getStr);
}
else{
espSerial.println("AT+CIPCLOSE");
// alert user
if (DEBUG) Serial.println("AT+CIPCLOSE");
return false;
}
return true;
}
void setup() {
DEBUG=true; // enable debug serial
pinMode(motorPin, OUTPUT);
pinMode(A0,INPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
//Serial.println("Approximate your card to the reader...");
//Serial.println();

espSerial.begin(9600);

espSerial.println("AT+CWMODE=1"); // set esp8266 as client


showResponse(1000);

espSerial.println("AT+CWJAP=\""+ssid+"\",\""+password+"\""); // set your


home router SSID and password
showResponse(5000);

if (DEBUG) Serial.println("Setup completed");

void loop()

{
Serial.println(analogRead(A0));
delay(1000);
if(analogRead(A0)<50)

{
digitalWrite(motorPin,HIGH);
delay(5000);
digitalWrite(motorPin,LOW);
}

// Look for new cards


if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "72 36 05 D5")
{
thingSpeakWrite(1,1);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
delay(1000);
Serial.println("Authorized access");
//Serial.println();
//delay(3000);
}

if (content.substring(1) == "46 A5 57 8F")


{
thingSpeakWrite(0,0);
digitalWrite(4, LOW);
delay(1000);
digitalWrite(4, LOW);
delay(1000);
//Serial.println("Authorized access");
//Serial.println();
//delay(3000);
}

if (content.substring(1) == "8E 10 72 5B")

{
thingSpeakWrite(2,2);
digitalWrite(4, HIGH);
delay(1000);
digitalWrite(4, LOW);
delay(1000);
//Serial.println("Authorized access");
//Serial.println();
//delay(3000);
}
else {
//Serial.println(" Access denied");
//delay(3000);
}

// thingspeak needs 15 sec delay between updates,


delay(15000);

}
STEP 4 : compile all in one breadboard and arduino.
STEP 6 : WEB SERVER AND CONNECT TO PHONE

We use ThingSpeak server as our webserver.


The graph show our data from circuit is delivered to webserver

Then we use virtuino application from android as our apps at the phone
We link from data from circuit to webserver and go to virtuino apps android.
STEP 7 : PROTOTYPE.

Anda mungkin juga menyukai