The principle of operation of the electronic meter
To calculate the electric energy consumed for a certain period of time, it is necessary to integrate the instantaneous values of active power in time.
For a sinusoidal signal, the power is equal to the product of the voltage and current in the network at a given time.
Any electric energy meter works on this principle.
1 shows a block diagram of an electromechanical meter.
Fig. 1. Block diagram of an electromechanical electric energy meter
The implementation of a digital electric energy meter (Fig. 2) requires specialized ICs capable of multiplying signals and providing the obtained value in a form convenient for the microcontroller.
For example, a converter of active power into a pulse repetition rate.
The total number of pulses received, calculated by the microcontroller, is directly proportional to the energy consumed.
Fig. 2. Block diagram of a digital electric energy meter
No less important role is played by all kinds of service functions, such as remote access to the meter, information about the stored energy, and many others.
The presence of a digital display controlled by a microcontroller allows you to programmatically set various information output modes, for example, display information on energy consumption for each month, at various rates, and so on.
To perform some non-standard functions, for example, matching levels, additional ICs are used.
Now they began to produce specialized ICs - power to frequency converters - and specialized microcontrollers containing similar converters on a chip.
But, often, they are too expensive for use in domestic induction meters.
Therefore, many global manufacturers of microcontrollers are developing specialized microcircuits designed for this application.
Let's move on to the analysis of building the simplest version of a digital meter on the cheapest (less than a dollar) 8-bit Motorola microcontroller.
The solution presented implements all the minimally necessary functions.
It is based on the use of an inexpensive IC of the power converter to the pulse frequency KR1095PP1 and the 8-bit microcontroller MC68HC05KJ1 (Fig. 3).
With this structure, the microcontroller needs to sum the number of pulses, display information on the display and protect it in various emergency modes.
The counter under consideration is actually a digital functional analogue of existing mechanical meters, adapted for further improvement.
Fig. 3. The main nodes of the simplest digital electricity meter
Signals proportional to the voltage and current in the network are removed from the sensors and fed to the input of the converter.
The converter IC multiplies the input signals to produce instantaneous power consumption.
This signal is fed to the input of the microcontroller, converting it to Wh · h and, as the signals accumulate, changing the counter readings.
Frequent power failures lead to the need to use EEPROM to save meter readings.
Since power failures are the most common emergency situation, such protection is necessary in any digital meter.
The program operation algorithm (Fig. 4) for the simplest version of such a counter is quite simple.
When the power is turned on, the microcontroller is configured in accordance with the program, reads the last stored value from the EEPROM and displays it on the display.
Then the controller goes into the counting mode of pulses coming from the converter IC, and, with the accumulation of each Wh · h, it increases the counter.
Fig. 4. The algorithm of the program
When writing to the EEPROM, the value of the stored energy may be lost at the time of a voltage outage.
For these reasons, the value of the stored energy is recorded in the EEPROM cyclically one after another through a certain number of changes in the meter readings, set in software, depending on the required accuracy.
This avoids the loss of stored energy data.
When voltage appears, the microcontroller analyzes all the values in the EEPROM and selects the latter.
For minimal losses, it is sufficient to record values in increments of 100 Wh.
This value can be changed in the program.
The circuit of the digital computer is shown in Fig.
5. A power supply voltage of 220 V and a load are connected to connector X1.
From the current and voltage sensors, the signals are fed to the converter chip KR1095PP1 with optocoupler isolation of the frequency output.
The basis of the counter is a motorola MC68HC05KJ1 microcontroller manufactured in a 16-pin package (DIP or SOIC) and having 1.2 Kbytes of ROM and 64 bytes of RAM.
To store the accumulated amount of energy during power failures, a Microchip company uses a small volume 24C00 (16 bytes) EEPROM.
The display uses an 8-bit 7-segment LCD, controlled by any low-cost controller, communicating with the central microcontroller via SPI or I 2C protocol and connected to the X2 connector.
The implementation of the algorithm required less than 1 KB of memory and less than half the input / output ports of the MC68HC05KJ1 microcontroller.
Its capabilities are enough to add some service functions, for example, combining meters into a network via the RS-485 interface.
This function will allow you to receive information about the accumulated energy in the service center and turn off the electricity in the absence of payment.
A network of such meters can be equipped with a multi-storey residential building.
All indications on the network will go to the dispatch center.
Of particular interest is the family of 8-bit microcontrollers with FLASH memory located on the chip.
Since it can be programmed directly on the assembled board, the program code is protected and the software can be updated without installation work.
Fig. 5. Digital computer for digital electricity meter
Even more interesting is the option of an electricity meter without an external EEPROM and expensive external non-volatile RAM.
In emergency situations, it can be used to record readings and service information in the internal FLASH memory of the microcontroller.
This also ensures the confidentiality of information, which cannot be done using an external crystal that is not protected from unauthorized access.
Such energy meters of any complexity can be implemented using Motorola microcontrollers from the HC08 family with FLASH memory located on the chip.
The transition to digital automatic electricity metering and control systems is a matter of time.
The advantages of such systems are obvious.
Their price will constantly fall.
And even on the simplest microcontroller, such a digital electricity meter has obvious advantages: reliability due to the complete absence of rubbing elements;
the possibility of manufacturing a building taking into account the interior of modern residential buildings;
increase in the verification period by several times;
maintainability and ease of maintenance and operation.
With small additional hardware and software costs, even the simplest digital meter can have a number of service functions that are absent in all mechanical ones, for example, the implementation of multi-tariff payment for energy consumption, the possibility of automated metering and control of energy consumption.