Saturday, November 23, 2024

Smart Receptionist With Smartlock System

Presented here is a security system that lets you see a visitor while EFY Tested your main office door is locked. If you are in the middle of a meeting in a conference room and there is a visitor at the door, this system will send a notification to your smartphone with a photo of the visitor as email. If you approve, you either use your mobile or PC to unlock the front door using a Web browser.

Alternatively, if you have a door bell with intercom facility, you can talk to the visitor when he or she rings the door bell. A typical block diagram of the smart receptionist with a smartlock system is shown in Fig. 1.

Fig. 1: Smart receptionist with a smartlock system
Fig. 1: Smart receptionist with a smartlock system

Smart Lock Circuit

Interfacing circuitry of the smart receptionist and smartlock system is shown in Fig. 2. Raspberry Pi runs on standard Raspbian Linux distribution with Wi-Fi dongle, GPIO library and software written in Python language. Raspberry Pi GPIO4, GPIO17 and GPIO25 are connected with resistors R3, R2 and R1, respectively, to make logic level low.

- Advertisement -

Doorbell

The doorbell signal from CON3 is routed to GPIO17 pin on Raspberry Pi. When a visitor rings the door bell, the status LED glows and GPIO17 becomes high. Amplitude of the door bell signal output depends on the door bell/chime used. You can use a door bell that gives 3V signal.

Circuit diagram of the smart receptionist with a smartlock system
Fig. 2: Circuit diagram of the smart receptionist with a smartlock system

Captured signal should not exceed Raspberry Pi’s 3.3V limit on GPIO pins. So a 3V zener (ZD1) is used in this circuit. Ground wire of the door bell circuitry should be connected to GND pin of Raspberry Pi and the anode of status LED to GPIO17.

- Advertisement -

When GPIO17 becomes high, the system captures the photo of the visitor through the webcam connected to Raspberby Pi through USB. Captured photo is sent to your email ID configured in your source program.

Open the attachment in your email and check the photo of the visitor. After your visitor is identified, either open the door directly or talk to him or her through an intercom if it is installed at the door.

Smart Lock

When status LED glows to indicate that the doorbell is ringing, press Camera tab on your Web browser (Fig. 3). This will make GPIO25 pin of Raspberry Pi high, enabling the webcam to capture the photo of the visitor. Captured photo is sent to your email ID.

After your visitor is identified, you may open the door by pressing Lock tab on the Web browser. With Lock tab pressed, GPIO4 becomes high. Since relay driver transistor T2 is connected to GPIO4, T2 conducts and energises relay (RL1). This provides a 12V DC supply from CON2 to the solenoid lock connected at CON1, and the door opens.

Software

Get the software ready

To start with, you should have Raspberry Pi with an Internet connection. Update it to ensure that it has all the latest software and drivers. Run the command given below in the terminal to update the OS installed on Raspberry Pi.

sudo apt-get update
$ sudo apt-get upgrade

Installing WiringPi library

WiringPi is maintained under GIT, so install it with:

 sudo apt-get install git-core

To obtain WiringPi using GIT:

$ git clone git://git.drogon.net/ wiringPi

If you are using clone operation for the first time, then use:

$ cd wiringPi
$ git pull origin

This will fetch an updated version and then run the build script using the command given below. To build/install, use the new simplified script given below:

$ cd wiringPi
$./build

The build script will compile and install it all for you.

Test WiringPi Installation

Run gpio command to check installation:

$ gpio -v
$ gpio readall

Setting up Apache Web Server on Raspberry Pi

Apache is a popular Web server application that can be installed on Raspberry Pi to allow it to serve Web pages. On its own, Apache can serve HTML files over HTTP, and with additional modules, you can make it a dynamic Web page using scripting languages such as PHP.

Install Apache using the following:

$ sudo apt-get install apache2 php5
libapache2-mod-php5

Find Raspberry Pi IP address using the following command:

$ ifconfig

Setup

Fig 355
Fig. 3: Web page window

Test your server setup of Raspberry Pi from another computer by typing its IP on any Web browser on the same or different network. You should see a message saying, “It works!” This means that Apache is working.

Changing the default Web page. The default Web page is an HTML file (index.html.) located at /var/www/html/index.html

Navigate to this directory in the terminal and have a look at what is inside.

$ cd /var/www/html
$ ls -al

This means that there is one file present inside the html directory owned by the root user. We do not need this file, so remove it.

$ sudo rm index.html

For owning the www directory, run the following command:

$ ls -l /var/www

You will see this only if you have root (the super user) privileges.
You can use the following command to change it or create a group named www-data in which you place the Pi user.

$ sudo chown -R pi /var/www

To own everything inside the directory (index.php as example), use:

$ sudo chown -R www-data /var/www

The smartfolder (inside the DVD) contains two folders, namely, html and my_project. Copy my_project inside Pi folder.

To copy html folder inside www directory, use the following command:

$ sudo cp -r /home/pi/smart/html /var/www

Now, you have a Web server ready and it will receive the Web page after refreshing it.

We have used main.py Python script to detect interrupt and call emailscript.py. Main.py gets executed when doorbell ring interrupt is received through CON3. emailscript.py Python script is used to send emails with photos as attachment.

Make necessary changes in emailscript.py. Change the text given below with your email credentials, which you will use to send emails:

USERNAME = “[email protected]
PASSWORD = “your_password”

Change the email ID in sendMail ([“[email protected]”] with your email ID or the person who will be receiving the photo.

Testing

After everything (webcam, interfacing circuit and others) Smart Receptionist With Smartlock System has been properly connected, follow the steps given below. Run main.py Python script on the terminal by giving following command:

$ cd my_project/
$ sudo python main.py

Open the browser from another computer having an Internet connection with your Raspberry Pi IP address. You will get the Web page as shown in Fig. 3. For testing purpose, provide a 3V DC at CON3 for around three seconds and release it. Press Camera tab to get the captured photo in your email. Within a few seconds you will receive a captured photo in your email attachment in [email protected] email ID. Press Lock tab to energise the solenoid lock.

Download Source Code: click here

If you are looking for the difference between Microprocessor and Microcontroller, you can read it here.

This article is a part of the Top 15+ Microcontroller Projects. If you want to read more projects based on Microcontroller, can go through this article.


This article was first published on 11 June 2017 and was updated on 19 September 2019.

22 COMMENTS

  1. Since it is a small project we do not have the component list included in the article. The main component are Raspberry Pi board and a transistor, the rest are resistors, a rectifier diode, a zener diode, three 2-pin connectors (CON1,CON2 CON3). The door bell section is external part. So, the complete and actual circuit of door bell is not shown here.

  2. Is there any topic explaining the alternative set out in the first paragraph, with the intercom (IP-)calling my cellphone?
    I’m looking to combine the two in my appartment, intercom and smartlock on the downstairs door with button ‘A’, and sending a picture with button ‘B’.

  3. In the first paragraph there is word of an alternative in utilizing an intercom, does anyone have a (working) link to such a project and/or more information on how to integrate this in the project laid out above?

  4. The component values are clearly visible in the circuit given above. You can use any suitable door bell in this project. That’s why the detail circuit is not given for door bell section as shown on the right side.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×