Keywords: ADC, MAXQ, MAXQ3120,
A new generation of electricity meters promises to automate the data gathering and tracking. Based on a microcontroller rather than a spinning disk, the next-generation electricity meter can be more accurate, more reliable, and much more flexible than its mechanical counterpart. Besides counting and automatically reporting the number of kilowatt-hours used by the customer, the microcontroller-based meter can also track when usage occurs, how much peak power was demanded, and whether the power factor is within acceptable limits.
This article describes how such an electricity meter can be constructed from a modern, mixed-signal microcontroller and a few additional parts.
Modern mixed-signal microcontrollers put an end to these limitations. Combining high-performance analog circuitry, a high-speed CPU core, and a full range of communication and display peripherals, these microcontrollers serve well as the heart of a modern electricity meter.
Deriving the voltage waveform is simple: a voltage-divider across the line serves nicely. To provide the -1V to +1V required by many ADC devices, it is necessary to divide the voltage waveform on a 240V circuit by a ratio of 400:1 to 600:1. A single-pole RC filter after the division performs anti-aliasing duty.
Measuring the current in the load can be performed in several ways, but the two most popular are to use a current transformer or a current shunt. A current transformer develops a voltage in its secondary circuit proportional to the current in the primary circuit. A current shunt used in this reference design (Figure 1) develops a voltage as a result of the IR drop across a resistance. To keep power dissipation low, the shunt resistor is often in the range of 250µΩ to 500µΩ. More details about the hardware components in this design can be found in application note 3819, MAX3120 Electricity Meter Reference.
Figure 1. A mixed-signal microcontroller is the heart of a sophisticated multifunction, multirate electricity meter. The reference design is based around the MAXQ3120 mixed-signal microcontroller. This microcontroller combines a robust analog front-end (including dual-channel 16-bit, ADCs with an internal voltage reference) and a powerful digital block (consisting of the 16-bit RISC core, a multiply-accumulate unit, two UART channels, and an integrated LCD controller).
In older power meters, communication was not an issue. When reading mechanical meters, the reader simply copied the value from the counter into a logbook. But modern meters use their communication channels to transfer billing information and configuration data using two mechanisms: noncontact and networked. This design provides both.
A noncontact reader transfers energy usage data without the device having to make physical contact with the meter. Often, a handheld instrument transfers the data using an infrared link. In this arrangement, a utility worker points a reader device at the meter, much as one might use a remote control to operate a television. A request packet is transmitted to the meter, which responds with the requested data. This usage data is stored on the reader until it can be transferred to the billing system.
A networked meter is usually found in a multifamily dwelling, such as an apartment building. In such an installation, all meters in the building "talk" on a network to a controller that polls them once a month. The controller then formats a set of messages containing the usage data for transmission to the billing authority. This meter uses RS-485 as a physical medium for networking.
For nonvolatile storage, the meter contains an I2C EEPROM device. Serial memory devices have provided reliable service over many years, and are available in sizes from 64 bits to 1Mb, or more. The device used in this design is 128kb.
Fortunately for the system designer, that question is largely answered in an international standard. IEC 61036 specifies a "Class 1" (1% accuracy) or "Class 2" (2% accuracy) electricity meter. This standard calls out not only accuracy, but mechanical, environmental, and safety parameters as well. In short, the IEC 61036 document describes what an electricity meter is. The standard has been adopted in one form or another as the national standard in nearly every country.
But IEC 61036 does not specify communication protocols that must be followed. This is a problem, as there is no single international standard for physical media, message protocol, or semantics for communication between a host computer and an electricity meter.
In the reference design presented here, we settled on a Chinese standard, DL/T 645. That document describes the physical layer, packet format, and rules for transmission that a meter (and a host computer) must follow.
The process of measuring energy begins with the DSP subsystem. Every time a sample set is received from the ADC channels (in this design, every 48µs), the voltage and current samples are multiplied and accumulated. The product of instantaneous voltage and current is instantaneous power, and this can be accumulated to calculate the energy usage. The waveforms are also lowpass filtered to find the zero crossing. On every zero crossing, the accounting subsystem is notified.
When alerted, the accounting subsystem dumps the accumulated energy from the DSP into a larger accumulator, and clears the DSP accumulator. When enough energy has been accumulated, the accounting subsystem then updates the accumulated energy registers in the EEPROM. The accounting subsystem cannot update the EEPROM on every zero crossing because most EEPROM devices wear out after some number of write cycles.
When a valid message has been received and decoded, it is likely that the request will either be for the meter to send some measured value (energy, voltage, power, etc.), or to send or set some operational parameter (meter constant, serial number, etc.). In either case, the request is referred to the register manager. This software component is responsible for reading, writing, and maintaining the hundreds of registers that are defined in the DL/T 645 protocol. Please refer to the software discussion in application note 3819 (see above) for more specific details.
The display controller selects an item to display and formats it for the LCD. In this design, the meter displays time of day, date, and accumulated energy. It then waits a prescribed number of seconds before selecting the next item and formatting that for the LCD. A detailed discussion of display parameters and display customization are found in application note 3820, Customization Guide for the MAX3120 Electricity Meter Reference Design.
Obviously, the schedule manager requires an accurate clock; the electricity meter design provides a clock in one of two ways. First, the microcontroller contains a 32-bit UNIX-compatible system clock, complete with battery backup. While simple and cost-effective, the crystal that controls the clock is not temperature-compensated, and can drift when exposed to changes in temperature.
If a more accurate clock is required, an external, temperature-compensated time-of-day clock can be used. These devices contain a built-in temperature sensor and hardware that adjusts the clock operating frequency to compensate for the natural drift that affects all crystal oscillators over temperature. By using a temperature-compensated clock, accuracies of 30 seconds/month are achievable over the entire industrial temperature range. For more detailed information about utility tariff periods and how this reference design manages data collection from these tariffs, see application note 3793, Flexible Tariff Scheduling for Multirate Electricity Meters.
The complete electricity meter reference design on which this article is based, including Bill of Materials, is available for download.
A similar article appeared in the December 2006 issue of Metering International.