Arduino anti-theft alarm shield

Complete anti-theft alarm compatible with any kind of sensors, with RFID recognition, GSM and web server, based on Arduino Mega.

Similar projects worth following
This anti-theft alarm is basically an Arduino Mega Shield with fairly complex software.

The system is composed by a main circuit (the arduino shield) installed in an hidden place and an i2c connected "remote control panel" near the main house door, offering LCD, capacitive buttons and RFID recognition.

The whole system may be managed and configured from the webserver; webpages are published in iphone/android webapp format. When the system is alarmed, it sends mail and SMS to the owner.
It also connects to house domotic system (e.g. close rolling shutters when it's activated), control IP cams, send push notification, detect humidity and temperature...


This shield transform an Arduino Mega 2560 in a burglar alarm ... with some cool extras.

- Supports NFC and RFIDs activation with authorization control
- Full web interface for managing and configuring the system, supported by smartphones as native WebApp
- Mail and GSM notifications when the system is alarmed
- Domotic integration (it may open/close windows, turn on/off lights, and so on)
- Fully configurable timings and options, stored in the arduino eprom
- Perimetral and Volumetric sensors may be independently enabled/disabled
- Automatically disable open windows sensors, warning you when activated
- Batteries to keep the system running on power fault
- DHT temperature/humidity sensor and communication to emoncms server or similar (read here for further information:
- Good looking installation :)


Components are listed in the proper paragraph below. Basically, the system is made up two parts:


The main circuit (Arduino Mega shield): this shield is connected with all the sensors (at the moment, 6 magnetic sensors and 2 volumetrics), the external siren, the ethernet and the GSM module. It is powered by a small UPS with a 2,2 Ah battery, enough to make it working for some hours if the power fall off. The siren has an independent 2 Ah battery too. The circuit communicates with the remote control panel with i2c. The whole circuit is completely hidden in a in-wall mounted box.
It basically read sensors as "buttons"; magnetic sensors (and tampers, like the siren one) were supplied directly with 5V, while the volumetric sensor output (12V) was converted to 5V with a voltage divider. To avoid arduino heating problems, I supplied energy to the components with independent voltage regulators (ENC28J60 has great consumption). The circuit also supply power to the siren. All power parts are protected with fuse and decoupling capacitors [not shown in the schematics for simplicity].


The remote panel: I tried to build a good looking panel for enabling/disabling/controlling the alarm. So, I use a in-wall mounted box covered with a white plexyglass frame with a small window for LCD. In the box, I put a small circuit, essentially an i2c hub with proper voltage regulators (the whole panel is supplied with 12v) that I use to communicate with all the i2c components: NFC reader, LCD and MPR121 for capacitive buttons/led. I also add a little speaker to give the user sound feedbacks. The panel is connected to the shield with a long 2+4 wire cable. The result is pretty good and it works perfectly. Since the i2c cable that connects to the main circuit is long, more than i2c specification, I planned to add some kind of serial translator. However, it already works perfectly so I didn't need it; the only trick to make it working fine was to add some capacitors to the magnetic sensors pins near the Arduino, since the rolling shutter electric motors randomly introduced some noise that caused i2c errors.


Software was obviously written with Arduino IDE and it may be downloaded from the link on the left.

I used several libraries: UIPEthernet for ethernet (or Ethernet if you want to use W5100 standard chipset), time and timezone for time management, LiquidCrystal_I2C for LCD and many others. For safety purpose, I preferred WSWire library over standard Wire, because it offers non-blocking i2c protocol (so, if i2c fails or has been broken, the system keeps running on). You can download the whole Arduino 1.6.4 IDE with the proper libraries from the link on the left.

The system configuration (sensor number / type, authorized NFC IDs, etc.) has to be hard-coded in the arduino code in some proper sections; system options (siren duration and other timings, domotic control, etc.) may be runtime configurated through the webserver, and will be stored in the Arduino eprom. Date and time are automatically and periodically acquired with NTP.

Basically, the system has three user interfaces:

- Remote Panel: using the capacitive buttons, user may select...

Read more »

  • 1 × Arduino Mega 2560
  • 1 × Ethernet ENC28J60 Module cheap arduino compatible ethernet interface
  • 1 × 16x2 LCD with i2c interface cheap lcd module
  • 1 × MPR121 capacitive buttons and leds managament
  • 1 × PN532 NFC/RFIDs reader/writer

View all 16 components

  • Fixes and enhancements

    IngGaro08/05/2015 at 10:23 0 comments

    Hi guys, i release a new version of the code with some fixes and enhancement. New features:

    • Watchdog: the system will reboot if it's stuck for more than 8 seconds (note: you have to be sure you have the last bootloader for arduino mega, older ones have a bug that causes endless reboot. You can easily flash it using another arduino and following these instructions:
    • Restore state: the system will remember its state in case of rebooting or shutting off.
    • Safe mode: the system will enter in a "safe mode" in case of any failure (it will stop rebooting after 5 reboots, to avoid undesidered false alarms)
    • Log php script: included in the source code, it may be put on a webserver to log you accesses
    • Some memory fixes and small stuff

    If you are going to use a W5100 ethernet (I finally got a working one) you have to connect pin 10 to the SS pin. Since in this project the pin 10 is used for GSM modem shield, you have to change it (maybe to pin 53, like in the scheme). You may easily do it with a small modification to the library, follow this link:

  • Big update is here... PROJECT COMPLETED

    IngGaro06/04/2015 at 23:33 0 comments

    Ok guys, here we are, I worked a lot and the project is fully finished.

    Many many news in the code.

    Main change: I switched ethernet library. I used UIPEthernet in order to use standard ethernet call, so you can switch between ENC28J60 or standard W5100 just changing the library inclusion in the code.

    Then, a lot of features were added:

    • completely rewritten webinterface, now it includes AJAX values update, basic authentication, favicon, colors, styles (look at the pictures in the description
    • push notifications
    • ipcam activation/deactivation
    • enhanced GSM controls and functions
    • enhanced messages (for example, when it's alarmed, it tells you which sensors were enabled)
    • enhanced domotic control
    • more options
    • more stability
    • lots more, I can't remember them all! :)

    I also posted an update drawing of the circuit and uploaded a fully arduino IDE with libraries I used for easy compiling.


    Small request: if someone wants to help me to create a cool PCB shield for the project, write me in private!

  • Big update coming

    IngGaro05/17/2015 at 22:57 2 comments

    I made a massive update recently. Now the sketch support both ENC28J60 and W5100 (standard ethernet library).

    I also added some new cool features (ip cam control, push notification...).

    I will release the code in some days!

  • 4 days to go...please help!

    IngGaro03/26/2015 at 06:41 0 comments

    Please give me some more votes!

    No need for registration, just push "VOTE" on Arduino Anti-theft Alarm Shield. You can vote multiple times.

    This is the website:

    Thanks guys!

  • Please help!

    IngGaro02/28/2015 at 17:52 0 comments

    Hi guys, I posted my project in a competition, can you vote for me? It's just one click...

    If I won I can get some items to improve my project ^_^

    Thanks in advance!

  • Project is not dead :)

    IngGaro01/20/2015 at 20:53 0 comments

    I'm still working on it. I'm working on a new code based on the standard ethernet library, that is also working with ENC29j60 using the ethercard library. I also added some cool functionalities. Unfortunately I got a broken W5100 board so I'm waiting for the new one, so it will still took a while.. stay tuned.

  • Network Improvement

    IngGaro09/21/2014 at 19:45 0 comments

    I played around with Webduino library and I think that I will release the final code after replacing ENC28J60 with a W5100, using standard ethernet library and webduino instead of ethercard lib. It's just to complicate and memory-intensive to handle multiple subsequent ethernet calls with ethercard lib (I had to implement a message queue), so for this reason I decide to try to use the W5100 (9$ on ebay) that will make me able to develop a much more stable and nice interface. I hope to put it online in some weeks (I'm waiting for the W5100 shipping :))

  • Huge code cleanup

    IngGaro09/03/2014 at 09:47 0 comments

    I did a massive code cleanup. The system seems to works very well and it's extremely stable (no errors or hangups); I will upload it soon. I also added a second webpage for options and a couple of feature:

    - intelligent mode: the system automatically preset itself in "perimetral only" or "perimetral and volumetric" mode based on the day time; it can be manually change as usual, of course

    - sensor reactivation: you may choose to automatically re-enable or not windows (perimetral) sensors after activating the alarm with open windows

  • GSM / Ethernet improvement

    IngGaro08/28/2014 at 09:20 0 comments

    Refined both ethernet implementation and GSM. Now the system calls and texts a pool of predefined phone number when the system is alarmed; it also answer with a confirmation SMS when the system is enabled/disabled through GSM.

    I want to replace ENC28J60 with W5100 for many reason: simpler and more powerful library, no need for external script for sending mail, better reliability.

  • Ethernet call implementation

    IngGaro08/21/2014 at 14:26 0 comments

    After implementing access log I found out that sometimes, on multiple sequential "ethernet call", some calls fail. That is due to some issue in ethercard library implementation. However, I'm working on a solution; I decided to re-implement all ethernet calls using a "queue" that emulate a different thread to correct manage connections.

View all 14 project logs

Enjoy this project?



Daniel Cabrera wrote 05/13/2021 at 17:55 point

Hello, how can I add the feature to work with wireless sensors?

  Are you sure? yes | no

bisshop69 wrote 12/03/2017 at 22:45 point

AMAZING! but would you mind make a video explaining everything? please, i'm sure there are a lot of people who wants it. I'm so sorry for my english, it''s too bad.

  Are you sure? yes | no

Christian wrote 11/01/2017 at 22:38 point

mi potresti spiegare come hai fatto a far comunicare la tastiera con la centrale? Non capisco che board hai usato per la tastiera. Grazie :)

  Are you sure? yes | no

Pungh0Li0 wrote 02/13/2017 at 02:26 point

This is almost exactly what I'm looking for. I would like to make it
(and have bought some parts) but I just can't wrap my head around it
without schematics. The pictures just aren't enough. The drawings seem
to be missing info and don't always match what the pictures show. 
Any chance you are still planning on uploading some schematics?

  Are you sure? yes | no

Georgi Nikolov wrote 08/05/2016 at 08:03 point

Hello guys,

Great work with this project. I was thinking to do something similar for my self, but you have done all the things I need. So I will give it a try with this project. However I am not big fan of breadboards, so I will make my own PCBs. I will gladly share them here when I am ready for others to use them. How can I do this? Send them to you? I did not find any schematic and Bill of materials on the site, is there any that will make the PCB creation easier?

Best regards Georgi Nikolov

  Are you sure? yes | no

IngGaro wrote 08/05/2016 at 08:45 point

A friend is working for a PCB... at the moment the best schematics I have are already on this site!

  Are you sure? yes | no

amoarg69 wrote 07/13/2016 at 18:16 point

Hello!  thanks for your project!

I'm currently developing something similar to your project, and I have some problems with Ardino leonardo-ENC28J60 module. This config is highly unstable. I try many librarys without success. Please, can you tell me if mega+ ENC28J60 is stable enough to make a domotic system based on client/server http architect? My plan its control home from tablet's or phone's. i'm not sure if buy a MEGA 2560 or Raspberry/UDOO/BBB (or similar) board. 

Thanks in advance. Sorry for my English. Daniel.

  Are you sure? yes | no

IngGaro wrote 08/05/2016 at 08:45 point

It is stable enough but I suggest to use W5100. Less problems and more power!

  Are you sure? yes | no

Joshua Yewman wrote 06/23/2016 at 11:51 point


I am having some trouble compiling the project's code and I was wondering if you could help me. I have downloaded both the source code and the IDE with pre-installed libraries however when I attempt to compile the code the progress bar stops at around 1/3 of the way there and will not continue, I have not changed the code in any way. Thank You

  Are you sure? yes | no

panagiotis wrote 05/26/2016 at 06:31 point

Nice work can u make a exactly diagram of wiring cause i want to make it for my son's project school


  Are you sure? yes | no

otso.ylonen wrote 03/10/2016 at 14:10 point


This is very impressive! I intend to build something like this, too. Also, I would like to play with ONVIF compatible IP cameras to see if I can control them with the Arduino.

Could you post a picture or link about the motion sensors you have used, please? Did you make them yourself or use off-the shelf packages like this:

Values of all your components, and obviously a schematic, would make it easier for many of us to start with this!

  Are you sure? yes | no

IngGaro wrote 03/10/2016 at 22:53 point


I used motion sensor like the one you posted. 12V, regual double technology sensor.

Schematic is already available in this page, I don't know the value of all my components but I can estimate the total in about 200$...

  Are you sure? yes | no

tomballe.olivier wrote 01/26/2016 at 17:15 point


nice project ;-)

but i'm have one question, when i see the main circuit picture and the picture that you take from the circuit mounted into the box the color codes of the resistances is not similar?

i'm see some capacitors to.

and some 3 transistor?

can you add a list for the parts value? R1, R2 etc

C1, C2 etc

and the type of the transistor?

many thank's

  Are you sure? yes | no

Ed wrote 09/21/2015 at 15:22 point

still a tad unclear to me: the Megashield does not have the  right spacing for the headers. Ofcourse one can bend the legs that I presume are under the Megashield... but still, then the other shields such as the Ethershield will not fit.
So how did u solve that?

  Are you sure? yes | no

IngGaro wrote 09/21/2015 at 17:23 point

I just created an homemade shield using a matrix board bending the headers. It fits perfectly; of course you cannot use other shields, but I didn't. I just used an ethernet controller like this one, check in the photos for details! The only shield I used is the GSM shield, I connected it with wires. I know it's not the most elegant solution, but it works :)

  Are you sure? yes | no

qle303 wrote 02/24/2015 at 07:46 point

Any update with the full Wiznet 51 library and updating the main with it? Much appreciated. Just got started with arduino Mega and somewhat new to Arduino. I love what you have done with it. This is a truly inspirational project.

  Are you sure? yes | no

IngGaro wrote 02/24/2015 at 09:38 point

Hi, unfortunately not. I got a broken W5100 and they're sending me another one from china, but it's been two months and the package isn't arrived yet (it's not so strange). I have already rewritten almost the whole code...

  Are you sure? yes | no

kusannaghi wrote 02/14/2015 at 20:03 point

Sorry, but i just do not see as you make connections. The hardward part i dont understand. Can you send me a diagram to my email? Thanks for all.

  Are you sure? yes | no

IngGaro wrote 02/24/2015 at 09:37 point

Hi, I don't have any further diagrams. However it is simple: the black strips are just sockets in which components are plugged in. No need for complex connections!

  Are you sure? yes | no

tiefpunkt wrote 01/18/2015 at 09:31 point

Do you have any pictures of the back of the panel? I was wondering how you connected the buttons. I'm currently building a keypad for the doorlck at our hackerspace, and was thinking ob using a similar method...

  Are you sure? yes | no

IngGaro wrote 01/18/2015 at 10:32 point

Sorry I don't have pics of the back at the moment. However it's really easy: just a single wire soldered on a piece of copper tape for each button. Then, that copper tape it's connected to the MPR121.

  Are you sure? yes | no

tiefpunkt wrote 01/23/2015 at 22:05 point

Thanks, I'll give that a try. Did you just put the copper tape on the paper?

  Are you sure? yes | no

IngGaro wrote 01/24/2015 at 18:30 point

exactly! it is adhesive, so I just stick it on the back of the paper.

  Are you sure? yes | no

marc wrote 12/01/2014 at 23:52 point
Great great project!
I'm currently searching for some GSM fearures to add to my own alarm project.
Unlike you i've user a rpi to communicate with the outside world
You can check my project below

  Are you sure? yes | no

francescocostantino4 wrote 11/28/2014 at 22:05 point
Is it possible to have the schemaic of the whole project? is it no clear to me how are connected the different modules

  Are you sure? yes | no

jon wrote 09/27/2014 at 21:15 point
Nice, I never even thought of a printed sheet... Just a comment on your change to the wiznet ethernet adapter, its a very good move, I had no end of issues with the ENC28J60s compared to the W5100. Look forward to more updates on this. Some of my parts have arrived for my system so I'm starting to build it up and put some code together.

  Are you sure? yes | no

jon wrote 09/12/2014 at 14:57 point
Also, did you etch the plexiglass yourself?

  Are you sure? yes | no

IngGaro wrote 09/21/2014 at 19:37 point
The plexy is just a square piece over a simple A4 ink-jet printed sheet! Behind, I attached some wire and copper tape to connect to MPR121 for capacitive buttons.
Yes, I used off the shelf sensors (not PIRs but double technology sensors and perimetral switches). The nice thing is that I can connect almost any sensors, just connecting it to the correct voltage (the circuit supplies both 12V and 5V) and correctly adjusting their pinout voltage to fit arduino inputs.

  Are you sure? yes | no

jon wrote 09/12/2014 at 14:54 point
Really good job, would like to build something similar myself. How did you connect the MPR121 to the plexi? wire and duct tape? With regard to the sensors, did you use off the shelf PIRs and perimeter sensors. I'd be looking to replace an existing alarm system with traditional sensors.

  Are you sure? yes | no

Squint wrote 09/08/2014 at 06:12 point
This is awesome.. I've wanted to do this for ever.. Great job on keeping the interface clean..
Any chance you have the schematics as Eagle files?

  Are you sure? yes | no

IngGaro wrote 09/21/2014 at 19:38 point
I think no... but if you want to help me doing it it would be great :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates