Introduction: "Smart Shield" - Portable Alarm System Using Arduino

PIR Sensor is connected to the arduino card. When a motion is being detected, an alarm sound and flashing LEDs will start to act. The times of the motion detections are saved, and can be viewed later on a small LCD screen. The data (motion detections) is sent via bluetooth and can be viewed on a smartphone by a designated app for android.

Step 1: List of Components

2. Motion detector (PIR sensor):
3. LCD screen (for showing the number of interrupts and their times of occurrences):
4. Small Speaker / piezo speaker.
5. LED / Flashing LEDs.
6. Push-button + 10k resistor.
7. Network module (serial communication):
PC connection: mini-USB to USB cable.
Bluetooth module (wireless):
JY-MCU - Specifications:
Dimensions: 4.4 cm x 1.6 cm x 0.7 cm (1.73 in x 0.63 in x 0.28 in)
Weight: 7g (0.25 oz)
Range: ~10 m (~33 ft)
Supply voltage: 3.6-6V
BT-Name: linvor
BT-Pin: 1234
BT-Baudrate: 9600bps (standard)
8. Wiring components: solderless breadboard, board, wires, connectors, headers.
9. Power input: 9V battery + battery case + connector + switch / external adaptor for arduino.
10.  A box (for containing all above, in a neat pack).
Software (the version I used mentioned in brackets, but a newer version for any software may work too):
1. Arduino Software (Ver. 1.0.1): http://arduino.cc/en/Main/Software
2. PC – Processing (Ver. 2.0b6), for testing purposes: http://www.processing.org/
3. Terminal - Tera Term (Ver. 4.75), for testing purposes: http://logmett.com/index.php?/download/tera-term-476-freeware.html
4. Android app "Smart Shield" (Android Developer Tools, Build: v21.0.0-531062), for developing in android (for anyone who wants to understand the code and to improve the app): http://developer.android.com/index.html

Step 2: Testing 1 - Building a Simple Circuit With the Arduino, Motion Detector and LED Indicator

The PIR Sensor is connected to the arduino card. The LED is turned on by a motion detection for 15 seconds.

Instructions:
https://www.instructables.com/id/Arduino-Basics-PIR-Sensor/

Step 3: Testing 2 - Adding a Speaker and Buttons to the Simple Circuit

I connected a speaker and a LED to the arduino and the PIR sensor.
The speaker makes an alarm sound that goes on and off and the LED turns on and off repeatedly.
Instructions:

Step 4: Testing 3 - Testing the LCD Screen

1. The LCD Keypad Shield is connected to the arduino card.

Instructions:
http://www.hobbytronics.co.uk/arduino-lcd-keypad-shield

2. LCD Keypad Shield is connected to the arduino card. I uploaded the the code for a timer. The time in seconds, milli-seconds and micro-seconds can be shown on the LCD Screen. Pressing the 'RST' button resets the timer.

Instructions:
http://www.arduino.cc/playground/Code/StopWatchClass

Step 5: Testing 4 (optional) - Setting Communication Between the Arduino and the PC With a USB Cable, Using Processing

Requires a LDR light sensor and a 1k resistor.

I connected LDR light sensor and the 1K resistor to the arduino.
When the light intensity is low, the LED 'L' on the arduino card is deactivated.
When the light intensity is high, the LED 'L' on the arduino card is activated.
Data is sent via USB cable to the processing software. Circle size changes when exposed to different light intensities.
Instructions:

Step 6: Testing 5 (optional) - Setting Communication Between the Arduino and the PC With the Bluetooth Module, Using Processing

Requires a LDR light sensor, a 1k resistor and an external battery.
1. I connected the bluetooth component and the external battery to the circuit containing the LDR light sensor and the 1k resistor.
The red light on the bluetooth blinks when it is receives power
The red light on the bluetooth permanently lit when a stable connection is created to other communication component.
Instructions:
2. Attention: To create a successfull communication between the bluetooth (connected to the Rx / Tx inputs of the arduino) and the PC, I changed the "serial" in the code to "serial1".
The standard "serial" is reserved for the USB input and the "serial1" is reserved for the Rx / Tx inputs
 and is required to properly communicate via the bluetooth component.
3. Communication test via COM6 port using Tera Term terminal. The numbers represent the light intensity (from 0 to 1023, where 0 is the brightest and 1023 is the darkest).

Step 7: Building the System - Electrical Diagram

Power input:
Internal input: By batteries (6 batteries, 1.5V each) or 9V battery to the power input of the arduino card.
External input: By an external transformer (9V, 1A) to the 2.1mm input or via USB cable to the mini USB input of the arduino card.
Wiring:
Arduino (Top: left to right):
GND - LED/s (GND), Speaker (GND).
Digital 13 - LED/s (Vcc).
Digital 12 - Pushbutton (right leg).
Digital 11 - Speaker (Vcc).
Digital 10, 9, 8, 7, 6, 5, 4 - LCD Keypad Shield (D10, D9, D8, D7, D6, D5, D4).
Digital 2 - PIR Sensor (OUT).
Digital 1 (TX) - Bluetooth module (RXD).
Digital 0 (RX) - Bluetooth module (TXD).
Arduino (Bottom: left to right):
Reset - LCD Keypad Shield (RST).
5V - Bluetooth module (Vcc), PIR Sensor (Vcc), LCD Keypad Shield (5V), 
Pushbutton (with a 10k resistor between the 5v and the middle leg of the pushbutton).
Gnd - Bluetooth module (GND), PIR Sensor (GND), LCD Keypad Shield (GND), Pushbutton (left leg).
Gnd - 9V connector (-).
Vin - 9V connector (with a switch between the Vin and the +).

Step 8: Building the System - Into the Box

I installed all of the components in the box and wired them. I made some cuts to the box to make the components fit nicely and some holes in the box for a better sound from the speaker.
In the front view, you can see the LEDs with a plastic cap and the PIR Sensor.
In the rear view, you can see the LCD Screen and the Keypad.
In the right view, you can see the switch and the pushbutton.
In the left view, you can see the mini-USB input and the external power input of the arduino.

Step 9: Uploading the Code to Arduino

Connect the arduino card to the PC with theUSB - mini-USB cable.

Run the Arduino software.

It can be downloaded here: http://arduino.cc/en/main/software
Download the zip file in this page: "Smart_Shield". Open the code in the zip file in the Arduino software (Fie -> Open...).

Download the libraries StopWatch and LiquidCrystal(Unzip them to the 'libraries' folder in the arduino folder).

For more information on these libraries, check out the following links:

http://playground.arduino.cc/Code/StopWatchClass

http://arduino.cc/en/Reference/LiquidCrystal

Choose the board: Tools -> Board -> Arduino Leonardo.

For other boards, see more information regarding the serial1 connection (to avoid compatibility issues): http://arduino.cc/en/reference/serial

Verify The code and upload to the arduino.

Step 10: Android App

I wrote Android smartphone app (I have Samsung Galaxy S, running Android version 2.3.3) and it works.

The app connects to the "Smart Shield" device via bluetooth and receives alerts and notifications when a motion is detected.

I'm still trying to improve the app and develop more features and fix some bugs. This is an open source, so you can improve the app by changing the source code and adding to it.

You can view the source code in GitHub: https://github.com/EranPe/Smart-Shield/


Both the source code and the app are available to download in this page.

Smart Shield (ver. 1.1) for android.

Arduino Contest

Participated in the
Arduino Contest