"Smart Shield" - Portable Alarm System Using Arduino
Intro: "Smart Shield" - Portable Alarm System Using Arduino
STEP 1: List of Components
STEP 2: Testing 1 - Building a Simple Circuit With the Arduino, Motion Detector and LED Indicator
Instructions:
https://www.instructables.com/id/Arduino-Basics-PIR-Sensor/
STEP 3: Testing 2 - Adding a Speaker and Buttons to the Simple Circuit
STEP 4: Testing 3 - Testing the LCD Screen
Instructions:
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
I connected LDR light sensor and the 1K resistor to the arduino.
STEP 6: Testing 5 (optional) - Setting Communication Between the Arduino and the PC With the Bluetooth Module, Using Processing
STEP 7: Building the System - Electrical Diagram
STEP 8: Building the System - Into the Box
STEP 9: Uploading the Code to Arduino
Connect the arduino card to the PC with theUSB - mini-USB cable.
Run the Arduino software.
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:
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.
25 Comments
crisnav09 9 years ago
thank you so much for the information sir :)
hhmm i still have a question, the android application smart shield v 1.1 is not functioning on the android phones that i have used. The bluetooth module which is hc-05 is already connected to the phone, but when i open the application the bluetooth sign on the upper part is not activated. Unlike on the screen shot that you have posted above. What should i do for this instances sir? thank you
crisnav09 9 years ago
and also, when i click the preferences and about. There's nothing happened.
EranP 9 years ago
Hi crisnav09,
I'm really glad that you've interest in this project.
The bluetooth communication between the Alarm System and the PC/android device is the most tricky part of the project, for my opinion. There are several things you need to check before using the android app. First, make sure that the bluetooth serial output of the Alarm System is working well. You can do this by a simple test*:
1. Connect a bluetooth dongle to your PC.
2. Power on the Alarm System. Wait for the "Alarm is active!" message.
3. Pair between the PC and the Alarm System by searching for the right bluetooth connection (HC-05, in your case) and insert the right code (1234 / 0000). Wait for pairing between the 2 devices.
4. Run the Tera Term software (You can download it here: Tera Term).
5. Make a new connection. Choose serial and insert the correct port (COM4 in my case, as seen in the attached photo).
6. Make sure that the baud rate is 9600 and the incoming data are as seen in the attached photo.
* you can also try this test on an android device with a compatible app. For more information on this, click on the link.
If the data, recieved from the Alarm System, are good ,then it's the time to check the android app.
Make sure that the phone and the Alarm System are within the bluetooth range (<10m). There are 2 states: "Trying to connect..." and "Connected" in the Android app (photos attached). I see that you "stuck" on the first state. Follow these steps to make sure the connection is good:
1. Wait for the "Alarm is active!" message to appear on the Alarm System, for a stable bluetooth transmission.
2. Try to disable and enable the bluetooth on the phone and then start the app.
3. If it doesn't work, restart the Alarm System and repeat stages 1-2.
I hope this will work for you. I tried it on my nexus 5 (Android 4.4.4) and it worked (photo attached).
crisnav09 9 years ago
it works on tera term, but still, it didn't work on the application :( it's still not connected
crisnav09 9 years ago
thank you so much for responding ^_^
i will now start doing what you've told .. hope it will works :)
(sorry for the english, i'm not use to it :) )
EranP 9 years ago
Hi crisnav09,
You're right. The app is still in development and a little bit "buggy", as mentioned in step 10. The menu is incomplete and the "preferences" and "about" options are not working yet, but the "clear history" option is working.
The app is adding a new alarm message to the list of the alarms and receiving a new notification in the notifications bar, when there's a new detection of motion from the Alarm System.
I'll consider on working on a new app that will replace the old one for improving the features.
crisnav09 9 years ago
good day ! hhmm I just want to ask , what if i would like to use a 9 volts charger as power source that is directly connected to the arduino power source. Do I still need to use rocker switch and push button switch? .. and oh by the way, I will no longer be using a 9 volts battery. Thank you.
EranP 9 years ago
Hi crisnav09,
The answer is Yes.
From the Arduino Leonardo website:
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.You can also power with the board's USB port.
For example:
You can choose to power the Alram System with a charger connected directly to the board's USB port, like a contemporary smartphone charger, with a voltage of 5V and a current of 1A. It works fine and the charger is cheap.
Another example of power usage:
You can also choose a rechargeable battery (like the ones for charging smartphones) to power the Alarm system with a cable to the board's USB port.
In any case of external power (power jack or USB port), you won't need the rocker switch, however, you'll still need the push button switch if you want to switch between 2 states: "silent" alarm and "noisy" alarm.
BIGDOG1234 10 years ago
How do you add the app to your phone.
EranP 10 years ago
Download the Smart Shield.zip in step 10 and unzip the apk file in your pc.
Use a USB cable to transfer the apk file to your android smartphone (no iOS or other moblie OS yet, sorry...).
On the smartphone, go to Settings, scroll down to Security, and select Unknown sources. Selecting this option will allow you to install apps outside of the Google Play store.
Install the apk file.
For more information on "How to install apps outside of Google Play" follow the link:
http://howto.cnet.com/8301-11310_39-57602654-285/how-to-install-apps-outside-of-google-play/
BIGDOG1234 10 years ago
Smart_Shield.ino: In function 'void setup()':
Smart_Shield:85: error: 'Serial1' was not declared in this scope
Smart_Shield.ino: In function 'void loop()':
Smart_Shield:135: error: 'Serial1' was not declared in this scope
Smart_Shield:165: error: 'Serial1' was not declared in this scope
Smart_Shield:188: error: 'Serial1' was not declared in this scope
What do I do.
EranP 10 years ago
What kind of board do you have?
The Arduino Leonardo board uses Serial1 to communicate via TTL (5V) serial on pins 0 (RX) and 1 (TX). Serial is reserved for USB CDC communication
All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.
You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().
For more information, refer to:
http://arduino.cc/en/reference/serial
Good Luck!
BIGDOG1234 10 years ago
EranP 10 years ago
BIGDOG1234 10 years ago
BIGDOG1234 10 years ago
EranP 10 years ago
For further information, go to the following link:
http://playground.arduino.cc/Code/StopWatchClass
BIGDOG1234 10 years ago
Smart_Shield:29: error: 'StopWatch' does not name a type
Smart_Shield:30: error: 'StopWatch' does not name a type
Smart_Shield:31: error: 'StopWatch' does not name a type
Smart_Shield:32: error: 'StopWatch' does not name a type
Smart_Shield:33: error: 'StopWatch' does not name a type
Smart_Shield:34: error: 'StopWatch' does not name a type
Smart_Shield.ino: In function 'void setup()':
Smart_Shield:83: error: 'Serial1' was not declared in this scope
Smart_Shield:85: error: 'sec' was not declared in this scope
Smart_Shield.ino: In function 'void loop()':
Smart_Shield:133: error: 'Serial1' was not declared in this scope
Smart_Shield:163: error: 'Serial1' was not declared in this scope
Smart_Shield:166: error: 'sec1' was not declared in this scope
Smart_Shield:167: error: 'sec2' was not declared in this scope
Smart_Shield:168: error: 'sec3' was not declared in this scope
Smart_Shield:169: error: 'sec4' was not declared in this scope
Smart_Shield:170: error: 'sec5' was not declared in this scope
Smart_Shield:186: error: 'Serial1' was not declared in this scope
Smart_Shield:196: error: 'sec' was not declared in this scope
Smart_Shield:211: error: 'sec' was not declared in this scope
Smart_Shield:214: error: 'sec' was not declared in this scope
Smart_Shield.ino: In function 'void KeypadPressed(int)':
Smart_Shield:321: error: 'sec' was not declared in this scope
Smart_Shield:351: error: 'sec1' was not declared in this scope
Smart_Shield:352: error: 'sec2' was not declared in this scope
Smart_Shield:353: error: 'sec3' was not declared in this scope
Smart_Shield:354: error: 'sec4' was not declared in this scope
Smart_Shield:355: error: 'sec5' was not declared in this scope
Smart_Shield:381: error: 'sec' was not declared in this scope
Smart_Shield:412: error: 'sec1' was not declared in this scope
Smart_Shield:413: error: 'sec2' was not declared in this scope
Smart_Shield:414: error: 'sec3' was not declared in this scope
Smart_Shield:415: error: 'sec4' was not declared in this scope
Smart_Shield:416: error: 'sec5' was not declared in this scope
Smart_Shield:442: error: 'sec' was not declared in this scope
Smart_Shield:459: error: 'sec' was not declared in this scope
Smart_Shield:485: error: 'sec' was not declared in this scope
What do I do.
EranP 10 years ago
It seems there are some library files missing, such as StopWatch.h file.
Download the libraries from step 9 (Unzip them to your 'libraries' folder in the arduino files).
For more information on these libraries, check out the following links:
http://playground.arduino.cc/Code/StopWatchClass
http://arduino.cc/en/Reference/LiquidCrystal
For the serial1 problem, check that you have the right board (I've used the Arduino Leonardo board). Choose the board on the arduino software: Tools -> Board -> Arduino Leonardo (In my case).
For other boards, see more information regarding the serial1 connection (to avoid compatibility issues): http://arduino.cc/en/reference/serial
BIGDOG1234 10 years ago