GSM Shield Home Alarm

17,421

244

39

FOLLOW MY BLOG > bengoncalves.net

SEE MY OTHER ISTRUCTABLES > Ben Hur's Profile

The other day my father and I were discussing about the problems of living in a third world country. Because of the social inequality, there is little security on the streets. Also one major problem is that no one is secure, even the 1% richer, because there are know cases of robbers getting inside homes even on private neighbourhoods. We ended up thinking about putting a home security system in our house. The problem is those are very expensive and, in general, they just ring an alarm to scare potential thieves, but they don’t actually warn you in real-time that your house is being invaded. A complete system would be even more expensive. So I got the idea to make my own Arduino based home alarm. I just had to buy a GSM shield for the Arduino Uno, because all other parts I already had.

Step 1: The Parts

For this project you will need:

  • Arduino Uno (Ebay);
  • GSM Shield (Ebay);
  • PIR sensor (Ebay);
  • An Arduino based buzzer (Ebay);
  • An alarm siren horn 12V(Ebay);
  • 12V power supply (Ebay);
  • Relay module (Ebay);
  • Keypad for the Arduino (Ebay);
  • A box;

Step 2: Connecting the Components

First you will place the GSM shield above the Arduino Uno, then you will need to solder the wires GND and VCC together from the two sensors, the buzzer and the relay module input. After that, you connect those soldered wires on the corresponding connector from the GSM shield. Next you will make a connector from the input / output signals from those parts, and the last thing will be to connect the keypad above the shield. It will be:

Arduino Uno / GSM shield pins:

  • Pin 0: unconnected;
  • Pin 1: unconnected;
  • Pin 2: unconnected (the GSM will use this pin);
  • Pin 3: unconnected (the GSM will use this pin);
  • Pin 4: last row from keypad (keypad pin 4 – from 8);
  • Pin 5: unconnected;
  • Pin 6: second column from keypad (keypad pin 6 – from 8);
  • Pin 7: third column from keypad (keypad pin 7 – from 8);
  • Pin 8: unconnected (the GSM will use this pin);
  • Pin 9: unconnected (the GSM will use this pin);
  • Pin 10: PIR sensor number 2 data;
  • Pin 11: siren horn signal (goes to the relay module input);
  • Pin 12: PIR sensor number 1 data;
  • Pin 13: buzzer signal input;

As it is possible to see, although the keypad has 8 pins, I just connected three (one rom and two columns, allowing two numbers to be read – 1×2 matrix), because this way I can make passwords using these three wires, and there is no need to use all the pins from the keypad. This is because once the movement sensor detects a person walking inside the room, the person will have just 5 seconds to deactivate the alarm, so there is not enough time for the thief to figure out the alarm code. Once the alarm is not disabled on the given time, the GSM shield will proceed to send SMS to you, or to call your phone. The Arduino was programmed to call and once you answer the phone, it will finnish the call. This way it will spare the credits from the mobile operator.

Of course, it is possible to get false readings from the sensor, or even the code can be buggy, so I put an option to disable the alarm just by sending an SMS text from my phone to the Arduino. Also another option you can make is to order the shield to send you one message a day to ensure you it is working correctly.

Step 3: The Code

Just download the code below and compile. It uses the Keypad.h and GSM.h libraries. As the Keypad.h is not standard with the Arduino, I put it to download here too. I suggest you test your setup by steps.

Step 4: Conclusion

Considering the code will make the Arduino Uno send SMS messages and call your phone in only five seconds after someone break into your house, I guess you will have plenty of time to call the police. Of course the siren horn will scare the thieves and they will run away taking whatever they can, but if you don’t use the siren, you will probably end up having them arrested. I hope this way you can have a more secure home. If you have some good idea please leave a comment, that I will improve my system here. Hope you guys find this article useful.

Share

Recommendations

  • Big and Small Contest

    Big and Small Contest
  • Toys Contest

    Toys Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018

39 Discussions

0
None
howlsmovinghut

5 months ago

I don't know if you're still here but, what part do I connect to the relay module? can you elaborate?

0
None
shaheerarshad22

10 months ago

hello i want to know that what to do if i have to add a reed switch to it.Thanks

0
None
noel.kuck

2 years ago

Could you advise the sketch changes necessary to offer a multiple digit password? Mine isn't working. Thank you.

0
None
AashishG6

2 years ago

will u please send a circuit diagram its little bit difficult without it

2 replies
0
None
jayt18AashishG6

Reply 2 years ago

I would love to make this. Can you please send me the schematic too?

planbmanjb@gmail.com

0
None
benhur.goncalvesjayt18

Reply 2 years ago

Sorry guys, I dont have a schematic for this one. Just follow these instructions:


  • Pin 0: unconnected;
  • Pin 1: unconnected;
  • Pin 2: unconnected (the GSM will use this pin);
  • Pin 3: unconnected (the GSM will use this pin);
  • Pin 4: last row from keypad (keypad pin 4 – from 8);
  • Pin 5: unconnected;
  • Pin 6: second column from keypad (keypad pin 6 – from 8);
  • Pin 7: third column from keypad (keypad pin 7 – from 8);
  • Pin 8: unconnected (the GSM will use this pin);
  • Pin 9: unconnected (the GSM will use this pin);
  • Pin 10: PIR sensor number 2 data;
  • Pin 11: siren horn signal (goes to the relay module input);
  • Pin 12: PIR sensor number 1 data;
  • Pin 13: buzzer signal input;
0
None
hilmi emred

2 years ago

Send me some shematic or detail photos how you connected the parts please

h_emre06@hotmail.com

1 reply
0
None
diyanamzahhilmi emred

Reply 2 years ago

hey hilmi, have you got the schematic? can you send to me too?

diyanahhamzah@yahoo.com

0
None
diyanamzah

2 years ago

Hi, can you send us the circuit diagram? I'm doing this project for my practical training and it will be so helpful if you upload the circuit diagram. Thank you

0
None
DS49

2 years ago

could u send us images of the whole connection circuit design,cause we have to show the judges in our school hows the circuit

0
None
TarekB3

3 years ago

este e o link

https://youtu.be/pUIGNnbTe0o?list=PLePNrRwjuwL35mTp9eKoDSPCmHSZoIRfy

1 reply
0
None
benhur.goncalvesTarekB3

Reply 3 years ago

sim entendi. seu problema é no codigo ou em como conectou o motor. vai testando por partes. esquece o codigo pronto do cara e testa como acionar o motor primeiro com algum exemplo especifico da web.. ou da plataforma mesmo. coloca no google "arduino servo motor" ou "arduino servo library", depois testa só a leitura do sensor sonar... pega exemplo da plataforma ou procura no google "arduino sonar example" ou "arduino sonar library", ai quando estiver um e outro funcionando separadamente, voce junta os codigos. Faz isso... vai por partes

0
None
TarekB3

3 years ago

ola amigo, tudo bem?

comprei um arduino uno, o mega kit, quero fazer um projeto simples para começar, quero fazer abrir e fechar ao ativar o sensor ultrasonico. tem um cara que fez tutorial do projeto, mais tentei muitas vezes e nao funciona, ou seja nao gira o motor. quando vou aos exemplos do arduino e testo o codigo blink funciona bem, ou seja o codigo se carrega bem.

vou colar o codigo para dar uma olhada se pude por favor

#define pingTrig 6

#define pingEcho 7

#include <servo.h>

Servo myservo;

void setup()

{

pinMode(pingTrig, OUTPUT);

pinMode(pingEcho, INPUT);

myservo.attach(9);

}

void loop()

{

long duration, inches, cm;

digitalWrite(pingTrig, LOW);

delayMicroseconds(2);

digitalWrite(pingTrig, HIGH);

delayMicroseconds(10);

digitalWrite(pingTrig, LOW);

duration = pulseIn(pingEcho, HIGH);

cm = duration / 29 / 2;

if (cm < 10 ) {

myservo.write(90);

delay(100);

} else {

myservo.write(0);

}

delay(2000);

}

o projeto no ytube chama-se

Home Made Motion Activated Trash Can.

0
None
TarekB3

3 years ago

ola amigo

posso comprar as parts de ebay e mandar para meu endereço em porto alegre?? tenho que pagar para alfandega??

1 reply
0
None
benhur.goncalvesTarekB3

Reply 3 years ago

Pode sim. O produto chega normal se o vendedor for confiável e tiver varias vendas. A alfandega taxa meio aleatoriamente e na maioria das vezes pelo valor declarado pelo vendedor. Agora com a crise estão taxando quase qualquer coisa. Na maioria das vezes da so 30 reais por pacote. Pede pro vendedor declarar 5 dolares como valor da mercadoria e de boa. Pacotes muito pequenos eles não taxam.

0
None
noel.kuck

3 years ago on Introduction

Thanks for the continual hand-holding. The keypad works fine. Altough a bit confusing, I believe that I connected the keypad according to your instructions. KP#4 to Arduino#4, KP#6 to Arduino#6, and KP#7 to Arduino#7. Sensors to Arduino #10&12, VCC & GND. I am using the Seeed GPRS Shield, and it has worked for me before.

1 reply
0
None
benhur.goncalvesnoel.kuck

Reply 3 years ago

Search Google for which pins your gsm shield uses, because I think different shields use different pins. Mine uses pins 2, 3 and 8 and 13 I think. Try google and putting the sensors and keypad on different pins to see which ones cause malfunction

0
None
noel.kuck

3 years ago on Introduction

I get SMS Messages Sender on the Serial port, and the GSM is on and flashing. That is as far as I have been able to go. How would you suggest the best way to test the keypad and the GSM shield separately?

1 reply

To test the keypad use it without the GSM shield. Plug it directly to pins 12 to 5, or 7 to 0 from the Arduino Uno and use the example "Multikey.ino" from the library. Set the line rowPins[ROWS] = {13,11,10,9}; colPins[COLS] = {8,7,6,5}; correctly (or the inverse depending on how you plug) then open the serial and press the buttons. When with the GSM shield you wont be able to use all 8 pins from the keypad because the GSM use some of them (I think the pins 0,1,2 and 3 wont be free to use), but you dont actually need all 8 pins. For example, to use one button as a password you only need 1 row and 1 column = 2 pins. For 2 different numbers password you will need 3 pins and so on. For my example I used 3 pins, but just the button "0" as password. But could have used 0 and #.