Centralized smart energy monitoring system for legacy home appliances

The increasing global population and reliance on electrical devices for daily life resulted in sharply rising energy consumption. Also, this leads to higher household electricity bills. As a result, there is a growing demand for energy monitoring systems that can accurately estimate energy usage to help save power, especially for older home appliances that are difficult or expensive to update with monitoring sensors. However, current energy monitoring systems have some drawbacks, such as the inability to detect different types of appliances and the deployment complexity. Moreover, such systems are too costly to use in older power infrastructures. To address this issue, we proposed a centralized smart energy monitoring system designed for legacy home appliances, aiming to address the limitations of current energy monitoring systems by avoiding costly infrastructure upgrades to calculate the power consumption of legacy home appliances. The proposed system employs a two-layered architecture comprising hardware (Emontx device, Analog-to-Digital Converters (ADC), and Current Transformer (CT) sensors) and a software layer that includes Artificial Intelligence (AI) predictors using a pre-defined set of rules and K Nearest Neighbours (KNN) algorithms. We conducted three experiments on real home appliances to evaluate the proposed work. The accuracy of the proposed system showed positive results after several modifications and hard tuning of several parameters in devices, specifically for Jordanian power plants


Introduction
Economic expansion and the growing global population have increased energy consumption lately (Farghali et al. 2023).The efficiency of energy services has slowly improved due to technological advancement, energy efficiency enactment, and power monitoring and management tools and frameworks.Nonetheless, this improvement has not always been adequate to offset the increase in demand for energy services.Power monitoring tools and frameworks are crucial in reducing energy consumption, a global requirement impacting energy prices, emissions, and lawmaking (Toshiba 2019).Both individuals and organizations are highly interested in economizing energy usage in their homes and workplaces and positively impacting the environment, as illustrated in Fig. 1.However, power monitoring necessitates prerequisite requirements for specialized monitoring devices, resulting in increased costs for investment and maintenance, which could ultimately lead to higher expenses for consumers (Zainuddin et al. 2020).Besides, this monitoring deployment type could strain power lines, leading to vertical clearance issues.Another method involves using a numerical calculation to determine conductor temperature as an indirect monitoring technique (Reddy et al. 2020).Then, the findings can be compared to measurement data to obtain accurate results.Line monitoring is challenging due to the inconsistent data for each span, particularly transmission lines running through complex terrains (Zainuddin et al. 2020).Therefore, operators must determine the most effective data measurement strategy (Reddy et al. 2020).They must consider adequate monitoring equipment and a proper deployment position based on the terrain to read real-time conductor temperature accurately.Hence, ensuring accurate data measurement throughout the operation with direct and indirect monitoring is challenging.
The monitoring system must be considered, so transmission engineers should design a robust system that addresses all sorts of concerns (Zainuddin et al. 2020;Krivohlava et al. 2022).Several studies have been conducted to prevent unauthorized access and avoid time delays in data processing, collection, and transmission.Researchers recently introduced several solutions to monitor power consumption using different approaches ranging from hardware, software, and user usage behavior to utilizing Artificial intelligence(AI) algorithms.
To this end, we propose a centralized smart energy monitoring system in this paper to provide a practical solution for legacy home appliances employing a predefined set of rules and K Nearest Neighbours(KNN) AI algorithms.The proposed system optimizes power usage detection of legacy home appliances without requiring sensors on each device or upgrading the electrical wiring system.Our system is composed of hardware and software layers.The hardware layer includes an Emontx device to read the electrical current in wires, Analog-to-Digital Converters (ADC), and Current Transformer (CT) sensors.The software layer processes the data from the hardware layer to predict the power usage of each appliance.Our proposed system will enable more installations in legacy households by simplifying and reducing the cost of wiring each end pint outlet and the effort of extra wiring required by such solutions.We conducted three experiment scenarios on actual home appliances to evaluate the proposed model.The Set of Rules achieved an accuracy of 16.1%, 16.1%, and 19.4% in the three experiments, while the KNN algorithm achieved 87.1%, 74.2%, and 80.6%.The contributions of our article are summarized as follows: • First, we proposed a smart centralized power monitoring system for legacy home appliances that employs a two-layered architecture that does not require any upgrade of the current electrical grid installations.• Second, we presented two AI approaches to predict appliances' power consumption.
• Thirdly, we calibrated and altered the sensor readings to be more efficient with Jordan's electricity to improve the accuracy of CT sensors.• Finally, we have evaluated the accuracy of the proposed system by building a realworld testbed with three experiment scenarios.
The rest of the paper is organized as follows.Section 2 describes the background topics.Section 3 overviews and categorizes the related work.Our proposed model is presented in Sect. 4. Performance evaluation and results are presented in Sect.5, while Sect.6 concludes the paper.

Background
Smart homes have recently obtained significant attention as they make people's lives easier and more convenient.A smart home is the automatic control of electrical appliances in the home (Hasan et al. 2018).The user can manage the devices remotely using electronic devices such as smartphones, personal devices, and laptops.Recent technological developments have also generated many intelligent and preceding systems that can promote intelligent technology in life (Shaban et al. 2019).One of the benefits of having a smart home is the ability to monitor energy consumption, which is unattainable in non-smart homes.Non-smart homes, which are still common and dominant, consume much energy and cannot monitor energy consumption, which can be costly for the user.However, before discussing monitoring systems, it is essential to understand power measurement.Power consumption and quality measurements should be part of any system's design and testing for power systems.These measurements are crucial to optimizing system design, complying with standards, and providing users with helpful information.This section will briefly discuss the background topics related to our research.We will describe necessary power basics, power monitoring systems, AC power theory, Arduinoś formulas, and the set of rules and KNN algorithms.

Power basic measurements
Electricity is gauged in units of power called Watts (W) in honor of James Watt (Co 2010).A W is equal one Ampere A under the pressure of one volt V, which can be measured as Eq.1: One W is a small amount of power (Adminstration 2018), and some appliances consume only a few Ws to work, while others consume more.The power consumption of small appliances is usually measured in Ws.In contrast, the power consumption of larger devices is measured in kilowatts (KW), equal to 1000 Ws.Electric power generation capacity is often measured in multiples of KWs, such as megawatts (MW) and gigawatts (GW).One MW equals 1000 KW, and one GW equals 1000 MW.The electric power that is used over time is measured in Watt Hours (WH).A WH is equal to the power of one W fixedly supplied to, or taken from, an electric circuit for one hour.The amount of power a power plant generates or a customer's electric power utility is usually measured in kilowatt-hours (KWH).One KWH is one kilowatt generated or consumed for one hour.For example, if you use a 30-watt (0.03 KW) light bulb for seven hours, you have used 210 WH, or 0.21 KWH, of electric power.
The power factor (PF) is the active power P ratio to the apparent power S. The power factor is the cosine of the angle between voltage and current and is expressed in percentage.Equations 2 and 3 (Chaudhari 2018) represent the relation.

Also,
In an inductive circuit, the power factor lags if the current lags behind the voltage.In contrast, the power factor leads to a capacitive circuit if the current leads to the voltage.

Power monitoring
Most home appliances can be classified into two types: straightforward and nonstraightforward (Monitor 2023).The straightforward type consumes all the energy given to them, including kettles, light bulbs, irons, water coolers, and electric water heaters.On the other hand, non-straightforward type devices use a partial amount of the given energy and then release part of it back into the source.Non-straightforward appliances include fridges, washing machines, pillar drills, and arc welders.Straightforward appliances resist loads according to Ohm's Law, as shown in Eq. 4 (Monitor 2023).
where I represents the current, V represents the voltage, and R represents the resistance.
When the power is constantly upbeat, electricity flows from the primary power source to the load (Co 2010).However, some appliances are more complex and include inductive or capacitive components in addition to the resistive component.These appliances take in a certain amount of energy and then release part of that energy back to the primary power source.During specific periods, the flow of (1) electricity may be negative, meaning that the positive portion flows to the load while the negative portion flows back to the primary power source.

Arduinoś power sensing
Arduino is limited in power sampling frequency between 50 and 100 measurements every 20 milliseconds by sampling the primary voltage and current at high frequency (Monitor 2023).They took 100 measurements every 20 milliseconds if they were sampling only current and 50 measurements if they were sampling voltage and current together.The sampling limitations are due to the math used in Arduino. Figure 2 shows the Arduino sampling, where each reading sample is the instantaneous voltage or current reading.
Emontx is the system we use in our proposed system to read the electrical current in wires and determine power usage.The Emontx most important formulas are depicted in (5) Real Power, (6) Real Power in discrete time, (7) Voltage, and (8) Current (Monitor 2023).
Where U represents the Root Mean Square (RMS) voltage, i(t) represents the current, I represents the RMS current, and cos(Phi) represents the power factor.
(5) Where u(n) represents the sampled instance of u(t), i(n) represents the sampled instance of i(t), and N represents the number of samples.
Where u(n) represents the sampled instance of u(t), and N represents the number of samples.
Where i(n) represents the sampled instance of i(t), and N represents the number of samples.

Set of rules
The set of rules is a method of deductive reasoning (Al-Janabi et al. 2018).The computer understands that zero means false and one means true.A set of Rules is a conclusion that comes after the hypotheses, for example, A ⇒ B , where statement A is the hypoth- esis and statement B is the conclusion.The following gives a real example to help you understand the concept better.If the traffic light is red, then stop.The hypothesis is that the traffic light is red, and the conclusion is that you have to stop your car.This model is used when fast outputs are needed, when there is a risk of error, and when there is no planning for using Machine Learning (ML).

KNN
The KNN algorithm is a popular non-linear regression technique used in supervised ML (Al-Janabi et al. 2018).This algorithm uses the K closest samples of the training dataset to predict a new sample.KNN assumes symmetry between the available and new statuses.It looks to find symmetry points between these statuses to classify new inputs easily into the most symmetric category among obtainable categories.

Related work
Several solutions exist to read appliance power usage; these solutions can broadly be categorized into two main categories, as described below.

Traditional power monitoring systems
Numerous studies have looked into various aspects of household electricity monitoring and control systems.For instance, a Wireless Sensor Network (WSN) monitoring system based on ZigBee is proposed in Hasan et al. (2018).The electrical socket's primary components are the IRM-10-12 switched-mode power supply, XBee communication module, Arduino Nanosensor, and signal-conditioning modules.Another work (Shah and Mishra 2016) proposed a solution using the appliance's IP address and port number to connect with STM32 using a remote control program so they could recognize room numbers by IP address.This guarantees that the host computer can accurately receive information about each room's electricity usage.Researchers in Serra et al. (2005) provided a specialized wireless sensing and monitoring platform with Internet of Things (IoT) capabilities to track temperature, relative humidity, and light in the context of building automation.The proposed IoT system comprises a transmitter node, a repeater node, and a sink node (receiver node) coupled to a PC powered by the USB interface.
The proposed wireless IoT consists of a Pic microcontroller, light sensor, temperature and humidity sensor, and wireless transceiver.The research work in Han et al. (2011) developed a prototype using hardware and software tools.They used an AD7757 IC chip to measure electric power, a local microcontroller to implement data acquisition, an external EEP-ROM to store several power profiles, an RS232 interface to provide communications with the personal computer, the I2C interface to provide communication with other telecommunication modules and ICD2, a set of subroutines in "C" languages for the micro-controller, and a created Visual Basic-based software module for the system's connected personal computer.Researchers in Patel et al. (2010) proposed a reference energy usage profile accessed by two methods of communication.First, suppose a user signs up for the energy service portal offered.In that case, the reference energy usage profiles of all household appliances can be sent to the user's home server to compare the energy usage of their appliances with server profiles.The second technique is manually installing the home appliance profile into the server.The equipment manufacturer might provide the typical reference energy usage profile for the model of home appliances as a device driver.Without signing up for the energy portal service, a user can determine the energy usage of household equipment by comparing it to the usually offered reference energy usage.Their hardware system included an electrical outlet that used ZigBee to measure power and energy.
In research work (Ueno et al. 2006), the power consumption is calculated using a calibrator connected to a PC through a USB connection.The GNU Radio software toolbox is used for signal conditioning and processing, and the hardware uses a Honeywell HMC1022 sensor.In Zhao et al. (2014), the researchers suggested a solution that consists of monitoring and distribution components.A Load-Survey Meter (LSM) and an End-Use Meter (EUM), which individually measure the amount of electricity used by a specific home appliance, are included in the monitoring component.Each of them measures power usage every 30 min.The Network Control Unit (NCU) receives the estimated data via distribution lines throughout the home.Then, a PC uses telephone connections to collect the data each night.The distribution component is a PC that sends data via mail to each home's information terminal.Every morning, the distribution server receives logs of the information terminal's operation and the users' reactions to the energy tips.

AI-based power monitoring systems
Several other research works have utilized AI, ML, and data mining in power monitoring and detection.The work in Zhao et al. (2014) aimed to create an indirect data mining method that would be less intrusive to learn about occupant passive behavior and how it can affect office building heating, ventilation, and air conditioning (HVAC) energy usage in various climates.Several software data mining methods, such as data gathering experiment design, are evaluated and tested to develop occupant individual behavior and group schedule prediction models.Each occupant's unique office appliance electric power consumption data is gathered via wireless smart meters over 5 min.Laptop computers, task lighting, computer monitors, personal fans, chargers, and printers are among the workplace equipment that has been measured.The individual behavior models for each occupant and the group scheduling models are constructed using the electricity-metered data from office appliances.The findings revealed that installing the system led to a 9% reduction in power consumption.
In Sense (2023), the study developed a practical data mining approach using power consumption data from office appliances to understand the passive behavior of occupants in a medium office building.The method achieved an average of 90.29% accuracy in classifying individual behavior instances and a correlation coefficient of 0.94 between predicted group schedules and ground truth.The experiment showed a consistent group occupancy schedule, capturing diversified individual behavior in using office appliances.The study also investigated the impact of occupancy schedules on building HVAC energy consumption across 17 different climate zones, showing significant variations in the buildings under different climate conditions.The findings suggest the significance of developing systems to persuade occupants to change their behavior to reduce plug load energy consumption and the effectiveness of learning actual group schedules during operation to reduce HVAC energy consumption.
In Rashid et al. (2019), the study suggests utilizing Internet-of-Things (IoT) and cognitive IoT (CIoT) to create an energy monitoring system for household appliances.It uses Google Colab as the training server, a Raspberry Pi-powered smart plug as a gateway, and a Matplotlib-based dashboard.With a high accuracy rate of over 80%, the system can read current data from individual home equipment, forecast power bills, and alert customers to unexpected energy consumption.The performance measures include the training score, test score, R2 test, and mean squared error.The study tackles the problem of rising household energy consumption worldwide and in Malaysia, blaming it on the increase in urban population and energy-inefficient lifestyle choices.It describes the ideas behind CIoT and IoT, emphasizing how crucial machine learning is to improving.
According to related work, Table 1 summarizes existing solution comparisons.We observe that wiring every outlet in a legacy property requires established methods that can be costly or time-consuming.Thus, to address the complexity and cost of adding power monitoring solutions to legacy home appliances, our work is designed to offer a solution to these shortcomings of existing methods.

Proposed system
With the tremendous technological progress and development in this era, advanced energy monitoring systems have become extremely important and one of the primary concerns of our time.As a result, it is critical to develop a system that monitors buildingsénergy consumption without replacing their infrastructure to avoid excessive cost and installation complexity.This section presents our proposed centralized smart monitoring system for home appliancesénergy consumption.

Proposed power monitoring system architecture
Our proposed power monitoring system's architecture consists of three layers, namely hardware, software, and reporting, as shown in Fig. 3.The software layer interacts with the hardware layer to collect data, which is then processed and analyzed.The reporting layer acts as the final interface module for users.Both layers can be combined on a single device or separated into two devices based on the user's preference.The paper's focus does not include the reporting layer; however, open-source reporting applications can be found in the Raspberry Pi community.

Hardware layer
To the best of our knowledge, CT sensors are the only existing sensors capable of reading power flow in wires at any point along the wiring path to the device.Additionally, as will be shown later, Arduino contains all the hardware components needed to handle the CT sensor reading.Thus, our system consists of the following hardware: • EmonTx Arduino Shield: EmonTx is used because of its low power consumption when sensing data from multiple CT sensors, optical pulse meters, and multiple onewire temperature sensors (Monitor 2018).EmonTx is a wireless energy monitoring node powered by 5V using a USB connector or AA batteries.Furthermore, it is fully compatible with Arduino IDE.• Raspberry Pi: Raspberry Pi is a low-cost, miniature computer that is as small as a credit card, and it is an open-source ecosystem (Github 2019).Raspberry Pi enables users to develop hardware projects, program for physical projects, automate their homes, and even learn how to program for physical projects.In our work, we use Raspberry Pi to provide a back-end code server to implement the software layer in the proposed system.• ADC: ADC converts analog signal data into a digital signal as the sensors used to measure the current are analog (Incorporated 2017).• CT sensor: A CT sensor clamps around the primary wire to transform the magnetic field into voltage (Explained 2019).
Figure 4 illustrates how our power monitoring system's components interact.

Software layer
Our proposed system utilizes a centralized sensor reading approach, meaning there is no need for individual CT sensors to monitor the energy consumption of each home appliance.Instead, we have developed a detection system that employs two algorithms (Set of Rules and KNN) to identify running appliances from a single source.The collected data is then stored on a Raspberry Pi, which facilitates behavior detection and allows for comparison with similar devices in various locations.Section 4.4 explains in detail the main processes of the software layer.

Proposed system operation
In this section, we explain the operation of our system in the three phases described below. • Step 1: The proposed system is installed at the primary circuit breakers.A CT sensor is attached to each sub-breaker for each area and up to four sub-breakers.Even though the system is divided into up to four CT readers, they are all in the same place, so it is still considered centralized.Figure 5 illustrates the installation of the proposed system with home appliances.• Step 2: The learning process starts when the system prompts users to run each appliance separately to read its power consumption signature.The user is also asked to identify the device's location to be placed in the future.• Step 3: In this step, the system enters the detection process to read the device's current power consumption and attempt to determine which device is now operational (if this device is a TV, Kettle, Cooler, Refrigerator, or Microwave) using the If-Then Rule.
The detection process starts using the If-Then rules engine to identify the running appliance.If the If-Then Rule process cannot detect the running devices, the system will use the KNN algorithm.The latter algorithm works based on finding the nearest value via distance measurement.Finally, if the system cannot detect the device, the user will be asked to manually identify the running appliance to provide feedback to the system.
Fig. 5 Our proposed power monitoring system with details Fig. 6 Proposed System Setup and Components

Proposed system prototype
This section will describe the prototype configuration we used to evaluate our suggested system.The configuration for the prototype was as follows: using an ADC, we connected the Arduino to the intended computing equipment in our two-story house, as shown in Fig. 6. a.As shown in Fig. 6. b, we then wrapped the CT sensors around the main breaker wires in the home.Ultimately, we took individual and group measurements for every device.We used the Arduino IDE program to gather the power consumption readings of household equipment, as shown in Fig. 6. c

Main processes
In our system, Algorithm 1 depicts the data collection process.We require the user to operate each appliance separately during this phase to obtain the power consumption value that will be used in the detection procedure later on (lines 1-4).The algorithm will continuously ask the user to apply the suggested strategy to monitor every device and operate one device at a time, as represented in lines 5-9.

Algorithm 1 Collecting Data Process
The detection procedure is illustrated by Algorithm 2 (lines 1-3), which begins by examining the output of the suggested Algorithm 3.Then, the algorithm will execute the KNN algorithms (as shown on Algorithms 4 and 5) if no value has been identified (lines 4-9).

Algorithm 2 Detection Process
The detection process is the system's heart, without which all this effort is futile.Below, we discuss our three proposed detection methods in detail and provide a brief comparison.

A) Search All Potential Candidates
The in 3 concerns reading the power consumption of device X and adjusting the value if it exceeds 1000 watts.No changes are made if the value is within the acceptable range (lines 1-3).The system is calibrated using a set of adjustments based on Jordan electric plants.In line 4, the algorithm multiplies the value of X with these adjustment percentages and stores them in a variable called Z.The result of Z is then added to X and stored in variable Y (lines 4-5).Next, the calculated value (the sum of the power consumption of two or more devices measured separately) is subtracted from Y. Finally, the minimum distance between all the values is determined (lines 6-13).
Algorithm 4 First 5-KNN Candidates Ignoring the First One

B) First 5-KNN Candidates Ignoring the First One
This method is represented by Algorithm 4 and is used to read the current power consumption of M and store them in list L. If the M value exceeds 1000 watts, the algorithm is applied to find the closest candidate.Otherwise, no changes are made, and the algorithm will find the most immediate value (lines 1 to 4).The system is provided by adjustments to calibrate the reading based on Jordan electric plants.As shown in line 4, the algorithm finds the five minimum distances (lines 5 to 7).Then, it ignores the first closest value and multiplies the other four values with predefined adjustment values.The results are then stored in variable S. K is the sum of S and M (lines 8 to 13).In line 15, the step subtracts each value of from the calculated value and stores it in list R (lines 14 to 16).Finally, the algorithm finds the minimum distance of the values in the list and displays the result (lines 17 to 23).

C) First 5-KNN candidates
This method is represented in Algorithm 5.The point of this method is to read the current power consumption of N and store it in list T; if the value of N is more significant than 1000 watts, then apply the algorithm.Otherwise, no changes are made (lines 1 to 3).First, it finds the five minimum distances, then multiply their actual values with predefined adjustment values and stores them in a variable called F (lines 4 to 6).Then, add each result of F to N and store the result in variable J. Line 13 subtracts J from the calculated value and stores it in E. Finally, find the minimum distance in the list and then display the result (lines 7 to 21).

Performance evaluation and results
This section shows the sample data we obtained during the training phase of several appliances such as Grills, Microwaves, Kettles, etc.Then, we will discuss the results, including the accuracy of each proposed detection algorithm.

Appliance power consumption readings
We collected data using a set of various home appliances to obtain different ranges of power consumption.Especially since electrical devices vary in running time characteristics and internal power transformation, as explained in Sect. 2. We conducted three experiments using different home appliances, as follows: • Experiment 1: This experiment measured the consumption values for rill, Microwave, Kettle, LG Refrigerator, and Hitachi Refrigerator.Each device consumption value running individually is shown in Table 2. • Experiment 2: This experiment measured the Grill, Microwave, Kettle, LG Refrigerator, and hairdryer consumption values.As we noticed, we replaced the Hitachi refrigerator with a hair dryer in this experiment.Table 2 shows the consumption value for the hairdryer running separately.• Experiment 3: This experiment measured the consumption values for TV, Lamp A, Lamp B, Lamp C, and Straightener.Table 3 shows the consumption value for the hairdryer running separately.
As we see in Tables 2, 3, the readings are almost steady, and the devices are constantly consuming the same power over time.Such behavior may produce more accurate results in our proposed system.These results show the power consumption over 10 s using the emonTx sensor readings for the tested appliances.
To ensure that our proposed system is accurate, the reading of the power flow using the CT sensor must be correct.Thus, we conducted a calibration phase for the power consumption reading and the CT sensor based on the characteristics of electricity in Jordan.To achieve the best accuracy of the CT sensor reading for devices using electricity in Jordan, we executed multiple experiment trials to find the optimal values to be used in the configuration of the EmonTx device.Firstly, we discovered that using 220V instead of 230V for the value of Vrms in the Arduino sketch was optimal.Secondly, we changed the value of phase shift from 1.7 to lower amounts (1.6, 1.5, and 1.4) and verified the accuracy of the desired change through trial.The results of all calibrations performed are presented in the following subsection.

Phase shift calibration
The following results show the CT sensor readings using 1.4, 1.5, 1.6, and 1.7 phase shifts.We measured the power consumption of two devices running separately, a Microwave and a Kettle.Then, we measured the power consumption of the two devices running together to detect the differences between the calculated value of consumption using the single read of each device and the actual value (the real value is the same as the sensor reading) from the CT sensor while the two devices were running at the same time.Table 4 shows the Microwave and Kettle consumption separately using phase shifts equal to 1.7, 1.4, 1.5, and 1.6.Table 5 shows the combination of Microwave and Kettle using phase shift equal to 1.7 and 1.4.Table 6 presents the combination of Microwave and Kettle using phase shifts equal to 1.5 and 1.6.
To summarize the full results of the previous calibration, Table 7 shows the summary of all tested phase shift values.The 1.6 phase shift leads to the slightest variance between the calculated and actual values.The reading devices will be set to a 1.6 phase change for a low variance for the rest of our proposed work.

Set of rules algorithm results
In this algorithm, the system first reads the power consumption for each device.Then, it begins to build tables using the values calculated from the data of each individual read by summing the values of all possible combinations for those devices.The results are stored for future comparison with new cases.The system will then begin to apply the  predefined Set of Rules.As shown in Table 8, the Set of Rules achieved an accuracy of 16.1 percent, which is five correct matches out of 31.
Figure 7 shows that most devices running together produce less power consumption than expected.Such performance showed unacceptable results in overall accuracy.The achieved accuracy using the Set of Rules technique in experiment no. 2 is 5 of 31, and in experiment no. 3 is 6 of 31.Such performance also showed no excellent results for the later experiments.

KNN algorithm results
The accuracy of the Set of Rules algorithm was 5 of 31, with the detection failure being about 26 of 31.As a result, the following detection step was required to achieve an acceptable accuracy percentage.We used a regression KNN algorithm with the Euclidean function without a validation technique, as we do not have prior or long datasets.Also, the calculated value is always more significant than the actual value, so there is no need to perform an absolute function.As shown in Table 8, the KNN algorithm achieved 87.1% accuracy, 27 correct matches out of 31 in experiment no. 1.
Figure 8 shows that some devices running together produce less power consumption than expected.Such performance increased the accuracy of the previous algorithm.However, the results on the overall accuracy of the corresponding experiment still do not yield acceptable behavior.We found that the KNN achieved an accuracy of 23 out of 31 in experiment no. 2, which has an accuracy of 74.2%.Also, we found that the KNN attained an accuracy of 25 of 31 in experiment no. 3, which has an accuracy of 80.6%.
However, further enhancement is desired to achieve an acceptable system.Thus, the following section discusses the suggested modifications to the previously proposed algorithms and the obtained accuracy in detail.

Enhancing the reading accuracy
This section illustrates the results of the three methods we used to enhance previous algorithms' reading accuracy.Table 8 shows that the accuracy of All candidates achieved an accuracy of 31 out of 31 in experiment no. 1, which has an accuracy of 100%.
As shown in Fig. 9, most devices running together match the calculated value with the actual reading value.Such performance showed promising results regarding the overall accuracy of the corresponding experiment.We did the same for experiment no. 2, with an accuracy of 24 out of 31, which is 77.4%.In experiment no. 3, we did not apply the method because the sensor reading was less than 1000 watts.So, the accuracy will remain at 25 out of 31 as before.
1.All candidates Table 9 shows the adjustment we use in this proposed method.This table has been generated using trial-and-error experiments and has the optimal values.Table 10 shows sample results using experiment no. 1.The attribute distance is the result of subtracting the calculated values from the sensor reading values.2. First Five KNN candidates except the first Table 11 shows sample data results of experiment no. 1, highlighting the distance before and after applying the enhancements.This proposed enhancement achieved an accuracy of 29 out of 31, 93.5%.As shown in Fig. 10, most devices have less than a slight difference between the actual and calculated values.Such performance showed promising results regarding the overall accuracy of the corresponding experiment.In experiment no. 2, the accuracy was 23 out of 31, and it enhanced up to 26 out of 31, which is improved up to 83.9%.Regarding experiment no. 3, we did not apply the method to it because the sensor reading was less than 1000 watts.We mentioned in the flowchart of this method that if the current sensor reading was less than 1000, no changes were made.So, the accuracy will remain at 25 out of 31.Table 13 shows sample data results of experiment no. 1, highlighting the distance before and after applying the enhancements.This proposed enhancement achieved 31 out of 31 correct matches with 100% accuracy.As shown in Fig. 11, most devices have less than a slight difference between the actual and calculated values.Such performance showed promising results regarding the overall accuracy of the corresponding experiment.
In experiment no. 2, the proposed method enhanced to 29 out of 31 correct matches; the accuracy is 93.5%.Regarding experiment no. 3, we did not apply the process because the current sensor reading was less than 1000 watts, so the accuracy will remain 25 out of 31.

Summary of all methods
In Table 14, we show the summary results of the accuracy of all proposed methods.The results of the first 5-KNN candidates' method showed the best accuracy.

Proposed system limitations
The proposed system was implemented with certain restrictions and presumptions.The model was only tested on electrical connectors in homes with a maximum of four subbreakers and five devices per sub-breaker.Adding a new appliance also necessitates a learning curve for the system.

Conclusion and remarks
In this paper, we propose a mentoring system that can detect the power consumption of legacy home appliances without requiring an infrastructure upgrade or a reading sensor on each appliance.The centralized design of our system reduces the complexity and cost of power monitoring systems and provides accurate power usage.The proposed system  comprises hardware and software layers and employs a predefined set of rules and K Nearest Neighbors (KNN) AI algorithms.After investigating various calibration techniques and adjusting sensor readings based on Jordan's electricity to be more efficient, the calibration process determined that using a 1.6 phase shift produces the best results.However, we discovered that when devices A and B run simultaneously, they do not consume the combined total of their power consumption due to errors in reading power usage and other electrical factors.We tested our proposed system using three experimental scenarios to address this issue.The Set of Rules achieved an accuracy of 16.1%, 16.1%, and 19.4% in the experiments, while the KNN algorithm achieved 87.1%, 74.2%, and 80.6%.Finally, we found that the detection process can be automated using KNN techniques, but more experiments are needed to verify the proposed technique's effectiveness.The proposed technology shows promise in measuring power usage from a single source, negating the need for sensors at each appliance endpoint and significantly reducing labor and expense.Such a technique can be helpful for older homes where installing wire would be challenging or impossible.This study can be used to improve detection algorithms for future development.In future work, we intend to employ user feedback to enhance the precision of our monitoring system, thus improving its overall effectiveness.In addition, a forthcoming application will be created to elucidate user engagement with recognized devices and optimize power consumption statistics.This application will guide consumers on effectively utilizing each appliance and accurately assessing its energy usage by implementing a recommender system.Furthermore, using data gathered from various sources, the application can offer a global understanding of power usage trends that could aid power plants in efficiently managing their resources.

Fig. 3
Fig. 3 Proposed power monitoring system architecture

Fig. 4
Fig. 4 Proposed power monitoring system components

Fig. 7
Fig. 7 Set of Rules Power Differences for Experiment no. 1

Fig. 9
Fig. 9 All candidates Power Differences in Experiment no. 1

Fig. 10
Fig. 10 First 5-KNN candidates except for first candidate power differences in Experiment no. 1

Fig. 11
Fig. 11 Distances before and after for First 5-KNN candidates in Experiment no. 1

Table 1
Summary of the previous techniques using AI

Table 2
Power Consumption in Watt for devices of experiments no. 1 and no. 2

Table 3
Power Consumption in Watt for devices of experiment no. 3

Table 5
Combinations of Microwave + Kettle at phase shift 1.7 and 1.4

Table 6
Combinations of Microwave and Kettle at phase shift 1.5 and 1.6

Table 7
Summary of the phase shift percentagesThe value in bold is the one chosen for the proposed work

Table 8
Set of Rules, KNN, and All candidates in Experiment No. 1

Table 9
Adjustment percentages for every 250 Watts 3. First 5-KNN candidatesTable 12 shows the adjustment table we use in this proposed algorithm.This table has been generated using trial-and-error experiments and has the optimal values.

Table 10
Experiment no. 1 sample results of First 5-KNN candidates Ignoring the first candidate

Table 11
Distances before and after for First 5-KNN candidates except for the first candidate in Experiment no. 1. (K=1 is True)

Table 12
Adjustment percentages of distanceś range

Table 13
Applying First 5-KNN candidates method on a sample data of experiment no. 1 (K=2 is True) AI Artificial intelligence, ADC Analog-to-Digital Converters, CT Current Transformer, KNN K Nearest Neighbours, ML Machine Learning

Table 14
Summary results of the accuracy of all proposed methods