Motion Detection System: Intruders Counter System With Signal Information
Motion Detection System: Intruders Counter System With Signal Information
Motion Detection System: Intruders Counter System With Signal Information
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.
Receiver
Transmitt er
e-mail (inbox)
Receiver side
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.
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.
Dimensions Width 3.9 inches (98mm) Height 2.35 inches (60mm) Display view size 76mm x 26mm
End Node
LCD Display 20 X 4 ARDUINO MEGA 2560 End Node RF 433 Mhz Receiver
Sensing Node:
Buzzer
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);
// 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); } }
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.