A simple burglar Alarm: reading data sensors

I found really useful  rc -switch library to read sensor data.

First of all i wanted to understand what happens  when I activate the door sensor or PIR sensor.
I connected the receiver to Arduino as the table below:

Pin Receiver Pin Arduino
Vcc 5 V
GND GND
DATA Pin 2 (digital)

I used the breadboard included in the arduino starter kit. 


I included the rc switch  library and copied it in Arduino library folder.
My filesystem under libraries\RCswitch\ look like:

  • keywords.txt
  • RCSwitch.cpp
  • RCSwitch.h
  • example folder

We can open Arduino Ide and copy and paste this code:

 

#include <RCSwitch.h>;
RCSwitch mySwitch = RCSwitch();

void setup() {
   Serial.begin(9600);
   mySwitch.enableReceive(0); // Receiver on inerrupt 0 =&gt; that is pin #2
}

void loop() {
   if (mySwitch.available()) {

      int value = mySwitch.getReceivedValue();

      if (value == 0) {
         Serial.print("Unknown encoding");
     } else {
         Serial.print("Received ");
         Serial.print( mySwitch.getReceivedValue() );
         Serial.print(" / ");
         Serial.print( mySwitch.getReceivedBitlength() );
         Serial.print("bit ");
         Serial.print("Protocol: ");
         Serial.println( mySwitch.getReceivedProtocol() );
      }

      mySwitch.resetAvailable();
   }
}

Uploading sketch to Arduino  and opening console monitor on 9600 baud I can read this values:

  1. door sensor 1: Received 1398111 / 24bit Protocol: 1
  2. door sensor 2: Received 1394004 / 24bit Protocol: 1
  3. PIR sensor      :Received 1392102 / 24bit Protocol: 1

At this point I can use these values ​​to intercept door opening or movements into house and  make Arduino send me an email or a text message.
I opted to receive an email: here comes ethernet shield .

An idea: a simple burglar Alarm

About a year ago I bought a typical Chinese burglar on Ebay, it’s composed of a control unit, a PIR ( passive infrared sensor) and two door sensors.

It is completely wireless and works on 433 Mhz frequency.

After a week the unit no longer works !!!

At this point I only had the sensor, what to do ?!
I want to try to use Arduino to read data coming from the sensors and to build a simple burglar.

My idea is :

– interfacing sensors with Arduino;
– add a noise sensor to detect any suspicious noises at home;
– send an e-mail to my email address in case of suspicious activity (like noise or movement)
– turn on a camera to see what is happening in the house

This is my first project with Arduino and I do not know excessively  about electronics, but I do know programming.

First I bought an Arduino UNO, then I searched for a receiver / transmitter 433 Mhz …..

For wireless communication I found these models :

MX05V and MXFS03V

As sensor noise :

FC04

Both are available on ebay (very cheap but with waiting time of about a month in Italy ) .

At this point it was time to connect the sensors to Arduino and understand how to read the data .