Motion Detection System: Intruders Counter System With Signal Information

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

MOTION DETECTION SYSTEM

The system title: Intruders counter system with signal information Introduction to the system:
This system studies the problem of people and banks in case if any Burglary happened and to safe banks
at night or gold shops from the Robbersng in public places where is uncrowded and unsafe places and

help the police to have a single email attached with the robbers and attacked photo and they. This can be inconvenient and time consuming when the banks are not close by, and this system will be connected with alarm after after sending signal to whom concerning about the place of installed system. This research will use the combination of PIR sensor and microcontrollers technology to develop Wireless sensor mailbox delivery alert. And this work will be useful not only for safety matter we can use this system to know the rate of people who are using the ATM for researcher who are doing analyzing other kind of research.

How the system works:


The sensor detects the motion of the movement and sensor will gives a signal to the alrem to take a make sound then will process the event and passes it to the second node. The transceiver, which is wireless receives commands from the sources node (mailbox microcontroller) and transmit the data to the alarming system, which will actually alert that a message had been dropped or not.

Receiver

Senso r Sensor side

Transmitt er

Display system & Buzzer

e-mail (inbox)

Receiver side

Computer & internet connection

SYSTEM OBJECTIVES:

In this project, the main objective is to develop a motion detector sensor board that can transmit signal to end node with giving signal through email.

To use this system in the important places (banks, gold shops and ... etc.) that need high security to give a signal. To help researchers to do their research easily and smoothly and the output will be in their email.

Requirements:
Hardware Requirement: Micro-controllers Sensor node PIR Alerting system and small LCD Display. RF Transmitter and Receiver.

1- Micro-controllers Arduino 1-1 Introduction


The Arduino microcontroller is an easy to use yet powerful single board computer that has gained considerable traction in the hobby and professional market. The Arduino is open-source, which means hardware is reasonably priced and development software is free. The Arduino project was started in Italy to develop low cost hardware for interaction design With the Arduino board, you can write programs and create interface circuits to read switches and other sensors, and to control motors and lights with very little effort. Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language(based on Wiring) in this project Python language used and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software running on a computer. Figure 1 shown Arduino board.

Figure 1: Arduino board

1-2 Requirement of programing Arduino board


- Arduino board - USB programming cable (Arduino board to computer) - 9V battery or external power supply (for stand-alone operation) - Solderless breadboard for external circuits - Installing the Software, Arduino software is free in (http://arduino.cc/en/Main/Software)

2- Sensor node PIR


PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out. For that reason they are commonly found in appliances and gadgets used in homes or businesses. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors as shown in figure 3.

Figure 3: PIR Sensors

PIRs are basically made of a pyroelectric sensor , which can detect levels of infrared radiation. Everything emits some low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they

cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low. For many basic projects or products that need to detect when a person has left or entered the area, or has approached, PIR sensors are great. They are low power and low cost, pretty rugged, have a wide lens range, and are easy to interface with. Note that PIRs won't tell you how many people are around or how close they are to the sensor, the lens is often fixed to a certain sweep and distance (although it can be hacked somewhere) and they are also sometimes set off by house pets.

3- Alerting system (Magnetic Buzzer) and small LCD Display. 3-1 Magnetic Buzzer
A buzzer or beeper is an audio signaling device which maybe mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers include devices, timers and confirmation of user input such as a mouse click or keystroke. The magnetic buzzer is type of the buzzer that uses in Arduino application, the buzzer and its specifications are shown in figure 4.

Figure 4: Datasheet of Magnetic Buzzer

3-2 LCD Display


20 x 4 (4 lines of 20 characters) LCD display with white text on a vivid blue backlit LCD. The pictures don't do justice to the bright blue background with clear white text of this display. Standard Hitachi HD44780. Used LCD shown below in figure 5. -

Dimensions Width 3.9 inches (98mm) Height 2.35 inches (60mm) Display view size 76mm x 26mm

Figure 5: LCD Display

4- RF Transmitter and Receiver


The RF module, as the name suggests, operates at Radio Frequency. The corresponding frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is represented as variations in the amplitude of carrier wave. This kind of modulation is known as Amplitude Shift Keying (ASK).Transmission through RF is better than IR (infrared) because of many reasons. Firstly, signals through RF can travel through larger distances making it suitable for long range applications. Also, while IR mostly operates in line-of-sight mode, RF signals can travel even when there is an obstruction between transmitter & receiver. Next, RF transmission is more strong and reliable than IR transmission. RF communication uses a specific frequency unlike IR signals which are affected by other IR emitting sources. This RF module (shown in figure 6) comprises of an RF Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx) pair operates at a frequency of 434 MHz. An RF transmitter receives serial data and transmits it wirelessly through RF through its antenna connected at pin4. The transmission occurs at the rate of 1Kbps - 10Kbps.The transmitted data is received by an RF receiver operating at the same frequency as that of the transmitter.

5- Figure 6: RF Transmitter and Receiver

Project Flow Chart

End Node

LCD Display 20 X 4 ARDUINO MEGA 2560 End Node RF 433 Mhz Receiver

Sensing Node:

Buzzer

LED Arduino UNO Sensor Node PIR Sensor

RF 433 Mhz Transmitter

Reset Button

Res et

Projects Coding
Sending code
In this case by using C++ language: #include <VirtualWire.h> int ledPin = 13; // choose the pin for the LED int inputPin = 2; // choose the input pin (for PIR sensor) int pirState = LOW; // we start, assuming no motion detected int val = 0; // variable for reading the pin status //int pinSpeaker = 10; //Set up a speaker on a PWM pin (digital 9, 10, or 11) #define BUTTON_PIN 7 // Button boolean button_was_pressed; // previous state void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inputPin, INPUT); // declare sensor as input // pinMode(pinSpeaker, OUTPUT); // Initialize the IO and ISR pinMode(BUTTON_PIN, INPUT); digitalWrite(BUTTON_PIN, HIGH); // pull-up button_was_pressed = false; vw_setup(2000); // Bits per sec Serial.begin(9600); } void loop(){ // handle button "reset button" boolean raising_edge = handle_button(); if(raising_edge) { // Serial.print("^"); // digitalWrite(ledPin, HIGH); // turn LED ON send("2"); delay(50); } else {

// Serial.print("."); // digitalWrite(ledPin, LOW); // turn LED ON } val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(ledPin, HIGH); // turn LED ON // playTone(300, 160); delay(50); if (pirState == LOW) { // we have just turned on // Serial.println("Motion detected!"); send("1"); delay(200); // We only want to print on the output change, not state pirState = HIGH; } } else { digitalWrite(ledPin, LOW); // turn LED OFF // playTone(0, 0); // delay(300); if (pirState == HIGH){ // we have just turned of // Serial.println("Motion ended!"); // We only want to print on the output change, not state pirState = LOW; } } } void send (char *message) { vw_send((uint8_t *)message, strlen(message)); vw_wait_tx(); // Wait until the whole message is gone } boolean handle_button() { boolean event; int button_now_pressed = !digitalRead(BUTTON_PIN); // pin low -> pressed event = button_now_pressed && !button_was_pressed; button_was_pressed = button_now_pressed; return event; }

Receive code
/* SimpleReceive This sketch displays text strings received using VirtualWire Connect the Receiver data pin to Arduino pin 11 */ #include <VirtualWire.h> #include <LiquidCrystal.h> byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message // initialize the library with the numbers of the interface pins LiquidCrystal lcd(9, 8, 5, 4, 3, 2); int MessageNo = 0; int pinSpeaker = 7; //Set up a speaker on a PWM pin (digital 9, 10, or 11)

void setup() { // set up the LCD's number of columns and rows: lcd.begin(20,4); pinMode(pinSpeaker, OUTPUT); Serial.begin(9600); //Serial.println("Device is ready"); lcd.print("Smart MailBox "); lcd.setCursor(0, 1); delay(1000); lcd.print("Starting"); lcd.setCursor(11, 1); lcd.print(". . ."); lcd.blink(); delay(3000); lcd.noBlink(); // delay(3000); // clear screen for the next loop: lcd.clear(); // lcd.autoscroll(); lcd.setCursor(0, 0); lcd.print("Smart MailBox..."); lcd.setCursor(6, 1); lcd.print("You Have"); lcd.setCursor(9, 2); lcd.print(MessageNo);

lcd.setCursor(6, 3); lcd.print(" Mail(s) ");

// Initialize the IO and ISR vw_setup(2000); // Bits per sec vw_rx_start(); // Start the receiver } void loop() { if (vw_get_message(message, &messageLength)) // Non-blocking {

for (int i = 0; i < messageLength; i++) { if(message[i] == '2') { MessageNo = 0; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Smart MailBox..."); lcd.setCursor(6, 1); lcd.print("You Have"); lcd.setCursor(9, 2); lcd.print(MessageNo); lcd.setCursor(6, 3); lcd.print(" Mail(s) "); playTone(300, 160); delay(150); } else { MessageNo= MessageNo + 1; //Serial.print("Received: "); Serial.println("MOVEMENT"); lcd.setCursor(9, 2); lcd.print(MessageNo); playTone(300, 160); delay(150); } } //Serial.println(); } // end if

} // end loop // duration in mSecs, frequency in hertz void playTone(long duration, int freq) { duration *= 1000; int period = (1.0 / freq) * 1000000; long elapsed_time = 0; while (elapsed_time < duration) { digitalWrite(pinSpeaker,HIGH); delayMicroseconds(period / 2); digitalWrite(pinSpeaker, LOW); delayMicroseconds(period / 2); elapsed_time += (period); } }

Sending E-mail Code


In this case need to use other software to receive a signal from end node and gives order to computer to send email and in this project used Python+ Pyserila library

import time import serial import smtplib TO = '[email protected]' GMAIL_USER = '[email protected]' GMAIL_PASS = '**************' SUBJECT = 'Intrusion!!' TEXT = 'Your PIR sensor detected movement' ser = serial.Serial('COM30', 9600) def send_email(): print("Sending Email") smtpserver = smtplib.SMTP("smtp.gmail.com",587) smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo smtpserver.login(GMAIL_USER, GMAIL_PASS) header = 'To:' + TO + '\n' + 'From: ' + GMAIL_USER header = header + '\n' + 'Subject:' + SUBJECT + '\n'

print header msg = header + '\n' + TEXT + ' \n\n' smtpserver.sendmail(GMAIL_USER, TO, msg) smtpserver.close() while True: message = ser.readline() print(message) if message[0] == 'M' : send_email() time.sleep(0.5)

Project System

CONCLUSION:
Finally, looking back at the project at whole, I have gained quite in how to achieve a project from vision to reality, Besides that Intruders counter system with signal information sensor lots knowledge and methods need to familiar and handle, such as making the transmitting and receiving Part, dealing for the first time with microcontroller in practical way. Also being capable to program the boards, connecting all the separate parts to achieve a whole working system and so on.

The last but not the least, this system achieved the goal that allow user to be notify automatically often account the intruders visually and audibly. As comfort the researchers can account the rate of the usersl without been stressing him/her-self for accounting. This is inconvenient ant time consuming for the user.

FUTURE WORK
An area will be consider as top priority to make the system more convenient and efficiency by using camera connecting with this system to capture image of the intrudes.

You might also like