IoT Based Low-Cost Smart Home Automation and Security System Using Wireless Technology

Home automation system has achieved an enormous reputation in recent years, as day-to-day life is getting simpler due to the speedy growth of modern technology. Various implemented systems have been offered in the sphere of Home Automation but have apparently failed to provide cost-effective solutions for the same. In this paper, to provide a low cost smart Home Automation and Security System (HASS) using Wireless Fidelity (Wi-Fi), and Bluetooth. These materialize the concept of internetworking of smart devices. A Wireless Sensor Network (WSN) based on Wi-Fi is considered to monitor and control the smart environment, safety as well as electrical parameters of a smart interconnected home. The Android application-based Graphical User Interface (GUI) on a Smartphone is used to give facility to users for seamless control over the devices in a smart home. It may also consist of home security for example access control and alarm systems. When connected to the Internet, home devices are an important element of the Internet of Things (IoT). Home security includes both the security hardware placed on a property and individuals' personal security practices. Security devices consist of a door locking, alert alarm, lighting, motion detectors, and security camera system. Additionally, several special features include such as ensuring windows are closed, each doors are locked, all alarms are activated, and extra keys are not secret outside.

an electronics device, such as the personal computers (PC), gadgets and cellphone devices to control basic functions.
Further, some features of such home can be controlled automatically through internet anywhere, everywhere, and anytime. This system is usually called as a HASS. The HASS is meant to reduce the utilization of resources and human activities on its operation, making it is suitable for client to operate systems from anywhere all over the world through internet access. The IoT devices are applied in the integration of several technologies for communication and performing some actions. The safety from unauthorized access through electrical alarm device and lighting control, ensure the security of house through automated door locks, monitoring the critical area through closed circuit television (CCTV) cameras, increase suitability through temperature adjustment systems, save valuable time and money through modern automated home aid technologies are most common benefits of home automation systems. The ultimate objective of this paper is to present the design of a low-cost home automation system by using Arduino UNO R3 and Android as well as the front-end is implemented with JAVA framework. All of the tools and applications are open-source platforms, so the developers can develop more applications or projects. The boundaries of this project proposal are how to switch lamps on or off, and how to open and close doors by applying servo motors. Home automation system and Security System, named as HASS, and could be accessed through either local network or internet. The system had been implemented and tested on a house prototype. In addition, users can easily manage and control the home automation system by using their familiar different devices including android mobiles, laptops and personal computers, tablets, voice or video supporters, and digital watches.

Review of Literature
There are several works related to IoT based home automation and security system available in the literature. Recently, IoT is highly required to design a smart home. Smart home automation is a collection of electronic devices connected to monitor and control in the market home appliance remotely. In their work (Alani et al., 2021), it was shown that the IoT based home automation is applicable to monitor and control home appliances remotely. An architecture to reduce the cost of inventing a smart door sensor that will automatically inform a user of door open events in a house or office environment through an Android application (Hoque et al., 2019). The architecture of this work was implemented by using an Arduino-compatible Elegoo Mega 2560 microcontroller board as well as a Raspberry Pi 2 board for collaborating with a web server application that implements a restful Application Programming Interface (API). A number of academic researchers have been proposed several home automation systems involved with IoT in the literature in the last decade. A study was carried out by (Puri et al., 2016;Asadullah et al., 2017 andAnandhavalli et al., 2015) for Bluetooth-based automation with low cost, fast, and easy to be installed was shown in their work but it is draw back to short distances. Patient monitoring system was presented in (Fabi et al., 2017), the goal of this research to automate the medical instruments to receive clinical data for diagnosis purposes. In their work (Harper & R. Ed., 2014) was introduced a smart homes for the comfort, security, convenience and to provide energy efficiency to its occupants. Authors (Raju et al., 2019) described the overall notion of the IoT based sensing systems and monitoring systems for implementing an automated home. Node MCU board has been used in proposed prototype along with Android OS smart phone is being remotely controlled by Internet. The most important equipment of this system is Node MCU and it can execute as a micro web server and it performances as an interface for the hardware modules. In modern days, most of the cases a smartphone having an android application and iOS operating system are used to supervise and control the appliances present in home automation system. Various types of communication methodologies such as GSM, IoT, Wi-Fi, and Bluetooth have been suggested by (Sivapriyan et al., 2020). The author (Pujari et al., 2020) suggested a multifunctional, low-cost, and flexible system for smart home monitoring and control. This work is implemented with the help of node-MCU ESP32 and internet connection is used to remotely control the device. The proposed system can send the collected sensor data to the firebase database and can accept commands from the server through automatic controlling system. The smart cell phone application based on android is considered to build connection with the firebase database and updating the stored data to regulate and observe the various home pieces of equipment. In their work (Erdogan S.Z., 2010) proposed smart appliances based on Bluetooth. The smart appliances are controlled by Bluetooth technology through Wi-Fi to efficiently monitor maximum energy consumption appliances. The researchers (Bhattacharyya et al., 2020) had proposed a smart home automation system based on IoT using an Arduino board with microcontroller and Short Message Service (SMS) application to do properly the system functions. Wi-Fi connectivity has been used to establish communication between the Arduino module and automated home appliances. The authors (Pandey et al., 2021) recommended the system with the help of different types of wireless communication techniques such as ZigBee, Wi-Fi, Bluetooth, etc. This will give access to users to remotely handle home appliances. The distantly control system of home appliances is smoother, harmless, more suitable, less time consuming as well as energy saving. For such remotely controlled systems with simultaneous data transmissions, author proposed an effective wireless network and communication system (Ahmed, M. T., 2022). Moreover, the implementation of an efficient security system with any kind of IoT based networks is very important. Authors suggested a robust security mechanism with low complexity which may be useful for such IoT based home automation system (Kabir, M. H., 2018). In their paper (Stolojescu-Crisan et al., 2021) represented a simple and common communication structure to interconnect sensors, actuators, and other data sources with the persistence of multiple home automations. The new architecture is entitled qToggle which is functioned by leveraging the power consumption flexibility and powerful API.
The researchers (K. Mandula et al., 2015) proposed a system that used to control the sensors data, like light, gas, motion, temperature and actuates a process depending on requirement, such as turning on the lights when it getting dark. A system was designed by (Singh et al., 2017) that can perform different functions to be performed at home. Mobile and system communicate with each other by Wi-Fi. It is very easy to install required application suitable for smart phone and communicate with projected system from any well-matched equipment. A smart home automation system that facilities with an interesting object of the motion sensor, fog computing, server and switch connection among things was showed by (Hossain et al., 2018). The designed smart home automation system has the ability to fulfill the requirements in customers' home and give the controlling system to users those activities are ON/OF system of Fan, Light, Door, Webcam/CC-Camera, Window, and Fire-Alarm/Sprinkler. They (S.K. Vishwakarma et al., 2019) were designed an efficient smart home automation system that was used to access, control and monitor home appliances from any distance in the world. Smart home automation system connects to main internet supply connectivity unit. IP static address is depended for wireless connectivity. Variables of temperature, gas, motion, and GSM module were configured into inputs. Pin of temperature LED was set on pin D1, pin of servo motor was set on pin D2, pin of gas LED was set on pin D9, pin of motion LED was set on pin D12, pin of buzzer was set on pin D13, and pin of 16x2 LCD was set on pin D3, D4, D5, D6, D7 & D8. Variables of servo motor, temperature LED, gas LED, motion LED, buzzer, and LCD were configured into outputs.

Home Automation System Design
Nowadays utmost of the home automation way out is basically an android phone based. Home automation systems established on wireless have been used in different technologies. A home automation prototype can be effortlessly implemented using arduino, WIFI (IE-EE 802.11b/g/n) or Bluetooth module with a PC or microcomputer. For instance, Bluetooth based automation is low price, easy and quick to install but the coverage area of this system is very short compare with other module. Zigbee is one of other automation module which is a cordless mesh network standard that is designed to be cost saving and with low power consumption. But the most common disadvantages are low data transmission speed, bad network stability and maintenance cost is very high. WIFI technology is suitable for home automation system and business network that can operate with local area network and internet access for many new devices without cables and wiring. WIFI technology is the best than Zigbee, Bluetooth and others technology. WIFI technology bandwidth is high up to 2 MHZ making common activities similar to checking email on a phone or tablet.

Features of Home Automation and Security System
The integrated features of home security system are digital doorbells, smart locks, high quality imaging cameras, LED lights, smoke alarms and others modern devices. The top security devices door bells and cameras are most common focusing points of security mechanism to meet the security system to prevent package theft. Most are prepared with package detection, high resolution video, two-way audio, motion sensing and live watch. Smart locks are useful not only for security but also user friendly to communicate with mobile phone via Wi-Fi or Bluetooth. The cameras get the modern high quality imaging security camera concept and its integrate Wi-Fi connections that allow user to be watched and controlled remotely using a smart phone application. Smart lighting system combines the convenience and boosted security. These are Wi-Fi enabled LED light bulbs that can be remotely controlled from user's mobile. A smoke detector with Wi-Fi connectivity is a device that can sense smoke to communicate and locate exactly where a fire is located which helps us to minimize damage.

Architecture of Proposed System
The main objectives of our offered system is easy to develop and to execute an cost effective & open source home automation system that's capable of the leading most of the home and sustain the house automation system. This system supports more flexibility, console capacity and safety. In this system is com-posed of two parts, including software and hardware part. The sensors are connected to Arduino Uno board and finally output can be seen in the smart phone camera.
The predictable system contains a great elasticity to user through wireless network technology to communicating various required modules to the server of home automation system. Wireless Local Area Network (WLAN) networking standard is used to create connection between various sensor devices and hardware modules.

Arduino UNO Board
The Arduino UNO board expansion was emerged in Italy to construct low cost hardware, flexible, and easy -to-use programmable open-source microcontroller board for IoT based communicating design. This Arduino UNO connects to the personal computer with a standard USB cable and it an excellent choice for any IoT applications.

Wi-Fi Module
The ESP8266 arduino compatible Wi-Fi module is a low-cost Wi-Fi chip with integrated TCP/IP protocol stack that can give any microcontroller access to your Wi-Fi network. This Wi-Fi Module microchip has no more than 5mm length and can be powered with as low as 10 micro Amps throughout the sleep period. Wi-Fi module easy to use for IoT based project development.

Accelerometer Sensor
Accelerometers are devices that calculate acceleration, which is the rate of change of the velocity of an object. They calculate in meters per second squared (m/s2) or in G-forces (g). The values are represented by X, Y and Z coordinates. These values are used to control the rotation of motor. Accelerometers need to detect the position of the devices in laptops, mobile phone and process control system.

Light Dependent Resistor
Light Dependent Resistors (LDRs) are often used in circuits where it is necessary to detect the presence or the level of light. In proposed system we have used LDR to manage automatic light control such that when there is bright ness light is automatically OFF or ON.

PIR Sensors
The Passive Infrared (PIR) sensors are needed for motion detection that can be connected directly to one of the Arduino (or any microcontroller) digital pins. The most attractive features of PIR sensors are small in size, wide lens range, easy to interface, inexpensive, low-power, and easy to use.

IR Sensors
An infrared sensor either emits and/or detects infrared radiation with an electronic instrument to sense certain characteristics of its surroundings. Infrared sensors are also capable of measuring the heat being emitted by an object and detecting motion. Infrared radiation extends from the nominal red edge of the visible spectrum at 700 nanometers (nm) down to 1 mm. This range of wave lengths relates to a frequency range of approximately 300 GHz up to430 THz.

Relay Board
A relay is an electromagnetic switching device consisting of an armature which is moved by an electromagnet to operate one or more switch contacts. Some striking benefits of relays are that it's delivered amplification and isolation, and straighter forward. It can be applied to control various appliances and equipment with large current relays that work under AC250V 10A or DC30V 10A. It has a standard interface that can be controlled directly by microcontroller. Fig. 9: Relay Board.

Software Infrastructure of System
The open-source Integrated Development Environment (IDE) or Arduino Software makes it easy to write code and upload it to the board. It runs on Windows, Mac OS X, and Linux. The environment is written in Java and based on Processing and other open-source software. It runs on your computer, used to write and upload computer code to the physical board. This infrastructure is made up of client software, server software and Database section. The client software is the android and web interface by which users can control the smart home system through the internet by the use of Wi-Fi. The main task of the client software running on the server is to manage lighting, ventilation and security units placed in the home automation system. Users need a PC, tablet or mobile device with internet access in order to connect to the system. The control software is kept on the server by which all communications of the home automation system are provided. The server works in both directions. It records instructions received from the home automation to the database and sends recorded control instructions from stored database to the smart home via Arduino.

Android Interface of System
Android Interface is the part of Home Automation and Security System (HASS) that integrates with the user.
Here, the user can perform all the operations of a home automation and security systems. Users can access all the rooms of the HASS, the temperature value of the house, the motion control in the house, gas and smoke control and door control units throughout the android interface. The android interface is consisted of three parts as user home screen, user control screen and the reporting screen. Login screen is the part on which user logs in with the user name and password.

Implementation of Proposed System
In this research work, we proposed a more user friendly automatic control system for home that could be accessed through internet or local area network. When the client is addressing a uniform resource locator (URL) of web server, the client will enter the system of home automation system, called as HASS. Before entering in the main page, it must enter an authenticcation of username and password.  Therefore, an information is valid than the client might have access to the system. There are features, such as lamp and lock-door controls exist on the main page of HASS. When the client wants to control lamp at such rooms, the client could choose any rooms which that could be switched on or off. After getting the input from the client, the server computer would read the input and instruct to the microcontroller to switch the lamp on or off. The client could also pick a door-lock control using the same way as switching a lamp on or off.

Algorithm of Home Automation
Step 1: Begin Step 2: At first checking and viewing the all connection and active signal.
Step 3: Check to which type RFID Card or Password System or Globally Controlling to show the display.
Step 4: More than five times the wrong signal will actually jump step the security system. Otherwise jump next step.
Step 6: Verify to Bluetooth, mobile application, manual recognition, voice detection, text detection veryfication to jump next step, otherwise to jump Step 5.
Step 7: Verify to access the system.
Step 8: Main door open and automatic light off and Security System deactivate.
Step 9: Control system active to lighting system. Drawing Room, Dining Room, Bed Room, Wash Room, Kitchen Room than will turn automatically or manually on /off.
Step 10: Again control system active to air conditioner and fan. Living Room, Dining Room, Bed Room than will turn automatically or manually on/off.
Step 11: If the water tank is not filled with water than motor will turn on automatically.

Algorithm of Security System
Step 1: Begin Step 2: Initialize Magnetic Contact, WIFI module, Bluetooth module, GSM module, LCD display, Keypad, Sensor and Motor.
Step 3: If the magnetic switch is connected, the system will remain at waiting state for receiving a password; Step 4: Otherwise, the system will switched on the alarming signal and transmits SMS to the owner's mobile.
Step 5: Receive a password of authentic user from keypad due to unlock the system.
Step 6: Verify the input pass word with the unlocking password which is mentioned in program. If the given password matched with the system password then the system will unlock. Otherwise, LCD display will show wrong password and the system will follow the similar procedure which is mentioned in step 4 for the false condition, and the system will jump to step 7.
Step 7: Receive a password from keypad due to lock the system. After opening the door, the system will remain at waiting state for receiving a number which is designated for locking the door.
Step 8: Verify the password with the locking password which is mentioned in program. If the input password is exactly equal to the system password for closing the door, the system will be locked and return to step 3. Otherwise, the system will operate at false mode and follow the similar procedure mentioning in step 5.
Step 9: Check the logic condition of enable pin. If it remains at low state, the system will sustain the maloperation & remain at waiting state until it will obtain high logic condition. On the contrary, the system will start again from step 2 for the high logic condition of enable pin.
Step 10: Gas & Fire leakage pulse signal will send to the sensor, motor which will pressurize the door resulting the system will be unlocked &all elasticity off and the system will turn on the alarming signal and send SMS to the owner's mobile.
Step 11: Unauthorized Person Detect signal will send to the sensor, motor which will pressurize the door resulting the system and the system will turn on the alarming signal and send SMS to the owner's mobile.

RESULTS AND DISCUSSION:
The overall performance will show and discuss in this section. The client will enter into the system of home automation system called as HASS by addressing a uniform resource locator (URL) of web server. Before entering in the main page, it must enter an authenticcation of username and password. Thus, if it is valid, the client might have access to the system.
The main features of this offered system such as lamp and lock-door controls exist on the main page of HASS. When the client wants to control lamp at such rooms then the client could choose any rooms which that could be switched on or off. After getting the input from the client, the server computer would read the input and instruct to the microcontroller to switch the lamp on or off. The client could also pick a door-lock control using the same way as switching a lamp on or off.
The work flow diagram of this research activity is presented in Fig. 12. It shows that it has strictly followed the design, implementation, and testing process of a new system model. The flowchart of the home automation system is shown in Fig. 13(a) and also security part shown in Fig. 13(b). The both Fig. shows the overall design of our proposed home automation and security model.

CONCLUSION:
This work has presented the prototype design, implementation as well as checks the performance of smart home control system. At first, it provides a wide-ranging literature review on HASS elements, carrier mode, wired and wireless protocols, application framework, and other related work. The hardware design and implementation are presented at the next stage using the up-to-date Arduino Mega 2560, APC220 Wireless, Ethernet shield, three sensors, and other required components. The flowchart of the overall system operation was shown and discussed in the software design section. Lastly, the final prototype implementation and test field design process were talked over in more detail with a suitable figure or diagram. The system prototype uses various equipment those are six lamps, one window blind, one speed-controlled fan, and one security gate. The web service also develops and demonstrates to control remotely the proposed smart home by the client. The home appliances are successfully integrated with the smart home control system through relays. Further research includes the performance evaluation of the developed prototype. It is clear that it has a large scope to develop and work with this project. Some desired task of client which would be added in future: 1) Add a camera and using image processing try to find out known and unknown face. If detect a known face by the system then it will able to send an SMS and email automatically with a picture and information about this face which is store previously in database. 2) Due to this, IoT has also expanded its area of application in various sectors, for example in healthcare, automotive, and agriculture industries.

ACKNOWLEDGEMENT:
This research work is partly supported by Bangamata Sheikh Fojilatunnesa Mujib Science and Technology University, Bangladesh.

CONFLICTS OF INTEREST:
The research is equally contributed by all authors and there is no conflict of interest among authors.