Introduction: DIY Security System

About: It from bit

Hello friends

I am from IOS Inventors Of Science

This is a complex, simple & yup a mind-blowing idea to turn your own little microcontroller into a thing called room security & automation. Let me remind it’s an idea not a pre-set plate with codes .

So let’s first understand what is room security & automation

Automation products keep you safe, manage energy consumption, and
provide entertainment. Solutions for your home or business are available for every income level and lifestyle.It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC
(heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security.

Here's a link for Further Details

Room security is something applicable to all of us and involves the hardware in place on a property, and personal items . The hardware would be the doors, locks, alarm systems, lighting that is installed on your property.

Step 1: Getting Started

So now I have made a plan & an idea on how to make our
room fully automated & secured. Let’s start it by first understanding how to improve them by using micro-controller as a brain & few sensors through a flow chart.

In this project you can use arduino or you can also make yourself one too just like I did. I would provide you schematic in few days.

And for programming and communicating with the Home made arduino you would have to use a serial cable and a usbasp or any other programming cable

Step 2: Door Locking

Now,let’s see the detailed explanation

-------------------Door locking------------

It could be from home made to professionally made
digital door lock ( it basically locks which we can operate through micro-controller).

To make it homemade here are the things required

a) Metal frame (which could hold servo at the door latch).

b) Servo (9g can work but in case of stiff latch use a servo with greater efficiency.)

c) Arduino UNO

Now attach the servo to door latch using a stiff material (remember that material should freely move so that if servo moves down the latch gets unlocked and if the servo is turned upwards the door should get locked

Here are some images for it

Step 3: Password Entering Solution Potentiometer

Now it’s just door lock, but how to unlock it? So here are few ways you can enter your password.

I. Potenentiometer code

Things required -- LCD Potentiometer arduino UNO

The code is given

IT works as the following

1. When you enter the code (or twist the potentiometer to a specific degree it will unlock your room, but in this code it will only turn on / off LED) you need to update the code a little bit to unlock the door Latch. Don’t worry its easy. .

2. The LCD will update itself either lock or unlock.

Thus you can enter into room thru that password only. If you don’t think the above procedure of entering password is safe, then don’t worry I have some more options.

Step 4: Key Pad

We all have watched robbery movies what do they all have common (at least most of them) is a key pad lock. So here is an library on key Pad lock.

In your room you can have lock with a key pad that has two types of passwords Master and other password. Master code stand for the code which you are entitled and other code is entitled our friend and relatives. Its advantages can be discussed at the end.

Step 5: Counter Recorder


It will tell you a number of people currently in the room by either printing on LCD or by messaging you or any other way.

Sorry the code is not with me currently but don’t worry coding for this will be easy . Its logic is easy it would be done by placing 2 IR sensor and receiver just like the one made by me for a universal remote. Anyways lets get back to logic part heres a pic on the positioning of the sensor . now lets say the person is travelling in the room so first sensor pair would get disturbed then second would be thus we can say 1 person has increased now if a person gets out of the room then in that case the second sensor would be disturbed first then the first would be so in this case we can say 1 person has decreased .Friends it may not be toooo much acurate but then also its worth installing it .

Heres a help for making the code

Let no of people in room be x

if(sensor 1 is disturbed)


if (sensor 2 is disturbed)





if(sensor 2 is disturbed)
{ if (sensor 1 is disturbed)





So there is another situation in which the thief comes from the window or any other way except the main door. So for this we would be using method that would collectively use sensors.

Step 6: Siren

HERE's A CODE for police siren I hope you like it.

int delay = 50;

void setup() {


void loop() {


tone(6, 440, 200);


digitalWrite(bluePin, HIGH);


digitalWrite(bluePin, LOW);


digitalWrite(bluePin, HIGH);


digitalWrite(bluePin, LOW);


digitalWrite(bluePin, HIGH);


tone(7, 494, 500);


tone(11, 523, 300);


Step 7: Sensors!!!!!

So let us understand what sensors are in brief.

A sensor is a transducer whose purpose is to sense (that is, to detect)
some characteristic of its environs. It detects events or changes in quantities and provides a corresponding output, generally as an electrical or optical signal; for example, a thermocouple converts temperature to an output voltage. But a mercury-in-glass thermometer is also a sensor; it converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube.

We would be using the following sensors.

1. PIR sensor

2. Ultrasonic sensor

3. Flexi sensor

4. LDR

And following is the list for other electric items.

A) Old digital Camera

B) Laser Light

C) Aluminum foil

D) Reed switch

E) Buzzer

F) Few wires

G) Small Mirror

H) Arduino

Step 8: PIR Sensor

Now let’s use these sensors in project.

A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. They are most often used in PIR-based motion detectors.

PIR sensor should be installed to the ceiling it should be able to scan the whole room. PIR sensor will trigger the alarm if there is movement in the room according to IR rays thus it will act a alarm tripper in my system.

Step 9: Ultrasonic Sesor

Now let’s be little sci fic imagine a suit which would hide
the IR waves which would not be detected by PIR. For this problem we can install ultrasonic sensor here and there in our room such that the sound waves of the US would cover the whole room it may cost but the results will be promising.

Ultrasonic transducers are transducers that convert ultrasound waves to electrical signals or vice versa. Those that both transmit and receive may also be called ultrasound transceivers; many ultrasound sensors besides being sensors
are indeed transceivers because they can both sense and transmit. These devices work on a principle similar to that of transducers used in radar and sonar systems, which evaluate attributes of a target by interpreting the echoes from radio or sound waves, respectively.

IT would not only give you a live feed data of the room but also act as alarm tripper. It would also help after crime investigation and its reading will also act as evidence.

Step 10: Securing Individual Items

Now you may have many important things in room which you
want to secure. You can do it by placing it in aluminum foil. (IF the thing is conductive then that thing itself would work) And using micro controller ADC convertor we can set it to alarm when someone touches it. Here is awesome project to understand the working of this placement.


We can also protect by using read switch and magnet . Here is how we do it. When magnet attached to a ting is placed near read switch the read switch closes thus current flows.

Now a little bit logical editing of button code of Arduino examples. Finally the alarm should be tripped if the object is removed from its place.`


Now like any other robbery film I decided to use Laser light
in my room too. But only during night.

Here's a schematic on how to connect LDR to microcontroler and after connecting just star printing ADC serial output

Here is a link to get info on how to make it yourself –


you can modify it to suite our arduino


Now we have code entering system, Alarm system than why not
the evidence taking end capturing system. To make your evidence capturing system you have to hack into an old digital camera.

First open the camera

Now desolder the two leads of the button used for capturing the image now solder two wires where the leads were earlier soldered. So now if you shot the two wires the camera will start the video recording now using the micro controller as a logical switch which would get to on position only if alarm is tripped. Thus in that case as soon as alarm is switch will take video of that room. In that way it would not only save the battery but also the storage.

You can also an SD card thru an SD shield of Arduino now modify the written SD card program in Arduino examples to save the readings of the sensors .

Now for capturing the intruder we can trip the metal net which would be electrified thru a capacitor circuit of camera flash.


Now let’s move to home automation part in this we would be
automating the appliances of the room.

We would need relay and an Arduino.

Recall the ‘PIR’ part and counter part we would be now using them to sense if anyone is in the room or not and also if there is no movement in the room for 10 minutes. Then it will switch off the lights and the fan.

Here's a circuit on how to connect relay to micro controller . You have to just give high or low depending on that relay would tun on LED but you can connect bigger appliances to it you just have to increase the power running through then relay

Here’s a project related to it

RELAY related project


The advantages of master and other code.

1. It would make sure that only master entered code person could access the important items

2. It would register the entrance of the person in the room in the SD card.

Now some more automation ideas are as follow

1) If you have raspberry pie then you can connect it to Arduino to switch ON/OFF through internet

2) You can attach a water gun to servo with laptop. So now when the alarm is trip the water gun will fire to the face through tracking the face of the intruder

Here’s a project Face gun

3) For entering the code we can use fingerprint scanner, RFID scanner or NFC.

If you have some interesting ideas please share it with us &please vote for me on home automation



Brahma - Vishnu-Shiv

Home Automation

Participated in the
Home Automation

Bedroom Contest

Participated in the
Bedroom Contest