Introduction: Intruder Alarm With Text Message Notification

Picture of Intruder Alarm With Text Message Notification

This is very easy to do and requires no soldering or advanced skills.

Heres how it works:

Range sensor detects interruption in pings --->

Calls to Temboo via WIFI --->

Tells Twilio API to send text!

This tutorial shows you how to create an intruder alarm that sends you text message alerts when motion is detected. This may sound complicated but I am pretty confident any beginner with electronics should be able to do this just fine. The range sensor senses motion and tells your Arduino board to send the text . So you can leave the intruder detector at home, connected to your network, and still receive the SMS alerts, no matter where you are, as long as you have cell phone service.

This is a pretty quick and easy project, it takes maybe 45 minutes to complete. Parts can be had on Amazon for about $80-$90, or about $50 if you don't mind waiting from AliExpress.com. The main cost is an Arduino board with WIFI capabilities, however once you have that it can be used in tons of other projects and much more fun can be had...

Parts you will NEED:

-HC-SRO4 Range sensor

-Arduino Yun board or Leonardo with a WIFI shield

-4 jumper wires

-A mini breadboard (if you want)

-A 9V battery

-A 9V battery box with barrel plug and on/off switch

Links to parts and code can be found here:


Parts Links and Code

Step 1: Make These Connections and Test!

Picture of Make These Connections and Test!

Connect your range sensor to your board as shown in the diagram here.

First we are going to test our range sensor and make sure its working.

Go to the first block of code here http://wirebeings.com/arduino-intruder-alarm.html

and copy/paste it into the Arduino IDE.

Plug in your board and upload the sketch.

Pull up the serial monitor and make sure it is on 9600 BAUD.

You will see a string of numbers being printed

(this is the distance the closest object is away from the sensor in inches)

Anytime a large enough difference in pings is detected by the sensor it will print out "Intruder Detected" to the serial monitor.

Step 2: Get Your Board Connected to Your Wifi Network.

Picture of Get Your Board Connected to Your Wifi Network.

If you are using an Arduino Yun follow the instructions here:

https://www.arduino.cc/en/Main/ArduinoBoardYun

If you are using a Leonardo with an Iduino wifi shield follow the instructions here:

http://www.geeetech.com/wiki/index.php/Iduino_Yun_Shield

To test a make sure it is connected to the same network as your computer you can use the terminal and do a quick LAN scan of your network or download a free program that will do it for you.

I use a Mac so I downloaded LanScan from the Mac store.

Step 3: Adding the Text Message Functionality.

Picture of Adding the Text Message Functionality.

Open the Arduino IDE and create a new sketch.

Copy and paste the second code block from here into the Arduino IDE:

http://wirebeings.com/arduino-intruder-alarm.html

Click the down arrow on the right side and hit create new tab.

Call it TembooAccount.h

Go back to the website above and copy and paste the last code block (the header file) into there.

Save it.

Now you need to create an Account on Temboo and on Twilio so you can add your information into the code.

Step 4: Add Your Twilio and Temboo Credentials to the Sketch.

Picture of Add Your Twilio and Temboo Credentials to the Sketch.

Navigate to account settings in your Twilio account to find your Account SID and Auth Token (click the lock button to display it)

Add these to the main sketch inside the quotes where appropriate "***********"

Go back to the Twilio homepage and hit Account again. Hit phone numbers and this will give you your "Sent From" phone numer, add this to the code.

Finally, add the phone number that you want to receive the text, and customize the message if you want.

(Keep the phone numbers in this format or it won't work "+1*******" )

Now go to the header file and add your Temboo account information. Login to your Temboo account and hit Applications to get all this information.

Save it and hit upload.

Power your board with the 9V battery pack (hit the on switch) and pull up the serial monitor to make sure its working!!!

It may take 20 seconds or so to connect.

Step 5: And....YOUR DONE!

Picture of And....YOUR DONE!

If your having problems where its not working correctly. Change the range of numbers in this highlighted statement in the picture here.

This statement means you will send the message if the distance to the closest object is less than 20 or greater than 500. Depending on where its located in your house and what the closest object is, those values will need to be played with in order to make it work properly.

This is best done in the testing stage where the code does not actually send the text message (the first code block on the website), because you only get a limited number of free calls to Temboo and the Twilio API, so don't waste them! Don't worry though the code actually prevents you from sending more than 10 calls before the board has to be unplugged and restarted.

Hit me up with any questions I would be glad to help!

Comments

ErvinI2 (author)2017-04-11

What if using the Arduino uno but we add the nfc

prador (author)2016-07-03

what language did you used in this program sir?

WÆłĶ (author)2016-02-22

hey .. how i do this with arduino Uno

Lanetron (author)2016-02-11

why is this in the raspberry pi competition

mla3 (author)2016-02-10

nice instructable... i actually wanted to build something similar to this but involve a camera so i can view actually whats happening when it alarms me.. any idea on how to go about it using info from this instructable?

matthewh8 (author)mla32016-02-10

I have no idea, I have not got to play with cameras yet, although I do want to soon.

Sandbird (author)2016-02-09

Parts cost 60-70$? oO I think you made a mistake there :)

Nice guide!
Thanks for the info

matthewh8 (author)Sandbird2016-02-09

Thanks for pointing that out! I meant to say from Aliexpress.com, it ends up being like $48 shipped to the states (it just doesn't include the 9V battery and takes like 3 weeks to arrive from China).

Sandbird (author)matthewh82016-02-09

Oh that's unfortunate...i live in Europe and usually we get free shipping from aliexpress. Thats why i was so surprised when i saw the price..I've done something similar using a Pro Micro ATmega32U4 ($3.85), of course the SR04($1.50) and an RGB Led and an old PC speaker. I'll use the ESP8266(

http://www.aliexpress.com/item/1Pcs-High-Quality-E... for the wifi part($2.34).

The first part is done. You can check my code here if you want:

https://codebender.cc/sketch:232105

I've done it so that you can place it wherever you want and it will calibrate for the first 10 seconds checking the furthest object in view. Then it will use 'that' distance to do its 'intruder calculations' . For example if there is a -+10cm change in distance the alarm will go off using a nice Tone library that actually sounds like a siren, and the RGB light will flash with variety of colors.

matthewh8 (author)Sandbird2016-02-09

I am really glad you mentioned that ESP8266, it's supposed to be the Arduino killer, I need to get with the times and try that out.

Actually, I am ordering one right now...

Sandbird (author)matthewh82016-02-09

while loops are awesome :P and so are the ESPs. Already bought 3. I use one on the balcony to get the temperature, and i'll use the other 2 with the intr. alarm. One with the SR04 to send triggers on a IoT page and the other one with a speaker to make a wifi portable speaker to sound the alarm :P
I think in the end i'll make a laser triggered alarm though, using these:

http://www.aliexpress.com/item/1pc-650-nm-KY-008-5...

cause for some reason i dont really trust the SR04s. A continuous beam sounds more 'robust' than fluctuating waves.

matthewh8 (author)Sandbird2016-02-09

I was planning on making a smart trash can thing this weekend with the same range sensor and this is genius:

while (x < 100); //Equalize values for 5 seconds

I never thought to do that.

machineiddia (author)2016-02-09

Will it give alarm only if object of the size humans intrude? I mean, will it give alarm even if cat or rat intrudes?

matthewh8 (author)machineiddia2016-02-09

It will alarm if anything gets in front of the sensor, so it just depends on where you have it aimed.

About This Instructable

5,432views

71favorites

License:

Bio: My name is Matthew and I attend the University of Pittsburgh. Currently I am a senior, going for a bachelors in Information Science with a ... More »
More by matthewh8:Apple ArKit Augmented Reality AppAugmented Reality Fidget SpinnerFacial Recognition With Tracking.js
Add instructable to: