Design and implementation of internet of things-based electrical monitoring system

Received Jul 25, 2021 Revised Sep 23, 2021 Accepted Oct 27, 2021 Many modern monitoring and controlling projects such as systems in factories, home, and other used the internet of things (IoT). These devices perform self-functions without requiring manual intervention in order to improve convenience and safety. Electrical networks are one of the most important areas in which IoT systems can control, monitor, detect, and alarm for faultier, because detecting faults, monitoring network data, and finding the best solutions in a smaller duration of time to improve the efficiency and reliability of electrical networks. This paper proposes a system on the basis of a wireless sensor network (WSN). This system monitors and controls a variety of electrical and environmental variables, including power consumption, weather temperature, humidity, flame, lighting, and detection cut in the cable in electrical poles. Each sensor is a node and is connected to a microcontroller board separately. The data collected by these sensors is display and monitored on a web page and saved in a local server's database, this site was created with a variety of web programming languages. The system was developed using a free global domain. The website having a database for storing real-time sensor information.


INTRODUCTION
The internet of things (IoT) (or internet of everything) first appeared in the early 1990s, but as technology advanced, so did the applications of the internet and wireless technologies, as well as the wide use of mobile phones, the IoT has become essential for providing rising, high-quality human services. Cloud computing and IPV6 promote an integrated development of the internet and the IoT, in which the IoT operates as a massive network of objects that communicate with each other and with individuals over the internet by linking each device to a single identification capable of collecting and processing data individually, the entry of IPV6 with the IoT made it possible to mix an unknown number of things on the internet [1], [2].
Kevin Ashton founded the IoT in 1999, with the goal of connecting anything physical to the internet via sensors. The global standards initiative (GSI) declared in 2013 that the IoT is the information society's infrastructure [3]. In the process of connecting devices with sensors surrounding the internet and facilitating access to information, exchange, and processing of required information anywhere in the world and at any time through ready-made software platforms over the internet, the IoT has become supportive of many areas. The IoT has made life and business easier and faster than before, as well as providing more flexibility in dealing with devices and allowing people to live more freely. The wireless sensor network (WSN) plays an important role in the development of the IoT, such as reducing, optimizing, and increasing the network's power consumption. It was made up of a set of fundamental integrative elements that were distributed across the environment and sent data to a central location for display, analysis, and use [4]. The IoT helps many devices stay connected via the internet, as each device can communicate with other devices over the internet. There are many examples of IoT applications, such as smart cities, healthcare, alarm systems, and so on [5]. The study in [6] shows how to invest in IoT technologies in smart cities to increase the quality of services for consumers and government systems while reducing resource consumption, such as electric energy, safety, and services facilitation, and other things. The IoT that is aimed to monitor and control a large number of devices linked to the internet in order to provide a specific service to the user in the simplest and most efficient possible way.
Singh et al, [7] discusses the need of investing in IoT technology in the medical field, as well as the global challenge faced by the covid-19 pandemic, which cuts across regional and societal boundaries. As IoT systems are a wonderful and significant support for monitoring patients infected with the Covid-19 virus through the use of an interconnected network of sensors, and as the employment of these technologies helps reduce the number of hospital admissions again. Thus, this technique work to monitor the infected and have proven their worth by presenting the roadmap for reducing the cost of health care and improving treatment outcomes for patients.
The research paper in [8] explains how to use IoT technologies in the smart grid, which is a large system with each component controlled by a group of energy and communications layers. As a result, the IoT makes these networks smarter and improves the support of their own communications as well as the lengthy stability of the structures that support them. The smart grid, on the other hand, was created to improve and develop basic services that are better linked with smart city infrastructure.
The goal of study in [9] was to invest in IoT technologies by connecting a group of electrical meters that are used to track the rate of change in electrical energy consumption using the Modbus protocol. This system was applied and worked correctly after it was installed in three different locations of University Technical Malaysia Melaka (UTeM), and it provides an easy way for the campus to monitor the amount of electrical energy consumption and store it efficiently and economically unlike other systems such as the expensive SCADA system.
In study presented by [10], the Nodemcu microcontroller, which gives the ability to connect to Wi-Fi continually and fetch data for sensors in real time, was used, and the system was monitored and controlled using the blynk program for the mobile phone. The study in [11] explains how to use WSN to create a lowcost farm management system that can detect soil moisture as well as the environment, as well as weather and prediction to future agricultural activities. The goal of this system is to ensure production in both quantitative and qualitative terms from the crops grown, as well as to study the agricultural environment in order to reduce the environmental impacts on crops, and this is a basic condition in the implementation of sustainable agriculture through linking traditional and modern agriculture, and at a low design cost, thanks to the implementation of small electronic modules that send data collected from sensors to an IoT cloud platform. Because WSN can continuously monitor the soil and weather conditions [12]. And then transferring the data to an IoT cloud platform so these changes may be tracked in the agricultural environment, since this method allows farmers to easily visualize the agricultural environment's future and how to develop or maintain its sustainability. Smart grid is one of the most important application for IoT, where the term energy internet is currently used to replace IoT abbreviation in smart grid. A lot of research papers [13]- [35] have used IoT efficiently in smart grid applications, where they used it to establish secure and efficient communication platform to serve different parts and processes in smart grid. So many other applications in different fields such as health care, weather monitoring, irrigation and farmer management, oil industry, smart home and other and others [36]- [62].
In this work, we present an IoT system consisting of several sensor nodes and a website that was created using various programming languages, the data is collected from the system nodes, which include various sensors such as light sensors, temperature, humidity, current, voltage, and cut sensing circuit in the cables, in addition to controlling of devices and the data is kept in a MySQL local server database. This data is sent via the NodeMCU microcontroller to the web page, allowing the system to be directly monitored and data to be received in real time, and finding the best appropriate solutions to in a smaller duration of time to deal with the system's problems.

RESEARCH METHOD
In this part, the suggested work is discussed, where it includes monitoring system nodes data via a website and storing sensor data in a server's database. The main board used in system is NodeMCU. The designed system is depicted in Figure 1. In our work, we offer a prototyping system for monitoring and detecting system warnings. The website which was created as a part of the proposed system utilizing a variety of web programming languages (HTML, CSS, Java script, PHP, SQL). The website represents the cloud platform; it receives data from nodes and displayed it on the website. While there are many free platforms for receiving and transmitting data, the proposed project chose to design a site that can support any number of nodes and can be developed in the future with any extra work.

Figure 1. General system design
When the nodes (sensors) begin collecting data, the data is sent to the microcontroller NodeMCU, and the controller connects to the internet via Wi-Fi connectivity, the controller set up the server domain to be sent to via http protocol, and the data is sent to the database and stored in it, after the database is successfully connected. The information is then transferred to a page, that is accessed using the http request protocol to display the information on the site, and when the response is complete, the data appears on the page to monitor and track the information nodes and resolve problems with it. Figure 2 shows the flowchart for data flow.
We designed an interface to display the data that came from the Nodes, so we designed the website shown in Figure 3. For the frontend end, a set of web programming languages (HTML/CSS/JavaScript) has been used. And for the backend, we use PHP to communicate data to the database, which we built using SQL. We loading data firstly through a local network, where control is limited and cannot be done by a network other than the local network (LAN).
The first node in the prototype project was a light and fire sensor; the light sensor detects the state of the light in the column and turns on the light when it gets dark; the fire sensor sends digital data; a value of zero indicates the presence of fire; and the alarm buzzer sensor works in the control room to prevent the risk of fire. This information is delivered to the server's database, which stores all cases in real time and displays the information on the site. The second node was concerned with tracking the value of the current and voltage traveling through the column, and we used two sensors ACS712 and DC voltage, which were represented by an electrical circuit consisting of an LED and a battery. This information is saved in a database and supplied to the site for monitoring.
The third node was represented by the dht11 sensor, which was used to obtain weather data, temperatures and humidity, it was used to monitor these quantities which influence the status of the wires in the columns, and to send an email alert about high temperatures using predefined threshold value. Tracing the faultier of electrical cables and determining the distance of the cut with the damaged phase was to represent the fourth node. The Arduino microcontroller was utilized in this node, with a series of resistors and switches, these resistors represent the electrical cable, and switches causing the cable to be cut off. It will send the change in voltage value of cable to the ADC pin, which will be used to determine the value of the distance with the Arduino. In addition to the relays that transfer the phase state to the Arduino and therefore determine the distance and phase affected by the cut [63], [64]. After that using NODEMCU ESP8266 URAT communication to send data to the server, then connecting ESP with Wi-Fi and send HTTP POST request to connect with database and send cutting information to server and webpage to monitor that.   Figure 4 (d) the last node is responsible for detecting the downs in the cables. Two PHP script will be written after these nodes have been linked. The first script will provide settings for connecting to the server database so that data may be entered and stored in the database, after the variables are checked and see if they match the table in the database. The data will be entered into the custom table if this is completed properly. The second PHP script will be the text that will be used to display the data on the web page. The data will be shown on the site in the form of a table that shows the real-time of the sensors and the sensor data values.  Figure 5. Depending on the value of light sensor, the light source connected to this node will be switched on and off, where it will be switched on when it gets dark. The flame sensor gives zero value when sensing fire and appeared "danger" in table, but "safety" if no sensing fire. The level of temperature and humidity in the environment is depicted in Figure 6, and monitoring the rise in temperature or humidity allows us to take the necessary and faster initiatives to protect the condition of the wires in the columns.   The web was built using free domain was reserved for a year on the website (000webhost.com), the project was built and the data was published to a free global website, that support many programming languages (PHP, CSS, HTML, JavaScript) and supports a MySQL database. The way the data nodes is displayed has also changed, with the results of the temperature and humidity sensor node being displayed in the form of a gauge giving reading update, as well as the latest 20 values of the sensor reading in a table format. as for the light and fire sensor node, the results were displayed in the form of a line chart model, the better data visualization for the user, especially when the data is big, to manage the sensor data direction. Some sample data displayed on the global site is shown in Figures 9 and 10. The node's DC current and voltage sensor was also replaced with a voltage and alternating current sensor, and the node was connected to the main voltage source 220 volts to measure the current and voltage passing through the light connected to the power source, as well as the amount of energy consumed in the light. Figure 11 depicts the node's data in the form of a line chart. Figure 11. AC energy (current, voltage, power) meter in free domain server The fourth node will be shown in the table form, which will deliver cable data to the free domain site, monitor the cutting condition, and calculate the distance with the affected phase, the Figure 12 shows that. Three colors were added to the table to represent the three phases of the cable. The data is monitored and the statuses of the nodes are tracked remotely from the free site. In addition to the presence of the free server database in which the system data is saved and maintained, to keep track of the data flow and choose the right plan of action. The free server database in which the nodes data was kept is depicted in Figures 13, 14 and 15.

CONCLUSION
This paper describes the automated IoT-based monitoring and control system that can detect temperature and humidity in column areas, as well as lighting, power meters, and cable faults. All of this information is saved in a database and shown on the website that keeps track of warnings and data in order to discover the best solutions. During this study, we were able to measure the variables using a system prototype. This system may be used to protect against the dangers of electrical shock, which can result in death and fire in many areas, and to decrease energy consumption by knowing the voltage and power utilized, as well as sensing lighting to reduce consumption from light and used in night only. Another possible use of the proposed system is in finding the cutting area in cables and determining the distance at which the cutting occurs, which is what is required, especially in ground cables where determining the cutting is difficult and requires more effort, time, and labor. In addition to the possibilities of development in the work according to the required need.