Arduino Projects

Anti Corona Touchless Doorbell using Arduino & IR Sensor

Anti-Corona Touchless Doorbell using Arduino:

Anti-Corona Touchless Doorbell using Arduino and IR Sensor- in this Covid-19 situation we are going to make a very practical project that you can build yourself if you follow my instruction. You know during this Covid-19 Corona Virus situation we need to keep the distance from others and stop touching things which may be easily infected. Doorbell is touched by everyone, and what if the Doorbell button is pressed by someone who is Corona positive then? We need to stop Corona Virus from spreading, not only Corona Virus there may be some other diseases which may spread through touching. As an engineer, I will show you how to make your doorbell touch-free or touchless. So, in this article, you will learn how to make your own touchless doorbell system using Arduino and an IR Sensor. By touch-free doorbell I quite literally mean touch-free. So you do not need to press the bell button anymore.  You just wave your hand in front of the IR sensor and the doorbell will start ringing. So the purpose behind this project is, as you all might know one of the most recommended precautions to take against the covid-19 is to maintain social distance and avoid contact with each other or strangers. So what happens is whenever a person comes to our houses the first thing that they do is they touch or press the doorbell and by doing so they are leaving the germs that were previously on their hands to the doorway and the next time someone from your family presses the doors doorbell the same germs gets transferred to their hands. So to avoid this kind of situation we completely eliminate the need to press the doorbell itself. So when there will be no need to press the doorbell no one will touch it and that’s when no germs will be transferred.

Previously, I designed a project on social distancing in which I used the Arduino and Ultrasonic Sensor, I also made on project on the Automatic touchless Hand sanitizer. I highly recommend you should read these articles.


Amazon Links:

12v Adaptor:

Arduino Nano

Arduino Uno

IR Sensor:

One-Channel Relay Module:

5V buzzer

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



Working principle of touchless doorbell:

This project basically works on the principle of IR sensor so we will be using an IR sensor. So how an IR sensor works, it has two LEDs one is the IR transmitter and the other one is the IR receiver. So the IR transmitter will generate IR infrared radiation and will be sending it out and that infrared radiation, when an object comes close to it will get reflected and be detected by the other which is the IR receiver and based on the it does a calculation based on the received wavelength and wavelength of the radiation and it can then detect an object based on that so this is how our project is going to work. So, you can say we are making an obstacle detection system, the one used in robots. But in this project we are going to control a doorbell instead controlling the robot motors.

Components Required:

For designing this project we will require the following components, the Amazon purchase links are already shared above. You can use Arduino Nano or Arduino Uno. The Arduino Nano is smaller so I will go with the Arduino Nano.

  • Arduino Nano
  • Infrared sensor
  • Relay module
  • jumper wires
  • door bell

Now there is no particular reason to use Arduino Nano however I just used it because it is small and in case if you wanted to mount it on let’s say the doorbell casing itself so that’s why  I have used Arduino Nano. However if you don’t want to use it you can go ahead with Arduino Uno or mega which one you have that’s totally up to you. The programming will remain the same.

Now the relay module is connected to a buzzer for the purpose of this project but however it is the same principle if you connect it to any other electronics or let’s say a doorbell for that matter. So it will work exactly the same way so there is no difference in that this is just for demonstration purposes you can go ahead and connect it to the doorbell. I will also tell you what you need to do when you are connecting it to the relay. So we will do that and one thing to notice is there are different types of infrared sensors out there in the market so this is probably one of the cheapest one and most common one that’s out there which we are using in our project. Infrared sensor has two LEDs in which, one is the transparent one that is the emitter and the other one the black one is the receiver. So the white led basically generates the IR infrared radiation and the black led will receives the radiation.



Interfacing the IR sensor and relay module with the Arduino:

So this is the wiring diagram that we will be following and the wiring as you can see is quite simple; so you don’t need much of wires as well so it’s basically very simple and we will just follow the wiring diagram.

touchless doorbell

  • The IR sensor has three pins which are VCC, ground and output pin
  • Connect the VCC of the IR sensor with the 5V of the Arduino
  • Connect the ground of the Arduino with the ground of the IR sensor
  • Connect the output pin of the IR sensor with the digital pin 8 of the Arduino
  • Now after interfacing the IR sensor with Arduino we will connect the relay module with the Arduino the relay module has again has three pins input, ground and vcc.
  • Input of the relay module will be connected to one of the digital pins on the Arduino board and in this case you can connect it to any digital pins but I will just go ahead and connect it to d3. Because if you connect it to a different pin you will just need to remember which pin you connected and make change in the code in our case. We have connected it to digital pin 3so that you will have to change that in your code. I am connecting the input pin to d3of the Arduino board.
  • Now connect the VCC of the relay module with the 5V and ground of the relay module with the ground.
  • Now for connecting the buzzer with the relay we will connect the positive terminal of the buzzer with center terminal of the relay module which is the normally open. And connect the positive wire from the supply with the common pin of the relay. It’s not shown in the circuit diagram. It’s simple, the voltage which you want to supply to the buzzer connect it with the relay common pin and connect the positive wire of the buzzer with the normally open pin of the relay. This way when the relay is turned ON the common pin of the relay connects with the normally open pin of the relay.
  • The negative terminal of the buzzer will be connected with the ground.



Touchless Doorbell Arduino Code Explanation:

After interfacing the relay module and IR sensor with the Arduino; we will do coding for our project. So let’s start the coding so go ahead and open up your Arduino IDE create a new project and let’s start typing the code which is pretty simple and it’s not very complex at all. We will just go ahead and, so we connected two pins to two digital pins, digital pin 8 for the IR sensor and the other one for the relay which is digital pin 3.  So we will just go ahead and define them.

#define ir 8

#define relay 3

Let’s create the setup function and as you all might know, setup function runs once when the code starts. So we are going to initialize the pin modes for our pins. So the infrared sensor pin is going to input data from the infrared sensor that’s why it is going to have an input and the other one the relay pin is going to output because we will get the input from the infrared sensor and based on the value of the infrared sensor we will send a signal to either turn switch on or off the relay. So the pin mode for our relay is output.

void setup(){

  pinMode(ir, INPUT);

  pinMode(relay,OUTPUT);

  Serial.begin(9600);

}

Let’s just begin the serial monitor so that i can show you guys what is actually happening when we are reading from the infrared sensor so that’s it for our setup function.

Now we will go to the loop function and write the code. Here I will print whatever we are getting from the infrared sensor so that you guys can know what’s actually happening so serial.print digitalRead(ir) and we will just add a delay so that we don’t get so many reading just for the sake of it.

void loop(){

  Serial.print(digitalRead(ir));

  delay(500);


Now we will write the if statement which will check if the value of the infrared sensor is low then turn the relay module on. When the infrared sensor does not detect anything the output is one and when it does actually detect an object the output is zero that’s why we are saying that if the digital read at the ir sensor is equal equal to low then digitalwrite relay high. So this will essentially turn on the relay module so the relay module will only turn on

  if(digitalRead(ir) == LOW){

    digitalWrite(relay,HIGH);

Whenever the infrared sensor detects an object in front of it or when the infrared sensor detects a hand or an object in front of it, it will turn on otherwise it will turn off. So this basically means that your doorbell will only turn on when the infrared sensor detects an object and that is when someone waves or say something in front of that object i mean the doorbell the IR sensor so we can also add an else statement. So if there is no object detected so then what we want to do is we want to turn off our relay so we want to digital write relay and low.

else{

    digitalWrite(relay,LOW);

So that’s all, that’s the code for this touch free doorbell.



Touchless Doorbell Arduino Complete code:

#define ir 8

#define relay 3

void setup(){

  pinMode(ir, INPUT);

  pinMode(relay,OUTPUT);

  Serial.begin(9600);

}

void loop(){

  Serial.print(digitalRead(ir));

  delay(500);

  if(digitalRead(ir) == LOW){

    digitalWrite(relay,HIGH);

  }

  else{

    digitalWrite(relay,LOW);

  }

}

After uploading code to the Arduino now if I wave anything or if I keep my hand or wave my hand in front of the IR sensor it will sound the buzzer and the buzzer will keep on sounding for as long as i keep my hand in front of the infrared sensor. So that’s pretty much it and another thing that you can note you can adjust is you can see this small screw on top of the infrared sensor module. So you can adjust the different distance to which the infrared sensor can actually detect.

The same exact project can also be built without using the Arduino board, you can directly connect the IR Sensor output pin with the relay module. But adding a controller board like the Arduino you can do many other things, you can create delays of your choice etc.

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button