Smart Monitoring and Controlling of Appliances Using LoRa Based IoT System

: In the era of Industry 4.0, remote monitoring and controlling appliance/equipment at home, institute, or industry from a long distance with low power consumption remains challenging. At present, some smart phones are being actively used to control appliances at home or institute using Internet of Things (IoT) systems. This paper presents a novel smart automation system using long range (LoRa) technology. The proposed LoRa based system consists of wireless communication system and different types of sensors, operated by a smart phone application and powered by a low-power battery, with an operating range of 3–12 km distance. The system established a connection between an android phone and a microprocessor (ESP32) through Wi-Fi at the sender end. The ESP32 module was connected to a LoRa module. At the receiver end, an ESP32 module and LoRa module without Wi-Fi was employed. Wide Area Network (WAN) communication protocol was used on the LoRa module to provide switching functionality of the targeted area. The performance of the system was evaluated by three real-life case studies through measuring environmental temperature and humidity, detecting ﬁre, and controlling the switching functionality of appliances. Obtaining correct environmental data, ﬁre detection with 90% accuracy, and switching functionality with 92.33% accuracy at a distance up to 12 km demonstrated the high performance of the system. The proposed smart system with modular design proved to be highly effective in controlling and monitoring home appliances from a longer distance with relatively lower power consumption.


Introduction
People in business and industries engage with modern tools and technology to monitor and control their daily activities.Enterprise Management Associates (EMA) claimed that 98% of businesses would turn to automation within the next few years to build a smart city, smart office, smart home, smart institute, smart industry, and so on.The internet of things (IoT), a core technology to establish the smart systems, has already reached a market value to $745 billion in 2019 [1].The International Data Corporation (IDC) predicts that IoT will maintain globally a double-digit annual growth rate throughout the 2017-2022 forecast period and surpass $1 trillion market in 2022 [2].However, the main limitation of the existing systems is the consumption of high battery power to operate.Therefore, a few key challenges of Industry 4.0 are reducing the power consumption and increasing the range of communication of the smart systems.Considering this, a low power and wide range (LoRa) based automation system using android application is presented in this paper.The Designs 2021, 5, 17 2 of 22 growing market of LoRa based automation systems is due to (a) companies building a large industry with colossal area to control processing operations remotely, (b) 45.12% people worldwide [3] with 3.5 billion smart phones willing to control their appliances remotely by the phone, and (c) people interested in monitoring and controlling their appliances at low cost and power, and in an error-free, hazardless way from a long distance.
LoRa based automation system offers a cost effective and straightforward solution [4,5].The LoRa module adopts a modulation technique that is capable of transmitting 300~19,200 bps data on air where transmission consumes 5~20 dBm power with a maximum distance of 12 km.In contrast, the widely used short-range technologies such as Bluetooth, Wi-Fi, and ZigBee are not best suited where LoRa has the ability to cover a wide area while consuming low power and using inexpensive wireless connectivity [6].In this paper, a LoRa based automation system is designed and developed to control appliances such as light, fan, TV, AC, car, and so on.Automation system that is controlled by ESP32 and LoRa with LoRaWAN communication protocol leverages the unlicensed radio spectrum in the Industrial, Scientific and Medical (ISM) band [6].The LoRa based system can overcome the challenge of low power communication.An application has been developed to use a smart phone to control and monitor the target appliances through the LoRa module.
Over the last few years, scientists and experts introduced various automation systems for making human life smooth and easy.The earlier systems mainly focused on home automation, automatic irrigation system, robotics in automation for home and industry, and laboratory automation.Automation system that is controlled by LoRa with LoRaWAN communication protocol leverages the unlicensed radio spectrum in the industrial, scientific and medical (ISM) band [7].Furthermore, LoRaWAN can handle the data losses when different nodes are increased to 1000 per gateway [8].
An IoT based automation system which can remotely control home appliances using a web server is published in [9].The system provides security for signal interaction using an android application.The system also controls several home appliances remotely through the internet using a microcontroller, sensor, and Wi-Fi module.Abu et al. [10], developed a home automation system using android phone and a Raspberry Pi.Communication was established between a server and a relay module which was connected to appliances for monitoring and controlling.However, the Raspberry Pi is expensive compared with other options such as a microprocessor.In addition, a remotely placed system is constrained by power requirement.Therefore, in wireless communication, high power consumption by the associated devices within the system to operate is a great concern.Modular hardware design and integration of renewable energy sources have been suggested to overcome this power constraint [11].A smart system is presented by More et al. [12] for monitoring home equipment where the authors used a Wireless Sensor Network (WSN) and Message Queuing Telemetry Transport (MQTT) protocol to interact between home appliances and user.For some selective sensors, WSN runs out of energy.Another IoT based automation system was proposed in [13] which could control and monitor home via mobile phone through internet connection.Again, this system requires high power consumption.A LoRa based smart home system was proposed by Shahjalal et al. [6] for remote monitoring.The potential of integrating artificial intelligence (AI) with IoT servers and clouds for serving intelligent tasks in home environment were also explored.Other conceptual framework for smart campus was also proposed in [14].
An IoT based automatic firming system was implemented by Hossain et al. [15] using a raspberry Pi which could monitor through IP camera for short distance.Wang et al. [16] developed smart wireless communication technology for National Chiao Tung University using IoT and LoRa gateway.However, their proposed system was very expensive.The system developed by Behera et al. [17] used Global System for Mobile Communications (GSM) technology to monitor the home devices using a phone.The main advantage of their system was to control home appliances when the homeowner would be travelling outside the country.However, the main challenge of GSM technology is that many users share the identical bandwidth.A hand gesture-based home controlling system was proposed by Rathi et al. [18], who used an accelerometer and flex sensor that transmitted the signal to a Raspberry Pi through Bluetooth module.Then the Raspberry Pi received the signal and sent it to a relay module, which linked to several home appliances for controlling the entire home.However, the system requiring huge memory to control Raspberry Pi was the key bottleneck.Mattia et al. [19], proposed an industrial wireless communication based on LoRa.Another work for home automation through Raspberry Pi was proposed by Lee et al. [20] who applied different modules such as Bluetooth, Wi-Fi, ZigBee, and Raspberry Pi to operate appliances at home or institute.Some other research works carried out on automation systems have also been published by other researchers [21][22][23][24].
Gambi et al. [25] proposed an IoT based architecture for a smart home application using LoRa technology.The system was designed to reduce power consumption where Message Queue Telemetry Transfer protocol was used as a domotic middleware to obtain interoperability among different devices in their system.However, the system has not provided clear guideline for controlling appliances through a mobile app.
Basford et al. [26] proposed a Low Power Wide Area Network (LPWAN) network across Southampton, UK which supported installing city-scale air quality monitoring.The system was built with a mixture of commercial off-the-shelf gateways and custom gateways.More than 135,000 messages were transmitted through twenty devices.A data server successfully received 72.4% of the messages.Among the received messages, 99% were received within 10 s of transmission.However, packet loss including potential jamming has not been considered in their system.
Bravo-Arrabal et al. [27] developed LoRa-based low power consumption static and mobile wireless sensors network to attain a wide coverage in an urban environment.The technology was deployed in a mid-size city (Malaga, Spain) where a mobile node was developed by a gateway and sensors.Activation by Personalization (ABP) mode was used for multicasting in urban area for managing the coverage through communicating data between the end devices and the gateways.The data collected from the city was synchronized in an external database.Web mapping service used in the system can monitor data in real time by geolocating data frames.The experiments showed that it can cover 12 km distance during exchanging information with vehicles, objects etc. on the road of Malaga.
Zhang et al. [28] proposed an emergency light-based smart building solution to reduce system deployment and maintenance cost using LoRa mesh network with one gateway.The system deployed nine types of building including residential and commercial as a case study.The results showed that the proposed system achieved over 97% average packet delivery rate.The system also performed well during changing environment.However, the system could be further improved by a user interface to facilitate remote monitoring of appliances in the building.
Xu et al. [29] have proposed LoRa system where large-scale and temporal fading characteristic, coverage, and energy consumption were analysed in four individual buildings for measuring its performance.Different measurement parameters in their study were varied for up to 145 times enabling the LoRa adaptive data rate feature in energy limited applications.However, the proposed system was tested only for indoor application.
From the smart home point of view, indoor localization is very important in order to identify locations of people or device within a multi-floor building.Kim et al. [30] conducted an experiment for assessing feasibility of LoRa for the application of indoor localisation in an apartment.The results showed that the LoRa based system achieved better localisation accuracy of a robot integrated with sensors compared to in line-of-sight scenario (1.6 m) and in extreme non-line-of-sight scenario (3.2 m) condition with a precision better than 25 cm.However, the authors did not explore the opportunity of integrating a mobile application with the system.An LoRa based system was developed and tested for its practical applications in smart buildings to facilitate energy management and improving resident comfort by measuring Designs 2021, 5, 17 4 of 22 data related to environmental and equipment parameters [31].Performance criteria such as coverage and transmission were considered during their experiment with three LoRa receiver nodes on one floor and eight LoRa receiver nodes on different floors in a 16story building.Furthermore, a data acquisition terminal was placed in the centre of the building.Send power, communication rate, payload length, and position of the module were changed following the experiment criteria to measure round trip time (RTT) and packet delivery ratio (PDR) as the reliability indicators of the communication system.The results demonstrated the suitability of LoRa technology in smart buildings.
More recently, investing data packet loss in LoRa system has become a research topic.Yasmin et al. [32] deployed indoor sensor network devices connected over low power wide area network (LPWAN) technology for monitoring a campus indoor environment.Their work was focused on identifying the reasons for the packet loss, which was approximately 8.56% on both during the on-air transmission and within the backbone.Nonuniform distribution of the packet transmissions caused by nodes in the networks was identified.Furthermore, the seasonal effects on packet delivery and effects of interferences on network performance were observed.
It is observed from the existing research work that the majority of the automated systems suffer the limitations in working efficiently for wide range applications with consuming low battery power.The communication took place within a very short distance ranging from 10 m to 100 m.For example, the ranges covered by Bluetooth, Wi-Fi, and Zigbee are approximately 10 m, 100 m, and 10-100 m respectively.The system presented in this work uses an LoRa module that can solve the limitation of short-range communication which has attracted research attention particularly for smart city and home applications [5,6,33].In this paper, an IoT based automation system has been designed and developed based on LoRa technology that has the potential to overcome the existing limitations with a communication range from 3 km to 12 km for developing smart home or institute.
The main contributions of this paper are: A mobile app has been developed to monitor and control appliances with a number of features and sub-functionalities. c Functionality tests were conducted in different simulated environments using different sensors to assess the system's performance.
The remainder of the paper is formulated as follows.Section 1 describes the existing related research works.The development of the proposed system including software and hardware part is presented in Section 2. Section 3 provides demonstrative results and analysis.Finally, key conclusions have been presented in Section 4.

Systems Architecture
Primarily, the proposed system has been divided into two parts.The first part is known as the sender end, where the system interconnects users' mobile phone to an ESP32 module using wireless network.Then the ESP32 module is connected to a LoRa module for transmitting data.The second part is the receiver end where a LoRa module is integrated with the ESP32.In this part, wired connections are made with several sensors and the ESP32 module.The receiver side is interconnected with the home appliances.The architecture of the proposed system is schematically presented in Figure 1. the ESP32 module.The receiver side is interconnected with the home appliances.The architecture of the proposed system is schematically presented in Figure 1.

Working Principle of the Proposed System
The working principle of the automation system is presented in Figure 2. The system checks the circuitry connections of the associated devices after supplying power to each device.In this system, the LoRa module has served as the data or signal transmitter among the users' devices.The status of all sensors, appliances and other accessories is displayed at the users' mobile application including the sensors' reading data.The status can be changed and displayed immediately when the user toggles the switches between the gadgets.By using such virtual switches, users can control opening and closing of doors and windows, switching of appliances such as light, fan, electric heater, AC, and so on.The proposed system shows the capability to monitor surrounding environment by observing temperature and humidity at the any region where the system is installed.The system can also monitor undesirable objects at muted time frame and notify the user instantly.

Working Principle of the Proposed System
The working principle of the automation system is presented in Figure 2. The system checks the circuitry connections of the associated devices after supplying power to each device.In this system, the LoRa module has served as the data or signal transmitter among the users' devices.The status of all sensors, appliances and other accessories is displayed at the users' mobile application including the sensors' reading data.The status can be changed and displayed immediately when the user toggles the switches between the gadgets.By using such virtual switches, users can control opening and closing of doors and windows, switching of appliances such as light, fan, electric heater, AC, and so on.The proposed system shows the capability to monitor surrounding environment by observing temperature and humidity at the any region where the system is installed.The system can also monitor undesirable objects at muted time frame and notify the user instantly.

Hardware Description
The proposed system used RYLR896 as LoRa module, ESP32 microprocessor, sensors, controlling switches and a relay module.The Node MCU ESP32 model of ESP32 microprocessor was used to test the system.

LoRa Module
The RYLR896 transceiver known as LoRa module provides fanatical long-range spectrum for establishing intercommunication and reliable interference security with low power consumption.This made the automation system more robust.A microcontroller and an antenna were integrated with a Printed Circuit Board (PCB).LoRa has built-in SimTech SX1276 engine and 127 dB dynamic range RSSI that enables controlling different appliances from 3 km to 12 km distance.

ESP32 Microprocessor
The system used ESP32 microprocessor which was a robust and adaptive module with many built-in functionalities.This module was assembled with different hardware devices.It acted as a bridge between the user application and the LoRa module at the sender end through Wi-Fi connection, between different sensors and controlling switches at the receiver end through wired connection.

Hardware Description
The proposed system used RYLR896 as LoRa module, ESP32 microprocessor, sensors, controlling switches and a relay module.The Node MCU ESP32 model of ESP32 microprocessor was used to test the system.

LoRa Module
The RYLR896 transceiver known as LoRa module provides fanatical long-range spectrum for establishing intercommunication and reliable interference security with low power consumption.This made the automation system more robust.A microcontroller and an antenna were integrated with a Printed Circuit Board (PCB).LoRa has built-in SimTech SX1276 engine and 127 dB dynamic range RSSI that enables controlling different appliances from 3 km to 12 km distance.

ESP32 Microprocessor
The system used ESP32 microprocessor which was a robust and adaptive module with many built-in functionalities.This module was assembled with different hardware devices.It acted as a bridge between the user application and the LoRa module at the sender end through Wi-Fi connection, between different sensors and controlling switches at the receiver end through wired connection.

Sensors
To monitor the up-to-date situation of the target environment or object, the system used different sensors.The sensors were connected with different I/O pins of the ESP32 module.The characteristics of diverse sensors used in this system are listed in Table 1.
Table 1.Description of different sensors employed in the smart automation system.

List of Sensors Sensor Description
Designs 2021, 5, x FOR PEER REVIEW 7 of 22

Sensors
To monitor the up-to-date situation of the target environment or object, the system used different sensors.The sensors were connected with different I/O pins of the ESP32 module.The characteristics of diverse sensors used in this system are listed in Table 1.
Table 1.Description of different sensors employed in the smart automation system.

List of Sensors Sensor Description
Provides 16-bit serial data for both temperature and humidity of the installed environment.DHT11 sensor is used in the system to monitor room temperature and humidity.
Detects industrial heating or domestic firing.The flame sensor is used in the system to automatically monitor sudden firing.
MQ2 sensor is used in the system to detect H2, LPG, CH4, CO, Alcohol or Propane gas very rapidly.
Laser sensor is used to detect object and to measure the distance of the object.

Relay
In the proposed system, many electrically operated switches were used for controlling various appliances.Furthermore, opening and closing of the doors or windows at home or institute were considered.To fulfill these requirements, the system used a relay module which was controlled by the users' mobile application through ESP32 module.
The proposed system employed a 2-channel relay although 1, 4, 8, and 16 channels were available to control more than one appliance at a time.

Sender End Circuit Diagram
A LoRa module, an android OS based mobile phone, and the ESP32 microprocessor module were connected at the sender end where ESP32 module acted as a bridge.Figure 3 illustrates the circuit diagram of the sender end.To control and monitor through a mobile device, a dedicated application was developed and installed for this system where Wi-Fi network was used to connect with the ESP32 module.Then, a wired connection was established between the ESP32 module and LoRa module.The system used a RYLR896 transceiver LoRa module for long range communication.The RYLR896 module includes 868-915 MHz antenna or transceiver module, a simple processor for data flow controlling, encrypting-decrypting module, and some other modules.Among the six pins of the RYLR896 module, the TXD pin was connected with the RXD pin of the ESP32 module, and the TXD pin of the ESP32 module was linked with the RXD pin of the LoRa module.To control the system, a signal from a user's mobile phone goes to the ESP32 module and then the signal is transmitted to long distance through the LoRa module.

DHT11
Provides 16-bit serial data for both temperature and humidity of the installed environment.DHT11 sensor is used in the system to monitor room temperature and humidity.

Sensors
To monitor the up-to-date situation of the target environment or object, the system used different sensors.The sensors were connected with different I/O pins of the ESP32 module.The characteristics of diverse sensors used in this system are listed in Table 1.
Table 1.Description of different sensors employed in the smart automation system.

List of Sensors
Sensor Description

DHT11
Provides 16-bit serial data for both temperature and humidity of the installed environment.DHT11 sensor is used in the system to monitor room temperature and humidity.

Flame Sensor
Detects industrial heating or domestic firing.The flame sensor is used in the system to automatically monitor sudden firing.

MQ2
MQ2 sensor is used in the system to detect H2, LPG, CH4, CO, Alcohol or Propane gas very rapidly.

Laser Sensor
Laser sensor is used to detect object and to measure the distance of the object.

Relay
In the proposed system, many electrically operated switches were used for controlling various appliances.Furthermore, opening and closing of the doors or windows at home or institute were considered.To fulfill these requirements, the system used a relay module which was controlled by the users' mobile application through ESP32 module.
The proposed system employed a 2-channel relay although 1, 4, 8, and 16 channels were available to control more than one appliance at a time.

Sender End Circuit Diagram
A LoRa module, an android OS based mobile phone, and the ESP32 microprocessor module were connected at the sender end where ESP32 module acted as a bridge.Figure 3 illustrates the circuit diagram of the sender end.To control and monitor through a mobile device, a dedicated application was developed and installed for this system where Wi-Fi network was used to connect with the ESP32 module.Then, a wired connection was established between the ESP32 module and LoRa module.The system used a RYLR896 transceiver LoRa module for long range communication.The RYLR896 module includes 868-915 MHz antenna or transceiver module, a simple processor for data flow controlling, encrypting-decrypting module, and some other modules.Among the six pins of the RYLR896 module, the TXD pin was connected with the RXD pin of the ESP32 module, and the TXD pin of the ESP32 module was linked with the RXD pin of the LoRa module.To control the system, a signal from a user's mobile phone goes to the ESP32 module and then the signal is transmitted to long distance through the LoRa module.

Flame Sensor
Detects industrial heating or domestic firing.The flame sensor is used in the system to automatically monitor sudden firing.

Sensors
To monitor the up-to-date situation of the target environment or object, the system used different sensors.The sensors were connected with different I/O pins of the ESP32 module.The characteristics of diverse sensors used in this system are listed in Table 1.
Table 1.Description of different sensors employed in the smart automation system.

List of Sensors
Sensor Description

DHT11
Provides 16-bit serial data for both temperature and humidity of the installed environment.DHT11 sensor is used in the system to monitor room temperature and humidity.

Flame Sensor
Detects industrial heating or domestic firing.The flame sensor is used in the system to automatically monitor sudden firing.

MQ2
MQ2 sensor is used in the system to detect H2, LPG, CH4, CO, Alcohol or Propane gas very rapidly.

Laser Sensor
Laser sensor is used to detect object and to measure the distance of the object.

Relay
In the proposed system, many electrically operated switches were used for controlling various appliances.Furthermore, opening and closing of the doors or windows at home or institute were considered.To fulfill these requirements, the system used a relay module which was controlled by the users' mobile application through ESP32 module.
The proposed system employed a 2-channel relay although 1, 4, 8, and 16 channels were available to control more than one appliance at a time.

Sender End Circuit Diagram
A LoRa module, an android OS based mobile phone, and the ESP32 microprocessor module were connected at the sender end where ESP32 module acted as a bridge.Figure 3 illustrates the circuit diagram of the sender end.To control and monitor through a mobile device, a dedicated application was developed and installed for this system where Wi-Fi network was used to connect with the ESP32 module.Then, a wired connection was established between the ESP32 module and LoRa module.The system used a RYLR896 transceiver LoRa module for long range communication.The RYLR896 module includes 868-915 MHz antenna or transceiver module, a simple processor for data flow controlling, encrypting-decrypting module, and some other modules.Among the six pins of the RYLR896 module, the TXD pin was connected with the RXD pin of the ESP32 module, and the TXD pin of the ESP32 module was linked with the RXD pin of the LoRa module.To control the system, a signal from a user's mobile phone goes to the ESP32 module and then the signal is transmitted to long distance through the LoRa module.

MQ2
MQ2 sensor is used in the system to detect H2, LPG, CH4, CO, Alcohol or Propane gas very rapidly.

Sensors
To monitor the up-to-date situation of the target environment or object, the system used different sensors.The sensors were connected with different I/O pins of the ESP32 module.The characteristics of diverse sensors used in this system are listed in Table 1.

List of Sensors
Sensor Description

DHT11
Provides 16-bit serial data for both temperature and humidity of the installed environment.DHT11 sensor is used in the system to monitor room temperature and humidity.

Flame Sensor
Detects industrial heating or domestic firing.The flame sensor is used in the system to automatically monitor sudden firing.

MQ2
MQ2 sensor is used in the system to detect H2, LPG, CH4, CO, Alcohol or Propane gas very rapidly.

Laser Sensor
Laser sensor is used to detect object and to measure the distance of the object.

Relay
In the proposed system, many electrically operated switches were used for controlling various appliances.Furthermore, opening and closing of the doors or windows at home or institute were considered.To fulfill these requirements, the system used a relay module which was controlled by the users' mobile application through ESP32 module.
The proposed system employed a 2-channel relay although 1, 4, 8, and 16 channels were available to control more than one appliance at a time.

Sender End Circuit Diagram
A LoRa module, an android OS based mobile phone, and the ESP32 microprocessor module were connected at the sender end where ESP32 module acted as a bridge.Figure 3 illustrates the circuit diagram of the sender end.To control and monitor through a mobile device, a dedicated application was developed and installed for this system where Wi-Fi network was used to connect with the ESP32 module.Then, a wired connection was established between the ESP32 module and LoRa module.The system used a RYLR896 transceiver LoRa module for long range communication.The RYLR896 module includes 868-915 MHz antenna or transceiver module, a simple processor for data flow controlling, encrypting-decrypting module, and some other modules.Among the six pins of the RYLR896 module, the TXD pin was connected with the RXD pin of the ESP32 module, and the TXD pin of the ESP32 module was linked with the RXD pin of the LoRa module.To control the system, a signal from a user's mobile phone goes to the ESP32 module and then the signal is transmitted to long distance through the LoRa module.

Laser Sensor
Laser sensor is used to detect object and to measure the distance of the object.

Relay
In the proposed system, many electrically operated switches were used for controlling various appliances.Furthermore, opening and closing of the doors or windows at home or institute were considered.To fulfill these requirements, the system used a relay module which was controlled by the users' mobile application through ESP32 module.The proposed system employed a 2-channel relay although 1, 4, 8, and 16 channels were available to control more than one appliance at a time.

Sender End Circuit Diagram
A LoRa module, an android OS based mobile phone, and the ESP32 microprocessor module were connected at the sender end where ESP32 module acted as a bridge.Figure 3 illustrates the circuit diagram of the sender end.To control and monitor through a mobile device, a dedicated application was developed and installed for this system where Wi-Fi network was used to connect with the ESP32 module.Then, a wired connection was established between the ESP32 module and LoRa module.The system used a RYLR896 transceiver LoRa module for long range communication.The RYLR896 module includes 868-915 MHz antenna or transceiver module, a simple processor for data flow controlling, encrypting-decrypting module, and some other modules.Among the six pins of the RYLR896 module, the TXD pin was connected with the RXD pin of the ESP32 module, and the TXD pin of the ESP32 module was linked with the RXD pin of the LoRa module.To control the system, a signal from a user's mobile phone goes to the ESP32 module and then the signal is transmitted to long distance through the LoRa module.

Receiver End Circuit Diagram
Figure 4 illustrates the receiver end circuit diagram.The LoRa module received transmitted signal from the sender end through antenna and forwards this signal to the wired connected ESP32 module.In the receiver end, different sensors and controlling switches were connected with the ESP32 module.For transmitting and receiving signal between the LoRa and ESP32 modules, the TXD pin of ESP32 was connected with the RXD pin of LoRa, and the RXD pin of the ESP32 was connected with the TXD pin of LoRa module.In the ESP32, typically there were 20 pins as data pins which are programmable and can be used as signal transmitting-receiving pin from various sensors or switching devices.

App Development
The automation system was controlled and monitored using a smart phone.For implementation purpose, the system considered android based smart phone though iOS and windows-based system can be developed in the same manner.As a part of the development, an application named 'LoRa based Smart Institute' was developed and installed on the users' smart phone.Users can monitor and control their appliances from 3-12 km using this dedicated application.
Currently, the home page of the application contains six main features such as Smart Office, Smart Industry, Smart Home, Security, Garden Monitoring and Sensors.Other potential features can be added in the same way if needed.Each feature is accommodated with sub-functionalities.For example, the Smart Home sub-functionalities are available for Living Room, Kitchen, Kids Room, and Bathroom.The system has designed virtual switches for controlling various appliances with different parameters.For example, the users will get switching options for Light, Fan, Table Lamp, and AC after clicking the option for Living Room.By touching a switch, it is toggled for ON or OFF and this ON/OFF signal is sent to the ESP32 module at the sender end through Wi-Fi connection.Within few ms this controlling signal is transmitted to the receiver end ESP32 module through the LoRa module.Subsequently, the ESP32 module of the receiver end transfers this signal to the particular relay for switching ON or OFF of the individual appliance or device through distinct I/O pin.The system also performed lock-unlock of door and openclose functionality of window.Furthermore, camera ON/OFF feature was added for security purposes.Figure 6 presents Graphical User Interface (GUI) of the system showing the home page (Options for Smart Home, Security, Garden Monitoring, Smart Office, and Smart Industry), smart home, and security sub-functionalities.

App Development
The automation system was controlled and monitored using a smart phone.For implementation purpose, the system considered android based smart phone though iOS and windows-based system can be developed in the same manner.As a part of the development, an application named 'LoRa based Smart Institute' was developed and installed on the users' smart phone.Users can monitor and control their appliances from 3-12 km using this dedicated application.
Currently, the home page of the application contains six main features such as Smart Office, Smart Industry, Smart Home, Security, Garden Monitoring and Sensors.Other potential features can be added in the same way if needed.Each feature is accommodated with sub-functionalities.For example, the Smart Home sub-functionalities are available for Living Room, Kitchen, Kids Room, and Bathroom.The system has designed virtual switches for controlling various appliances with different parameters.For example, the users will get switching options for Light, Fan, Table Lamp, and AC after clicking the option for Living Room.By touching a switch, it is toggled for ON or OFF and this ON/OFF signal is sent to the ESP32 module at the sender end through Wi-Fi connection.Within few ms this controlling signal is transmitted to the receiver end ESP32 module through the LoRa module.Subsequently, the ESP32 module of the receiver end transfers this signal to the particular relay for switching ON or OFF of the individual appliance or device through distinct I/O pin.The system also performed lock-unlock of door and open-close functionality of window.Furthermore, camera ON/OFF feature was added for security purposes.Figure 6 presents Graphical User Interface (GUI) of the system showing the home page (Options for Smart Home, Security, Garden Monitoring, Smart Office, and Smart Industry), smart home, and security sub-functionalities.The system employed different sensors for switching and monitoring various appliances in different places.The sensors read data from the appliances and the users control the appliances by observing the data.In addition, the system made provision for monitoring gardening sub-functionality.In addition, a switching functionality for watering in the garden was incorporated.Water flow can be turned ON/OFF after reading the data from the soil moisture sensor.The GUIs for Living Room, Sensor, and Garden Monitoring sub-functionalities have been demonstrated in Figure 7.

Android App User Tests
The functionality of the proposed system was controlled and monitored using the developed mobile app by 5 different Android phone users.An example of user tests on controlling switches and temperature measurement via connecting through Wi-Fi is presented in Figure 8.The main functionalities of the app such as smart home, security, garden monitoring, sensor, smart office and smart industry are displayed in the first screen for interactions by the users.By turning the Wi-Fi button on, the app establishes wireless The system employed different sensors for switching and monitoring various appliances in different places.The sensors read data from the appliances and the users control the appliances by observing the data.In addition, the system made provision for monitoring gardening sub-functionality.In addition, a switching functionality for watering in the garden was incorporated.Water flow can be turned ON/OFF after reading the data from the soil moisture sensor.The GUIs for Living Room, Sensor, and Garden Monitoring sub-functionalities have been demonstrated in Figure 7.The system employed different sensors for switching and monitoring various appliances in different places.The sensors read data from the appliances and the users control the appliances by observing the data.In addition, the system made provision for monitoring gardening sub-functionality.In addition, a switching functionality for watering in the garden was incorporated.Water flow can be turned ON/OFF after reading the data from the soil moisture sensor.The GUIs for Living Room, Sensor, and Garden Monitoring sub-functionalities have been demonstrated in Figure 7.

Android App User Tests
The functionality of the proposed system was controlled and monitored using the developed mobile app by 5 different Android phone users.An example of user tests on controlling switches and temperature measurement via connecting through Wi-Fi is presented in Figure 8.The main functionalities of the app such as smart home, security, garden monitoring, sensor, smart office and smart industry are displayed in the first screen for interactions by the users.By turning the Wi-Fi button on, the app establishes wireless

Android App User Tests
The functionality of the proposed system was controlled and monitored using the developed mobile app by 5 different Android phone users.An example of user tests on controlling switches and temperature measurement via connecting through Wi-Fi is presented in Figure 8.The main functionalities of the app such as smart home, security, garden monitoring, sensor, smart office and smart industry are displayed in the first screen for interactions by the users.By turning the Wi-Fi button on, the app establishes wireless connection with the system.After entering any of these main functionalities, further options are appeared to turn the virtual buttons ON or OFF.For example, in the smart home section, a number of options are available to turn the appliances such as light, fan, table lamp and AC ON or OFF.Similarly, the sensor functionality provides the options for reading necessary data from different sensors connected with the system.For example, turning the temperature sensor ON, the app can display the value of live temperature in the home or institute.
Designs 2021, 5, x FOR PEER REVIEW 11 of 22 connection with the system.After entering any of these main functionalities, further options are appeared to turn the virtual buttons ON or OFF.For example, in the smart home section, a number of options are available to turn the appliances such as light, fan, table lamp and AC ON or OFF.Similarly, the sensor functionality provides the options for reading necessary data from different sensors connected with the system.For example, turning the temperature sensor ON, the app can display the value of live temperature in the home or institute.

Smart Home or Institute Application Cases
In order to validate the systems functionality for effective automation, three experiments were conducted with different sensors and control switches in different simulation environments.The purpose of the simulated experiments was not to check the functional accuracy of the sensors, rather it was to monitor the functionality of the automated system through the sensors and the developed mobile app as already demonstrated in Figure 8. Figure 9 presents a summary of the functionality tests for the system's validation with the general application areas, sensors used, example application and type of operation.
(1) In the first case, temperature and humidity were measured by the sensor and monitored by the developed mobile app in order to check the room temperature so that appropriate appliances can be turned ON or OFF remotely.(2) In the second case, distance of fire from the flame sensor were varied to observe whether the sensor used in the proposed system can detect the fire or not and to send the message to the app for drawing attention of the system user.(3) In the last case, the proposed system used a servomotor, ESP32 module and a relay to control switches of the appliances (i.e., fan, AC and door) by toggling the ON/OFF button in the android app.Then, the LoRa module transmitted signal to the target appliances for controlling their operations.

Smart Home or Institute Application Cases
In order to validate the systems functionality for effective automation, three experiments were conducted with different sensors and control switches in different simulation environments.The purpose of the simulated experiments was not to check the functional accuracy of the sensors, rather it was to monitor the functionality of the automated system through the sensors and the developed mobile app as already demonstrated in Figure 8. Figure 9 presents a summary of the functionality tests for the system's validation with the general application areas, sensors used, example application and type of operation.
(1) In the first case, temperature and humidity were measured by the sensor and monitored by the developed mobile app in order to check the room temperature so that appropriate appliances can be turned ON or OFF remotely.(2) In the second case, distance of fire from the flame sensor were varied to observe whether the sensor used in the proposed system can detect the fire or not and to send the message to the app for drawing attention of the system user.(3) In the last case, the proposed system used a servomotor, ESP32 module and a relay to control switches of the appliances (i.e., fan, AC and door) by toggling the ON/OFF button in the android app.Then, the LoRa module transmitted signal to the target appliances for controlling their operations.Observation was conducted at Dhaka International University (DIU), Dhaka, Bangladesh, and Mawlana Bhashani Science and Technology University (MBSTU), Tangail, Bangladesh.All the experiments were conducted within 3 km to 12 km distance between the sender and the receiver ends with fixed positions.Finally, a comparison was made among the LoRa module and other wireless data exchange technologies.Table 2 shows the comparison of LoRa as a Low Power Wide Area Network (LPWAN) and other wireless based technologies.The frequency band of LoRa is free to use, consumes low power, and covers a long range.To measure temperature and humidity of surrounding environment and to collect relevant data digitally for transmission, DHT11 sensor was selected.The system used an ultra-low-cost sensor.After installing the sensor at the receiver end, the temperature can Observation was conducted at Dhaka International University (DIU), Dhaka, Bangladesh, and Mawlana Bhashani Science and Technology University (MBSTU), Tangail, Bangladesh.All the experiments were conducted within 3 km to 12 km distance between the sender and the receiver ends with fixed positions.Finally, a comparison was made among the LoRa module and other wireless data exchange technologies.Table 2 shows the comparison of LoRa as a Low Power Wide Area Network (LPWAN) and other wireless based technologies.The frequency band of LoRa is free to use, consumes low power, and covers a long range.To measure temperature and humidity of surrounding environment and to collect relevant data digitally for transmission, DHT11 sensor was selected.The system used an ultra-low-cost sensor.After installing the sensor at the receiver end, the temperature can be monitored in the app by turning the toggle switch ON.The experiments were conducted, and data was collected at two different labs with a distance ranging from 3 km to 12 km.The system measured data at different hours of a day with a three-hour time interval.Average temperature and humidity were calculated by taking 5 readings within an hour as shown in Figures 10 and 11.The system found 26.4 • C temperature and 64.55% humidity on an average at the DIU lab 22.65 • C and 55.85% at MBSTU on a particular day.The results indicated that the developed automation system could effectively monitor and collect temperature and humidity data within a home environment from a distance as far as 12 km.
setting off for home from work at a distance up to 12 km.Based on this data, the users can make the decision on turning the central heating/cooling ON or OFF.Therefore, the home environment can be made to comfortable level even before reaching home.Temperature and humidity measurements were also suggested by other studies using LoRa technology in a smart campus application for monitoring and controlling of distributed energy sources in an energy saving programme [14], in an airport using multiagent approach for measuring the temperature of a certain area [39], or in a smart city environment for assessing the feasibility of planting and harvesting [33].The data can be useful for smart decision making using artificial intelligence.Therefore, the integration of temperature/humidity measurement capability would open further deployment opportunities of the current system in other applications.

Case 2: Fire Detection
Flame sensor was installed within the system with the ESP32 module to detect fire.The sensor detects fire and generates output '1′ in the app when it identifies fire occurring within three-feet distance, otherwise it generates '0′.Experiments were conducted by varying sensor distance from the fire occurring place.The response time and fire detection capability were measured to evaluate the performance of the system.The experiments were controlled from 3 km in the urban set-up (DIU).The response time was calculated as the time required for sending the notification to the users' mobile after occurring the fire.The experimental results presented in Table 3 shows that the system detected fire correctly 9 out of 10 instances.This could be due to several reasons such as temporary communication loss or power interruption.This automatic fire detection capability The experimental measurement and monitoring of temperature and humidity demonstrated that the automated IoT system could establish long distance communication using a demo sensor.From smart home point of view, the reason for measuring the temperature and humidity inside the home is to create and monitor a comfortable room environment remotely [6].For example, people working away from home can remotely monitor the temperature and humidity inside their home from their android phone before setting off for home from work at a distance up to 12 km.Based on this data, the users can make the deci-sion on turning the central heating/cooling ON or OFF.Therefore, the home environment can be made to comfortable level even before reaching home.Temperature and humidity measurements were also suggested by other studies using LoRa technology in a smart campus application for monitoring and controlling of distributed energy sources in an energy saving programme [14], in an airport using multiagent approach for measuring the temperature of a certain area [39], or in a smart city environment for assessing the feasibility of planting and harvesting [33].The data can be useful for smart decision making using artificial intelligence.Therefore, the integration of temperature/humidity measurement capability would open further deployment opportunities of the current system in other applications.

Case 2: Fire Detection
Flame sensor was installed within the system with the ESP32 module to detect fire.The sensor detects fire and generates output '1 in the app when it identifies fire occurring within three-feet distance, otherwise it generates '0 .Experiments were conducted by varying sensor distance from the fire occurring place.The response time and fire detection capability were measured to evaluate the performance of the system.The experiments were controlled from 3 km in the urban set-up (DIU).The response time was calculated as the time required for sending the notification to the users' mobile after occurring the fire.The experimental results presented in Table 3 shows that the system detected fire correctly 9 out of 10 instances.This could be due to several reasons such as temporary communication loss or power interruption.This automatic fire detection capability through the smart phone can help the user in taking necessary action to avoid any fire related damage.

Case 3: Controlling Switches
To examine the performance of the proposed system in controlling switches of the appliances, two appliances (i.e., fan and ac) and a door were chosen for the experimental purpose.The experiments were controlled from 3 km in the urban set-up (DIU) and 12 km in the rural set-up (MBSTU).The door was controlled by a servomotor that was connected with the ESP32 module through a relay.
When a user toggled the switches ON/OPEN to open a device through the mobile application, the control signal was transmitted via LoRa module to the target accessory so that the device was turned ON or OPEN.In order to turn OFF/CLOSE an accessory, similar functionality can be followed.The system has transmitted six hundred signals by toggling the ON/OFF or OPEN/CLOSE switches of mobile application for each appliance and door.Among the six hundred transmitted signals, 300 signals were used for ON/OPEN switches and other 300 signals were used for OFF/CLOSE switches.The system was able to receive 273 and 281 signals respectively for controlling the accessories.The results of this experiment presented in Table 4 demonstrated that 9% and 6.33% signals were lost for ON/OPEN and OFF/CLOSE respectively and in total 7.66% signal loss was occurred for both.However, in majority of the cases (92.33%), the system worked correctly in effective controlling (open/close) of appliances or accessory by turning the switches ON and OFF.The data loss could be due to the obstacles between the sender and receiver sides as the experiments were conducted in non-line-of-sight condition.

General Discussions
In this paper, the use of LoRa technology in an automated communication system has been demonstrated to be effective in longer distance communication.Furthermore, a proof of concept of LoRa based automation system with few real-life scenarios was also demonstrated.This technology has the potential to be further expanded in future in developing smart communication frameworks for different areas such as home, institute, agriculture, healthcare etc.However, issues such as scalability, security and integration of data analytics stills need to be resolved for large-scale deployment in both domestic, commercial and industrial applications.

Comparative Analysis
Recently published literature has also reported on the development of other LoRa based systems for intelligent communication in home, building or institutes.Therefore, a comparative analysis of the proposed system with the published work would provide a further insight for the readers.Gambi et al. [25] proposed an IoT based architecture of a home automation system using LoRa and Message Queuing Telemetry Transport (MQTT) protocol that could cover multistorey large buildings without multiple gateways.The authors tried to figure out how a low-power and low-cost but long-range communication devices could be developed for making IoT-based solutions.They used the LoRa module which provided low latency in message delivery for the development of their methodology.The MQTT protocol in their system acted as middleware where interoperability among different devices was obtained through the protocol.However, compared to the proposed system in this study, the major limitation of the system was its inability to provide acceptable quality of services and could not work through multiple nodes.
Islam et al. [40] suggested a home automation system design using LoRaWAN, serverbased LoRa gateway, and Bluetooth connectivity for covering both short-and long-range communication.An Android application was developed to control the home appliances and to keep smart communications among all the connected devices.The system attained a usability scale score of 93% after calculating transmission delay and coverage area.However, LoRa gateway used in their system was costly and not quite flexible to manage in comparison to the LoRa modules used in both the sender and receiver sides in this work.
Ali et al. [41] have developed ZigBee and LoRa based communication system which was tested at Yildiz Technical University campus in Istanbul, Turkey.The system was developed using a central receiver unit with LoRa and ZigBee transceiver modules, a microcontroller, temperature and humidity sensors and a relay unit.ZigBee or LoRa transceiver modules were responsible for sending temperature and humidity data from the sensors to a central receiver unit.The reported results provided the effectiveness of their system as low-power and suitable for long-range smart IoT based applications.The system was only tested for 400 m in comparison to several hundred kilometres in this work.
The system was not developed to connect to any mobile application on android platform for controlling the appliances.
Souifi et al. [42] developed a smart home system architecture using a wireless communication module, which communicated with sensors and LoRa for control the connected devices.The communication between LoRa server and the sensors was established and managed using a LoRaWAN gateway.Furthermore, Mycroft voice assistant was employed in their system to control the appliances via voice commands.However, their system did consider the communication only within the home perimeter and demonstrated only with thermostat and lighting controls.
Another low-cost communication system was proposed by Lousado et al. [43] for monitoring health conditions of elderly people at their homes using LoRa nodes, LoRa Gateway and The Things Network.Data collection module was developed using an ESP32/LoRa microcontroller with various environmental sensors to gather temperature, humidity, carbon monoxide, gas and smoke data.LoRa nodes sent data to LoRa gateway with the use of internet which were saved in a data base server.The experimental tests in their system were carried out indoors and the communications covered maximum range of 1.2 km only.

System Development
In a typical LoRa network low, the end devices directly communicate to LoRa via gateways (front end) and the data from the end devises are sent to a network or cloud server via gateway (back end) [6,44,45].ESP32 module was chosen for the automated system developed in this work to control the total appliances of home or institute due to its more powerful processing capability and supporting both Wi-Fi and Bluetooth connectivity without any gateway.The power consumption of the ESP32 module is lower than other devices such as Raspberry Pi.The system architecture presented in this work was different from other reported architectures.Here, a one-way Wi-Fi connection (at the sender side) connected the ESP32 module to the Android phone, and the signal went to LoRa module from the phone.Furthermore, a LoRa module connection with ESP32 (at the receiver side) eliminated the requirement of Wi-Fi connection.The combination of simple modular design, cheaper hardware and controlling by a smart phone allow making changes in the system by adding or removing additional sensors in order to expand its functional capability.
Line of sight (LoS) is a type of propagation that can transmit and receive data only where transmit and receive stations are in view of each other without any obstacle between them.However, in this study, the communication established between one LoRa module with the other LoRa module was invisible.During the experiments, the sender was at a fixed place and the receiver was in the remote locations.Hence, the system was effective in a situation where line-of-sight transmission was not possible.

Key Performance Metrices Analysis
The key performance metrices for LPWAN are generally defined by throughput, scalability, power consumption, coverage and cost [14,44].LoRa technology can achieve throughputs suitable enough for low rate but long-range IoT applications.Integration capabilities of a large number of nodes are the vital advantage of LoRa technology in terms of scalability.For example, several millions of devices can be potentially served by a single Lora WAN cell through sending a few bytes of data.Lavric et al. [46] have demonstrated that LoRa gateway module can communicate with 8 different channels simultaneously.The technology has high potential for scalability by increasing the number of gateways that can accelerate the capacity of network.Adaptive Data Rate (ADR) mechanism can help in achieving superior data rate while a node is placed near to a gateway by adjusting by the spreading factor (SF).Among other advantages of LoRa for scalability, its strong modulation scheme is important for resisting Doppler effect and multipath fading [33].
In terms of coverage range, LoRa can be applied both in urban and rural areas up to 20 km distance and for indoor and outdoor applications such as healthcare, traffic monitoring, agriculture, industry and environment monitoring.However, the coverage area could also be affected by location of LoRa gateway in indoor and outdoor scenarios [45,47].A number of parameters, such as received signal strength level (RSSI), signal-to-noise ratio (SNR), and packet delivery rate (PDR), define the coverage of LoRas [33].Haxhibeqiri et al. [48] demonstrated the performance and coverage of a LoRaWAN network with a single gateway and a single network server in a real industrial environment (a flower auction warehouse).The system can be used in both indoor and outdoor environment with a maximum indoor coverage of up to 400 m path even though the path between the LoRaWAN end device and the gateway was blocked by the metallic flower trolleys.Coverage area can be altered by adjusting the SF.However, the degradation of LoRa coverage quality must be improved particularly in an urban set-up where high density building block are the common obstacles [45].
The LoRa technology has been commercially succeeded due to its low-cost hardware and connectivity subscription per unit [11,49,50].The affordability of the technology not only provides the opportunity for wide range of applications, but also dominates its capability in the areas of short-range wireless technologies and the cellular networks.The automated system has adopted multiple ways to reduce capital expenses (low cost ESP32 module) and operating expenses for both the end-users and network operators such as spectrum cost (free license), network/deployment cost, and device cost compared to other similar technologies such as Sigfox or NB-IoT [51].In addition, reduction of complexity in hardware, using minimum infrastructure would also make LoRa technology as a cost-effective solution [11].
Power consumption can be reduced through turning off power hungry components such as data transceiver within the system developed here.For example, radio duty cycling allows LoRa end devices to turn on or off based on the requirements of transmitting and receiving data or not [11].The duty cycling is adapted based on application, type of power source, and traffic pattern.During transferring data for an application over uplink, the end devices may wake up only when data is ready to be transmitted.Designing modular hardware provides further opportunities of reducing power consumption as well as increase the battery lifetime by turning on or off individual hardware components.Integration of renewable energy sources such as solar panel, wind turbine etc. to end devices can further reduce the energy consumption.
It should be emphasized that it is worth implementing the system in real-life particularly for lower and lower middle-income countries where the access of internet is still limited particularly in rural areas.The system was developed and experimented in Bangladesh which is a lower middle-income country where internet is not available in most of the rural areas.In addition, the connections between the devices can be lost during extreme weather (i.e., heavy rain, storm etc.) due to the reduction of the internet connectivity from 3 g to 2 g.Again, when internet is used to communicate within different modules of the system, power consumption would increase.Furthermore, any system is communicated via internet is expensive.Moreover, if gateways are used to communicate with each device, several gateways would be required to add to the system which would further the cost of the system.In our system, a reliable and user-friendly architecture for communicating within the devices has been proposed.As an example, the LoRA and IoT based system presented in [52] has used a server which is costly.As our proposed system can communicate directly between sender and receiver, the cost is low.In the case of limited access to internet, our system can work properly.Furthermore, any IoT based system requires a lot of power and there is a risk of data loss.In this respect, the possibility of data loss and power and communication costs in our system is low.

Security Analysis
The quick development of internet, multimedia and communication technologies convey the exchange of confidential information through public telecommunications channels using electronic devices or embedded systems (ES).Security of LoRa technology is ensured through symmetric-key cryptography [53].Furthermore, two layers of security such as network security and application security are incorporated in LoRa network [51].However, the LoRa devices are still vulnerable to security attacks due to its wide transmission window (between 900 ms and 1.2 s) [50].Researchers are continuously trying to solve this issue by developing new security systems.For example, Flores-Vergara et al. [54] have implemented a chaotic cryptosystem using profiling and parallel computation techniques in a cluster of embedded systems with multiprocessors.In another study, Tlelo-Cuautle et al. [55] have introduced cryptographic application of the Hopfield and the Hindmarsh-Rose neurons for chaotic image encryption which was used in FPGA-based implementations to perform the encryption of the RGB Lena, Fruits, and Baboon images.Furthermore, Aras et al. [53] suggested implementation of security measures such as key management and frame counters by technology developers or manufacturers.
Other than text data, LoRa technology can be used to transfer image data wirelessly although it suffers from the limitations of low bit rate data transfer and lack of real time encryption [56].Currently, researchers are applying classical encryption schemes, including Data Encryption Standard (DES), Advanced Encryption Standard (AES), Triple Data Encryption Standard (3DES), International Data Encryption Algorithm (IDEA) and Rivest Cipher 4 (RC4) for only text encryption.Moreover, a large computational time and high energy consumption are required.Therefore, it is essential to develop new methods to ensure that the information is secured against any attacks while transmitting image data.Guerrero et al. [57] have proposed a simple, efficient, and secure algorithm to encrypt digital images in a wireless communication scheme using five chaotic maps, microcontroller and (machine-to-machine) M2M links via Zigbee channel to transmit data more securely than the classic encryption schemes.

Further Development Opportunities
Different sensors included in the proposed system can be multiplexed and then connected to a microcontroller or a raspberry Pi, and to the LoRa system to expand the functionalities of the current system.In order to establish and maintain communication through the automated system, one microcontroller is required to connect with each LoRa module.However, for controlling appliances in multiple institutes that communicate each other, two LoRa modules, namely transfer and receiver, are required at the sender side.Similarly, the receiver also needs to be equipped with two LoRa modules same as the sender side.Again, a similar system can also be developed by combining a microcontroller with a wireless module adapter or embedding in wireless circuits similar to LoRa.However, the microcontroller could be more expensive than the ESP32.Furthermore, the operations of the microcontroller could be more complex than the relatively simple control system by Android app proposed in this study.
Data loss was encountered during the experiments with the automated system as seen in the results.Multiple gateways could be used with LoRa to cover a long distance without encountering any data loss.Other than the sensors used, a host of other types of sensors in home set-up such as gas, dust, or noise sensor can be combined with this system for monitoring and controlling home or institute environment.In one case, the system failed to detect flame possibly due to data loss.A solution for managing the messages/data loss could be that the sensor node waits for an acknowledgement (ACK) message until the system sends alarm upon detecting fire.In addition, the detected data from the fire sensor can be supplemented by temperature reading from the temperature/humidity sensor to improve the fire detection capability of the proposed system in case if the flame sensor fails to detect any fire.This system can be further expanded with the option of collecting and storing data from the sensors via the app connected to a local network or cloud server.The integration of data analytics with artificial intelligence would pave the way for making intelligent decisions based on the data collected by the system [6,33] such as improving energy efficiency or residence safety.In order to support applications requiring high data rate, it has been suggested to develop multiple modulation scheme for LoRa.Furthermore, cross-and self-interference issues need to be resolved in an area where the density of the deployed LoRa devices is increased within a certain area [6].Other development opportunities are also discussed in the literature [6,58].
Currently, the operational functionalities of the system are compatible with the android mobile phone as a majority of the mobile users in Bangladesh use android based phones.However, the functioning of the system can be controlled with an iOS app in order to make the system universal.Although the basic design of the app will remain the same, some modifications to the design and customization of coding would be required according to the new platform.

Conclusions and Future Work
In this investigation, a smart automation system has been designed, developed and tested for effective remote controlling of appliances at home, institute or industry.The system was developed at low cost with a capability of monitoring and controlling from a distance ranging from 3 km to 12 km through LoRa based wireless communication.Users can monitor the entire condition of the surroundings of the covered area by using the developed android-based software application "LoRa based Smart Institute".Different features such as Smart Office, Smart Industry, Smart Home, etc. with sub-functionalities for each feature were embedded within the app for easy monitoring and controlling of the appliances.Functionality tests in simulated environments demonstrated that the system could monitor environmental temperature and humidity, detect fire with an accuracy of 90% and control the switching functionality with 92.33% accuracy by toggling the virtual switches of the mobile application.The proposed system provided a solution to overcome the limitation of the traditional short-range communication technologies at lower cost without consuming too much battery power.
Although the proposed IoT system showed effectiveness in non-line-of-sight transmission, its major limitation was data loss during transmission, particularly at longer distance, which can be addressed by employing multiple gateways.In general, the different modules in the IoT system will consume power, which can be reduced by integrating renewable power sources such as a solar panel, wind turbine etc.Other future work could involve attaching additional sensors (e.g., gas, dust, or noise sensors) with the system and collecting and analysing data with the App for making intelligent decisions.

a
The research work has designed and developed a smart IoT system with ESP32 module and LoRa wireless communication module for long range communication (3 km to 12 km) via transmitting and receiving data at low power consumption in order to overcome the limitation of existing short distance (10 m-100 m) communication technologies.b

Figure 1 .
Figure 1.A complete architecture of the proposed automation system for smart home/institute application.

Figure 1 .
Figure 1.A complete architecture of the proposed automation system for smart home/institute application.

Figure 2 .
Figure 2. Flow diagram of working procedure for the proposed system.

Figure 2 .
Figure 2. Flow diagram of working procedure for the proposed system.

Figure 3 .
Figure 3. Sender end circuit diagram of the smart automation system.

Figure 4
Figure4illustrates the receiver end circuit diagram.The LoRa module received transmitted signal from the sender end through antenna and forwards this signal to the wired connected ESP32 module.In the receiver end, different sensors and controlling switches were connected with the ESP32 module.For transmitting and receiving signal between the LoRa and ESP32 modules, the TXD pin of ESP32 was connected with the RXD pin of LoRa, and the RXD pin of the ESP32 was connected with the TXD pin of LoRa module.In the ESP32, typically there were 20 pins as data pins which are programmable and can be used as signal transmitting-receiving pin from various sensors or switching devices.

Figure 4 .
Figure 4. Receiver end circuit diagram of the smart automation system.The data reading procedure from different sensors obtained through ESP32 microprocessor is almost same.The flow diagram of the sensors' reading is shown in Figure 5.

Figure 3 .
Figure 3. Sender end circuit diagram of the smart automation system.

Figure 4 22 Figure 3 .
Figure4illustrates the receiver end circuit diagram.The LoRa module received transmitted signal from the sender end through antenna and forwards this signal to the wired connected ESP32 module.In the receiver end, different sensors and controlling switches were connected with the ESP32 module.For transmitting and receiving signal between the LoRa and ESP32 modules, the TXD pin of ESP32 was connected with the RXD pin of LoRa, and the RXD pin of the ESP32 was connected with the TXD pin of LoRa module.In the ESP32, typically there were 20 pins as data pins which are programmable and can be used as signal transmitting-receiving pin from various sensors or switching devices.

Figure 4 .
Figure 4. Receiver end circuit diagram of the smart automation system.The data reading procedure from different sensors obtained through ESP32 microprocessor is almost same.The flow diagram of the sensors' reading is shown in Figure 5.

Figure 4 . 22 Figure 5 .
Figure 4. Receiver end circuit diagram of the smart automation system.The data reading procedure from different sensors obtained through ESP32 microprocessor is almost same.The flow diagram of the sensors' reading is shown in Figure 5.

Figure 6 .
Figure 6.Graphical User Interface (GUI) of the android app developed for the automation system.

Figure 7 .
Figure 7. GUI for Living room, Sensor and Garden Monitoring sub-functionalities.

Figure 6 .
Figure 6.Graphical User Interface (GUI) of the android app developed for the automation system.

Designs 2021, 5 , 22 Figure 6 .
Figure 6.Graphical User Interface (GUI) of the android app developed for the automation system.

Figure 7 .
Figure 7. GUI for Living room, Sensor and Garden Monitoring sub-functionalities.

Figure 7 .
Figure 7. GUI for Living room, Sensor and Garden Monitoring sub-functionalities.

Figure 8 .
Figure 8. Smart institute app showing functionality of Wi-Fi connection, controlling appliances and displaying measured temperature.

Figure 8 .
Figure 8. Smart institute app showing functionality of Wi-Fi connection, controlling appliances and displaying measured temperature.

Figure 9 .
Figure 9. Summary of functionality tests for the LoRa based automation system.

Figure 9 .
Figure 9. Summary of functionality tests for the LoRa based automation system.

Figure 10 .
Figure 10.Average temperature values per hour at two different experimental locations.Figure 10.Average temperature values per hour at two different experimental locations.

Figure 10 .
Figure 10.Average temperature values per hour at two different experimental locations.Figure 10.Average temperature values per hour at two different experimental locations.Designs 2021, 5, x FOR PEER REVIEW 14 of 22

Figure 11 .
Figure 11.Average humidity values per hour at two different experimental locations.

Figure 11 .
Figure 11.Average humidity values per hour at two different experimental locations.

Table 1 .
Description of different sensors employed in the smart automation system.
Flow diagram for connecting different sensors.

Table 2 .
Comparison between the proposed system and existing systems.

Table 2 .
Comparison between the proposed system and existing systems.

Table 3 .
Flame sensor's data obtained from fire detection experiments.

Table 4 .
Experimental data for controlling switches through signal transmission.