Keywords

1 Introduction

In today’s world, there is a great demand of automated systems. This system provides facilities to control appliances remotely from the Android device. Smart home can provide privacy and security. Computer vision technology is used for facial recognition, content organization, and many more. The problem of smart home automation is an issue that occurred a few decades ago when scientists and engineers around the world developed solutions such as automatic light switches and voice control devices. In order to control the intelligent detection switches, the results are currently obtained using an array of IR sensors [1]. Currently, the homeowner can monitor and control the home appliances using a smartphone. However, many companies offer new systems as apps which make the use or the control of smart homes easy [2]. The user can access the system from anywhere but the internet connection should be there in the microcontroller. Raspberry Pi 4 board is the latest Pi board which is small in size and also acts as a server. The idea of automation for each machine in the home was developed many years ago, starting with connecting two power lines to the battery and closing the circuit by connecting the load as a lamp. Later, it can be developed by different organizations, which creates its own automation systems with different devices like sensors, controllers, actuators, buses, and interfaces. In present days, most of the automation systems utilize the combination of hardwired and wireless systems for controlling the appliances [3]. In this paper, we have integrated our system implementing computer vision technology for face detection with Android application in a smart home system [7]. Our system can also control the speed of the fan and brightness of the light.

2 Proposed system

Home automation plays an important role for our protection and convenience. The main benefit of the system is that, by sitting anywhere in the world, it can be controlled by our Android device. The proposed system provides facility to control home appliances like fans, lights, etc. [9]. Raspberry Pi 4 board is a basic, simple all-in-one chipboard which is the main base of the system. Motor driver L298N module acts as an interface between the motors and the circuit. When any intruder enters home, the infrared sensor which detects infrared radiation gets activated and sends the signal to the processing unit Raspberry Pi 4. Then the camera will take a snap of the intruder and our system will compare the intruder’s face with the existing data set, then it will match the face. If match occurs, then the system will consider the face; otherwise, it will give an alert notification to the owner’s Android device. An Android application is established using Android studio platform which is a unified environment where we can build apps for Android devices. Kotlin and Java programming language is used. Android applications will be used to control the home appliances. The system architecture is shown above (Figs. 1 and 2).

Fig. 1
figure 1

System architecture

Fig. 2
figure 2

Circuit diagram of the system

3 Components Required

3.1 Hardware Requirements

  1. (1)

    Raspberry Pi 4

  2. (2)

    IR sensor

  3. (3)

    L298N motor driver

  4. (4)

    DC motor

  5. (5)

    LED

  6. (6)

    Battery

  7. (7)

    Android device

3.2 Software Requirements

  1. (1)

    Android studio

  2. (2)

    Python 3.6.5

  3. (3)

    My home automation app

4 Hardware Implementation

Here, Raspberry Pi 4 acts as a controlling unit of the system. Pi collects the data from the infrared sensor which detects the infrared radiation whenever any intruder comes in the range of IR. Motor driver L298N is used to control DC motor and stepper motor. It can be used for two techniques—for speed control and rotation direction of the DC motor. Motor driver uses H-bridge techniques for rotation of DC motors. Apart from this, two 5V DC motors (toy fans) and an LED are used as home appliances (Fig. 3).

Fig. 3
figure 3

Experimental setup of the system

5 Working of the System

Phase 1: Home automation implementing Internet of Things.

The processing unit Raspberry Pi 4 is initialized [10]. Then the infrared sensor and other components in the circuit are initialized. Once the setup is completed, the system will check the network WiFi connectivity and it will automatically connect to the Google Firebase database and initialize with it [8]. The system will then read the infrared sensor data and update the data in the Firebase database. Now, we set our application with respect to the Firebase database identity and generate a key. After proper connection of the application with the Firebase database, our application will read back the sensor data from Firebase with the logic of the program, the home appliances will automatically control. We can manually control with the help of application interface. Manually, our application interface will have the functionality to control on and off switches of home appliances such as light, fan, etc.

Phase 2: Home automation applying machine learning.

In the second phase of the project, we mainly concentrate on machine learning on the basis of computer vision. Raspberry Pi will be in surveillance mood. The program logic will already store the familiar face of the family as the data set in the Google Firebase. Once the surveillance Pi camera detects a human face, it will fetch the image into the program, and extract feature of the image. Now, system will make a quarry of this image that is already stored in the data set. If the image features match with any of the data set, the system will be at ease. If there is any mismatch of image with data set, the system will generate an alert message via the Firebase messaging system and send to the reliable person mobile or into the application. Also, it can ring an alert buzzer in the circuit. Workflow of the system can be referred to in the below chart (Fig. 4).

Fig. 4
figure 4

Flowchart of the system

6 Software Implementation

The main aim of developing Android application is to allow control signals sent from Android phone through WiFi to provide facilities like device control, device monitoring, etc. By developing this application, one can control the home appliances like lights, fans, etc. Android package is a file format used by Android operating system [5, 6] (Fig. 5).

Fig. 5
figure 5

Developed interface of the Android application

7 Results and Discussion

We have successfully assembled our system and the prototype is shown in the figure below. The basic aim of the system is to provide a safe and efficient home automation. This system provides the facility to control home appliances through a designed Android application. Using computer vision and through a Haar Cascade classifier, we are able to detect intruder’s face and, finally, send as alert notification to the owner’s Android device. This paper is based on the implementation of Raspberry Pi 4, IR sensor, Camera, Android platform Java, and XML. The assembled system and results can be shown below, respectively (Figs. 6, 7, 8, 9).

Fig. 6
figure 6

Intruder detection by the system

Fig. 7
figure 7

Image detection using Haar Cascade

Fig. 8
figure 8

Designed Android application

Fig. 9
figure 9

Alert message received

8 Conclusion

This paper has the main motive to monitor the home and keep it safe and secure. This paper describes the design, implementation, and integration of Android application, home automation, and computer vision. Our system eliminates many disadvantages of earlier systems with certain modifications over it. Image processing has been done to improve the accuracy of automation system. This system is designed by Python programming language and it provides safeguard from possible intruders. The proposed system enables the features to send message alert to the Android device of owner, which works as an alert signal for the homeowner. Our designed Android application helps in controlling home appliances. The overall configuration is very low cost and can be easily implemented.