Security is the main concern in all the aspects of our life. And it applies to our very own home too. By saying "Precaution is better than cure", lets make our living place more secure by adding advanced security feature to it. Face recognition is the "State-of-the-art" security feature till date and multiple researches are going on in this domain. So lets get started to convert our Sweet home into Smart and Secured home by adding that advanced security feature.
"Smart Home Monitoring - Intruder Alert System" identifies the guest visitor and validates whether he/she is a known person or an intruder. For validating, I have used the Advanced Face Recognition using HOG (Histogram of Oriented Gradients) model. For Alert System, LED and Buzzer will be powered on, when an intruder is detected, also it sends an image of the intruder to the registered Telegram Channel using Telegram Bot. I used pycharm IDE for python coding and testing. Lets see every details below.
2) Environment Setup2.1) Pycharm IDE InstallationFirst Install Pycharm IDE on Windows/MAC, which is the all-in-one tool for python projects. Refer Pycharm installation from the below link
https://kite.com/blog/python/pycharm/
2.2) Python PackagesWe need multiple python packages for this project. For installing python packages in pycharm, press see the below link.
Or install python packages as shown below. Go to Terminal window present at the left bottom in Pycharm, and install packages using the following commands.
pip3 install boltiot
Similarly install the other commands like
pip3 install opencv-python
pip3 install dlib
pip3 install face-recognition
For this project, I have used BOLT Wi-Fi module as an alert system, which comes with its own cloud platform. First we need to connect the BOLT Wi-Fi Module to its cloud platform. Also after successful connection we need the API Key corresponding to the BOLT Wi-Fi device, with which we can trigger the alert system from our python bolt library code. Lets see the steps in detail
First and foremost register yourself in the below link to use cloud platform.
https://cloud.boltiot.com/login?next=%2F
After successful login, fetch the API Key details under the API tab
That's it, BOLT Cloud is now ready.
2.4) Connection to Telegram Channel via Telegram BOTDownload and install Telegram application from Playstore/Appstore and complete the registration process. After successful sign-in follow the below steps to create a Telegram Channel, which is equivalent to Groups in Whatsapp.
- Go to Menu and select New Channel from the list of options.
- Give an appropriate name to the Telegram Channel
- Select the Channel type as Public Channel and make sure to create a permanent link which is mandatory for a Telegram Channel
- That's it, the Telegram channel is created
We will be using this Telegram channel for publishing our alerts. For sending these alerts, we need to create a Telegram Bot and attach it to this Channel. Follow the below steps
- Go to Telegram home screen and select the search icon which is present in the top right corner and search for botFather. Select the correct botFather as shown below
- Type /newbot to create a new bot. Choose bot name and bot username and it generates a token, which is necessary to access the bot from the python code.
Next add the new Bot to the Telegram channel which we created earlier.
- Open the Telegram Channel and select Administrators
- Then select Add Admin option and select the new bot which we created recently.
That's it, we have setup our Telegram environment.
3) Hardware SetupBefore moving on to the hardware connection, lets define the motive of the alert system. When the system detects the visitor as a known guest, it should blink the LED for 2 seconds, whereas when the visitor is an unknown intruder, blink LED and alarm buzzer thrice.
I used BOLT Wi-Fi module as the hardware for my alert system. Since we use two devices, we need two power sources. Lets connect digital PIN 0 to the positive end of Buzzer and digital PIN 1 to the positive end of LED. Then connect GND PIN to the negative ends of both LED and Buzzer. Please refer below
First we need to capture the frames from the live video, for which I used openCV to do the job. It captures and reads the video frame by frame, which we can use it as input for face recognition module.
For Recognizing the faces in the frame given, I used HOG (Histogram of Oriented Gradients) model. Lets see a brief on how HOG model works.
- First it converts the RGB frame into Histogram frame for easy face detection
- Then it tries to identify the faces in the given frames using 68 points facial landmarks detection method as shown below
- Then it encodes all the facial information in a 128-d vector which can be used against the input frames.
- If the input picture closely resembles the known data, then the visitor is a known person, Else the person is an intruder.
By the above technique when any intruder is detected, it triggers the BOLT Wi-Fi module, which in turn blinks LED and alarms buzzer thrice. Also it sends an image of the intruder to created Telegram Channel.
Please see the below pictures and demonstration video about the project.
Now we have made our sweet home into safe, secured and smart home.
Comments