/* Name: Sophie Wang, Sara Li, Annie Zou, Aaiza Khalid
Project: Pickpocketing Detector
Date: Feb 17th, 2019
Purpose: To warn users and protect their bags from potential pickpocketing threats
Outline:
1. user clips the device onto the zipper of their bag
2. user puts on the key reader/ ring on their finger
3. device continuously checks for potential pickpocketing threats
4. if person going into bag does not have ring on - the device will alert the owner
Testing:
- tested the distance of the zipper opening that will trigger the sensor
- tested the connection between TELUS LTE-M IoT Starter Kit and the device
- tested the connectivity between the wires
- tested the sensitivity of the sensors by using different mediums
to break the beam connection
Restrictions:
- current prototype is too large to carry
- should have a better sound system rather than just an LED light to warn the user
*/
#include "SPI.h"
#include "MFRC522.h"
#define SS_PIN 10
#define RST_PIN 9
#define SP_PIN 8
#define LED_PIN 7
#define BEAM 4
MFRC522 rfid(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
void setup() {
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
pinMode(LED_PIN, OUTPUT);
pinMode(BEAM, INPUT);
digitalWrite(LED_PIN, LOW);
}
void loop() {
digitalWrite(LED_PIN, !digitalRead(BEAM));
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
return;
// Serial.print(F("PICC type: "));
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
// Serial.println(rfid.PICC_GetTypeName(piccType));
// Check is the PICC of Classic MIFARE type
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
Serial.println(F("Your tag is not of type MIFARE Classic."));
return;
}
String strID = "";
for (byte i = 0; i < 4; i++) {
strID +=
(rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
String(rfid.uid.uidByte[i], HEX) +
(i!=3 ? ":" : "");
}
strID.toUpperCase();
Serial.print("Tap card key: ");
Serial.println(strID);
if (strID == "A0:AE:DD:87") {
digitalWrite(LED_PIN, LOW);
delay(5000);
} else {
digitalWrite(LED_PIN, HIGH);
}
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
}
Comments