RoomAlert- Intrusion Protection




About: I am an electrical engineering student at virginia tech and loves instructables and making all sorts of projects. I have been doing science fair with my younger brother jack andraka since middle school and h...

This was the creation for my open ended freshman engineering final project. We were told to build something that used electronics to improve the life of the public. It is my own design and idea, copy, improve and let me know what you have done with it in the comments. I attached a video a friend did for me to make an add for the project. I am not in the video if you were wondering.

RoomAlert was the product I made that was designed for life in the dorms but could be adapted for other situations. RoomAlert would sit above the door it was monitoring and had a switch that was flipped when the door opened and reset when the door was closed. When the switch is flicked on it sends a signal to the arduino that is the heart of this project. The arduino is connected to a GSM cellular shield that sends a text message to a pre-saved phone number of the person whose room it is. Once the user receives the text message notifying him that his room has been entered he is able to call RoomAlert and it will use a microphone with an amplifier to listen in on whatever is going on in the room.

This project requires you to have general soldering skills, understanding of arduino and some patience. It is a great project for those trying to get started with electronics and is a ton of fun, lets get started!

PS. I am entering this in the RadioShack sensors competition, your support is appreciated!

Step 1: How It Works

This is a detailed guide for why parts were chosen and what everything does and how it goes together.

The device is attached above the door to the wall and has a rocker switch that is mounted with an L bracket so that it sits above the door (see picture in extras). The rocker switch is mounted so that the rocker part is just flush with the edge of the door. The plan is that the door will swing open, activating the switch, then that will signal to the arduino. Next, the arduino will communicate with the GSM shield and tell it to send a text message to the given number. When the door swings back it will flip the rocker switch back the other way so it deactivates the switch and the arduino will then reset. While all of this is going on the arduino is constantly testing the switch to see what position it is in and testing the GSM shield to see if it is receiving a call. If the GSM receives a call it will connect the user to the input from the microphone mounted on the enclosure of RoomAlert. The GSM shield takes this signal from the mic directly and send it to the user. The impedance of the mic must be correct so I found some links that showed how to set that up. See the Hardware: Microphone step for more details. As the device takes a while to connect I also installed a small LED to signal once the device is connected.

Step 2: Gather Your Materials

For this project you will need several parts:

  • Arduino, I used the Uno but it is possible to use most of the other boards including the Mega and Leonardo such as Radio Shack part #276-128
  • Arduino GSM sheild (
  • SIM card (not verizon) I used a T-Mobile one I had on hand but the GSM shield comes with one as well
  • Electret Microphone such as Radio Shack part #270-092
  • SPST rocker switch such as Radio Shack part #275-690
  • 100Kohm ohm 1/4w resistor such as Radio Shack part #271-1347
  • 220 ohm 1/4w resistor such as Radio Shack part #271-1313
  • 2.2 Kohm 1/4w resistor such as Radio Shack part #: 271-1325
  • 66 ohm (or (3) 22ohm) 1/4w resistors such as Radio Shack part #271-1103
  • 10uF electrolyitic capacitor such as Radio Shack part #55047760
  • (2) 33pF disc capacitors such as Radio Shack part #55047524
  • Scrap pcb board or Radio Shack part #276-004
  • Any ole' LED or Radio Shack part #55050694
  • An enclosure of size about 6"x4"x2.5" or Radio Shack part #270-1805
  • A few jumper wires or Radio Shack part #276-114
  • A few feet of thin gauge (24 or greater) or enamel wire
  • A few feet of thicker wire (18 or less)

Step 3: Software

If we look at the functions our device has to perform we can outline what our code needs to do and how to write it. I will provide my code at the end but for anyone who wants to understand how it works or wants to write their own code this step is where to look. I based my code very heavily on the arduino examples that are included in the arduino IDE already under examples>GSM.

RoomAlerts first function is to be able to connect to the cellular network. To do this I copied and pasted the beginning of the GSM examples arduino gives. I added in four extra variables, remoteNum[20], textData[200], texted, and buttonState. remoteNum is an array of up to 20 characters that constitute the phone number you want roomAlert to text. It must be characters because all of the arduino and gsm's internal funtions like sendText work. textData is an array of up to 200 characters that make up the message roomAlert will send you. texted is a boolean to check whether the user has been texted already for that time the door was opened. Lastly, buttonState keeps track of if the switch is on or off (door open or closed).

In the setup() we create a pin that is an input and reads if the switch is on or off. Also, make an output pin that will light an LED once the device has connected to the network so the user knows the device is ready. The rest of setup() was copied from the example except for the last line. The final line of setup() was to light the LED once everything is ready and connected.

The loop() has the working part of the project in it and is repeated until RoomAlert is shut off. It will be checking if the switch was flipped then checking if it is receiving a call continuously one after another very quickly. If the switch is flipped it will check to see if it has texted you already (with the texted variable) and if it has not texted you and the switch is on then it will text you. If the switch is off it will reset the texted variable. Make sure to keep the delays because they debounce the switch. If deleted you will get 3-4 texts everytime it changes from on to off or back because mechanical switches flicker for a fraction of a second when they are flipped. For the calling portion this was copied from the recieveCall program in the arduino examples.

Lastly, the sendText method I created uses a couple internal methods from the GSM library. You have to start the text and give the number, give it the text data then end the text.

Step 4: Hardware: Arduino/Shield

First we should set up the arduino and shield and make sure they work and connect to the network alright.

Take your SIM card and use the information provided on it to set it up and put a little bit of money on it if it is a prepaid card. Once you have this out of the way we can start having fun!

Insert the pins of the GSM shield into the arduino and slide the SIM card into the holder and close it. Plug the serial and power cables into the arduino and open the arduino IDE. Go to open>examples>GSM>sendSMS open and upload this program. When you run it then open the serial monitor. You will (hopefully) be able to enter a number and text message and send it.

Sometimes, people have trouble getting the device to connect to the wireless network. One issue could be you are using a SIM card that doesn't support unauthorized devices (like verizon) typicaly, T-mobile and Sprint work well as well as the card that came with the GSM shield. Another issue is that it isn't connecting right where you are. Check with a phone that uses t-Mobile ect. if it gets service in that area. Try placing it closer to a window and make sure the arduino is being powered by a power supply that can deliver at least 0.7 to 1 amp.

Once you are able to get your arduino to connect it is time to build the rest of the hardware

Step 5: Hardware: the Switch

One might wonder how we will make the arduino detect that a switch has been flipped. We have set a pin to read digital high or low in our software so we will use the switch to either connect the ground (low) to the pin or 5v (high) to the pin.

A great example of how to do this is on the arduino site at We will use this method to detect the switch.

In short, what happens is that the pin is connected to one side of the switch as well as a resistor going to ground. The other side of the switch is connected to the 5v pin. When the switch opens, the pin is connected only to the ground (through the resistor). When the switch is closed the pin is connected directly to the 5v pin. The huge ohm resistor keeps the current draw low when the switch is open though.

Solder two ~12" sections of the 18 gauge wire to the middle pin and one of the side pins on the switch. Twist the two wires together to create a thicker cable that looks neater and more compact. Route this through the enclosure sidewall (see Hardware: Enclosure for more details).

Use one of the jumper wires to connect a lead from the switch to the 5v pin. Attach a jumper wire and a lead of the 100K-ohm resistor to the other wire from the switch. The jumper wire is connected to pin 4 on the GSM shield.

Finally, solder a final jumper wire to the other end of the 100K-ohm resistor and connect that to the ground pin.

To test you have done this correctly, plug the GSM shield into the arduino, upload the sketch given in the software step and set up the switch. If you are connected to the wireless network and everything has been done correctly when you flip the switch you will receive text messages!

Step 6: Hardware: Microphone

The microphone is a little tricky. This version of the instructable will not include the amplifier but it will be included in the extras portion at the end.

We will follow the schematic illustrated. Get out your electret microphone, perf board/proto board, electrolytic capacitor and 2.2k-ohm resistor, (2) 33pF capacitors and 66 ohm/(3) 22 ohm resistor(s). First, construct the board with the mic, electrolytic cap and 2.2kOhm resistor. Solder the positive (red) lead of the mic to the board and solder the positive (longer) lead of the capacitor to the positive lead of the mic on the board. Then solder one lead of the resistor to the positive leads of the mic and capacitor. Solder a section of enamel wire to the negative lead of the capacitor, a separate length to the free lead of the resistor and another piece to the negative lead of the microphone. The wire from the resistor lead will go to 5v from the arduino. The lead from the capacitor is the positive signal and the lead from the negative of the mic is the ground. Route these leads to the second board on opposite sides of the board. Put in the first 33pF capacitor and solder the wire from the electrolytic capacitor to either of the leads of the 33pF capacitor. Then to the same lead of the 33pF capacitor solder a lead of the 66ohm or 3 22ohm resistors. To the other lead of the resistors solder a lead of the second 33pF capacitor. Finally, solder the two free leads of the 33pF capacitors together. Route a wire from the resistor-second 33pF capacitor joint and that will be the microphone positive. Route a wire from the joint between the two 33pF capacitors to the ground. The grounded wire from the electret microphone can be soldered to the grounded wire from the 33pF capacitors. The ground and positive leads must be twisted together (which is why I chose to use enameled wire). Then solder the positive lead to the micP terminal on the back of the GSM shield and the negative (ground) lead to the micN pin on the back of the GSM shield.

To test this, make sure the GSM is plugged into the arduino, the arduino has power, the arduino is connecting to the wireless network correctly and the microphone circuit has been assembled and soldered correctly. To test, dial the SIM card's number on your phone and call it. It should pick up pretty quickly and you may hear a bit of static. If you are hearing a ton of static it means you should try and wrap your enamel wires better and check your wiring and wireless connection. The mic will respond best to sharp noises like snaps but will respond to voice as well.

Step 7: Hardware: LED

The status LED was added so you know that the arduino had connected to the wireless network and was ready to use. Simply solder the cathode (shorter lead) to 220 ohm resistor and attach the other lead of the resistor to ground. Plug the LED's anode into pin 8 on the GSM shield.

Step 8: Hardware: Enclosure

The final part of building RoomAlert is mounting it in a housing. I personally put the arduino on four nylon standoffs to offset it from the bottom of the enclosure but this is purely optional. Either way you will need to drill four holes in the enclosure so that the arduino can be secured to the housing. I put a dab of paint on each of the standoffs and set the arduino down where I wanted it to mark where I should drill the screw holes. Then screw the arduino into position. A hole must be drilled in the side of the enclosure for the arduino power cable to fit in. On the top drill a small hole for the LED to poke out of. In addition, drill a small hole for the wire of the microphones to go through so it can sit outside the enclosure. Finally, drill a final hole on the side for the wires from the switch to come through.

Step 9: Final Test

You have assembled everything correctly and everything appears to be working, let's put it to the test! Connect the arduino and GSM shield, make sure the circiutry is connected properly and give the arduino power. Wait for the LED to turn on so you know you have service and are connected. Be aware this can take a while (usually a minute or two for me but you have to move around a bit to find decent service). Once you get service try flipping the switch a few times and checking to make sure you are receiving text messages. Once this is all working try calling RoomAlert and if it picks up try making noise in front of the mic then slowly get further from it to see the mic's range. If any of these aren't working your best friend will be writing new code using what I gave you and the examples arduino gives you to try and figure out the problem. A useful tool for trouble shooting is using the serial port in the arduino IDE to figure out the problem; see the arduino examples for this as most of them use it.

Step 10: Extras!

This instructable did not cover several add-ons that I have put on my RoomAlert or think would be cool to add.

  1. Acrylic Enclosure Lid - This looks nice and was pretty easy to do since my college had a laser cutter and acrylic available
  2. Mounting- It is cool to make RoomAlert but to mount it you I used an L-bracket to mount the switch above the door and Velcro strips to mount the enclosure to the wall.
  3. Text to Turn Off- A function I didn't have time to add but wanted to was a function in the arduino program that allowed the user to send an on/off text to RoomAlert that would keep it from texting you every time the door is opened or closed
  4. An Amplifier- A small amplifier would be nice on the microphone because the mic is not extremely powerful. I ran into the problem of the small amp I had built didn't have the correct impedance for the arduino so it sounded funny.
  5. A Speaker- It's cool to know somebody is in your room but if they aren't saying anything you have no way to know who they are. A speaker would allow you to talk to them through your phone, you could ask for their name or what they're doing ect.
  6. A Different Switch- I felt the rocker switch was a great solution because then you know definitively whether the door is open or closed but I threw around the idea of using a reed switch or a PIR motion switch but the rocker switch was simplest and easiest to implement.
Sensors Contest

Finalist in the
Sensors Contest



    • Sew Tough Challenge

      Sew Tough Challenge
    • Paint Challenge

      Paint Challenge
    • Backyard Contest

      Backyard Contest

    25 Discussions


    5 years ago on Introduction

    I'm curious, instead of the switch on the door, if you use a webcam, couldn't you use a "motion" app that would essentially kick on the webcam when it picks up movement? All the rest of the logic/functionality would be the same, as soon as the camera kicks on, then you send a text, etc. I've read articles, but have yet to get around to making one, with a Rasp Pi and web cam... Cool post though, I am def going to give this a run at some point.

    1 reply

    Reply 5 years ago on Introduction

    Video can absolutely tell you more about what was going on, I'll add that on in the extras part, maybe with a wi-fi shield you could even rig something up to view the video feed... Message me if you ever get around to making anything like this! I'd love to check out what you do with it!


    5 years ago on Introduction

    the idea is genious. the switch and sensors can be improved to avoid tampering. good instructable, thumbs up!


    4 years ago on Introduction

    Read on laws in U.S. regarding recording conversations. This may not apply to your device, just a thought.


    5 years ago on Introduction

    I believe the commercial equivalent of this is the Belkin Netcam. Sold in stores for about $129, but easily obtainable on Ebay for about $50 per camera (in Summer 2014). Otherwise, great project!

    2 replies

    Reply 5 years ago on Introduction

    recent posts for similar cam, but (not needed in this case) PTZ capabilities from tmart for 35$(usd)


    Reply 5 years ago on Introduction

    I don't see this as equivalent to Belkin Netcam, at all. The Netcam is just a wifi camera. This has built-in notification and is specific to you. I think you have a good chance with this - maybe even commercially!

    Great job!!!!!


    5 years ago on Introduction

    Ok, good start. Now, link the webcam/security cam into something to send video to my phone, computer, or whatever. I am tired of people stealing my tools and my boss has forbidden me from killing/wounding anyone without express proof. This would be perfect.

    2 replies

    Reply 5 years ago on Introduction

    lol!! Mann I think your boss and my boss go out to the wing-house to talk about policies! Lol!! Although his are written and we have to sign or them :-|.

    This little project has kicked off gears in my head that the transmission is trying to keep up ;-)


    Reply 5 years ago on Introduction

    Haha I'll get right on it! The video sounds like a very popular add-on, I am working on a way to do this but it is going to require the use of a wi-fi shield or a computer nearby. I have wanted to get one of those for a while so I might be getting one soon. Look forward to an instructable like this but with video! I also recently was given a intel galileo microcontroler so I am thinking about using some sort of web interface? I'd love to hear any sudjestions!

    If it is using a cellular shield, doesn't that mean you need a cell contract for it?

    Wouldn't it make more sense and be cheaper in the long run to use a wifi shield and a basic camera? Have it start taking pics and sending e-mails to you when the door opens and keep sending every few seconds for a couple of minutes after the intrusion so the pics are safely saved in your inbox and you have a decent chance of getting the intruder on camera.

    2 replies

    When I first created the project it was designed for use in the dorm room where we didn't have wifi. I am really excited about building a second version that uses the wifi shield and a webcam. I actualy bought a wifi shield yesterday and found an old webcam in my basement. Construction shall begain as soon as it arrives!


    Reply 5 years ago on Introduction

    would it have the ability to authenticate to the network??

    If so, look up YAWCAM, I've used them before, there are some more out there, but I don't know how you would save the parameters in the arduino.

    I posted me if you get this to work :-)


    Reply 5 years ago on Introduction

    Well, a few more paragraph breaks.

    Steps 4 & 5 are the worst, solid slabs of text. I'll PM you with how I would split them into paragraphs, but I'm no expert and there are no fixed rules. Just when it is hard to follow, it is too long. You can also try reading it out without pausing, when it starts to drone and you can't remember the first bit, it is too long.

    Step 6 has a doozy which needs splittting, 8 & 9 could also have a couple of paragraph breaks.


    Reply 5 years ago on Introduction

    I really appreciate all you help! I just sent you the link for a 3 month pro membership! We need more commenters like you(:

    i love the video its so thanks Obama infomercial

    but yes i agree with everyone else add video to device


    5 years ago

    Try using ARM CortexM3 instead. It's more powerful.