Share this

Design of a Single-Phase Electronic Energy Meter Based on AS8228

2026-04-06 03:32:56 · · #1
1. Overview Electronic energy meters will become the mainstream product in the energy meter market in the next few years, and the metering IC inside the energy meter is the core of the overall meter's performance, functionality, and price. Austria Microsystems, a major supplier of electronic energy meter components in the United States and Europe, has launched the AS8228 power metering integrated circuit. This device integrates a precise single/dual current input energy measurement front-end, an 8-bit 8051-compatible microcontroller unit (MCU), a 96-segment LCD driver (LCDD), 12 programmable multi-function input/output pins (I/Os), a 4-wire serial peripheral interface (SPI), a system control module (SCT), and a real-time clock (RTC) powered by an external backup battery. Single-phase electronic energy meters based on the AS8228 fully meet the specifications in international standards TEC62052 and ANSI. This not only improves the reliability of energy metering and ensures the flexibility of metering product functional design, but also greatly simplifies the development of metering systems. 2. Main features and pin functions [1] The main features of AS8228 are as follows: The accurate energy measurement front end is single-phase, single/dual current input, including ∑-ΔA/D converter and digital signal processor, with a measurement error of less than ±0.1%. Dynamic range up to 1000:1[2]; Two current channels for digital phase calibration and gain selection; Built-in power monitor for power-on reset and power-down monitoring; Programmable industry-standard 8-bit 8051 compatible microcontroller with 24 KB program RAM and 1 KB data RAM; Two Universal Asynchronous Receivers (UARTs) configured for access and debugging purposes; Programmable watchdog timer; On-chip digital calibration, externally powered real-time clock/calendar that can directly provide date, time and alarm data to the microcontroller, with a digital scale better than 6×10-6; External separate battery power pin and system reset pin; Small temperature coefficient reference voltage, typically 30x10-6/k; Low-power 3.0 MHz to 4.0 MHz crystal oscillator; 96-segment standard on-chip LCDD interface; 12 programmable multifunction input/output pins. Used for selecting data transmission direction, pull-up/pull-down resistors, and drive strength; provides indication of main current leading or lagging main voltage status during power measurement; standard SPI interface enables reading/writing data from external non-volatile memory (E2PROM); storage temperature range: -55℃ to +125℃, normal operating temperature range: -40℃ to +85℃. The AS8228 uses a 64-pin LQFP package. The functions of each pin are as follows: VP, VN (1,2): Differential analog input for voltage channels, range ±100 mV; 11P, 11N (3,4): Differential analog input for current channel 1, range +150 mV (when PGA is set to 4); 12P, 12N (5,6): Differential analog input for current channel 2, range ±150 mV (when PGA is set to 4); VDDA (7): Analog power supply, 3.3 V ±10%; VSSA (8): Analog ground, 0V; IO0~IO11 (9~12, 15~19, 26~28): Programmable multifunction input/output port; VDDD (13,22): Digital power supply, 3.3 V ±10%; VSSD (14,21): Digital ground, 0V; SI (20): External memory interface (serial data input pin); SN (23): External memory interface (chip select signal, active low); SO (24): External memory interface (serial data output pin); SO (25): External memory interface (serial clock output pin); TXD, RXD (29, 30): Universal Asynchronous Receiver/Transmitter (UART1); VDD_BAT (31): Backup battery voltage input, 2.0 V to 3.6 V power supply; XIN, XOUT (32, 33): Clock input, external 3.0 MHz to 4.0 MHz crystal oscillator, typical value is 3.579545 MHz; RES_N (34): System reset pin, active low; LBP0 to LBP3 (37, 38, 39, 40): LCD block driver output common pin; LSDO to LSD23 (41 to 64): LCD segment driver output pin. 3. Internal Structure of AS8228 The AS8228 chip provides all the functional modules required for single-phase metering, including an energy measurement front-end, an industry-standard 8-bit 8051-compatible microcontroller (MCU), a system timing and real-time clock module, a system control module, a 96-segment LCD, 12 programmable multifunction input/output pins, and a standard SPI interface. 3.1 Energy Measurement Front-End The accurate energy measurement front-end consists of an analog front-end (AFE) and a programmable DSP. The analog front-end has three differential analog inputs, specifically for measuring main voltage, single-channel current (phase current), or two-channel current (phase current and neutral point current). The two input currents are first amplified by a programmable gain amplifier (PGA), and then output as digital signals by a Σ-Δ A/D converter. The output result and the input voltage sampled by the Σ-Δ modulator are respectively passed through three selectable compensation filters, which compensate for the amplitude loss caused by the previous filters, and then through three selectable high-pass filters to remove the DC component in the current and voltage before RMS and energy calculations. The corner frequency of the high-pass filters is less than 10 Hz. The filtered voltage and current values ​​are first used for power calculation. Then the effective value is calculated. The two currents can be obtained by two current sensors or one shunt resistor and one current sensor, so that the meter can still measure and record the power when any of the electricity theft connection devices are changed, including the mutual conversion between the connection and the output, the mutual conversion between the phase and the neutral point, the neutral point removal or the simultaneous occurrence of these situations[3]. The gain of the internal gain amplifier can be selected as 4, 16 or 20. When different PGAs are selected, the range of the input differential voltage is different and the way to obtain the current is also different. The voltage can be obtained by a low-cost voltage divider network, so that the differential input is 100 mV under rated conditions. When calculating the power, the current is taken from any one or the larger of the two circuits, and the voltage is taken from the line voltage or a constant voltage value set internally (default is 083Dh, equivalent main voltage 311 V). The active power is obtained by the instantaneous power through the low-pass filter, and the cutoff frequency of the low-pass filter is 18.6 Hz. If designed for traditional single-phase current calculation, only current channel 1 is connected to obtain the phase current, while channel 2 remains unconnected. The on-chip DSP filters the data output from the ADC, providing suitable data and protocols for the MCU. The meter manufacturer then freely programs the MCU to implement all the functions required by the meter, including active power, reactive power, apparent power, RMS main voltage, RMS main current, and power factor. Metering manufacturers can design products according to their requirements, ensuring flexibility. The DSP internally contains a Meter Data Register (MDR) and a Setting Register (SREG). The MDR stores the latest data for MCU processing and contains 5 registers. The SREG sets and indicates relevant meter parameters and contains 13 registers. An internal reference voltage provides temperature stability for the entire circuit, ensuring the measurement accuracy of the AS8228. The built-in Power Supply Monitor (PSM) ensures that the system can independently generate a reset when the power supply voltage rises or falls. 3.2 Microcontroller Unit (MCU) The MCU is compatible with the standard 8051 microcontroller and contains a microprocessor core, program memory (P_RAM), data memory (X_RAM), internal data memory (I_RAM), a square root calculation unit, a counter Timer0, and a universal asynchronous receiver/transmitter (UART2). The MCU has the following characteristics: It adopts a Von Neumann architecture. The program and data unit address portions are shared. It has a more optimized clock cycle than the standard 8051. Some instructions can be completed in a single clock cycle. It includes the standard 16-bit counter Timer0 and RS232 serial port UART1 (8051 standard). Special function registers: Universal Asynchronous Receiver/Transmitter UART2, Square Root Module (SQRT). It is fully compatible with the 8051 instruction set. It has 7 internal interrupt sources. Each instruction takes 6 clock cycles (compared to 12 clock cycles for the standard 8051). 3.3 Liquid Crystal Display Driver (LCDD) The LCDD can directly drive almost any type of 24×4 segment liquid crystal display (LCD). The LCD has two sets of data registers, used to receive and store information to be displayed in turn. The LCDD control module selects a certain set of registers, decodes the information, and sends it to the corresponding segment for display in a timely manner, simplifying programming. The voltage value for adjusting the LCD contrast is one of eight values ​​evenly distributed between 2.5 V and 3.0 V, selected through the register selvlcd[2:0]. There are four driving voltages for the LCD segments and common terminal, selected as 0, 1/3, 2/3, and 1 respectively. 3.4 Serial Peripheral Interface (SPI) The serial peripheral interface is a synchronous, bit-series 4-wire interface for full-duplex data transmission, used for direct communication with an external E2PROM. During communication, SPI and E2PROM have a strict master-slave relationship. After the system starts, the bootloader controls SPI to automatically read the contents of the E2PROM before the MCU can be programmed. Its main features are as follows: Standard 4-wire synchronous serial port (SI, SO, SC, s_N); Operates only in master mode; 8-bit word length; SC is high when idle; Sends the most significant bit first; 4 selectable clock configurations; SPI clock resolution selectable between mcu_clk/2 and mcu_clk/65536; 3 maskable interrupts: transmission complete, overflow, and transmission collision. When SN=0, data is output on the falling edge and input on the rising edge of SC. SPI is managed by four registers: the control register (SSPCON), the clock configuration register (SSPCLKDIV), the status register (SSPSTAT), and the data register (SSPBUF), with an address space range of 9400h to 9403h. 3.5 System Control Module (SCT) The SCT plays a role in handling different operating modes (normal mode, test mode), clock generation, and reset control. The internal asynchronous transceiver module UART1 provides the interface for AS8228 to communicate with external devices, including writing programs and data. The program in the E2PROM is written directly through the UART1 port RXT, or it can be written through UART2 and the MCU. However, in this case, a dedicated NCU program is needed to handle this data stream and a dedicated I/O port is required as the interface for communication between the AS8228 and the external system. Of course, data can also be read from the E2PROM through the UART port. 3.6 System Timing and Real-Time Clock Module The system timing and real-time clock module internally includes a low-power crystal oscillator (LP_OSC), a low-power divider (LP_DIV), and a real-time clock module (RTC). When the external power supply VDD is interrupted, it is powered by a 3.3V backup battery connected to the VDD_BAT pin of the AS8228. The low-power oscillator is connected to an external 3.0 MHz to 4.0 MHz crystal oscillator to provide the system clock. The oscillator can operate in two modes: normal mode and low-power mode. In low-power mode, other parts of the circuit do not operate. The low-power divider first divides the master clock provided by the oscillator by a fixed value of 5 as the input to the programmable divider. It then divides the input clock by setting relevant registers, providing a 1 Hz signal to the real-time clock module. The clock module is connected to the MCU via a dedicated interface register. 4. AS8228 Application Circuit Design: A typical application circuit of AS8228 in power metering. The 3.3 V operating power supply is obtained directly from the line through a voltage regulation circuit. The current in channel 1 is obtained using a shunt resistor. The size of the shunt resistor depends on the selection of the PGA and the magnitude of the main current. If PGA=20 and the effective value of the main current Irms=60 A, then the shunt resistor Rsh=30 mV/(21/2×60 A)=354μΩ. The current in channel 2 is obtained from a current sensor. The output load impedance of the secondary winding of the current sensor depends on the effective value of its secondary current under rated conditions and the selection of the PGA. If the current sensor is 60 A/24 mA and PGA=4, then the output load impedance is selected as 4.3 Ω. If the effective voltage of the voltage channel is 230 V, then from the voltage divider network, we can see that the 12 input/output terminals can be designated as inputs or outputs. It sets the data transmission direction, pull-up or pull-down resistors, and drive strength (4 mA or 8 mA) through related register programming. There are a total of 5 types of registers: configuration register, input register, output register, pulse count register, and status register, with an address space range of 9500h to 951Fh. In this design, three ports can be arbitrarily selected for calibration, energy direction indication, and selection of current channel 1 or channel 2, respectively. The E2PROM connected to the SPI interface must meet the AS8228's minimum requirements for external memory: Typical SPI pins: EEP_SI, EEP_SO, EEP_SC, EEP_S_N; To ensure correct program loading when mcu_clk is at most 4 MHz, the serial input clock must be ≥1 MHz. The bootloader is configured to download the user program by at least four instructions (WREN, RDSR, READ and WRITE), and the system control unit uploads the user program and data to the E2PROM by two instructions (READ_ and WRITE_P). The E2PROM has two operating modes: CPOL=0, CPHA=0 and CPOL=1, CPHA=1 (recommended). In the CPOL=1, CPHA=1 mode, the data is output on the falling edge of SC and input on the rising edge; when idle, SC is high level; the data is stored cyclically, that is, when the address of the stored data reaches the maximum address of the memory. The address pointer points to 0000h; the length of the program is placed in the highest two bits of the address content. When reading and writing data, the instruction and address are fetched first, and then the data length and content are transmitted. In order to meet the above requirements, the Microchip 25AA640-I/SN is selected. Its storage capacity is 8 KB and the operating voltage range is 1.8 V to 5.5 V. The maximum clock frequency is 1 MHz[4]. The backup battery voltage should be selected between 2.0V and 3.6V; 3.3V is chosen here. 5. Conclusion The AS8228 is a low-power, high-precision, and high-performance energy metering circuit. It integrates all the anti-theft functions required by power companies. It ensures that the meter can accurately measure electricity consumption even under most reverse tampering conditions, improving metering reliability, significantly reducing the burden on programmers, and guaranteeing the flexibility of metering manufacturers in designing metering product functions. Furthermore, it greatly simplifies the development of metering systems and shortens time-to-market.
Read next

CATDOLL 138CM Miho Silicone Doll

Height: 138 Silicone Weight: 24kg Shoulder Width: 31cm Bust/Waist/Hip: 65/62/78cm Oral Depth: N/A Vaginal Depth: 3-15cm...

Articles 2026-02-22