Introduction: Basic Android Controlled Motion Detector
Hai. This is a simple project to demonstrate home security system using arduino.
In this tutorial iam going to show you how to monitor movement within a particular distance through an android phone . The device is controlled from a android phone and output is received as messages. The system is password protected.
This is fun project and it is portable also.
So let's begin...
Step 1: Required Materials
These are the materials that I have used!
1.Atmega 328 freeduino
2.hc sr04 ultrasonic sensor
4.hc 05 Bluetooth module
8.Android smart phone
And you need to download Bluetooth terminal app from play store. Its available for free.
Now let's get started!!
Step 2: Circuit Connection
The circuit connections are really simple. Connect vcc pin of hc05 to 5V and gnd pin to ground.The RX pin of hc05 is to be connected to TX pin of freeduino board and vice versa. For the ultrasonic sensor connect vcc to 5V and gnd to ground, trig pin to 13 pin of freeduino and echo pin to pin 12. For the rtc , connect vcc and gnd like in other cases and connect SCL pin to analog input pin 5 and SDA pin to analog input pin 4. Also connect an led between gnd and digital pin 7.power the arduino through a power bank soon after uploading the code.
Install the app "Bluetooth terminal" in your android phone!
Step 3: Arduino Code
Go to "Tools" in arduino software and make sure the board chosen is "atmega 328" and serial port is connected to correct 'COM'
upload the code given below.you can also modify the code to make it more efficient or change the code the way you wish this circuit need to work!
Step 4: Working!!
Upload the code onto the arduino board. Make sure Bluetooth module is not connected at the time of uploading. After which, open the Bluetooth terminal app and choose connect insecure device. Click on hc 05 and pair it with default code 1234.
Now device is activated by character 'p'.
Once activated the mobile continues to receive continuous messages like NO DANGER, object approaching, Object receding, Object too close.
At any point if you send 'a' . It will send you the exact distance of object and real time and date at that instant.
Character 'b' will switch off the device.
Note: you need to connect the power bank immediately after uploading the code otherwise it creates time delay in etc.
Step 5: Thinking Further!
To make it more interesting you can add more sensors like lm35 temperature sensor, light sensor, or you can encode the output messages.
You can even use light signals as means of communication between two breadboards, of any!
You can change the current code by adding/removing functions based on purpose.
Hope you enjoyed building this project.
If any doubt, feel free to leave comment below!