Introduction: RFID Security System

This is an alarm system which you can use at home. The alarm system is capable of telling you who's inside your home and is also capable of automatically activating an alarm system when nobody is inside. The prototype is build around personal RFID chips which should be used everytime a person enters or leaves.
A motion sensor and an active buzzer, which can be replaced with a solid sirene, is used for the alarm system.
To monitor the inhabitants i've also set up a webserver on a raspberry pi which speaks with a MySQL database.

The system itself has three components.

  1. An Arduino Uno which drives al the components and sends serial data.
  2. A Raspberry PI which reads serial input from the Arduino and runs the webserver.
  3. The casing of the prototype which is a little fuse box with a door

Step 1: Required Components and Materials

The required compontents are easy to find and relatively cheap. Most of the components can be bought at electronics/ prototyping webstores.

  • Arduino Uno
  • Raspberry Pi
  • RFID RC522 reader writer module
  • MIFARE PICC
  • HC-SR501 PIR motion detector
  • 2 x LED
  • active buzzer
  • small fuse box
  • wires
  • solder iron and tin
  • 1 x 1 K resistance

Step 2: Getting Everything Into the Fuse Box

For the casing of the prototype you can use or build anything you want, important to keep in mind is that the signal of the RFID reader is quite weak and isn't always able to penetrate through heavier matterials.

I used a simpel fuse box with a door, which comes in handy for the RFID reader. If you've chosen for a fusebox like mine, the electronics can be simply placed by following these 6 steps.
For the next steps you'll need a drilling machine, a screwdriver, some bolts, and second adhesive.

  1. Start by drilling holes into the back plate of the fuse box for placing the arduino and raspberry pi into it.
  2. Drill some holes into the frontpanel for placing the RFID reader.
    Make sure you solder the RFID reader because some models have bad contacts.
  3. Drill a big hole for the motion sensor
    If you get the right fuse box, drilling holes wont be necessary.
  4. Drill medium holes for the LED's.
  5. Use bolts to fasten the arduino, raspberry pi and RFID reader onto the box.
    Don't tighten the bolts to mutch as it can damage the hardware.
  6. Use second adhesive to fasten the LED's and motion sensor into the holes.
    Make sure none of it gets on the PCB

Step 3: Connections

Connect the wires as shown on the image.
You can always review the arduino code to ensure you've connected everything the right way.

Connect the RC522 module as follows:

  • SDA (SS) - pin 10
  • SCK - pin 13
  • MOSI - pin 11
  • MISO - pin 12
  • IRQ - none
  • GND - GND
  • RST - pin 9
  • 3.3v - 3.3v

Step 4: Uploading the Code to Arduino

Upload this code to the arduino.

If problems occur with the Arduino IDE and the MIFARE library, i suggest you download an older software release.

Step 5: Raspberry Pi

Follow both guides below to install Apache, PHP, MySQL and PhpMyAdmin on your PI

Apache , php , mysql

PhpMyAdmin

Upload this code to the Raspberry Pi.

/home/pi/Python_Script/Project_Python

You can't use sudo from a PHP script. Apache is running from an user (www-data generaly), so edit

/etc/sudoers 

and add this line :

www-data ALL=(ALL) NOPASSWD:ALL

Care ! this will authorize all functions to be called by a PHP script, you can adapt changing "ALL" by your script.

Then precise your user in your exec command.

A reboot is required !

Step 6: Build Database

To build up your database;

  1. surf to your phpmyadmin page which can be found at yourPi'sIP/phpmyadmin
  2. Open the sql tab
  3. Insert these sql statements top down.

Step 7: Add Your Php Files to the Webserver

Download these files to your Raspberry Pi.

Place them at this location:

/var/www/html/

Step 8: Complete !

Now that you followed all the steps your prototype should be up and running.

#NMCT

#Howest