§ 13 The principle of operation of electronic meters.
The implementation of a digital electric energy meter (Fig. 2) requires specialized ICs that can multiply signals and provide the obtained value in a form convenient for the microcontroller. For example, the active power converter - to the pulse repetition rate. The total number of incoming pulses, counted by the microcontroller, is directly proportional to the electricity consumed.
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 various 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, for example, level matching, additional ICs are used. We have now begun to produce specialized ICs — power to frequency converters — 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 proceed 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 the KR1095PP1 pulse and an 8-bit MC68HC05KJ1 microcontroller (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.
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 the 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 enters the counting mode of the pulses coming from the IC of the converter, and as each Wh accumulates, it increases the counter reading.
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 the power outage. For these reasons, the value of the accumulated energy is written to 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 latter. For minimum losses, it is enough to record the values in increments of 100 Wh. This value can be changed in the program.
Digital computer circuit
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 basis of the counter is a 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 (16 byte) EEPROM from Microchip is used. The display uses an 8-bit 7-segment LCD, controlled by any low-cost controller, communicating with a central microcontroller via SPI or s protocol. The algorithm implementation 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 case of no 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.
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 using a Motorola HC08 microcontroller 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 calibration period several times; maintainability and ease of maintenance and operation. With small additional hardware and software costs, even the simplest digital meter may 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.