Scientific Paper / Artículo Científico


pISSN: 1390-650X / eISSN: 1390-860X









Pilicita-Garrido, A. E.1,*, Cevallos-Duque, D. C.1




The present work focused on the design and implementation of an integral system to monitor, locally and remotely, the electrical consumption generated in the different environments within a home. In this way, it was considered the creation of a prototype capable of measuring the current consumed every minute, by the different loads connected to the electrical network in different environments of a home. A wireless network based on Zigbee technology was used to transmit the data from the prototypes to a server that is responsible for receiving the data when there is a consumption of electricity in the home. The data is processed and subsequently stored in a database. Finally, a web page was implemented that graphically shows a history of electricity consumption, which the user can access locally or remotely and quickly and practically monitor the electricity consumption within the home. For the development

of this integral system, the operation of current sensors, voltage dividers, Xbee modules was analyzed, and the application was developed with the use of Open Source software such as Java, MySQL and PHP. Currently, the user only has the monthly readings, delivered by the electricity service provider, ignoring the reality about critical environments within the home. Through the proposed system. The user can know in any place and at any time the electricity consumption generated in specific areas, and thus take appropriate energy saving measures.


El presente trabajo se enfocó en el diseño e implementación de un sistema integral para monitorear local y remotamente, el consumo eléctrico generado en los diferentes ambientes dentro de un hogar. De esta manera, se consideró la creación de un prototipo capaz de medir la corriente consumida cada minuto, por las diferentes cargas conectadas a la red eléctrica en los ambientes de un hogar. Se utilizó una red inalámbrica basada en la tecnología Zigbee para la transmisión de los datos desde los prototipos hasta un servidor que se encarga de recibir los datos cuando exista un consumo de electricidad en el hogar. Los datos son procesados y posteriormente almacenados en una base de datos. Finalmente, se implementó una página web que muestra gráficamente un historial del consumo eléctrico, a la que el usuario puede acceder local o remotamente y monitorear de forma rápida y práctica el consumo eléctrico en el hogar. Para el desarrollo de este sistema integral se analizó el funcionamiento de sensores de corriente, divisores de voltaje, módulos Xbee, y se desarrolló la aplicación con el uso de software Open Source como Java, MySQL y PHP. Actualmente, el usuario cuenta tan solo con las lecturas mensuales, entregadas por el proveedor de servicio de electricidad, desconociendo la realidad sobre los ambientes críticos dentro de su casa. Mediante el sistema propuesto, el usuario podrá conocer en todo lugar y en cualquier momento el consumo eléctrico generado en áreas específicas, y así tomar medidas oportunas de ahorro energético.




Keywords: Electricity, Electronic, Software Computer


Palabras clave: electricidad, electrónica, software,

programación informática

1,* Facultad de Ingeniería Eléctrica y Electrónica, Universidad de las Fuerzas Armadas, Ecuador. Corresponding author:


Received: 13-01-2019, accepted after review: 30-04-2019

Suggested citation: Pilicita-Garrido, A. E. and Cevallos-Duque, D. C. (2019). «Technological Innovation of a Comprehensive System to Monitor Electric Consumption». Ingenius. N.° 22, (july-december). pp. 9-16. doi:





1.   Introduction

The electrical distribution networks carry the energy through high-voltage lines to the consumption sites: factories, businesses, hotels, particular households, among others. There is no doubt about the high dependence of actual societies and most human daily activities, both domestic and industrial, on energy sources. Appliances such as lamps, recorders, sound systems, irons, TVs and computers, among others, are used every day. All them require electric energy to operate, thus becoming the main source to drive equipment in general [1].

The energy systems worldwide have been called inefficient, highly contaminant and unsustainable [2]. Due to this, governments of different countries search for system improvement.

It is estimated that due to the future demographic growth, very big cities will be created with more electric appliances required for the development of technology, thus implying a significant energy consumption; simply, the network will not be able to supply the energy demanded [2, 3]. On the other hand, the environmental impact will be greater, the energy distribution needs to evolve and expanding the energy distribution network is very costly; it is sought to generate consciousness about energy saving [4].

Final consumers should be aware of the positive economic and environmental effects of the rational use of electricity. The regional learning curve improves every day, regarding the knowledge about responsible consumption [4]. In order to face this requirement, a tool was created for consumers to know the amount of electricity consumed, when it is being used and which area of the household has the greater consumption. According to the National Institute of Statistics and Census (Instituto Nacional de Estadísticas y Censos, INEC), 62 % of the Ecuadorian population considers as very important to save energy in their households [5].

The project to develop the integral system of electric consumption in four areas of a household, comprises four stages. It is emphasized to use Open Source software for the developing the different codes.


-       Prototype.A device capable of measuring the electric consumption was designed and implemented. The prototypes were placed in four electric circuits inside the household, to measure the flow of current of the different appliances located in each area.


-       Data transmission. Xbee devices, which operate under Zigbee technology, were utilized to transmit the data in a wireless manner. A communication network with wye topology was established between the Xbee devices, which were placed in the prototypes located in the different areas. A coordinator established the communication with each of them.


-       Data processing and storage. The data transmitted by the wireless network are received by the coordinator, which establishes the communication using a program developed in Java,to process the data and store the information in an appropriate database; MySQL was utilized for the project.

-       Remote monitoring. A web application was designed using PHP language, which enables the user to remotely monitor the electric consumption of the household. A historical is graphically displayed to the user.


2.   Design and implementation of the prototype


A device was designed to measure the electric energy consumption. Such device provides an exact measurement of the current consumed by the different loads connected to the electric network. For designing the device, it is assumed that the household consumes only active power, i.e. all the connected load is considered resistive.

The measurements of the magnitudes correspond to peak values; for calculating the power it is necessary to determine that the values are in a same wave, and then transform them to RMS values. The prototype was developed with the components shown in the block diagram of Figure 1.



Figure 1. Block Diagram of the prototype.


2.1.     Current sensor


The sensor chosen for the design was the Hall effect ACS712, since it is easy to use, has a low price and small error range [6].

The selected current sensor should verify the maximum current that can be consumed in each electrical outlet where the device is connected, such that it can carry out the measurement in an extreme case without being damaged. Since the maximum consumption of electronic appliances is approximately 1100 Watts [7], the current sensor has to support 10 Amperes maximum. It was found in the technical sheet of this sensor, that the optimal measuring range of this device is 20 Amperes [6]. Therefore, it can be concluded that the sensor will be able to carry out the measurements without being damaged by excessive current. The sensor delivers an output voltage whose magnitude is proportional to the measured current, with a sensitivity of 0.1 [V/A] [6].


2.2.     Voltage divisor


Since the voltage of the line is not constant, it should be measured. For this purpose, a voltage divisor with a 100:1 relation is designed to interpret it [8].

This stage constantly measures the value of the voltage. Although the electrical network in Ecuador delivers an AC nominal voltage of 110 Volts [5], this value is not constant due to distribution issues. Therefore, the power cannot be




calculated using this nominal value, because it is not necessarily the real value. As a consequence, it is required to measure this voltage.

This is carried out using a voltage divisor, which is fed with the line voltage, to acquire a signal with a magnitude of voltage that does not damage the microcontroller (over voltage). In this case, the implemented equivalence is 100 AC Volts to 1 AC Volt, to proportionally vary the output voltage in response to increases or decreases in the line voltage.


2.3.    Zero crossing


In order to have an exact measurement of the consumed current, it is necessary to detect the start of the cycle of the signal [9]. There is a simple method to detect the zero crossing of the alternate current wave, which is useful for measurements at 50 Hz, 60 Hz, and 400 Hz, in systems with voltages of hundreds of Volts. Such method requires a resistance as the unique external component, which makes it more reliable tan other methods that require voluminous condensers or costly transformers. Detecting the zero crossing of the signal was necessary to determine which values of voltage and current should be multiplied in the same cycle. In consists of connecting a resistance of 5M [Ω] in series with the tension line, and input such signal at the interruption of the PIC 12F1840. This is used to know when a cycle ends [10].


2.4.    Microcontroller


The microcontroller selected for the prototype was the PIC 12F1840, which has two analog inputs, one for serial output, a 10 bit analog-to-digital converter (ADC), an internal oscillator of 32 MHz and 4 KB of flash memory. These specifications comply with the parameters of the design of the prototype [11].

The program in the microcontroller samples each wave, and determines its peak value with the 10 bits ADC; thus the peak value of each magnitude varies in the range from 0 to 1023. These values are then converted to RMS values and averaged along a one-minute period. At last, it waits until the monitoring system of electric consumption establishes the communication to send the data, controlling the flow using letters of the alphabet (ASCII code) [10]. Figure 2 shows the petitions and responses generated from the prototypes to the code developed in Java.



Figure 2. Flow control between the connection of the client of the monitoring system and the prototype measurement system.

2.5.     Xbee module


The selected Xbee module belongs to series 1, because the area to be covered is smaller than 30 meters. In addition, the cost is smaller than a series 2 Xbee [12].

Once the microcontroller has captured the information and has sent it through the USATR output pins, the Xbee 1 module is in charge of receiving this information and transmitting it to the coordinating Xbee module [13]. Such coordinator is connected to an Xbee USB explorer which enables the communication with the PC that has the server application that will store and process the obtained data in a database.


2.6.     Source


It was designed because it is necessary for feeding the microcontroller, the Xbee module and the current sensor. It consists of a 120 [V] : 12 [V] AC transformer, and this signal is further rectified with a diode and a capacitor; a 3,6 [V] DC limiting diode is connected in parallel with the capacitor [10].


2.7. Calibration of the prototypes


The microcontroller reads the values in a range from 0 to 1023. The following formulas are applied to transform them to RMS values (Table 1) [10]:


Table 1. Values for the formula of the voltage factor



- Nominal voltage factor








- Nominal current factor








3.    Data transmission


As it was detailed previously, the Zigbee technology was employed. This technology operates under the network standard 802.15.4, required for this short range wireless project (less than 30 meters) [14].

The wireless network is constituted by four Xbee modules, which are known as final devices in a network. There is a necessarily a coordinator Xbee module, which is connected to the






computer via an USB port [12], and is in charge of synchronizing all the final devices and receiving the data generated y each prototype. At last, it delivers the data to the code developed in Java. Figure 3 illustrates a block diagram of the data transmission process.



Figure 3. Block diagram of the data transmission process.


3.1.    Transmission Mode


The transmission mode of the Xbee modules (coordinator-final device) represents a transparent connection, i.e. basically all that goes through the UART port is sent to the desired module, and what is received by the module is returned through the same UART port [12].

In order to establish the communication, the Xbee modules must belong to the same PAN ID network and to the same channel; according to the IEEE 802.15.4 protocol, 16 channels are available [15].

The configuration of addresses is carried out in the following manner:


-       Xbee final device: the address of the Xbee coordinator module is configured in the destination address.


-      Xbee coordinador: A «0» is configured in the destination addresses, which corresponds to receiving all the data from any Xbee final device module [16].


4.    Data processing and storage


For processing the data delivered by the coordinator Xbee, a program called (Electric consumption) was developed in Java. This program establishes a serial communication to obtain the data of electric consumption, then processes them, and finally stores them in the MySQL database manager. Figure 4 illustrates the next stage for data processing.



Figure 4. Data processing.

4.1.     Processing


The control of flow was established to enable the communication between the computer and the remaining prototypes, determining the beginning and end of a data transmission. Each prototype was identified to receive the voltage and current data that will be used to calculate the electric consumption in the four areas of the household. The control of flow is carried out

every minute, taking into account the following steps:


-       To initiate the communication and determine which electric consumption prototype is on, a different letter is sent to each device waiting for a response.


-       A response is received with the letter that identifies the Xbee final device associated with the measuring prototype, indicating that the petition has been received and, therefore, the electric consumption is being measured.


-       Another character is sent to request the voltage and current values.


-      The voltage and current values are received.


Then, the power is calculated at every minute using the voltage and current values delivered by the coordinating device. After an hour elapses, the electric consumption of every appliance is calculated as the average of the 60 available samples. The program was developed in Java; Table 2 contains the classes and the function of each of them [10].


Table 2. Structure of the program in Java





4.2.    Storage


A database that operates with the MariaDB Database Managing System was created to store the data of electric consumption. It was defined using the software Power Designer, working from the conceptual, logical and physical modeling, for the storage of information [17]. Figure 5 shows the structure of the database according to the conceptual model. There is the tabla

usuario, which stores the personal information of the final clients, them to register and further access the system and visualize the electric consumption.

There is the tabla dispositivo to store information of the electric consumption generated every hour. At last, there is thetabla prueba which enables the verification of the correct storage of data per minute.

The values of power calculated every minute are averaged to calculate the electric consumption of the appliances after every hour. Then, after 60 samples has been automatically taken, the connection with the remote database is opened, and the data are inserted from the application developed in Java using SQL sentences. The prototype sends the information, the time, date, voltage, current and power [10].



Figure 5. Conceptual model of the DB.


5.    Remote monitoring


A web site was developed for the final users or clients to remotely access via Internet and visualize the data generated in their household, as illustrated in Figure 6.



Figure 6. Access to a web site from a client.

The web application enables the communication through the Internet, with the server that houses the web site [18]. The electric consumption can be checked by final device or by entered dates, and it is also possible to eliminate historic data of the electric consumption.

The web sites were designed in DreamWeaver and developed in the language HTML y PHP. They include information, both text and images, about the energy saving in the household, and visual material, such as dynamic graphs that represent the electric consumption of the appliances in the household, is also available.

The structure of the web site developed can be visualized in Figure 7.



6.   Tests


Once the integral system for measuring the electric consumption was finalized, tests were carried out to verify a correct delivery of voltage by the source, and also the acquisition and sending of data.

It should be taken into account that for obtaining the value of consumed power of the load connected to a particular prototype, the current consumed by the prototype (38 [mA]) should be subtracted from the magnitude of the current, and the result multiplied by the line voltage [10].

Afterwards, tests with the designed prototype were carried out, as shown in Figure 8.



Figure 8. Prototype for measuring the electric consumption.


Each prototype has been distributed in the 4 main areas of a standard household, namely a bedroom, a bathroom, the kitchen and the social section. The distribution of the devices can be observed in Figure 9.












Figure 9. Distribution of measuring devices in a standard household.


Images of the consumption of electric energy detected by prototype 1, are shown in what follows. Figure 10 displays the result obtained using the application generated in Java [10].



Figure 10. Obtained values of voltage and current consumed by the laptop in the monitoring system.


The multimeter shown in Figure 11 was used to verify these values, and validate the real-time measurements with the values transmitted to the application and further stored.



Figure 11. Measured values of voltage and current consumed.


6.1.    Measurement tests


Various measurement tests were carried out, with the purpose of calibrating the devices, verifying the data obtained by the systems that measure and monitor the electric consumption and, besides, reducing the measurement errors that may exist [10].


Table 3. Error la potencia medida y la obtenida de los prototipos.



Table 3 shows the error percentage between the magnitudes measured with the multimeter, and the obtained with the developed integral system of electric consumption. Considering that the system calculates the average of the data collected every minute, while the multimeter registers instantaneous values, the errors are in an acceptable range of operation which indicates accuracy for the system in general.


-       Data stored per minute


The data are stored in the database of the system for monitoring the electric consumption. Figure 12 illustrates the collection of data per minute of the four prototypes.



Figure 12. Data uploaded in the Table DATOS of the database true_electricidad.


6.2.     Test in contrast with the electric meter


In these tests, the data considered included values of the power consumed in the household for a period of 5 hours, calculated by the system for monitoring the electric consumption. The purpose was to compare these values with the registered by the electric meter [10].

The monitoring was initiated at 10:52 and ended at 15:42, after a total of 4 hours and 50 minutes. The electric meter had initial and final consumptions of 32571 [kWh] and 32576 [kWh], respectively, i.e. in such interval 5 [kWh] were approximately consumed. The monitoring system registered a consumption of 5,755 [kWh] during that day, which indicates that the values provided by the system are similar to the values considered by the electric service provider [10].


7.    Conclusions


It is important to make optimal use of the electric energy in the household, generating policies, plans and projects that promote the efficient use of electric energy. For this reason, the project informs about the electric consumption in the household, to be aware of the excesses, and start to save energy. For future applications of home automation, the system may be expanded with a module that remotely controls the appliances to maintain electric efficiency in the household.






The percentage between the measured and obtained values of electric consumption in the prototypes, is in an acceptable range of operation, smaller than 2 %, considering that the monitoring system averages the data obtained every minute, while the multimeter measures instantaneous values. However, the error diminishes with higher loads and the obtained data tend to coincide with the values considered by the electric service


The electric meters have to constantly evolve according to the needs of the people. Therefore it is necessary to extend the project, with the purpose of developing a future implementation at a macro level, i.e. monitor the total electric consumption of each household in the country, and provide information of vital interest for the electric service provider.

The project displays a history of the power consumption in the household, which can be used to estimate the daily/monthly consumption capacity. In this way, renewables energies, such as solar panels and eolic turbines among others, may be dimensioned and implemented to fulfill the demand of each household and establish an efficient consumption.




[1] ENDESA. (2014) La red eléctrica. Endesa Educa. [Online]. Available:


[2] C. Vargas, “Sobre la problemática energética,” Comunicación.


[3] E. Menéndez Pérez, Las energías renovables: un enfoque político-ecológico, L. de la catarata, Ed., 1997. [Online]. Available:


[4] F. Estenssoro Saavedra, J. M. Zolezzi Cid, M. Tokman Ramos, R. Núñez Muñoz, E. Águila Mancilla, R. Sohr Biss, C. Parker Gumucio, J. Zanelli, A. Cubillos Meza, J. A. Perrotta, J. Griffiths Spielman, I. Witker, and O. Sunkel, Energía y medio ambiente. Una ecuación difícil para América Latina : los desafíos del crecimiento y desarrollo en el contexto del cambio climático, IDEA-USACH, Ed. Colección Idea, 2011. [Online]. Available:


[5] INEC, “Módulo de información ambiental en hogares,” Instituto Nacional de Estadísticas y Censos, Ecuador., Tech. Rep., 2017. [Online]. Available:


[6] M. J. Mnati, A. Van den Bossche, and R. F. Chisab, “A smart voltage and current monitoring system for three phase inverters using an android smartphone application,” Sensors,

     vol. 17, no. 4, 2017. [Online]. Available:



[7] NOAO, “Guía para el cálculo de energía,” National Optical Astronomy Observatory, Tech. Rep., 2016. [Online]. Available:


[8] W. McAllister. (2019) Divisor de voltaje. Khan Academy.            [Online]. Available: http: //


[9] L. Burwell. (2019) ?’qué es un detector de cruce por cero? techlandia.


[10] A. Pilicita and D. Cevallos, Diseño E Implementación De Un Prototipo Para El Monitoreo Remoto Del Consumo Eléctrico a través de una red Zigbee con médulos Xbee, S.-E. Universidad de las Fuerzas Armadas-ESPE, Ed. Proyecto de titulación, 2014.


[11] MICROCHIP, “Pic12(l)f1840 data sheet,” Microchip Technology Inc., Tech. Rep., 2019. [Online]. Available:


[12] DIGI, “Digi xbee®s2c 802.15.4 rf modules,” Digi International Inc., Tech. Rep., 2019. [Online]. Available:


[13] ZOLL, Manual del usuario de la unidad X Series ®, ZOLL Medical Corporation, 2016. [Online]. Available:


[14] I. Vidri Salgado. (2011) Zigbee y sus aplicaciones. Escuela Técnica Superior de Ingeniería-ICAI. Universidad Pontificia Comillas. [Online]. Available:


[15] IEEE, IEEE 802.15.4-2015 - IEEE Standard for Low-Rate Wireless Networks, IEEE standards association Std., 2015. [Online]. Available:


[16] Interactivo, Xbee y arduino, 2016. [Online]. Available:


[17] A. Lozada. Las etapas del diseño de una correcta base de datos relacional. EDteam. [Online]. Available:



[18] Hostname. (2014) Servidor web. Servicio Informáticos Hostname Limitada. [Online]. Available: