DIY: Creating a Smart Doorbell that Sends Alerts to your Phone

We all have doorbells outside our homes. Whenever a guest or a family member comes he looks for the bell, and after finding out he/she rings it. Mostly it is observed that the guests can’t find the doorbell outside the house and if the height of a person is small even then he/she may find it difficult to reach the doorbell. This problem is solved electronically and today we will make a smart doorbell that uses an object detection circuit that rings automatically then there will be no more hassles. When the doorbell will start ringing a Smartphone alert will also be generated that will alert the people living inside the house and someone will then go and open the door. We will integrate some basic electronic components in the circuit design and place the circuit near the gate so that it is automatically activated whenever a person appears in the front of the door.

Smart Doorbell System

How To Receive Alerts Generated By Smart Doorbell On Your Mobile Phone?

Firstly, we will gather the components and then assemble the circuit initially on software so that any beginner to electronics can assemble it easily and then on hardware for final testing of the doorbell.

Step 1: Components Needed (Hardware)

The most intelligent way to start working on any project is to make sure that you have every component that you are going to need. This not only saves time but also prevents you from getting stuck somewhere in the middle of the project. A complete list of all the components that are easily available in the market is given below:

Step 2: Working

As we now have a complete list of all the components that we are going to use, let us move ahead and understand the main working of the whole system.

The heart of this project is a SIM900A GSM module. SIM900A is a complete dual-band GPRS module. It has a built-in RS232 which is a very reliable and ultracompact interface. The operational frequency range of this module is 900/1800 MHz. The connection between this module and any other microcontroller is made possible with the help of RS232. This module can send an SMS and make a call after a connection is made.

A PIR is a Passive Infrared Sensor. It is an electronic sensor that has an ability to detect infrared radiations from any object that is in its field of operation. Most of the systems that are used to detect some sort of motion, use this sensor in them. This sensor does not emit any of its energy but it works just be receiving the IR radiations from the surroundings. The output pin of this sensor is initially LOW which is converted into HIGH if some motion is detected. The best operational range for this sensor is around 6 meters.

When any sort of motion is detected by the PIR sensor, a HIGH signal will be sent to the microcontroller board which is, in this case, Arduino Uno. Then the microcontroller will enable the serial communication with the GSM module and the GSM module will send an SMS or make a call to the owner of the house telling him that there is some guest on the door.

Step 3: Assembling The Circuit

The connection of the PIR sensor to the Arduino board is quite simple. The sensor is powered by connecting the Vcc into the 5V of the Arduino and GND pin to the Ground of Arduino respectively. The OUTPUT pin of the PIR is connected to pin 5 of the Arduino board.

To establish a serial connection of the Arduino board with the GSM module, connect the Rx pin and the Tx pin of the microcontroller with the Tx pin and the Rx pin of the GSM module respectively. Make sure that the GSM module is disconnected when you are uploading the code on the microcontroller.

After assembling and powering the whole circuit, burn the code on it and make sure you give some time to the PIR sensor to warm up. It is very important because the surrounding of the PIR is to be observed by the sensor to settle it according to the surrounding. Make sure that no motion is produced near the PIR sensor during the warm-up. Use the potentiometer on the sensor to calibrate the sensor.

Step 4: Getting Started With Arduino

Arduino IDE is a software on which you can write, debug, and compile a code that will run on an Arduino microcontroller. This code will be uploaded to the microcontroller through this IDE. IF you have no previous experience with this software, there is nothing to worry about because the whole procedure to use this software is given below.

  1. If you don’t have the software already installed, click here to download the software.
  2. Connect your Arduino board to the PC and open Control Panel. Click on Hardware and Sound. Now open Devices and Printer and find the port to which your board is connected. This port is different on different computers.
    Finding Port
  3. Now open the Arduino IDE. From Tools, set the Arduino board to Arduino / Genuino UNO.
    Setting Board
  4. From the same Tool menu, set the port number. This port number should be exactly the same as the port number that was observed before in the control panel.
    Setting Port
  5. Download the code attached below and copy it to your IDE. To upload the code, click on the upload button.
    Upload
  6. To download the code, click here.

Step 5: Configuring The GSM Module

To configure the GSM module with the Arduino board, we will burn a C code on the bard so that all the components start communicating with each other.

1. At the start, the pin oof the Arduino board is initialized that will be used to connect the OUTPUT pin of the PIR sensor.

int pirOutput=5; // connect output of PIR sensor to pin5 of Arduino

2. void setup() is a function that runs only once when the circuit is powered on or the enable button is pressed. In this function, we have set the speed in bits per second of the controller by which it will communicate with other components. This speed is also known as the baud rate. Then the pin5 of the Arduino is declared as INPUT. This means that this pin will be used to take the input from an external source. The status of this pin is initially set to LOW.

void setup()
{
 Serial.begin(9600);          //set the baud rate
 pinMode(pirOutput,INPUT);    // declare PIR sensor pin as OUTPUT pin 
 digitalWrite(pirOutput,LOW); // initially send a LOW signal to the PIR sensoor output pin
}

3. void loop() is a function that runs again and again in repetition. Here the pin of Arduino, which is connected to the PIR is checked continuously. If its status becomes HIGH, it means that some motion is detected. When a motion is detected, it will enable the GSM module to send an SMS to the number that is provided in the code. After sending the SMS, the GSM module is disabled to send a message.

void loop()
{
 if(digitalRead(pirOutput)==HIGH) // if motion is detected
 {
  Serial.println("OK"); // print OK on serial Monitor
  delay(1000); // wait for one seconds
  Serial.print("AT+CMGF=1\r"); // set the GSM module to send SMS
  delay(1000); // wait for one second
  Serial.print("AT+CMGS=\"+xxxxxxxxxxx\"\r"); // replace xxxxxxxxxx with your mobile number
  Serial.print("Intruder Alert - A guesst is on the main door \r"); // send this message on the specified mobile number
  Serial.write(0x1A); // ASCII code for CTRL+Z (end of message)
 }
}

This was the whole procedure to make a smart doorbell for your home which will be continuously checking for moton at the main door and notify the owner through an SMS if some guest comes at the main door. You can edit this code a little bit and set the GSM module to call the owner instead of sending an SMS and enjoy your low cost and efficient smart doorbell system.

Hamza Iqbal


Hey! I am Hamza. I am an Electrical Engineer who has a very innovative approach towards daily life stuff. I tend to make life easier by making circuits and designs to automate things around me. I mainly work with printed circuit boards on proteus to bring life to my inventions.
Close