Automatic Doorbell – A step towards Home Automation.

Automatic Doorbell

Automatic Doorbell – What is it?

So, whenever a visitor arrives at your doorstep, the very first thing he does is – search for a doorbell. But what if i say the next time they visit,  they won’t be doing the same. The automatic doorbell will serve the purpose of doing all the sorts and ringing the bell. Just imagine the expression of astonishment on the face of your visitors. The automatic door not only will serve the purpose of ringing the bell but also will act as a burglary alarm. This article basically discusses about how you can make one automatic doorbell for yourself, and make your home a more secure place to live in.

How it works?

This automatic doorbell uses transmitter and receiver modules for transmitting signals.  So, whenever any visitor comes in the path/range of Ultrasonic Sensor, the micro controller detects the distance of object from the sensor. And if the object is in the defined range, it sends signal to the buzzer and its starts beeping. This  detects the intruder and the door bell is automatically turned ON when a person is in front of the door. This device not only serve as a doorbell but also helps in raising an alarm in case of intruders. This act as a third eye and helps in guarding your homes.

Components required

  1. Ultrasonic Sensor (HC-SR04),
  2. Buzzer,
  3. Arduino UNO- The universally accepted board.
  4. Jumper Wires – both male to male and male to female,
  5. USB cable for Arduino or
  6. 12V adaptor or else a 5-9V supply.

 If you are finding hard to find the components  from the stores, you can order them from online stores at nominal cost.

Ultrasonic sensor module( HC-SR04 ) :


Ultrasonic sensor HC-SR04

This sensor module consists of ultrasonic transmitter. One of them is the receiver and the other is a control circuit. Basically these seem as a pair of circular eyes out of which one is to the transmit the ultrasonic wave and the other is to receive the reflected wave.

Basically, the way the ultrasonic sensor works is:
When we flash the trigger pin high for a small amount of time (in this case let it be 1000 microseconds), the sensor would send an ultrasonic wave at a known time (let’s say t1). The wave will reach the object and reflect back to the receiver sensor at another known time (t2) . Certainly, lets assume

  t3 = t2 – t1

t3 is equal to the time taken for the wave to reach the object and comeback, so (3/2 * t)is the time needed for the wave to reach the object. Most importantly, we know the speed of sound which is 340 m/s or 29.1cm/ms hence we are able to get the distance in cm.

Certainly, using the time in which the ultrasonic wave return, we can calculate the distance of the object. Since by now, we know time and speed of sound, we can calculate the distance by the following formulae.

Distance = (Time x Speed of Sound) / 2

 The value is divided by two since the wave travels twice for covering the same distance.

Circuit diagram and Explanation

First of all one need to connect all the components according the skeletal diagram shown below.

Automatic doorbell skeletal circuit diagram


If you find it bit clumsy, for better visuals you can refer this pictorial diagram.

Pictorial representation



Step 1: Connecting the Sensor !!

  1. Connect the Vcc to Vin,
  2. GND to GND,
  3. Trigger pin to pin 12, Echo pin to pin 13,

Note:- if you are using a 9v battery you have to connect the Vcc pin of the sensor to 5v . While if you are using your computer as a power source you have to connect the Vcc pin to the Vin of your arduino

Step 2: Connect the Buzzer.

For this you connect buzzer, basically connect ground to ground and power to pin 8.

Step 3: The CODE.

code 1

code 2


Most importantly, we define the trigger pin as pin 12 and  the echo pin as pin 13. The piezo (buzzer) was named as pin 8. The trigger and piezo (buzzer) pins were set as output and  the echo pin as input. Let the doors length is 60 cm , so as long as there is nothing less than 60 cm away the buzzer is off . Once some come in the range of the sensors, the buzzer start to sound.

Basically, here we will require NewPing.h Library for Ultrasonic sensor, developed by Tim Eckel. You can get all the features and uses of this library in the following link –

Also you can download the library from the Github :

For more details about arduino and uploading code you can refer : Best Robotics Kits for High School Students

Certainly, your Automatic doorbell is almost ready and you can install it on the door.

Hope you liked this automated doorbell and want your home to be more secure with the help of this watchdog.

Most importantly, please share your views and doubts in the comment box.

Don't miss out!
Subscribe To Our Newsletter

Learn new things. Get an article everyday.

Invalid email address
Give it a try. You can unsubscribe at any time.