Introduction: Motion Camera Alarm With Bluetooth and Arduino

About: Android app developer

Is someone stealing your food at work? Is your annoying sibling is eating your sweets?Well here is a cheap project that you can use to catch them in the act!

Almost everyone these days has a smartphone.So what if you could integrate your phone and its many features in your arduino projects.In this tutorial you will learn how to use arduino and Bluetooth with your phone to take pictures and send an Sms to a selected phone number when motion is detected.

So you may be wondering how this works?

We will use a PIR sensor so sense any movement. The arduino will read this input and if there is motion it will send a command to the phone via Bluetooth to take a picture.At the same time it will send another command to tell the phone to send an Sms to another phone to alert you.

Lets get started!

Step 1: Parts List

Here is what you will need for this project:

  • Arduino
  • HC-05 Bluetooth module
  • PIR Sensor(motion sensor)
  • Solder less Breadboard
  • Jumper wires
  • Your phone with the Arduino Bluetooth Controller app downloaded to be able to take pictures with your phone

Step 2: Circuit

Bluetooth module connection

  • Connect the BT module's Rx pin to pin 11 on the Arduino
  • Connect the BT module's Tx pin to pin 10 on the Arduino
  • Connect up the Gnd and Vcc (5v) to the Arduino

PIR motion sensor connection

  • Sensor Gnd to arduino Gnd
  • Sensor Vcc(5v) to arduino 5v
  • Sensor Out pin to arduino pin 2

If the led on the Bluetooth Module is blinking quickly then it is ready to pair to your phone,if not then check your connections.

Adjust the 2 potentiometers on the PIR sensor to adjust of how long the output pin stays on for after sensing motion and the other to adjust the sensitivity.

Circuit Complete! now lets move on to the code

Step 3: Arduino Code

#include<SoftwareSerial.h> 

SoftwareSerial bluetoothSerial(10, 11); // Tx pin of the bluetooth module must be connected to Rx pin on arduino
                                   // Rx pin of the bluetooth module must be connected to Tx pin on arduino
const int PirPin = 2;   //PIR sensor 
int pictureNumber=0;
String commandSms;
String phoneNumber="1234567890"; //phone number with out spaces between digits,number you want the Sms to be sent to

String message="Alarm set off. There is an intruder"; //message to be sent via sms. must not contain commas

void setup(){    //set the digital pins
      pinMode(PirPin,INPUT);
 
      //start communication with bluetooth module
      bluetoothSerial.begin(9600);
  
}

void loop(){

 if(digitalRead(PirPin)==HIGH){  //PIR sensor has been triggered

  pictureNumber++;
   String commandPhoto = "TAKE_PICTURE,photo_" + String(pictureNumber) +"/#";
   bluetoothSerial.print(commandPhoto);
   delay(100);
   commandSms = "SMS,"+ phoneNumber +","+message +"/#";
   bluetoothSerial.print(commandSms);

  while(digitalRead(PirPin)==HIGH);// traps until its low so that the sms and photo are only taken once
 }
}


Step 4: Download Bluetooth App for Phone

Download it Here

Step 5: Bluetooth Communication With Arduino

Make sure that the led on the Bluetooth module is blinking quickly which means its ready to connect.

Turn on your Bluetooth on your phone and make sure your Bluetooth module is paired with your phone. then go into the Arduino Bluetooth Controller and click the "Connect" button, if it is connected with your module then the led on the Bluetooth module will blink every 2 seconds and the button in the app will now say "Disconnect".

Once it is connected you can click on the menu at the right top corner or if it is not displayed there click the menu hardware button on your phone at the bottom.Click on "Send Data" and make sure the "Sms" and the "Camera" options are switched on.

You will find the pictures that were taken in your phones gallery.

Step 6: Placing Your Alarm

Place the PIR sensor facing the area where your target is.

Place your phone somewhere where it can take a clear photo and make sure nothing is covering the camera lens.

You can choose whether or not to disguise your alarm so it doesn't look suspicious.

Here are the pictures that my Motion alarm took.

Finished! No more stealing of your food or sweats! :