This page has been robot translated, sorry for typos if any. Original content here.

The principle of operation of the electronic meter

To calculate the electric energy consumed over a certain period of time, it is necessary to integrate the instantaneous values ​​of active power over time. For a sinusoidal signal, the power is equal to the product of the voltage on the current in the network at a given time. On this principle, any meter of electrical energy. In fig. 1 shows a block diagram of an electromechanical meter.

Block diagram of an electromechanical meter of electrical energy

Fig. 1. Block diagram of an electromechanical meter of electrical energy

The implementation of a digital electric energy meter (Fig. 2) requires specialized ICs that can multiply signals and provide the resulting value in a form convenient for the microcontroller. For example, the active power converter - in the pulse repetition rate. The total number of incoming pulses, counted by the microcontroller, is directly proportional to the electricity consumed.

Block diagram of a digital electricity meter

Fig. 2. Block diagram of a digital electricity meter

No less important is the role of all sorts of service functions, such as remote access to the meter, information on stored energy, and many others. The presence of a digital display, controlled by a microcontroller, allows you to programmatically set different modes of displaying information, for example, display information about the energy consumed for each month, at different rates, and so on.

To perform some non-standard functions, such as level matching, additional ICs are used. We have now begun to produce specialized ICs - power converters to frequency - and specialized microcontrollers containing similar converters on a chip. But, often, they are too expensive to use in household induction meters. Therefore, many global manufacturers of microcontrollers are developing specialized chips designed for such an application.

Let us turn to the analysis of the construction of the simplest version of a digital counter on the cheapest (less than a dollar) 8-bit Motorola microcontroller. The solution presented implements all the minimum necessary functions. It is based on the use of an inexpensive power converter IC to the frequency of pulses KR1095PP1 and an 8-bit microcontroller MC68HC05KJ1 (Fig. 3). With such a structure, the microcontroller needs to sum up the number of pulses, display information on the display and protect it in various emergency modes. The considered counter is actually a digital functional analogue of existing mechanical meters, adapted for further improvement.

The main nodes of the simplest digital electricity meter

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, obtaining instantaneous power consumption. This signal is fed to the input of the microcontroller, which converts it into Wh and, as signals accumulate, which changes the meter readings. Frequent power failures make it necessary to use an EEPROM to store meter readings. Since power failures are the most typical emergency, such protection is necessary in any digital meter.

The algorithm of the program (Fig. 4) for the simplest version of such a counter is quite simple. When the power is turned on, the microcontroller is configured according to the program, reads the last stored value from the EEPROM and displays it. Then the controller goes into the mode of counting the pulses coming from the IC of the converter, and as each Wh accumulates, it increases the counter reading.

The algorithm of the program of the electric meter

Fig. 4. Algorithm of the program

When writing to an EEPROM, the value of the accumulated energy may be lost at the moment of power failure. For these reasons, the value of the accumulated energy is recorded in the EEPROM cyclically one after another through a certain number of changes in the meter readings, set programmatically, depending on the required accuracy. This avoids the loss of stored energy data. When a voltage appears, the microcontroller analyzes all values ​​in the EEPROM and selects the last. For minimal losses, it is enough to record the values ​​in increments of 100 Wh. This value can be changed in the program.

The circuit of the digital calculator is shown in fig. 5. Connect the supply voltage of 220 V and the load to the connector X1. From the current and voltage sensors, signals are sent to the KR1095PP1 converter chip with an optocoupler isolated from the frequency output. The counter is based on the Motorola MC68HC05KJ1 microcontroller, manufactured in a 16-pin package (DIP or SOIC) and having 1.2 Kbyte of ROM and 64 bytes of RAM. For storing the accumulated amount of energy in case of power failures, a small 24C00 EEPROM (16 bytes) from Microchip is used. 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 connector X2.

The implementation of the algorithm required less than 1 Kbyte of memory and less than half of the input / output ports of the MC68HC05KJ1 microcontroller. Its capabilities are enough to add some service functions, for example, the integration of meters into a network via RS-485 interface. This feature 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 residential high-rise building. All indications on the network will come to the control center.

Of particular interest is a family of 8-bit microcontrollers with flash memory located on a chip. Since it can be programmed directly on the assembled board, the program code is protected and the software can be updated without installation.

Digital computer for digital electricity meter

Fig. 5. Digital computer for digital electricity meter

Even more interesting is the version of the electricity meter without an external EEPROM and expensive external non-volatile RAM. It is possible in emergency situations 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 electricity meters of any complexity can be implemented with the help of Motorola microcontrollers of the HC08 family with a flash memory located on a chip.

The transition to digital automatic systems of accounting and control of electricity 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; compactness; the possibility of manufacturing the body, taking into account the interior of modern residential buildings; an 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 not available for all mechanical, for example, the implementation of multi-tariff payment for consumed energy, the possibility of automated metering and control of electricity consumed.