Electricity consumption meter for the White Tariff and feasibility study of tariff migration to residence

— Until the end of 2019, only consumers who had a monthly average above 250 kWh/- month could join the White Tariff in Brazil, however, since January 1, 2020, there is no minimum consumption limitation required. This modality has different tariff values according to the consumption time range, which can bring savings of up to 14.17% in the electric bill at the end of the month if the consumer uses the energy service only during off-peak hours, and due to this possible economy, an increase in the number of customers is expected. However, it is common to question whether it is worth migrating, which depends on each consumption profile, since this modality can also increase the value of the monthly bill by up to 82.14%, if the consumer consumes energy only at peak hours, comparing the tariff values applied by Copel in June 2019. Using a typical residential energy consumption profile, the average is that the White Tariff is around 1.20% more expensive than the Conventional Tariff at the end of the month. An electric energy meter was developed for the White Tariff; and its main objective is to indicate, at the end of a period, which method is more economically advantageous, the White Tariff or the Conventional Tariff, in a residence.. The meter was developed based on the IC ADE7753 microcontroller; and it can be used to perform several measurements, including the active power. ESP82266 NodeMCU was also used to communicate with the IC, carry out the necessary calculations, and send the data to the IoT ThingSpeak platform, where it is possible to remotely monitor the results. The meter was developed to perform the analysis in a home serviced by a single-phase voltage of 127 V, where it was calibrated based on the PZEM-022 meter. In addition to the meter measuring active power, for the calculation of consumption, it also measures the power factor. The meter was on for 7 days in this residence, where residents maintained their common consumption routines. At the end of this period, the result was that the value of the White Tariff was about 0.81% above the value of the Conventional Tariff, indicating that for this residential unit,


I. INTRODUCTION
LECTRICITY is an indispensable service in almost anywhere around the world today. It is difficult to think about how to survive without this resource, which is already consolidated in the daily lives of the population. Among the different applications, we can mention the lighting, temperature control (electric shower, air conditioning, fans, etc.), entertainment (TV, computer, cell phone, electronic games, etc.) among so many everyday equipment, such as household appliances in general (refrigerator, vacuum cleaner, blender, etc.) are just some examples of applications/equipment that the population uses daily.
The National Electric Energy Agency (ANEEL) defines that the electric energy supplied by the concessionaire to homes, commerce and industry is charged to cover operating and maintenance costs, in addition to being a way of maintaining the service provided with quality and continuity, including covering future investments and research to improve the service provided [1].
Until recently, in 2018, there was only a single mode of charging electricity for customers served with low voltage in Brazil, which is called the Conventional Tariff. With the increase in demand in consumption and the increase in selfgeneration of energy, it was necessary to create an option for customers, in which it could bring savings for them and, concurrently, shift demand to off-peak hours. Then, in 2018, a new pricing model was launched in the Brazilian market, called the White Tariff.
The White Tariff is a type of tariff for residential and commercial consumers, as long as they are in ANEEL group B, which takes into account the time and day of consumption, unlike the Conventional Tariff, in which the tariff is fixed for any day of the week and anytime [2].
As the White Tariff is a recent form of charging in Brazil, many consumers may not even have heard of this option. Parallel to this, it can be said that it is common for a large part of the population not to know details of their consumption profile. On the other hand, many may not even know how their consumption is quantified. When there is knowledge of different forms of tariffs, it is understandable that there is a desire to know how much is being spent on electricity at the current tariff and how much would be spent if you migrate to the White Tariff. Currently, the common thing is to follow the flowchart shown in Fig. 1.
The consumer has two options for verifying the feasibility of migration. The first is to conduct a simulation of consumption on the power distribution company website and obtain an approximate result. The other option is for the consumer to request a migration to the White Tariff and stay for a period at that tariff. After some time, it will check if it was worthwhile to migrate. If not, he will end up having a loss.
Based on this, the development of equipment that allows consumption monitoring and profile analysis can provide support for choosing the most advantageous tariff. This is the objective of this work, to develop a single-phase electricity meter to perform the analysis of the consumption profile in a residence and then verify the feasibility of migrating from the Conventional to the White Tariff.

II. WHITE TARIFF MODE
Created in 2018 in Brazil, it is an alternative option for the residential consumer to be charged for electricity consumption.
This charging method aims to encourage consumers to shift their consumption to alternative times, which do not coincide with the highest consumption demand (also called rush hour or peak consumption time), thus reducing the amount of energy generated and distributed by the concessionaire at certain times. This reduction (better hourly distribution of consumption) allows better use of the infrastructure of the electric network, so reducing installation and investment costs, and thus providing a cost reduction for the consumer too [3].
In 2019, only consumers who had an annual monthly average above 250 kWh / month, could join this pricing model. Now, since January 1, 2020, there is no minimum consumption limitation required [3]. Therefore, the number of consumers who will be able to migrate to the White Tariff will increase, thus, there may be a greater demand to know if it is worthwhile or not to migrate to this type of tariff. Table I shows the relation of the White Tariff bands, together with the price comparison in percentage compared 1 to the Conventional Tariff, on working days (from Monday to Friday). On weekends and national holidays, the whole day is considered off-peak hours.
As shown in Table I, where the White Tariff is around 82.14% more expensive than the Conventional Tariff at peak times, it is in the consumer's interest to know on the monthly average what the difference between these tariffs would be. So, we sought to know what is the typical profile of energy consumption in a home.
The blue line in Fig. 2 illustrates the typical profile of residential electricity consumption on working days, in p.u. 2 based on studies by the EPE -(Energy Research Company) in March 2020. The orange line indicates the typical profile, preceding the peak in three hours, while the gray line is with the peak succeeding in three hours.
Based on these typical profiles, a cost comparison was made between the tariffs, considering this profile for all days of the week. With the typical profile (blue line), the White Tariff would be 1.20% more expensive than the Conventional Tariff. Already preceding the peak by three hours (orange line), the White Tariff would be 0.04% cheaper. Finally, succeeding the peak in three hours (gray line), the White Tariff would be 3.37% cheaper than the Conventional Tariff.
This typical consumption profile is representative of the profile of most electricity consumers in Brazil since the  majority of electricity consumers in Brazil have similar daily routine (working hours, school, rest, etc.). However, some have the possibility of readjusting their way of life (different working hours, school, and especially bathing hours) and may leave this typical profile and move most of their consumption to off-peak hours. There is then a consumption adaptation for the White Tariff.

III. MEASUREMENT OF ELECTRICITY CONSUMPTION
To measure electricity consumption, two quantities are required, the current and the electrical voltage.
The product between the effective current ( ) and the effective voltage ( ) results in the apparent power (S), as shown in (1). Its unit is the VA (Volt-Ampere).
The consumption of residential electrical energy is measured by active power (P). This power takes into account the lag between the current and voltage signal, which is given by (2), in which the power factor (PF) is used. Its unit is W (Watts).
The power factor can be calculated by (3).

= (3)
With active power, it is then possible to measure consumption. Electricity consumption is the product of the active power in kW for the consumption time ∆ in hours, then having the unit kWh (Kilowatt-hour), as shown in (4).

IV. ELECTRICITY METERS
The most well-known electricity meters on the market today can be broadly divided into three categorie: electromechanical, electronic, and intelligent.
Electromechanical meters were the first to be used on the market. They operate based on opposing voltage and current coils, which generate an electromagnetic field, causing a disk to be rotated as this field varies. This phenomenon is called electromagnetic induction. Registers are attached to the disk to show how much energy has been consumed [5].
Electronic meters came to replace electromechanical meters. They have greater precision and measurement accuracy. They work with the use of two transducers, voltage and current. The voltage and current signals pass through their respective transducers and are multiplied, obtaining the power. The power is then integrated, generating consumption and then being stored in the registers [6].
Some electronic meters have a connection to the internet network, where it is then possible to check consumption remotely, eliminating the labor of the reader [7]. Some are still bidirectional, with the possibility of measuring both the energy consumed and the energy injected into the power grid in which they are used in places where there is the use of on grid systems, that is, where there is generation of local electricity.
With the advancement of technology, smart meters emerged, which are nothing more than electronic meters with connection to the internet network and the possibility of making cuts and reclosing remotely. These meters can also measure various quantities such as energy, active, reactive power, maximum power demand, voltage, current, and PF [8].
With smart meters, in addition to the advantage that there is no need for an employee to travel to the location and read, cut, and rewire, there can be flexible tariff changes, such as the White Tariff and the Conventional Tariff, without the need to change the equipment. In addition, the customer can monitor their consumption remotely, which can generate greater control over consumption and consequently savings at the end of the month.

V. MATERIALS AND METHODS
The starting point for the development of the electricity meter was to define how this measurement would be carried out. After that, it was desired to develop a way to visualize this result to verify the feasibility of migration to the White Tariff.
In the case of an electric energy meter aimed at the White Tariff, the first fundamental requirement is that it measures the active power (power which is measured by the energy concessionaire), so that billing is done. It is also desirable to obtain the power factor at the residence, for information purposes only, as it is not necessary for measurement in the White Tariff. Fig. 3 shows the basic structure of the project.
To perform the power measurement, an integrated circuit called ADE7753 was used. It is a single-phase multifunctional measuring integrated circuit. There are two pairs of main pins, the V1P/V1N and the V2P/V2N. The first pair is an analog input responsible for reading current from a current transformer. The second pair is responsible for the voltage reading. Both pairs read in voltage, at maximum ±0.5 V. The signals pass through ADC and filters, in which, through registers, the active, apparent, and reactive power are stored [9]. The current signal is obtained by the current sensor SCT-013-000, a Split Core type non-invasive current sensor, that reads 0-100 A and has an output of 0-50 mA [11].
The voltage signal is obtained by a voltage divider, which is connected directly to the power grid, providing no insulation between the grid and the system.
The ADE7753 performs the measurements of active and apparent power and then sends it to ESP8266, which is a rapid prototyping platform. It has 160 kB of RAM, 4 MB of flash, and an analog-to-digital converter. It has SPI, I2C, I2S, and UART interfaces. It stands out for having integrated Wi-Fi communication, opening up several project possibilities [12].
The ESP8266 also receives the date and time information from a real-time clock (RTC DS1307) through an I2C communication protocol, compatible with ESP8266 NodeMCU [14].
The White Tariff, unlike the Conventional Tariff, takes into account the time slots and the day of the week of electricity consumption [13]. For this reason, an RTC system is required.
The NodeMCU executes all the developed programming, such as calculating the power factor, active power consumed, power accumulation in all-time bands in addition to its detection, storage in memory and sending data to ThingSpeak.
The ThingSpeak platform is an IoT platform that receives data from rapid prototyping platforms, so it is possible to access the data via computers, tablets, cell phones, and similar platforms. It is one of the most used IoT platforms due to the simplicity of synchronization and data visualization, in addition to having a free version in which the limitations are low.
On the ThingSpeak platform, it is possible then view the following data: active power, total consumption, peak hour, intermediate and off-peak consumption, the final value in the Conventional Tariff, the value in the White Tariff, and the power factor.

A. Experimental Protocol
Initially, circuit and communication tests were carried out in a protoboard, to detect possible problems and solutions. After this preliminary analysis, the circuit was implemented on a printed circuit board (PCB). For this, an electronic design was developed that was printed directly on the board, which was then corroded and its components welded.
With the hardware part ready, the software part of the system was developed, in which the calculation of consumption, power factor, calibration, saving in memory and sending data to the IoT platform was developed.
With the meter ready, it was installed in the residence, where it was connected for 7 days. After this period with the data collected on the IoT platform, the analysis and comparison between the White and Conventional Tariff were carried out. An analysis was performed by day of the week, verifying consumption in each time slot and the total tariff value accumulated on each day in the two tariffs, reaching a total at the end of the week that indicates which tariff was the most economically advantageous in that residence.

B. Meter Calibration
With all programming completed and the meter running, the equipment calibration step is reached.
The ADE7753 has registered with gain and offset adjustments. However, the project opted for an indirect calibration using reference measurement equipment for comparison, in which the gains are then adjusted directly in the code.
The equipment used to be the reference meter was the Peacefair PZEM-022, observed in Fig. 4, which measures voltage (80 V to 260 V AC), current (0.02 A to 100 A), active power (0.5 W to 22 kW), consumption (0 kWh to 9999 kWh), frequency (45 Hz to 65 Hz) and power factor (0 to 1). The reading error is only ± 1% [10]. This device was used to evaluate (to calibrate) the own prototype.
In the case of an indirect calibration, the two meters were connected and the measurements started. The values of the active and apparent power registers were noted by the ADE7753 and the values indicated for the active power and power factor indicated by PZEM-022. As PZEM-022 does not show the apparent power directly, the power triangle was used to obtain it.
The gain in a generic way is obtained by (5).
Where REG_ADE7753 is the value pointed by the ADE7753 register and Valor_PZEM022 is the real value pointed by PZEM-022.
The calibrated power (Cal. power) is then obtained by (6), in which the presence of the term offset is perceived, in which it was necessary to add it because when there was no load connected, the meter still marked a small value, which was corrected by adding a negative offset.

C. Adjustment of Input Signals
As previously stated, the ADE7753 is responsible to measure current and voltage signals.
The voltage signal, coming from the resistive divider, was adjusted to be around 0.3 V, to have a margin in case of an overvoltage in the electrical grid. The voltage divider circuit then has the following configuration: R1 = 620 kΩ ± 5% and R2 = 1 kΩ ± 5%. With this combination of resistors, for an effective voltage signal from the grid at 127 V, there is a theoretical output at 0.2892 V peak, representing a value very close to the desired. In order to read the current signal, it was necessary to use a resistor to convert the output signal from the SCT-013-000, which is current, to a voltage signal. This resistor, called RB, had a value set at 12 Ω ± 5%. With this configuration, under Ohm's Law, to obtain a maximum voltage of 0.5 V peak at it, the maximum effective current at it must be 29.46 mA, which is the current output of the SCT-013-000.
As the transformation ratio of the SCT-013-000 is 1:2000, the maximum reading current, as effective value, should be 58.92 A. Fig. 5 illustrates the connections between ESP8266, ADE7753, RTC, electrical network, and electronic components.

D. Electric Diagram
Pins from 17 to 20 of the ADE7753 have the SPI communication function and they are connected from D5 to D8 in NodeMCU, respectively.
Pins D1 and D2 are responsible for the communication in I2C with the RTC DS1307, in which it is powered by ESP8266 itself through pin 3V3, which has a voltage output of 3.3 V.
The NodeMCU is powered through its micro-USB port, through an external 5 V source, in which in this project a 5 V / 0.85 A portable source was used. This voltage is perceived in the NodeMCU Vin pin, in which it is then used to power the ADE7553.

E. Firmware Development
The basic logic diagram of the firmware developed for the project is shown in Fig. 6.
The first step is the system initialization, in which the NodeMCU is connected to the internet network, communicates with the ADE7753 assigning the defined gains and reading the data saved in memory, assigning this data in the appropriate variables.
Then the active and apparent power readings are taken, in which consumption and power factor are then calculated. This data is then calibrated and sent to ThingSpeak every 20 seconds.
The system saves data of interest in memory in two cases. The first case is every 5 minutes and the second is when there is a time band change. Whenever there is a save in memory, a red LED is flashed.

F. Memory Storage
Each byte of memory can store data of type UINT8, so it is only possible to store whole numbers from 0 to 255. As consumption will be the variable to be saved in memory and contains decimal places, it was necessary to save each decimal number in one byte of the memory. The entire consumption portion will be saved in a single byte, limiting the project to recording up to 255 kWh. The decimal part is not possible, as it will always vary between 0 and 999. For that reason, number by number will be saved.
In Fig. 7 an example of how the number 255.987 is saved for example is illustrated. The entire part 255 is saved in byte 3, while the decimal part is broken number by number, being saved in bytes 0, 1 and 2. As each byte of the EEPROM has a limitation of 100 thousand recordings [15], it was necessary to limit the number of recordings. Instead of saving every second, it was limited to 5 minutes, in which way it would be possible to use the same byte for almost a year and still have a good result, losing information of a maximum of 5 minutes, in which it would not be great impact compared to the total analysis period.
Another point also defined is that there is a saving at each time band change, that is, when there is a change from the peak slot to the intermediate slot, for example, there will be a recording to reduce a possible loss of information.

G. Calculation of Consumption and Power Factor
Generically, consumption is obtained by (4). However, this consumption is increased at all times. In the code, this increment is performed at each looping, which is around 1 second and the active power is in watts. Consumption is then calculated by (7), which adjusts the units, converting the power from watts to kilowatts and the period from seconds to hours.
Where Pk is the active power in watts, ∆ k is the period in seconds, all in looping k and n is the number of loopings (nknown number. It is incremented at all times).
The power factor is obtained by (3), which uses the active and apparent power from their respective ADE7753 registers, but already calibrated.

A. Meter
The prototype is developed on a printed circuit board of 10x10cm. To connect the ESP8266, ADE7753, and RTC DS1307 on the board, female pin bars were used to reuse them.
For the input of the voltage and current signal, 2-way KRE terminal connectors were used.
The result of the plate with all soldered components and devices attached can be seen in Fig. 8.

B. Calibration Process
After performing the meter calibration based on the PZEM-022, some measurements of active power and power factor of several loads in the residence were obtained, from power below 10 W to above 4 kW. Table II shows the calibration results and the comparative error between the two meters.
It is possible to notice, in general, the measurement error of active power is less than the measurement error of the power factor. For power, the biggest error was 2.06%, while for power factor the biggest was 5.48%. It is also noticed that the error in the measurement of the PF is greater for a PF below 0.90.

C. Case Study
From the beginning, the main purpose of the project was to analyze the electricity consumption of a home, comparing the Conventional Tariff with the White Tariff and see which is the most economically advantageous.
The meter was installed in the residence and remained in operation for a period of 7 days. During this period, the routine of energy use by residents did not change, that is, they maintained their usual bathing hours and use of their electrical equipment. After the week of data collection, the final results are shown in Table III. In this table it is possible to analyze consumption and the expense per day, both in the White Tariff and in the Conventional Tariff.  Table III also shows, although consumption in the off-peak time band is the largest portion, about 70% of the total and has a lower rate than the Conventional Tariff for that time, still at the end the value of the White Tariff was above the value of the Conventional Tariff.   9 shows consumption by time bands during the week, in which the consumption in the off-peak time was higher every day. It is worth noting that on weekends, Saturday, and Sunday, consumption in the peak and intermediate was equal to zero, which is a characteristic of the White Tariff. Fig. 10 shows the evolution of the daily accumulated value between the two tariffs. Starting on Sunday, when the whole day is considered off-peak, the value of the White Tariff naturally comes out ahead in terms of being the cheapest. However, as the week goes by, the Conventional Tariff becomes lower and on Wednesday this turn is observed. At the end of the week, on Saturday, the total cost of the White Tariff is R$ 18.59 and that of the Conventional Tariff is R$ 18.44. A small difference of 0.81%.

VII. CONCLUSIONS
The development of the meter had some points of difficulty. The ADE7753 for being an IC of the SMD type, ends up requiring tools and techniques suitable for its handling, besides that it is a component that is not easily found in the Brazilian market. Knowing this from the beginning, about ten IC's were acquired in a single purchase on the foreign market, of which some were used to improve welding and testing techniques.
The possibility of monitoring consumption remotely using the ThingSpeak platform is very advantageous. In the palm, with the use of the smartphone, it was possible at all times to check how much was being consumed and how much was being spent. It is a way to control consumption day by day and avoid surprises at the end of the month.
The White Tariff is still a type of pricing little known by the population. Many want to know that they can choose another tariff. A party that knows the option, is in doubt if it is worth migrating. With the development of this work, it was possible to verify which tariff is more advantageous for a specific residential unit.
With the use of the meter it could be concluded that for the specific residence, migration to the White Tariff is not advantageous maintaining the same consumption habits. However, if these habits were changed minimally, with the shift of a small part of consumption to off-peak hours, possibly the White Tariff would become more financially advantageous since the difference between the two tariffs was small.
Small businesses, which are serviced by group B, have a great chance of having the White Tariff be more financially advantageous since almost all business hours are within the offpeak time. It is an opportunity for study and verification for future work. Another perspective for future work is the development of a multi-phase meter with another IC of the ADE775-family, such as the ADE7752, ADE7754, and ADE7758, which are focused on multi-phase measurement.