PIR motion detection sensor
So where the pir sensor is to be mounted in order to detect the presence of person. It must be mounted on the upper portion of inlet of door. Below diagram best illustrates the mounting of pir above the door.
Sim900 Gsm module(Arduino Gsm)
All sim900 gsm modules communicates with external controllers/microcontrollers on Uart protocol. Uart protocol has two pins. One is TxD(Transmit) and other is RxD(Receive). In order to send and receive data to sim900 gsm module the external microcontroller must also have a Uart port. In simple words Uart communication takes place between two Uart ports. Gsm sim900 module has Uart port so our external microcontroller must also have one to communicate with gsm module. In Uart communication we connect TxD pin of first device to RxD of second one. Similarly Rxd of first one is connected with TxD of second one. After connection we set the baud rate of communication in software. Baud rate is simply the speed of communication between two devices communicating on Uart port. In circuit diagram of the project it will be cleared to you about uart connections.
Sim900 gsm module works on AT command set. Their are lot of AT commands if you go through the data sheet of sim900 chip set. We will use in our project only ones which a necessary to send an sms text message. I have an another tutorial on how to send an Sms with sim900 gsm module. You can visit it by clicking the below button.
Door contact switch/Reed switch
How to install the door reed switch? We usually mount the switch half on fix/immovable surface and the magnetic half is installed on the moving surface. In our case, i installed the magnetic half on door and the switch half on the wall near to door closing point. Both half’s must be in correct position and at correct distance to make a contact. Below you can see the correct placement and installation of door contact sensor.
Arduino Home Security – Project circuit diagram
Door contact switch can be powered from +5v to +12v. I powered it with 5v power supply. If you input +12 volt to reed switch then you might need to insert a resistor in series with the reed switch because arduino pins are 5 volt tolerant and +12v(when contact is made) can destroy the input pin of arduino. When contact is made by reed switch the input voltage appears on the arduino digital pin. In our case on Door(Pin#9) pin. If the voltage is above 5 v it might destroy the input pin of arduino. So be careful before powering the reed switch.
Note: I write +12 v due to the fact that door sensor is installed at a distance from the main microcontroller(Arduino our case) and after contact the voltage drops across wire due to length of the wire.
Gsm module needs an extra power during sms sending time. Use an adopter which can supply continuous 1 Ampere of current at 5 volts for powering sim900 gsm module. 1 ampere adopter is enough to power all the components(Arduino, Pir, Reed switch and Gsm module) used in the project circuit.
For sending commands out by arduino on its Uart port Serial.println() statement is used in arduino ide. First “AT+CMGF=1” is send. This command sets the sim900 gsm module in sms text mode. Then “AT+CMGS=” is send with “\”+923425500809\””. Its actually the recipient sim number or the number to which we want to send the sms. Back slash in the last statement is preventing the double quotations to be executed by arduino ide. Sim900 requires mobile number to be enclosed in double quotations. After the number comes the body/text of the sms. I am sending my website name www.microcontroller-project.com as text. You can send what ever you want. Then comes the most important statement Serial.write(26). To end message and to send it sim900 requires Ctrl+Z command. If we translate the Ctrl+Z in ascii code it translates to ’26’. So at the end of the code we are sending Ctrl+Z command to sim900 to send the text message.
The project can be further upgraded by controlling the other appliances like light and alarms etc if any threat is detected. Arduino relay board containing multiple relays can be used to switch on and off the peripherals(lights, alarm). Beside an sms alert message an email can also be send to the house owner by utilizing the GPRS function of sim900 gsm/gprs module.