Development of an Intelligent Smart Home Automation System

Generally speaking, security has been a major concern in every nook and cranny of our nation -Nigeria. Recently, cases of vandalisation, stolen vehicles, and related issues have been on the increase. The security personnel has done lots of work to curb this menace but most of their actions have not yielded the expected results. Therefore, there is need to use technology, such as smart home, to create a safer society. Though the major challenges of smart home technology among others are authentication of the IoT devices, uninterrupted connectivity, intelligent decision making and privacy issues. Many researchers have targeted some of these issues, nevertheless, a smart home technology that has intelligent decision making and analytical abilities is the need of time. Based on this background, a smart and efficient security lighting system that resulted in maximum energy savings by employing new technology for automatic motion detection was developed. A digital light-dependent resistor (LDR) sensor coupled with a microcontroller, relay, camera, and GSM technology was used. The LDR sensor converts the light intensity to a digital format for the microcontroller to control the security lights automatically by using the relay as a switch. The passive infrared motion sensor perceives human movement and converts it to digital format for the microcontroller to trigger the GSM module and alert the user for live streaming of what is happening on the mobile app by establishing a connection between the camera and android smart device. The switching ON/OFF of the security lights of the device is time-independent. The capturing and videoing are done on the mobile android device. The hardware components and technology used in the system are easily available and replicable. The system is tested and results highlight its significance and validate the proof of the concept.


Introduction
The frightening rate of crimes in the nation has made the government and people look for several ways of protecting lives and properties in the nation -Nigeria [1]. Lately, the problems of stolen vehicles and related issues have been on the increase; and this has brought about an unhealthy society. Therefore, there is need to use technology to create a safer society. The technology is not going to replace the security personnel and usage of appliances such as gates, and doors locks, electric wires, etc, but it will be used as an alternative method for prevention/detection. Lots of researches that have been done in the areas of the subject matter had limited access to both indoor and/or outdoor environments. Home automation is considered as the residential extension of building automation that is related to home, housework, or household activities. It usually includes centralized control of JITeCS Volume 6, Number 2, August 2021, pp 209-219 p-ISSN: 2540-9433; e-ISSN: 2540-9824 lighting, HVAC (heating, ventilation, and air conditioning), appliances, gates, and doors locks, as well as parts for other purposes, to provide improved convenience, comfort, energy efficiency, and security. These operations are fundamentally supported by handheld devices and often are remotely performed.
The last decade has witnessed the development of some intelligence into home security [2]. Several systems have been designed that cover efficiently every desirable security requirements. These requirements may be different from time to time, and they can be referred with different purposes and targets of protection. So the primary requirements for security have become a field of research of great interest in the last years [3]. Home or office security systems have grown in popularity in recent years, home/office owners' look for ways to protect their personal belongings and enhance their home values. Every homeowner must consider adding a home security system, as burglaries, thefts, and murders have become routine in big cities.
Passive Infrared (PIR) sensors are a low-cost security system for home applications in which the PIR sensor was developed to sense the motion of humans through the detection of infrared radiation from that human body. PIR device does not emit infrared radiation but passively accepts incoming infrared radiation. PIR sensor notices the presence of a human in the home and generates a signal which is read by the microcontroller. According to the signal received by the microcontroller, a call is acknowledged to the mobile station through a GSM technology and thus alerts the presence of a human in the home to the owner-occupier as well as captures the image and save it on the memory card. In this work, a smart home security system digital using a light-dependent resistor (LDR) sensor coupled with a microcontroller, relay, camera, and GSM technology for automatic detection was developed. The LDR sensor will convert the light intensity to a digital format for the microcontroller to control the security lights automatically by using the relay as a switch. The Passive Infrared motion sensor will perceive the movement and converts it to digital format for the microcontroller using embedded C language to trigger the GSM module and alert the user for live streaming of what is going on the mobile app by establishing a connection between the camera and android smart device. The proposed work employs two methods for the home security system. The first method uses an Infra-red motion detector which will sense any intruder with 10 feet and alert the owner of the house by sending SMS through GSM technology about the intruder. The second method would use a camera, when the security system is activated, the camera is activated to capture the image of the intruder and save it on the android device memory.
Nowadays, image-processing solutions are been used in public and private places to automatically detect incidents and make measurements on video images from CCTV cameras, relieving the staff in control rooms of much of the difficulty in finding out where interesting events are happening. Events of particular interest of CCTV operators include abnormal stationery, queuing, intrusion detection, loitering [4], unattended luggage detection as well as closely related problems such as action recognition [5]. Some of the above events could be detected based on several user predefined rules others require more sophisticated methods involving behavior analysis [6].
The detection approach can be grouped into two. The first one is the unsupervised approach. This builds a kind of probabilistic behavior pattern. As a result, anomalies that do not fit into the estimated model can be detected. The major advantage is that it does not require user input, and it adapts dynamically to the changing conditions. Besides, it offers low control of the detected events as they are not strictly defined. Therefore, several non-relevant situations can be detected if some situations are rare in a general context. The second, more frequent case is when a rule-based approach is applied. Here, several atomic events like object stopped, the object left the scene, the object entered the area, are defined. Based on these elementary events, complex rules can be built that allow for specific situation detection [6].
In respect to the analyzed objects, the event detection problem can concern objects in general or specific people. In the second case, a single person, groups, and crowds need to be considered. Various events are possible to be detected in each of these cases. For the crowd, in general, its flow-based specific activity and some anomalies from the main trend can be detected. Regarding single people, primitivesbased event detection, as well as more complex behavior recognition, can be applied. 2

Review of Related Works
An Automatic Street Light Using Dependent Resistor (LDR), a sensor that senses light just like human eyes was developed in [7]. The work was to illuminate streets during dark hours of the day. Though personnel in offices need light to work its' cost is low when compared to the personnel costs. The goal of the work was to use LDR to control light. When light falls on the LDR then its resistance decreases, which increases the voltage at pin 2 of the integrated circuit (chip) -IC555. The chip has a comparator inbuilt that compares the input voltages from pin2 and about 33% of the power supply voltage. Since the work was solar-based, as a result, it was costeffective. The limitation, however, was that the source of power was basically from sunlight. It also required an adjustment of LDR so that it does not get light from the other street lights because it makes use of a battery in which its opposite polarity can destroy I.C.
In [8] a Solar Street Light Using a Photovoltaic (PV) panel was presented. The work makes used of the PV panel to draw power energy from the sun and used it to charge the backup batteries that will power the streetlights at night. The work was to illuminate streets during the night for traffic safety and crime prevention. The system will save enough energy during the day so that it can work throughout the night. However, its limitation was that dust combined with moisture might accumulate on the horizontal PV-panels and reduce or stop energy production; and this will destroy the rechargeable batteries attached to the panels.
In [9] a Modular Intelligent Control System was developed. This smart system is an autonomous operation that detects the environment changes through sensors and acts to correct the offset caused by the environment. Moreover, the systems continually perform from time to time to reach the optimal result that pre-defined in the system. The work was to corroborate the existing energy-saving systems. The problem, therefore, arises when a large group of lighting in a building becomes hard to control, which causes energy wastage. The work aims to implement a smart system which has compatibility and scalability with other commercial product and automation system. The modular design approaches applied to MICS design allowed for any additional sensors or lighting module to be added to the whole system. However, the phototransistor does not give accurate values of the ambient light level, while the controllers in the MICS design are slow.
In [10], an Optimization of the Standalone Street Light System with the study of lighting control was developed. Energy is the first parameter to consider when evaluating the influences of technical systems on the environment. Increasing environmental concerns will ensure that lighting control systems play important roles in the reduction of energy consumption of the lighting without deterring comfort goals. This research, therefore, tried to build an energy-saving smart lighting system with unified sensors and controllers. The method installs chips on the lights. These chips will consist of a micro-controller accompanying several sensors like carbon dioxide (CO2) sensor, fog sensor, light intensity sensor, noise sensor, and GSM modules for wireless data transmission and reception between concentrator and PC. A remote concentrator (PC) will receive data from the chips and transmit the controlling action to the chip. Dynamic programming was done in other to ensure the tiniest consumption of energy. At the end of the research work, the system was able to detect failures of each node and lengthen bulb life by up to 25%. The basic limitation of the work was that the system made use of Microcontroller C8051F350 that has low memory.
In [11] a Home/Office Security System Using a Micro-Controller-Based Home Security System was implemented. The micro-controller was used to detect intrusion and fire. The system is fully controlled by the PIC 16F877A microcontroller. In the security system, the device is connected to sensors like door alarm sensors, heat detector sensors, when the sensor that is connected to the door is broken, a signal will be sent to the microcontroller and an SMS to the owner' mobile phone or authority in charge. This research was able to develop an affordable and scalable system. The limitation however was that the system used PIC 16F877A which has low flash memory and thereby slows down the detection.
In [12] an iOS-Based Home Automation Security System Using General Packet Radio Service (GPRS) developed by [13] was reported. The purposed scheme uses the client/server model for communication. The research develops an iOS application that runs on a user's mobile phone and is the client. The cloud to which the home devices are connected is the server. The research use video cameras, microphones, and motion sensors to provide security at home. When a motion sensor is triggered, the video cameras in the vicinity start to record. The life steams can be viewed on a mobile device through GPRS. The proposed system can also be accessed using a web browser.
In [14] a Biometric Car Security and Monitoring System Using IoT was proposed. The work uses a fingerprint vehicle starter system. The work presents a protected and trouble-free thanks to starting/stop vehicle engine. The car does not need a key but uses a fingerprint. The system allows licensed users to start the vehicle. Users will initially register into the system by scanning fingerprints. It allows registrations of multiple users. The work uses Atmega 328 microcontroller and an esp8266 wifi module. The fingerprint detector is connected to the microcontroller and LCD display together with push buttons and starting motor. The system, which is IoT-based technology, update vehicle information on the web. The fingerprint access was accurate because the proponents used 10 unique fingerprints enrolled and scheduled to the system with 10 trails for each and garnered a result of 82 valid fingerprints scanned out of 100 fingerprints scanned attempts. Scanning errors were due to different ways the fingerprint was placed on the scanner.

System Features
The work employs a smart home security system that evaluates the development of a very Low-cost security system using a PIR sensor and a camera is incorporated around the Arduino microcontroller. When it is nighttime, the programmed microcontroller will automatically trigger the light sensor and then turns on the light; and then turns off the light during the daytime. Human movement is detected in a covered area using the PIR sensor. This time, the system triggers a buzzer beep detecting the presence of an unauthorized person in a specific interval of time and simultaneously puts a call through to the homeowner's mobile phone through a GSM modem while the camera is activated and saves the captured image to the phone storage. This highly reactive approach has a low computational requirement.

System Architecture
As shown in figure 1, the Arduino Uno board embedded with an ATmega 328P microcontroller receives input from the camera, light, and motion sensor accurately. The microcontroller board's voltage is between 3v and 5v. Then the microcontroller board will trigger the output components (buzzer, light, and GSM module) and saves the images captured in the memory card based on the instruction received from the input components. The mobile device receives calls and SMS appropriately.

Hardware Circuit Diagram
As depicted in figure 2, the design comprises of components, such as ATmega 328p microcontroller board, camera, GSM module, relays, buzzer, light, and motion sensors. The components are connected appropriately on the microcontroller board and alternating current (AC) is needed for the bulb to turn on when the need arises.

System Flowchart
As shown in figure 3, when the smart system is powered, the microcontroller unit (MCU) sends AT command to the GSM module, the reply received from the GSM module by the MCU determines whether to proceed or loopback. The Light sensor senses the intensity of the light, while in the daytime; the system triggers the light off and vice versa in the night-time. In case the PIR sensor detects the human movement, the MCU triggers: the buzzer to beep, the GSM module to send a message/call to the owner of the house, the camera to start and store the data.

System Implementation
The implementation of the codes for the project is in four phases using the integrated development environment (IDE). i.
Importation of GSM module library ii. The motion sensor Arduino instructions iii. The light sensor library instructions iv. Loading of the code into the microcontroller board using a USB connector.
The GSM library is imported into the IDE and then implemented to communicate with each other. The communication process is called 'wiring' because the embedded c will communicate with the components using the digital pins on the modules and microcontrollers.

Components Used
As shown in Table 1, the Arduino microcontroller board is employed as the nucleus of the system to control all the components. The GSM module is used to call when the necessity arises, relay serves as a switch from D.C (direct current) to alternating current (A.C), the bulb produces a sensation of brightness that makes seeing possible, the PIR motion sensor detects motion, LDR sensor perceives the intensity of the light, 9v DC battery is required to power the microcontroller board and 15Amps plug is required to tap 220v alternating current (A.C) from the power outlet while the jumper wires connect the components to the microcontroller board.

Experimental Setup
The surveillance system can be powered by a laptop, power bank supplying a minimum of 5v D.C on to the microcontroller board, camera and motion sensor, light sensor, and relay, as shown in figure 4 and figure 5.

Mobile App Installation
The android device is then connected to the camera via Wi-Fi technology, then the netcam app is installed for an amazing interface. As shown in figure 7 and 8. For a GSM technology-based connection, the SIM card is inserted in the SIM card slot of the module; and when the PIR motion sensor senses movement, the microcontroller puts a call through to the user. The user receives the call with the identification number and name of the surveillance system as shown in figure 9. As shown in figure 10, after the completion of the hardware coupling, various tests were done to ensure that the design meets with the specification. A wooden lamp-stand was used to hold the bulb and the smart surveillance device. The device is powered using a 9V DC battery while the bulb taps power from a 220V source. In the daytime, the light sensor automatically detects the intensity of the light while the microcontroller triggers the bulb on and vice-versa. The microcontroller triggers the GSM module to put a call through whenever the motion sensor senses body movement. When the user receives the call, the event can be easily streamlined by ensuring a connection of the android device with the camera via Wi-Fi technology. The images are taken and videos are accessible via external storage of the smartphone (figure 11).

Features of the Application
The system had some features which made it unique and better than some of the existing research works. These features include: 3. The device can automatically detect motion 4. We can capture the image and record video through the mobile app 5. We can establish voice communication 6. We can save the captured images and videos on the external storage of the android device.

Uses of the Application
As the device switches the light ON and OFF automatically, energy consumption can be reduced considerably, and it can also eliminate errors, which occur due to manual operation. The surveillance system uses GSM technology coupled with a camera that is accessible on an android mobile Wi-Fi connected device. In addition, the construction of the device is simple as it involves easily available components. The system can be used for other purposes like office, farm, supermarkets, hospitals, warehouses, and home surveillance systems, etc.

Conclusion and Recommendation
The work develops a smart home security system using a LDR sensor coupled with a microcontroller, relay, camera, and GSM technology for automatic detection of motion.
The LDR sensor converts the light intensity to a digital format for the microcontroller to control the security lights automatically by using the relay as a switch. The PIR motion sensor senses the human movement and converts it to digital format for the microcontroller to trigger the GSM module and alert the user for live streaming of what is going on the mobile app by establishing a connection between the camera and android smart device. The switching ON/OFF of the security lights of the device is timeindependent. The capturing and videoing are done on the mobile android device. Power or energy conservation is also an issue, which must be of significant concern to everyone in the world. Hence everyone must give great attention to utilize the energy properly. The advantages of combining a camera with LDR, Passive Infrared motion sensor, and GSM Technology may be extended to different areas like real-time home security systems using IR sensors and cameras. Thus, using the LDR sensor we can save the wastage of power from improper lighting which is controlled manually.