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.
- An Arduino Uno which drives al the components and sends serial data.
- A Raspberry PI which reads serial input from the Arduino and runs the webserver.
- 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
- 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.
- Start by drilling holes into the back plate of the fuse box for placing the arduino and raspberry pi into it.
- Drill some holes into the frontpanel for placing the RFID reader.
Make sure you solder the RFID reader because some models have bad contacts.
- Drill a big hole for the motion sensor
If you get the right fuse box, drilling holes wont be necessary.
- Drill medium holes for the LED's.
- 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.
- 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
Upload this code to the Raspberry Pi.
You can't use sudo from a PHP script. Apache is running from an user (www-data generaly), so edit
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;
- surf to your phpmyadmin page which can be found at yourPi'sIP/phpmyadmin
- Open the sql tab
- 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:
Step 8: Complete !
Now that you followed all the steps your prototype should be up and running.