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

§ 13 Principle of operation of electronic meters.

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 in the frequency of pulses KR1095PP1 and 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 counters, 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.

Digital Computer Circuit
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 s protocol. 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.

Digital computer for digital energy meter

Fig. 5. Digital computer for a 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 of the HC08 family with FLASH memory located on the 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 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.