Introduction: How to Make a Simple Security System (startup)

This is an Instructable to show you how to add some simple sensory to your house or apartment. I call this "security" because you should not rely on a system that has not been thoroughly tested and attacked. This is more of an information system, to give you status of doors and windows and keep a log of what has happened. This is not a necessity build for me, but more of a learning and informative one, to improve my skills and learn some new ones.

All of the materials that I will be using come from GearBest.com. A great supplier of hobby electronics for great deals, along with other great gear and devices. I would like to thank them greatly for sponsoring this Instructable.

Step 1: Gathering the Material

This project will only require that we use four different components...

1 - Reed Switch

1 - 433MHz RF Transmitter/Receiver pair

2 - Arduino Nano or compatible

1 - general purpose magnet

You may also want to use the following to make connections easier...

Solderless Breadboards

Hookup Wire

This Instructable assumes that you already have the Arduino IDE installed and know how to upload sketches.

Step 2: Hooking Up to the Arduino

Receiver Side

The first thing that we are going to do is connect one of the Arduinos to the receiver module, which is the longer module of the pair. There is only one data pin on the receiver and it gets connected to digital pin 11 of the Arduino. The receiver also gets 5V power and connected to ground.

Transmitter and Reed Switch Side

The other Arduino will get connected to the transmitter, the smaller module of the pair, and to the reed switch. The data pin of the transmitter gets connected to digital pin 12 of the Arduino. The power and ground also need to be wired to +5V and ground respectively. The reed switch module has three pins. On my particular module there is one pin labeled 'S', this is the signal pin that gets connected to digital pin 6 on the Arduino. You could connect it to any other digital pin that you would like. The middle pin of the reed switch module gets connected to ground, and the last pin gets connected to ground. This connection makes the signal pin LOW when there is no magnet present and HIGH when you introduce a magnet.

Step 3: Arduino Code

The majority of this code actually comes pre-installed in an Arduino add-on library as the 'transmitter' and 'receiver' examples in the 'Virtual Wire' library. The library can be downloaded here. Go here if you do not know how to install a new library. All that we have to do is change when to send a message, since we only want it to send when the reed switch has no magnet near it, or the door is open.

Transmitter

In the transmitter sketch, we added a boolean variable called 'lastReed' that will just keep track of the last state of the switch at the end of the loop, this will allow us to detect a falling edge as the magnet goes away. We also setup pin 6 as an input. The loop section was changed to the attached picture. The actual sketch file is attached as well. All we had to do was add an 'if' statement so we would send the message on a falling edge of the input signal. We also changed the message to something meaningful, in my case, 'door opened'.

Receiver

On the receiver side, all we do is comment out a couple of unneeded 'Serial.print' lines and added one 'Serial.write' line to print out our message. This sketch is also attached.

Step 4: Finishing Up, Review and Going Further

All that is left to do is mount your transmitter to a door that you want to monitor and mount a magnet to the door frame and wait for messages!

The products that I have used from GearBest have been great! I had no issues with any of the products, no physical or hidden defects to speak of and I would highly recommend them and will most likely go to them from now on instead of my usual eBay. I would like to thank them again for sponsoring this Instructable!

This small project is a stepping stone for a bigger picture that I am looking at. I am hoping to have little sensors like this throughout my apartment, all communicating back to a main computer that has the receiver on it. I then plan to read the serial data to a custom Visual Basic program that as a layout of my apartment floorplan and will have indicator that correspond to each of the sensors scattered throughout.

I hope that you have enjoyed this Instructable and have learned how easy it is to get Arduinos talking to each other and how easy it is connecting sensors and transmitting information. Don't forget to go and check out all the great products at GearBest.com and be sure to stay tuned for further developments in this project and many more!

Comments

About This Instructable

2,710views

34favorites

License:

Bio: I am an application engineer for an industrial distributor. I help to support our sales team in programming of new projects for our customers. I ... More »
More by jordantallent:Automatic Window CurtainsHow to Use a 3D PenMy Shapeoko 2 Workflow
Add instructable to: