<<

MQX-Enabled MCF51EM256 Single- Phase Meter Reference Design

Using the MCF51EM256, MC1322x and MMA7660FC

Document Number: DRM121 Rev. 0 MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 2 Freescale Semiconductor, Inc. Contents

Section Number Title Page

Chapter 1 Introduction

1.1 Overview...... 7

1.2 General platform features...... 8

1.2.1 Hardware design features ...... 8

1.2.2 Software features of the design...... 9

1.3 MCF51EM256 series...... 9

1.3.1 Peripheral application usage...... 11

1.4 1322x low power node (LPN)...... 13

1.5 MMA7660FC 3-axis Xtrinsic accelerometer...... 15

Chapter 2 Basic Theory

2.1 Definition of terms...... 17

2.1.1 Power...... 17

2.1.2 ...... 19

2.1.3 ...... 19

2.2 Electricity distribution...... 20

2.3 Electricity meters...... 21

2.3.1 Electromechanical meters...... 22

2.3.2 Electronic meters...... 22

2.4 and current measurement...... 24

2.4.1 Voltage divider...... 25

2.4.2 Shunt resistor...... 26

2.4.3 ...... 26

2.4.4 Rogowski coil...... 28

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 3 Section Number Title Page

Chapter 3 System Concept

3.1 Application description...... 29

3.1.1 Metering board...... 30

3.1.2 Switch mode power supply board connection...... 33

3.1.3 External current sensors connection...... 34

3.1.4 1322x-LPN connection...... 35

3.1.5 Power meter case...... 36

3.2 Application usage...... 38

3.2.1 Power meter hardware configuration...... 38

3.2.2 Application example...... 39

Chapter 4 Hardware Design of the Metering Board

4.1 Introduction to hardware implementation...... 41

4.2 Power supply ...... 41

4.3 Digital hardware ...... 42

4.3.1 MCU core...... 42

4.3.2 RS232 interface...... 43

4.3.3 interface (IEC1107)...... 44

4.3.4 User interfaces...... 44

4.3.5 LED interface...... 45

4.3.6 SPI interface...... 45

4.3.7 Accelerometer interface...... 45

4.3.8 IIC interface...... 46

4.4 Signal conditioning ...... 47

4.4.1 Voltage measurement...... 50

4.4.2 DC Bias circuit...... 50

4.4.3 Shunt resistor current measurement...... 51

4.4.4 CT current measurement...... 53

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 4 Freescale Semiconductor, Inc. Section Number Title Page

4.4.5 Input protection...... 55

Chapter 5 Application Set-Up

5.1 Setting-up the demo hardware ...... 57

5.2 Setting-up the software demo...... 58

5.2.1 FreeMASTER data visualization ...... 58

5.2.2 ZigBee communication ...... 60

5.2.3 Code reprogramming via serial bootloader...... 63

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 5 MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 6 Freescale Semiconductor, Inc. Chapter 1 Introduction

1.1 Overview This design reference manual describes the solution for a single phase electricity meter based on the MCF51EM256 microcontroller (MCU). The design demonstrates the capabilities of this MCU for electricity metering applications. There are also additional Freescale components used in this design, including the RF (ZigBee) and accelerometer solution (interface). The reference design provides a high performance solution for power measurement in single phase two-wire installations. The target market is residential metering. The reference design has the ability to connect to a ZigBee® network thanks to the integrated 1322x low power node, hence it can easily become part of the network. Besides this development, this design uses the MQX real time operating system, to improve the code structure and to serve as a proof of concept for the true real-time applications, such as a power meter. Because of the MQX, this power meter is designed for use in advanced markets. In addition, various analog front end configurations and measurement methods are explored, implemented, and compared in this reference design. This reference design manual describes only the hardware solution for the power meter. Software solutions; mainly metering algorithms are described in associated documents, like the application note titled FFT-based Algorithm for Metering (document AN4255). The power meter reference design is prepared for use in a real customer metering area, this is due to the implemented HMI (LCD and buttons) and communication interfaces for remote data collecting (AMR). Finally, it provides both hardware and software solutions for customer applications.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 7 General platform features

1.2 General platform features This chapter describes the main hardware and software features of the MCF51EM256 Power Meter Reference Design.

1.2.1 Hardware design features • 5 (100) A current range, nominal current is 5 A, peak current is 100 A • 120/230 V AC, 50/60 Hz operational range • Accurate metering function (IEC50470-3 class B), 1% (applicable for two-gain stages configuration) • Active and reactive power (energy) measurement • Line frequency measurement (for precision zero-cross detection) • Two standard current sensing circuit implementations (shunt resistor and CT) • Voltage sensing is executed by an inexpensive resistor divider • Cost-effective bill of materials (BOM) due to various configurations of hardware signal conditioning parts • Low-power modes effectively implemented, including the use of standby RAM and RTC • 3 V internal battery for proper RTC function and data storage for a minimum 10 years • 4 x 40 segment LCD, including charge pump (values shown on the LCD: V,A,W,Var,VA,kWh, kVArh, cos , Hz, time, date) • Tamper detection via: • Built-in tamper push-button • 3-axis IIC MMA7660FC accelerometer (optional only) • Simple user interface — Two user buttons, one LED • LED pulse outputs (kWh,kVArh) • Open-collector power pulse output — Maximum power rating is 1.6 W • IEC1107 infrared hardware interface

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 8 Freescale Semiconductor, Inc. Chapter 1 Introduction • Optically isolated RS232 interface (19200 Bd, 8 data bits, no parity) • BDM debug interface (non-optically isolated) • 2.4 GHz RF interface through a 1320x-RFC RF daughter card (optional only) • 2.4 GHz RF interface through a 1322x low power node daughter card • Powered by 3.3 V SMPS open-frame module (3-rd party solution) • All components (board, sensors, and SMPS) are built into a plastic box with a transparent cover • EMC proven design (EN61000-4-2, EN610004-4) • Power meter demo mechanical dimension — 18 x 26 x 15 cm (w x l x h) • Power meter demo weight — 1 kg approximately

1.2.2 Software features of the design • Application C/ASM source code for CodeWarrior is available • MQX based design for advanced markets • Fast Fourier Transform (FFT) computing technique for precise reactive energy measurement • ZigBee SE2.0 stack implemented in 1322x low power node for connection to a ZigBee® network • FreeMASTER visualization script for calibration, watching, and so on. • Serial bootloader for safe firmware upload through RS232, see application note Developer's Serial Bootloader for M68HC08 and HCS08 MCUs (document AN2295)

1.3 MCF51EM256 Microcontroller series The MCF51EM256 is Freescale’s new smart-meter-on-a-chip 32-bit ColdFire® V1 core microcontroller (MCU) with embedded LCD controller, 16-bit ADC, and metrology- specific peripherals optimized for applications. The MCF51EM256 comes with a full suite of hardware and software tools to make development quick and easy. There is a block diagram of this MCU in Figure 1-1.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 9 MCF51EM256 Microcontroller series The MCF51EM256 MCU provides the following main features: • Operating at processor core speeds of up to 50.33 MHz (peripherals operate at half of this speed) at 3.6 V to 2.5 V, and 20 MHz at 3.6 V to 1.8 V • Up to 256 KB of flash memory • Up to 16 KB of RAM • Less than 1.3 µA of typical power consumption in battery mode, with the MCU supply off • Ultra-low power independent RTC with calendar features, separate time base, power domain, and 32 bytes of RAM • Integrated 16-bit SAR analog-to-digital converter • Programmable Delay Block (PDB) • Two analog comparators with selectable interrupt (PRACMP) • LCD driver • Three Serial Communications Interface modules (SCI) • Three Serial Peripheral Interfaces (SPI) • Inter-Integrated Circuit (IIC) • Two 8-bit and one 16-bit Modulo Timers (MTIM) • Two-channel Timer/PWM module (TPM) • 80-pin LQFP or 100-pin LQFP package • –40° C to +85° C operating temperature range • RoHS compliant

Target applications of this MCU are: • Smart metering • Sensor collection • Phase measurement units • Industrial energy measurement • 1-phase and 3-phase electricity meters

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 10 Freescale Semiconductor, Inc. Chapter 1 Introduction

Figure 1-1. MCF51EM256 block diagram

1.3.1 Peripheral application usage The power meter concept benefits greatly from plenty of integrated internal peripherals in the MCF51EM256 MCU. The Analog to Digital Controller (ADC) features used in the application: • Four channels are used, one is differential for CT current measurement, the second is single-ended for voltage measurement. The remaining two channels are also single- ended for shunt resistor current measurement (two gain stages) • Linear successive approximation algorithm with a 16-bit resolution • High-speed conversion (up to 128 samples per one period) • 3.735 MHz module clock • 16 hardware averaged samples to create a proper ADC result The General Purpose Input Output (GPIO) features used in the application are:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 11 MCF51EM256 Microcontroller series • Used for directly controlling some peripherals such as LEDs, open-collector, and so on. The Inter-Integrated Circuit (IIC) features used in the application: • Primarily provides a method for internal communication between the meter (slave) and the 1322x-LPN daughter card (master)—prepared for ZigBee communication • Secondarily used for internal communication with the 3-axis digital accelerometer MMA7660FC (optional only)—prepared for tamper detection • Interrupt driven by byte-by-byte data transfer • Communication up to 100 kbps with software selectable slave address The Keyboard Interrupt (KBI) features used in the application: • Used for reading the state of the buttons in interrupt mode The Liquid Crystal Display (LCD) controller features used in the application: • Up to 288 segments (4x40 is currently used) • Used for data displaying The 16-bit Modulo Timer (MTIM16) features used in the application: • Free-running mode with interrupt is used • Generates a precision time marks for zero-crossing The PRACMP (Programmable Analog Comparator) features used in the application: • Compares input voltage signal with a bias voltage (reference) • Interrupt on rising edges is used • Generates capture flags for zero-cross voltage signal detection. Due to this, a variable time window for the PDB is generated • Line frequency measurement The Programmable Delay Block (PDB) features used in the application: • Hardware triggering of the ADC channels • Four individually controlled trigger conditions (one for each ADC channel) depending on the phase shift of the sensors The Real-Time Clock (RTC) features used in the application: • Ultra-low power independent real time clock with calendar features (iRTC) • Tamper detection and indicator • Battery monitor output The Serial Communication Interface (SCI1) features used in the application:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 12 Freescale Semiconductor, Inc. Chapter 1 Introduction • Provides communication interface with an external PC (for calibration, watching and safe code uploading) • Communication settings are—19200 Bd, 8 data bits, one stop bit, and no parity The Serial Communication Interface (SCI2) features used in the application: • Provides communication interface for the IEC1107 infrared communication port (optional only) The Serial Peripheral Interface (SPI) features used in the application: • Provides internal communication interface for the1320x-RFC RF daughter card (optional only) The Voltage Reference (VREF) features used in the application: • Provides a reference voltage for internal analog peripherals such as the ADC, PRACMP • Low-power buffer mode is used

1.4 1322x low power node (LPN) The 1322x-LPN is one of the Freescale 1322x development kits designed for connecting to a ZigBee network. The 1322x low power node is designed as a stand-alone development board, including an MC1322x, two LEDs, two push buttons, a GPIO connector, header pins, and a programming and debug port. Note that the ZigBee capabilities of this board are only used in the MCF51EM256 metering concept – because of this feature, the power meter can easily became part of the smart grid. The low power node board is internally connected to an EM256 metering board via a IIC interface. Here are the main features of the 1322x low power node board: • 2.4 GHz wireless nodes compatible with the IEEE 802.15.4 standard • Based on the MC13224V Platform in a Package • Hardware acceleration for both the IEEE 802.15.4 MAC and AES security • Printed F antenna • Over-the-air data rate of 250 kbps • Typical range (outdoors, line of sight) is 300 meters • On-board expansion capabilities for external application-specific development activities • Programmable flash • J-Tag port for reprogramming and in-circuit hardware debugging • Buttons and LEDs for demonstration and control • Connections for battery or external power supply

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 13 1322x low power node (LPN) The core of the 1322x low power node is the Freescale MC1322x 99-pin LGA Platform- in-Package (PiP) solution that can be used for wireless applications ranging from simple proprietary point-to-point connectivity to complete ZigBee mesh networking. The MC1322x is designed to provide a highly integrated, total solution, with premier processing capabilities, and very low power consumption. A full 32-bit ARM7TDMI-S core operates up to 26 MHz. The RF interface provides for low cost and high density as shown in Figure 1-2.

Figure 1-2. MC1322x RF interface As described above, the 1322x low power node is used for connecting an EM256 power meter to a ZigBee network. ZigBee, an IEEE® 802.15.4 standards-based solution, as defined by ZigBee Alliance, was developed specifically to support sensing, monitoring and control applications. The ZigBee solution offers significant benefits, such as low power, robust communication and a self-healing mesh network. The ZigBee solution frequencies are typically in the 868/915 MHz or 2.4 GHz spectrums. The ZigBee data rate for technology solutions is 250 Kbps. ZigBee technology theoretically supports up to 65,000 nodes. Common applications in sensing, monitoring and control, which are best supported by a ZigBee technology solution include: • Personal and medical monitoring • Security, access control and safety monitoring • Process sensing and control • Heating, ventilation and air conditioning (HVAC) sensing and control • Home, building and industrial automation • Asset management, status, and tracking • Fitness monitoring • Energy management

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 14 Freescale Semiconductor, Inc. Chapter 1 Introduction NOTE For connection of the power meter to a ZigBee network via the 1322x-LPN daughter card, it is necessary to program the 1322x-LPN with the correct firmware. That description is out of range of this design reference manual.

1.5 MMA7660FC 3-axis Xtrinsic accelerometer The MMA7660FC is a digital output (IIC), low power, low profile capacitive micro machined accelerometer featuring a low pass filter, compensation for 0 g offset and gain errors and conversion to 6-bit digital values at a user configurable output data rate. The device can be used for sensor data changes, product orientation, and gesture detection through an interrupt pin (INT). The device is housed in an extremely small DFN package. The EM256 metering concept is prepared for tamper detection – this means illegally opening the cover of the power meter. However, the tamper function using a 3-axis IIC accelerometer is only optional. The MMA7660FC provides the main following features: • Digital output IIC • 3 mm x 3 mm x 0.9 mm DFN package • Low power consumption—Off mode: 0.4 A, standby mode: 2 A, active mode: 47A at 1 ODR • Configurable samples per second from 1 to 120 samples a second • Low voltage operation: • Digital voltage— 1.71 V – 3.6 V • Analog voltage— 2.4 V – 3.6 V • Auto-wake and sleep feature for low power consumption • Tilt orientation detection for portrait and landscape capability • Gesture detection Including shake detection and tap detection • Robust design, high shocks survivability (10,000 g) • RoHS compliant • Environmentally preferred product • Low cost Typical applications for this accelerometer are: • / PMP/PDA—Orientation detection, image stability, text scroll, motion dialing, and tap to mute • Laptop PC—Anti-theft

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 15 MMA7660FC 3-axis Xtrinsic accelerometer • Gaming—Motion detection, auto-wake and sleep for low power consumption • Digital still camera—Image stability There is a simplified accelerometer functional block diagram in Figure 1-3.

Figure 1-3. Simplified accelerometer functional block diagram

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 16 Freescale Semiconductor, Inc. Chapter 2 Basic Theory

2.1 Definition of terms To understand the electricity metering theory, here are some definitions of basic terms.

2.1.1 Power AC power flow has the three components — Real power (P) measured in (W), apparent power (S) measured in - (VA), and reactive power (Q) measured in reactive volt-amperes (VAr). Active power (P) also known as real power or working power is the power that actually powers the equipment. As a rule, true power is a function of a circuit's dissipative elements usually resistances (R).

Reactive power (Q) is a concept used by engineers to describe the loss of power in a system arising from the production of electric and magnetic fields. Although reactive loads such as inductors and dissipate no power, they drop voltage and draw current that creates the impression that they actually do. This imaginary power or non- working power is called reactive power (Q). If the load is purely inductive or capacitive, then the voltage and current are 90 degrees out of phase (for a , current leads voltage; for an inductor, current lags voltage) and there is no net power flow. This energy flowing backwards and forwards is known as reactive power. Reactive power thus is produced for system maintenance and not for end-use consumption. By convention, a "lagging" or inductive load, such as a motor, will have positive reactive power. A "leading", or capacitive load, has negative reactive power. Reactive power is a function of a circuit's reactance (X).

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 17 Definition of terms

Apparent power (S) is the vector summation of active and reactive power. It is the product of a circuit's voltage and current, without reference to phase angle. Apparent power is a function of a circuit's total impedance (Z).

These three types of power — true, reactive, and apparent relate to one another in a trigonometric form. This is called a power triangle (see Figure 2-1). The opposite angle is equal to the circuit's impedance (Z) phase angle. Apparent power is often computed from this power triangle using the Pythagorean Theorem as:

Figure 2-1. Power triangle

A common utility system is often based on Total Apparent Power (Stot) measured also in volt-amperes (VA). Total apparent power is a product of the RMS voltage and RMS current, and is defined as:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 18 Freescale Semiconductor, Inc. Chapter 2 Basic Theory

This a general proposition:

In a pure sinusoidal system with no higher harmonics, the apparent power (S) equals Stot. If there are some higher harmonics in the mains, apparent power is not the same as total apparent power, because the simple vector sum in apparent power computing loses accuracy. Therefore, Stot is often used because it is more precise in these situations.

2.1.2 Energy Energy is the accumulated power over a period of one . Active energy means the produced, flowing, or supplied by an electric circuit during a time interval, being integral with respect to time of the instantaneous active power and measured in units of - (Wh). For practical use in power meters, a higher unit called a kilowatt-hour (kWh) is used, which is 1000 watt-hours (Wh). Apparent energy means the integral with respect to time of the apparent power. Kilovolt- -hour (kVAh) is the unit for total (apparent) energy. Reactive energy means the integral with respect to time of the reactive power. Kilovolt- ampere-reactive-hour (kVArh) is the unit for reactive (non-working) energy.

2.1.3 Power factor The power factor of an AC electric power system is defined as the ratio of real power flowing to the load to the apparent power in the circuit, and is a dimensionless number between 0 and 1 (frequently expressed as a percentage, that is 0.5 pf = 50% pf). Real power is the capacity of the circuit for performing work in a particular time. Apparent power is the product of the current and voltage of the circuit. Due to energy stored in the load and returned to the source, or due to a non-linear load that distorts the wave shape of the current drawn from the source, the apparent power will be greater than the real power. In an electric power system, a load with a low power factor draws more current than a load with a high power factor for the same amount of useful power transferred. The higher currents increase the energy lost in the distribution system and require larger wires and other equipment. Because of the costs of larger equipment and wasted energy,

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 19 Electricity distribution electrical utilities usually charge a higher cost to industrial or commercial customers where there is a low power factor. Therefore, a modern electronic smart power meter must also measure the power factor. Power factor is defined as:

is the phase angle between voltage and current. When power factor is equal to 0, the energy flow is entirely reactive. Stored energy in the load returns to the source on each cycle. When the power factor is 1, all the energy supplied by the source is consumed by the load. Power factors are usually stated as leading or lagging to show the sign of the phase angle. It is often desirable to adjust the power factor of a system to near 1.0.

2.2 Electricity distribution Electricity distribution is the final stage in the delivery of electricity to end users. A distribution system's network carries electricity from the transmission system and delivers it to consumers. Part of what determines the design of the electricity meter is the transmission supply design, the most common residential arrangements being: • 1-phase, 2 wire (1P2W) — Europe and Asia 220 V-240 V, US 2-wire 110 V • 1-phase, 3 wire (1P3W) — US 3-wire, sometimes called 2-phase • 3-phase, 4 wire (3P4W) The 1-phase 2-wire installation is the most common form of electricity distribution in the world. Finally, more than 80% of the population in the world uses a 1-phase 2-wire installation of 230 V/50 Hz (see at Figure 2-2). Much of the US installation is 110 V/60 Hz 1-phase 2-wire. The electricity meter described in this design reference manual is designed for use in 1P2W installations.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 20 Freescale Semiconductor, Inc. Chapter 2 Basic Theory

Figure 2-2. Residential voltage and frequency worldwide

2.3 Electricity meters An electric meter or energy meter is a device that measures the amount of electrical energy consumed by a residence, business, or an electrically powered device. Electric meters are typically calibrated in billing units, the most common is the kilowatt hour. Periodic readings of electric meters establish billing cycles and energy used during a cycle. The most common unit of measurement on the electricity meter is the kilowatt hour (kWh), which is equal to the amount of active energy used by a load of one kilowatt over a period of one hour, or 3,600,000 . Some electricity companies use the SI megajoule instead. Similarly to active energy in kWh, there is also defined a reactive energy (kVArh) and apparent energy (kVAh), see Section 2.1.2 Energy . Electricity meters operate by continuously measuring the instantaneous voltage () and current (amperes) and finding the product of these to give instantaneous electrical power (watts) which is then integrated against time to give energy used (joules, kilowatt- hours and so on.). Meters for smaller services (such as small residential customers) can be connected directly in-line between source and customer. For larger loads, more than about 200 amps of load, current transformers are used, so that the meter can be located other than in line with the service conductors. The standard electricity meters fall into two basic categories, electromechanical and electronic.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 21 Electricity meters

2.3.1 Electromechanical meters The most common type of electricity meter is still the electromechanical induction watt- hour meter. These meters will be progressively substituted by fully electronic meters because of many additional advantages of these meters (see Section 2.3.2 Electronic meters). The electromechanical induction meter operates by counting the revolutions of an aluminium disc that is made to rotate at a speed proportional to the power. The number of revolutions is proportional to the energy usage. It consumes a small amount of power, typically around 2 watts. The metallic disc is acted upon by two coils. One coil is connected in such a way that it produces a in proportion to the voltage, and the other produces a magnetic flux in proportion to the current. The field of the voltage coil is delayed by 90 degrees using a lag coil. This produces eddy currents in the disc and the effect is such that a is exerted on the disc in proportion to the product of the instantaneous current and voltage. A permanent exerts an opposing force proportional to the speed of rotation of the disc. The equilibrium between these two opposing results in the disc rotating at a speed proportional to the power being used. The disc drives a register mechanism that integrates the speed of the disc over time by counting revolutions, much like the odometer in a car to render a measurement of the total energy used over a period of time.

2.3.2 Electronic meters Electronic meters display the energy used on an LCD or LED display, and can also transmit readings to remote places. In addition to measuring energy used, electronic meters can also record other parameters of the load and supply such as maximum demand, power factor, reactive power used, and so on. They can also support time-of-day billing, for example, recording the amount of energy used during on-peak and off-peak hours. A typical electronic power meter has a power supply block, a signal conditioning circuit, a metering engine (AFE), a processing and communication engine (that is, a microcontroller), and other add-on modules such as RTC, LCD, communication ports and modules, and so on. A basic block outline of the electronic power meter, see Figure 2-3.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 22 Freescale Semiconductor, Inc. Chapter 2 Basic Theory

User Selection

voltage Signal analog AFE digital MCU LCD current Conditioning ADC

AMR Communications

Figure 2-3. Basic outline of the electronic power meter The signal conditioning circuitry is used for adapting a high-amplitude signal from the mains to a lower one, accepted by the AFE (ADC). The metering engine is given the voltage and current inputs, has a voltage reference, samplers. and quantisers followed by an ADC section to yield the digitised equivalents of all the inputs. All of this is sometimes called the Analog Front-End (AFE). These inputs are then processed using a DSP or MCU to calculate the various metering parameters such as powers, , and so on. The processing and communication section has the responsibility of calculating the various derived quantities from the digital values generated by the metering engine. This also has the responsibility of communication using various protocols and interfaces with other add-on modules connected as slaves. RTC and other add-on modules are attached as slaves to the processing and communication section for various input and output functions. On a modern meter, most if not all of this is implemented inside the microprocessor, such as the Real Time Clock (RTC), LCD controller, temperature sensor, memory, and analog to digital converters. One of the important features of the modern electronic power meter is AMR technology. The AMR is the technology of automatically collecting consumption, diagnostic, and status data from energy metering devices and transferring that data to a central database for billing, troubleshooting, and analyzing. This advance mainly saves utility providers the expense of periodic trips to each physical location to read a meter. Another advantage, is that billing can be based on near real time consumption rather than on

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 23 Voltage and current measurement estimates based on previous or predicted consumption. This timely information coupled with analysis, can help both utility providers and customers to better control the use and production of electric energy. Electronic meters with AMR technology can read and communicate through several mechanisms such as: • Infrared • Radio frequency • Data (via a line) • Power line carrier • (RS-485) • Broadband AMR meters often have sensors that can report the meter cover opening, magnetic anomalies, extra clock setting, stuck buttons, inverted installation, reversed or switched phases, and so on. These events may be immediately sent to the utility company thanks to AMR technology. Smart meters go a step further than simple AMR. They offer an additional function, including a real-time or near real-time reading, notification, and power quality monitoring. They allow price setting agencies to introduce different prices for consumption based on the time of day and the season. The feedback they provide to consumers has also been shown to cut overall energy consumption. In comparison to traditional mechanical or electromechanical power meter solution, the electronic meters offer the utility market several additional advantages including: • Improved immunity and reliability • Higher accuracy • Higher security • Support of a wide range of power factor loads • Calibration is easier • Anti-tampering protection including traditional or modern solutions • Automated meter reading (AMR) • Advanced billing methods (prepay, time-of-use, an so on.)

2.4 Voltage and current measurement In electricity meters the energy is calculated from two measured signals, voltage and current. For line voltage and line current measurement, systems that are generally called sensors are used. Whichever sensor is used for voltage and current measurement results in an AC voltage with a magnitude proportional to the signal being measured.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 24 Freescale Semiconductor, Inc. Chapter 2 Basic Theory The voltage sensor results in a sine wave with a fundamental frequency typically either 50 Hz or 60 Hz depending upon the power distribution used, see Section 2.2 Electricity distribution. For current measurement, the sensor provides a fundamentally sinusoidal signal (possibly with harmonics) which may lag or lead the voltage signal depending upon the load. A typical simplified configuration for metering voltage and current in a 1-phase 2-wire installation is shown in Figure 2-4. There are three typical sensors used for sensing current and voltage in power meters. All of these sensors are also used in the electronic power meter described in this manual.

Figure 2-4. Typical measurement circuit in 1P2W installation The following sections describe the most used methods for sensing voltage and current used in the electronic power meters.

2.4.1 Voltage divider A voltage divider is used for voltage measurement. In a practical implementation, multiple series resistors are used instead of R1to limit the power dissipation and reducing heat generated thus improving accuracy, see Figure 2-4. The equation for computing output voltage of the voltage divider is defined as:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 25 Voltage and current measurement

Where Vin is the phase voltage and Vout is the voltage measured by the ADC (voltage drop at R2). The voltage divider can be selected to more closely meet the specification of the ADC.

2.4.2 Shunt resistor A shunt resistor is used to sense the current primarily due to the fact it does not distort the signal and is extremely low cost in comparison to other current measurement methods. The downside of using a shunt resistor is primarily the power dissipation that can create inaccuracies in the measurement due to resistive changes and due to temperature and waste of power. To limit the self heating effect of the shunt, the resistor is made using a metal with suitable properties. The resistance of the shunt is kept very low to reduce the power dissipation. Typically, shunt resistors are in the range of 100 μΩ to 300 μΩ and as such the voltage developed across them is very small. For example, 100 A drawn through a 200 μΩ shunt develops only 20 mV (Voltage = current * resistance) through a 300 μΩ shunt this would be 30 mV, which develops 2 W power loss and 3 W respectively. The problem of this approach is the very small derived from the shunt resistor and the even smaller resolution of valid measurements. Therefore, a signal derived from the shunt resistor must be amplified to keep the correct measurement precision. An Operational Amplifiers are frequently used for this purpose (see Figure 2-4). There are several rules for a right selection of a shunt resistor in the application: • A shunt resistor must have good thermal properties (that is Manganin-Alloy with a low temperature coefficient of resistance) • Select the shunt size to maximize the dynamic range of the ADC input • Minimize the power dissipation in the shunt resistor NOTE Power dissipated by the shunt resistor plus the power supply used by the meter, must be below the specification for the meter (IEC1036 specifies a 2 W total power loss).

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 26 Freescale Semiconductor, Inc. Chapter 2 Basic Theory 2.4.3 Current transformer Current Transformers (CT) are used extensively for measuring current and monitoring of the power grid. Like any other transformer, a current transformer has a primary winding, a magnetic core, and a secondary winding. The flowing in the primary produces a magnetic field in the core, which then induces a current in the secondary winding circuit, see Figure 2-5. The CT is typically described by its current ratio (N) from primary to secondary. Relative to current output of the CT, it is necessary to use an external current to a voltage converter, such as a burden resistor Rb (see Figure 2-4), in systems where the voltage input of the ADC is used in the majority of applications. The primary objective of the current transformer design is to ensure that the primary and secondary circuits are efficiently coupled, so that the secondary current bears an accurate relationship to the primary current. Benefits of using a CT are that the output voltage can easily be matched to the capability of the ADC input by selecting appropriate winding or appropriate burden resistor (Rb), because of this, an OpAmp pictured at Figure 2-4 is not necessary. The next important benefit of using a CT is that this sensor isolates the measuring engine from the mains, therefore the CTs may be easily used in polyphase meters. A typical feature of a CT is the time shift (delay) between the primary and secondary currents in the windings. For using this in the power meters, it is good to know that the power meters must wait a specific time after the voltage measurement before reading the current from the CT. The delay required is specific to each CT and is established during calibration of the meter and programmed into the meter; as a part of calibration constants. CT coils have the negative effect of distorting the current measurement. Considering the magnetic core of the CT, it is necessary to respect a maximum recommended current in the primary winding (rating factor) because of saturation of its core. A good accuracy in the case of CT current measurement is directly related to other factors, including external electromagnetic fields and a change of temperature.

Figure 2-5. Current transformer principle

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 27 Voltage and current measurement

2.4.4 Rogowski coil A Rogowski coil is an electrical device for measuring alternating current (AC) or high speed current pulses. It consists of a helical coil of wire with the lead from one end returning through the centre of the coil to the other end, so that both terminals are at the same end of the coil, see Figure 2-6. The whole assembly is then wrapped around the straight conductor whose current is to be measured. Because the voltage that is induced in the coil is proportional to the rate of change (derivative) of current in the straight conductor, the output of the Rogowski coil is usually connected to an electrical, or electronic integrator circuit to provide an output signal that is proportional to the current. One advantage of a Rogowski coil over other types of current transformers is that it can be made open-ended and flexible, allowing it to be wrapped around a live conductor without disturbing it. Because a Rogowski coil has an air core rather than an iron core, it has a low and can respond to fast-changing currents. Also, because it has no iron core to saturate, it is highly linear even when subjected to large currents, such as those used in electric power transmission, welding, or pulsed power applications. A correctly formed Rogowski coil with equally spaced windings is largely immune to electromagnetic interference. Benefits of using a Rogowski coil are similar to using a CT, namely that the output voltage can more easily be matched to the capability of the ADC input by selecting an appropriate winding, load resistor and filter. Another advantage of a Rogowski coil, is the lower cost than a traditional CT, although it requires an integrator and additional phase compensation.

Figure 2-6. A Rogowski Coil Principle

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 28 Freescale Semiconductor, Inc. Chapter 3 System Concept

3.1 Application description A standard system block diagram of the MCF51EM256 power meter concept is described in Figure 3-1. The full-metering system solution, that is all the components inside of the green-dashed rectangle, incorporate these parts: • Metering board, inside the grey-dashed rectangle — The main metering engine, here is the concentrated majority of metering components • Switch Mode Power Supply board — SMPS, this board is used for supplying the metering engine and the 1322x-LPN daughter card • External current sensors (CT, shunt resistor) — Located directly to the mains power connector inside the metering case • 1322x-LPN — Daughter card for ZigBee communication • Power Meter case with an integrated mains power connector and RS232 communication connector Some common parts of the power meter in the block diagram have the same color for better function identification, mainly the voltage and current sensors (red color), see Figure 3-1. There are two current sensors in the power meter; shunt resistor and current transformer, both are located near the mains power connector inside the power meter case, outside the metering board. There is voltage measurement sensor (voltage divider) which is located directly on the metering board.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 29 Application description

Figure 3-1. MCF51EM256 power meter block diagram

3.1.1 Metering board The metering engine (board) is the main part of the power meter. Here are concentrated components such as: the MCU with AFE, signal conditioning part, LCD, buttons, LEDs, optical interface for the IEC1107 and RS232, voltage sensor, tamper button, 3 V battery, accelerometer, and connector for the 1320x-RFC daughter card. The metering board is designed on a two-sided printed circuit board. Most of the components are soldered on its top side (see Figure 3-2), with only some connectors soldered on the bottom side of this PCB, (see Figure 3-3).

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 30 Freescale Semiconductor, Inc. Chapter 3 System Concept

Battery Display BDM Infrared Interface Interface User LED

OC Interface

Bias Voltage RS232 for OpAmps Interface

EOC Interface

CT Signal Conditioning Part LED (full configuration) Interface

Tamper Shunt Resistor Button LED KWh LED Kvarh Signal MCU XTAL Power-on CT Signal Voltage Divider Reset MRAM Conditioning Part LED Conditioning Part Signal Button Accelerometer (low-cost configuration) Conditioning Part User Buttons Interface Figure 3-2. Top side metering board view

Open-collector interface

RS232 interface

EOC interface

1322x-LPN or accelerometer interface

1320x-RFC interface

Power Voltage Shunt CT supply interface interface interface Figure 3-3. Bottom side metering board view

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 31 Application description The core of the metering engine placed on the top side of the PCB is the 32-bit Coldfire V1 microcontroller, called the MCF51EM256 (for a description see Section 1.3 MCF51EM256 Microcontroller series). All of the MCU peripherals except for the BDM interface, which are currently used in the application are pictured in the block diagram in Figure 3-1. A simplified function of the MCU in the application is as follows: The ADC primarily reads data from voltage and currents sensors. The MCU computes other values like powers, energies, power factor, and line frequency consecutively. The MCU communicates with the user via the built-in HMI (LCD+buttons) or via several communication interfaces (RS232, ZigBee, IEC1107, LEDs, OC). A description of the metering algorithm is the content of this design reference manual, but it is described in application note titled FFT-based Algorithm for Metering Application (document AN4255). The HMI of this power meter is comprised of these parts: LCD, two user push-buttons, and one user (yellow) LED. On the LCD, the user can see plenty of computed values, such as the RMS value of line voltage and current, powers, energies, power factor, line frequency, and also actual time and date. By using the two push-buttons, the user can select one of these values to be shown on the LCD. NOTE There is only one value shown on the LCD at one time. The user yellow LED is part of the open-collector (OC) interface. The next important part of the metering engine board is the signal conditioning part. This part is used for adapting the signal level from sensors to the AFE (part of the MCU included ADC, VREF, and so on). There are several different types of signal conditioning parts with regards to sensors used: the part for voltage measurement is made of a simple voltage divider, which is also described as the voltage sensor in this Design Reference Manual. The part for current measurement via a shunt resistor is made from two operational amplifiers (only one is pictured in the simplified block diagram in Figure 2-4) with a resistive feedback network which produce two voltage signals with different gains (26x and 520x approximately). The current measurement via the current transformer (CT) is made in the first level by a burden resistor which works as a simple current to voltage converter. This connection produces only one-gained voltage measurement. The second level of signal conditioning for the current measurement via the CT is optional (dotted symbol for the OpAmp in the block diagram). This is done by several operational amplifiers, also with a resistive feedback network that produces two voltage level signals with different gains; because of this, a two-gained voltage measurement is executed (similar to the current measurement via a shunt resistor).

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 32 Freescale Semiconductor, Inc. Chapter 3 System Concept There are several communication interfaces on the metering board. The interface for RS232 is optically isolated via optocouplers and the interface for the IEC1107 is optically isolated via infrared components. The open-collector is a non-optically isolated output of the power meter – this may be used for switching some small loads (up to 1.6 W). One of the most interesting types of communication in this power meter is RF or ZigBee. Communication via RF/ZigBee is done primarily by the external 1322x-LPN daughter Card (outside the metering engine) which communicates with the metering board through the IIC interface. Secondarily, the RF communication may be done via the 1320x-RFC daughter card which communicates with the metering board through the SPI interface. But the preferential type of RF communication in this Power Meter is through external 1322x-LPN board (the IIC interface between the boards). Finally, two red LEDs are used for optical communication with utility service provider – this is energy output interface, the first LED is here for active energy counting and the second LED is for reactive energy counting. The essential parts of the metering board are components for proper function of the RTC part of the MCU, including the 3 V battery (for saving date and time), crystal and external tamper push-button. The tamper push-button is used only for simulation purposes in this power meter, because it needs user interaction. But in true power meters this button is hidden inside of the power meter and waits for the cover opening by the user – in this case, the illegal interference to the metering engine is detected. The other way of tamper detection in this power meter may be by using a 3-axis IIC accelerometer—the MMA7660FC silicon may be used for that. The MCF51EM256 power meter currently does not use this type of tamper detection, however the interface for it is now prepared. An illegal cover opening can cause a 3-axis motion that which can be detected by this accelerometer. Then some kind of sophisticated algorithm must be used consecutively, because this event must be filtered from ordinary motions of the power meter and interpreted as an illegal cover opening. But this type of tamper detection is only optional, primarily the tamper push-button is used for that.

3.1.2 Switch mode power supply board connection The SMPS board is used for supplying the metering board engine. The SMPS used in this application is a 3-rd party open-frame solution for the power supply that produces one galvanic-isolated level of output voltage. This open-frame SMPS module has a wide range of input AC voltages beginning at 85 V RMS up to 264 V RMS with a wide range of mains frequency (47 Hz to 63 Hz) too. Thanks to input parameters of this SMPS, the whole power meter can work with mains of these voltage and frequency ranges. The output voltage is fixed to a 3.3 V DC level with 1.3 A nominal output current, and the power rating is then 4.3 W. The board overview is in Figure 3-4. There are two power

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 33 Application description connectors on this board—on the left side there is an input socket for connection to the mains (L_inp, N_inp), and on the right side there is an output socket for supplying the board. The SMPS is screwed onto the bottom part of the power meter case and connected to the mains and metering board via two thin cables.

+3.3V N_inp L_inp GND

Figure 3-4. SMPS board view

3.1.3 External current sensors connection There are two types of external current sensors as was described above: shunt resistor and current transformer. For the correct mains current measurement in the basic power meter configuration, only one of these sensors is required. In the full metering configuration, two sensors are used. In this configuration, the shunt resistor is used for phase current measurement, the CT is used for neutral current measurement. LINE_IN LINE_OUT

GND

L_inp L_out Figure 3-5. Shunt resistor description

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 34 Freescale Semiconductor, Inc. Chapter 3 System Concept The shunt resistor is mainly a MANGANIN® resistor of an accurately known resistance, in this case 150 μΩ . This shunt resistor is intended for current measurement of up to 100 A RMS. The voltage drop across the shunt resistor is proportional to the phase current flowing through it, because its resistance is known, a small voltage drop is amplified by operational amplifiers, and then measured by the internal ADC of the MCU. For a photo of this shunt resistor see Figure 3-5.The terminal connection of this shunt resistor is divided into two parts—power connection and sense connection, because of this, a 4-wire current measurement may be done. The power connection is intended for a connection between the phase input (L_inp) and phase output (L_out) connectors. The sense connection of this shunt resistor is intended only for measuring its voltage drop. NOTE There is also a separated ground terminal in the sense connection area for the metering board ground connection. This ground terminal is located on the same side as the power phase input (L_inp). The CT is also used for current measurement. In the basic configuration (low-cost), it is intended for phase current measurement equally to the shunt resistor, but in a full-system configuration (where a shunt resistor is used) the CT is used for neutral current measurement. The primary winding of this CT is created from a one-coil hard wire, connected between the phase input and phase output terminals (basic configuration), or between the neutral input and neutral output terminals (full-system configuration). In fact, this hard wire connection is executed by several (two) wires connected in parallel. For a maximum flowing current of 100 A RMS, a minimum of 16 mm2 of conductor cross-section is required. There is a CT description in Figure 3-6.

Gap for primary winding

Secondary winding termination

Figure 3-6. Current transformer description

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 35 Application description 3.1.4 1322x-LPN connection The 1322x-LPN is intended for use of a ZigBee node for the power meter. It works as an inter-mediator between the power meter and a ZigBee coordinator which is based at the utility provider area for example. The ZigBee coordinator scans data from numerous equipment (power meter, home thermostat, sensor, dimmer switch, and so on.) in the ZigBee network and sends it to the central (PC) station. The 1322x Low Power Node is screwed on the bottom part of the power meter case, similar to where the SMPS is, and connected as a daughter card to the metering engine through a thin flat cable. The board overview is in Figure 3-7. There are two (optionally three) pairs of wires for its connection to the metering board: the first pair is for supplying the node (3.3 V, GND), the second pair is for the IIC communication lines (SCL,SDA), and the last optional pair is for resetting the node by the external RESET push-button which is placed on the metering board. NOTE The RESET push-button is used primarily for supplementary resetting the metering board, but for resetting the 1322x-LPN there are unused pins for doing this.

IIC connections

- Power connection arrea +

Reset pin Figure 3-7. 1322x-LPN Board View

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 36 Freescale Semiconductor, Inc. Chapter 3 System Concept 3.1.5 Power meter case Placed in a power meter case are all the components mentioned (boards, sensors, and so on). It is made as a base with the terminal compartment cover, an EPDM gasket, and a smoked transparent cover with a PUR gasket. It is intended primarily for DIN-rail mounting in a vertical position (for example, on the wall ). Ingress protection of this case is IP65, but due to apertures for push-buttons, it is downgraded to IP42. Because of the transparent cover, the metering board with all its components, including the LCD primarily are easily visible.

Spacer RS232 flat cable & connector Spacer

SMPS

CT

Primary winding for CT

N_out

N_inp

L_out

L_inp

Metering Board Spacer 1322x-LPN Shunt Resistor Spacer Figure 3-8. Power meter case — inside view Figure 3-8 shows a photo of the metering case. You can see the boards and the current sensor placements. There are also three or four power terminals in the terminal compartment section. The number of terminals (3 or 4) depend on the system configuration—basic with one current sensor (three terminals), or full-system with two current sensors (four terminals). The main metering board is screwed onto four spacers on the front side of the power meter case. On the bottom inside of the case there are the SMPS and 1322x-LPN daughter card. The shunt sensor is soldered directly between the two left power terminals (L_inp,L_out), and the CT sensor with its hard-wires, is

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 37 Application usage connected between the two right power terminals (N_inp,N_out). On the right side of this case, there is an RS232 connector, which is connected to the main board via a thin 9-pin flat cable.

3.2 Application usage

3.2.1 Power meter hardware configuration This power meter is primarily used for demonstration purposes of the MCU used in a single-phase two wire installation. For a better practical demonstration of the power meter, the metering case is placed on a perspex base where an outlet is also placed (for load connection) and a cable with a plug (for connection to the power mains). The whole configuration is also called the power meter demo, see Figure 3-9.

SW1 SW2 Tamper Transparent Reset cover

Metering engine

Case

Terminal compartment

Plug

Pedestal

Outlet Figure 3-9. The power meter demo view

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 38 Freescale Semiconductor, Inc. Chapter 3 System Concept Although the current range of this power meter is internally set for a current measuring of up to 100 A, for practical use this range is decreased to approximately 16 A, adequate for demonstration purposes. This is caused by a maximum current rating of the outlet and plug used. For customers who want to use the whole metering range up to 100 A, both the plug and outlet must be replaced by more powerful ones. For remote data communication the RS232 port may be used or the in-built ZigBee node. Some communication interfaces, like an open-collector and so on are not directly accessible.You must first open the cover of the case to access their connections.

3.2.2 Application example The power meter demo can work in several hardware configurations, depending on the current sensors used. In the basic or low-cost configuration it works only with one current sensor, the shunt resistor or CT described in Section 3.1.3 External current sensors connection. One of these sensors can measure line current only. The full metering configuration allows measuring of not only the line current, but also the neutral current. Because of this, several tampering techniques may be used for protecting against hacking in the energy systems. For example, against a partial earth fault condition. An earth fault means some of the load is connected to another ground potential and not the neutral wire. Figure 3-10 shows a normal connection in a full-metering configuration and how the phase and neutral wires are connected to the single-phase power meter. NOTE The current going through the phase wire is the same as that coming out of the neutral wire (IP=IN). Figure 3-11 shows a partial earth condition where one of the loads is connected to the ground and thus part of the return current I2 does not go through the meter. Thus the current in the neutral wire IN is less than that in the phase or live wire (IP). To detect this condition, the power meter firmware monitors the current on both energy wires, phase and neutral, and compares them. If they differ significantly, the firmware uses the larger of the two currents to bill the energy and signals a fault condition. This is one of the tampering events in the power meter.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 39 Application usage neutralphase Single Phase Energy Meter IP L_inp

Fault shunt

L_out metering N_inp engine IN CT

N_out

I1

I2 Figure 3-10. Normal phase neutral connection for 1-ph power meter neutralphase Single Phase Energy Meter IP L_inp

Fault shunt

L_out metering N_inp engine IN CT

N_out

I1

I2 Figure 3-11. Partial earth fault condition

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 40 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board

4.1 Introduction to hardware implementation This chapter describes the design of the application hardware, that is the design of the metering board (engine). The main hardware is divided into two main parts, digital hardware (HW) and analog hardware. Analog HW is also called signal conditioning in this manual. Both of these parts are configurable depending on the customer request, from a low-cost up to a high performance configuration. The stand-alone section of the metering board is the power supply section, this is a mandatory part of each configuration of the power meter. There are also plenty of test points in some important parts of the metering board for primarily metering and testing purposes.

4.2 Power supply The power supply section is used only for adapting the voltage level from the external SMPS to the internal board, including also the overvoltage protection and signalize function (LED) - see Figure 4-1. Connector J1 placed on the bottom side of the PCB is the input power supply connector of the board. This connector must be joined to the external SMPS, therefore, pin 1 of connector J1 to 3.3 V on the SMPS and pin 2 of the connector J1 to the GND of the SMPS. As you can see, there is a simple overvoltage protection including the Zener diode D1 and D3. These diodes protect against a reversing of polarity. Some circuits of the whole design require two separate power supply levels, a digital and analog power supply. The analog power supply level is separated from the digital part of the power supply by the chip inductors L1 and L2 with filters (C5―C7) co-operation. The analog power supply level is consequently marked +3.3 VA in the schematic, analog ground is then marked GNDA.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 41 Digital hardware For presence of an external power supply level (from the SMPS) there is a green LED D2 in the power supply section.

+3.3V +3.3VA J1 L1 1uH 1 1 2 A 1 2 D1 D2 C5 C6 + C7 D3 B + C3 C1 C4 MMSZ5231BT1G CON_2_TB GND WP7104LGD 47UF 0.1UF 100PF L2 1uH 0.1UF 100PF 47UF 5.1V 5.1V 1 2 2 GND R2 GND GND GND GNDA

MMSZ5231BT1G 330

GND Figure 4-1. Power supply part of the metering board

4.3 Digital hardware

4.3.1 MCU core The MCU is the core of the metering board. It is marked U1 in the schematics. The MCU core with all key components are diplayed in the digital section of the schematic in Figure A-1 or Figure A-3. For the MCU to function correctly, several components are necessary: • Filters C8–C12, C48 • Crystal Y1 • Battery BT1 (for RTC only) • Tamper push-button TAMPER1 for simulation only (for RTC only) Analog circuits (ADC, PRACMP) are also present in the MCU, therefore analog power supply is necessary for supplying it. Another part of the the MCU core, which we may simply assign to it, is the HMI. These components include the display LCD1 and the two user push-buttons SW1 and SW2 with simple filters C13, C17. Pull-up resistors for the buttons are software selectable by the MCU. The charge pump for the LCD is the part of the MCU. Therefore, only minimum external components regarding the LCD are required, in fact, only capacitors C14, C15, C16, and C18. Connector J3 is the BDM interface for MCU programming. Be careful about programming the MCU through this interface in the configuration where the power meter demo is fed from the mains. This interface is not isolated from the mains, therefore an electric shock can arise. To prevent this, use an external optically isolated BDM interface.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 42 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board However, the best solution for MCU re-programming is using the bootloader in co- operation with the optically isolated RS232 data line (see at Section 5.2.3 Code reprogramming via serial bootloader). There is a RESET1 push-button that can reset not only the MCU, but also the external 1322x-LPN daughter card, this is because of the unused pins 4 and 5 of this button. Here, this button is only for evaluation purposes in real power meters there is no room nor reason for it. The auxiliary part of the MCU core is an external universal SPI MRAM, whose density is 1 Mb.

4.3.2 RS232 interface This interface is primarily used for a basic set-up of software for the meter, this includes calibration and checking sensor outputs. The second function of this interface is programming the power meter from a PC by a bootloader (see Section 5.2.3 Code reprogramming via serial bootloader). Communication is optically isolated through optocouplers ISO1 and ISO2. Because of using two additional signals on the serial data line, RTS and DTR, the secondary side of ISO1 and the primary side of ISO2 are powered from the RS232 data line (from the PC side). These signals are normally used for transmission control, but this function is not used in the application, it is because of the fixed voltage level on these control lines used for supplying these optocouplers, in co- operation with others components. These components include, D6–D8, C19, R7, and R13. The part of the schematic including the RS232 communication interface can be seen in Figure 4-2.

TP5 ISO1

2 3 (+12V) RTS R6 330

R7 +3.3V RS232_TXD 4.7K RS232_RXD 1 4 2 2 SFH6106-4 C19 D7 D6 J5

R9 1 2 1.0K ISO2 + 2.2UF RXD 3 4 5 6 1 1 TXD MMSD4148T1G 3 2 MMSD4148T1G DTR 7 8 GND 9 10

R13 CON_2X5 470 TP6 D8 4 1 1 2

SFH6106-4 MMSD4148T1G

GND Figure 4-2. RS232 communication interface of the metering board

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 43 Digital hardware

4.3.3 Infrared interface (IEC1107) This interface uses infrared components, the high efficiency IR emitting diode D9, and the NPN phototransistor Q3. Both of these are through-hole assembled. Other than these, some necessary passive components are used such as R8, R10, R12 and C21. The part of the schematic including the IEC1107 communication interface can be seen in Figure 4-3.

IR_TX TP7 IR_RX +3.3V R8 R10 680.0 22K IR_RX R12 TP8 1.0K Q3 D9 2 1 C21

0.1UF OP506B TSAL4400 2 GND GND 1 GND Figure 4-3. IEC1107 part of the metering board

4.3.4 User interfaces The part of the schematic including both user interface parts can be seen in Figure 4-4. One of these interfaces is also called the open-collector interface (OC). It has two functions, primarily, it is used for switching some small loads up to 1.6 W, by using the NPN transistor, Q1. It switches the voltage level 3.3 V through an external load to GND. The second function of the user interface optically signalizes some program states via a yellow LED D4 that may be used for debugging purposes. NOTE The user interface uses the same control signal from the MCU for OC interface and for LED controlling.

CON_2_TB 2 +3.3V B 1 A ISO3

3 CON_2_TB LED_USR R3 1 Q1 J2 EOC_PULSE 2 3 EOC_OC2 220 MMBTA42 R14 330 B 220 EOC_OE1 2 A R4 TP9 J7 GND +3.3V

1 1 4 D4 SFH6106-4 WP7104LYD 2 GND Figure 4-4. Two user interface parts of the metering board

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 44 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board There is also one general purpose user interface, called the EOC interface. This interface is optically isolated through optocoupler ISO3. Output from this interface is accessible on the connector J7.

4.3.5 LED interface The LED interface is used for energy counting. There are two separate high-efficiency red LEDs for doing this, D5 for active energy counting and D15 for reactive energy counting. Both of these LEDs are through-hole assembled for a better placement near the cover. The part of the schematic including the LED interface can be seen in Figure 4-5.

D15 LED_kVarh R59 2 1 330 WP7104LSRD +3.3V D5 LED_kWh R5 2 1 330 WP7104LSRD Figure 4-5. LED part of the metering board

4.3.6 SPI interface This interface is used exclusively for joining the 1320x-RFC daughter card to the metering board through the 40-pin header J8. Communication between the boards uses SPI data lines. The part of the schematic including the SPI communication interface can be seen in Figure 4-6.

J8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 IRQ 21 22 23 24 25 26 27 28 29 30 RF_RESET 31 32 RF_RTXEN RF_ATTN 33 34 SPI1_SCK 35 36 SPI1_MOSI SPI1_MISO 37 38 RF_CE 39 40 +3.3V GND CON_2X20 Figure 4-6. SPI Interface Part of the Metering Board

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 45 Digital hardware 4.3.7 Accelerometer interface The accelerometer function in this power meter was minutely described in Section 3.1.1 Metering board. The section of the schematic including the accelerometer interface can be seen in Figure 4-7. In this schematic, the accelerometer is marked U6. The accelerometer may be used in this power meter for tamper detection (optional only) instead of the standard button.The accelerometer communicates with the MCU through IIC data lines, therefore external pull-ups R60 and R61 on the SDA and SCL lines are required. There is also the possibility of placing the accelerometer outside of the metering board, like the daughter card thanks to the IIC header J4. This daughter card may be placed on the inner side of the case cover for a better detection of tamper events.

D16 1 +3.3V U6 J4 3 10 1 5 6 C44 C45 9 NC2RESERVED 2 C46 C47 3 4 2 8 DVDD NC1 3 1 2 10UF 0.1UF 7 DVSS AVDD 4 10UF 0.1UF BAT54CLT1 R61 6 SDA AVSS 5 HDR 2X3 1.0K R60 SCL INT V_BAT 1.0K GND MMA7660FC GND SCL GND SDA /INT Figure 4-7. Accelerometer interface part of the metering board

4.3.8 IIC interface The IIC interface is used for joining the accelerometer (Section 4.3.7 Accelerometer interface), and the 1322x-LPN Daughter Card. This daughter card is used primarily for RF/ZigBee communication, more often then the 1320x-RFC daughter card is used. The 1322x-LPN board is connected via a thin flat cable directly to the 6-pin header J4 of the metering board and also to the RESET1 push-button of the metering board. A schematic of the connection between the metering engine and daughter card can be seen in Figure 4-8.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 46 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board Metering board1322x-LPN +3.3V J4 J1 5 6 1 2 3 4 I2C_SDA 3 4 I2C_SCL 1 2 5 6 7 8 HDR 2X3 9 10 11 12 GND

90122-12

BC1 2xAAA Cells GND 2 1 +3.3V - + RESET1 6 1 2468 J17 5 2 1 2 4 3

TSM-102-01-L-SV P12S1LZ

Figure 4-8. Interface between 1322x-LPN and the metering board

4.4 Signal conditioning In regards to various signal conditioning part configurations, there are also various power meter configurations. These configurations depend not only on the analog parts, but also on digital configurations. There are three power meter configurations differentiated in regards to the current signal conditioning section: • Full configuration with both a CT (1 gain or 2 gains) and a shunt resistor (2 gains) current measurement. For sensor connections to the board see Figure 4-9, for a schematic view see Figure A-1, and Figure A-2. For layout views see Figure B-1 and Figure B-2, and for the BOM see Table C-1. • Low-cost configuration with a shunt resistor (2 gains) current measurement. For sensor connection to the board see Figure 4-10, for a schematic view see Figure A-3, and Figure A-4, for layouts views see Figure B-5 and Figure B-6, and for the BOM see Table C-4. • Low-cost configuration with a CT (1 gain) current measurement. For sensor connection to the board see Figure 4-11, for a schematic view see Figure A-3 and Figure A-5, for layouts views see Figure B-3 and Figure B-4, and for the BOM see Table C-3.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 47 Signal conditioning

L_inp L_out N_inp LOAD N_out

Figure 4-9. Shunt and CT current measurement connection

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 48 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board

L_inp

L_out

LOAD N

Figure 4-10. Shunt current measurement connection

L_inp L_out

LOAD N

Figure 4-11. CT current measurement connection

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 49 Signal conditioning Apart from these three basic configurations, others may be constructed by adding or disconnecting some digital parts of the power meter configuration, for example the infrared or OC communication. Be careful, some parts mainly in the digital area are vital (MCU core, RS232 communication, and so on).

4.4.1 Voltage measurement There is a simple voltage divider used for the line voltage measurement in Figure 4-12. It is a basic and key part of each configuration of the power meter. In the basic block diagram (see Figure 3-1) there is a voltage divider, based on two simple resistors. In a practical implementation it is better to design this divider from several resistors connected serially due to a power-loss spread. One part of this total resistor consists of R32, R33, R34, and R57, the second part consists of resistor R36. The basic voltage divider described produces a sine voltage signal around ground. This is not acceptable for the ADC, because all voltage signals connected to it must be above ground (single-ended configuration). Therefore, a further voltage divider that raises the signals is added to the connection. This second divider is made from the R29||R30 combination and from the R36 (a part of the mains divider). The ratio of this second divider allows having a voltage on the ADC input from 0 V to 1.2 V (Vref). The sine voltage signal from the mains is then shifted to Vref/2, that is 0.6 V approximately (voltage at VLINE, see Figure 4-12).

VDDA

TP13 R29 R30 100k 4.7K

R57 R32 R33 R34 VLINEVLINE R35 V_OUT N_IN V_OUT 220K 220K 100k 47k 47 1.2V +/-0.6V

1k C30 R36 1000pF LPF CUTOFF 3.4MHz

GNDA GNDA Figure 4-12. Voltage signal conditioning part schematic Finally, there is a simple RC low-pass filter (R35+C30) at the end of the voltage divider. The cut-off frequency for that is set to 3.4 MHz according to this relation:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 50 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board 4.4.2 DC Bias circuit This circuit is used for raising the voltage signal levels to about Vref/2 in the current measurement. This is necessary for converting the input signal levels from differential to a single-ended configuration, required by the ADC. Its function is the same as the function of the voltage divider R29||R30 plus the R36 in the voltage measurement section (see Section 4.4.1Voltage measurement). In comparison to that voltage divider, higher output loading is required because of using this connection in several parts of the current measurement sections (see below). Therefore, an operational amplifier U7, working as a voltage follower, is used for that. This amplifier extends loading of the basic voltage divider (R21, R56), that produces a DC bias offset of 0.6 V, for using in other parts of the current measurement sections. The part of the schematic including DC bias circuit is in Figure 4-13.

R21 1.8K VDDA TP11 U7A 3 8 + 1 DC_BIAS DC_BIAS 2 0.6V - R56 C25 390 MC33502DG

1UF 4

GNDA GNDA GNDA

Figure 4-13. DC Bias circuit schematic

4.4.3 Shunt resistor current measurement Because there is a very small voltage drop at the shunt resistor, external amplifiers must be presented in this part of the connection. Finally, there are two operational amplifiers used and housed in one package U3 (see Figure 4-14) and some feedback resistors for the correct function.The first gain stage is made from one half of U3 and resistors, R22, R24, R25, and R28. For maintaining a good signal stability in this gain stage at higher frequencies, there is a filter C23 with a small capacity value. This first gain stage works as a differential amplifier for amplifying higher levels of input signals, and as a pre- amplifier for the next gain stage, with this gain:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 51 Signal conditioning The second stage of the signal conditioning for current measurement is made from the second half part of the operational amplifier U3 and as usual with the cooperation of a resistive feedback network (R23, R26) and input bias-adjusting resistor R31. The capacitor (filter) C27 has the same function as filter C23 in the first gain stage, for maintaining the signal stability. NOTE The second gain stage works in co-operation with the feedback resistors as an inverting amplifier and because of this, it inverts the phase of the input signal. Between the first and the second gain stage there is 180 degree phase shift. The second gain stage is primarily used for amplifying low levels of input current signals with this gain ratio:

Between both of these gain stages, there is an isolated capacitor C28, which is used for cutting off the DC offset. Therefore, the DC offset from the first gain stage is 0.6 V. Both of these gain stages also have their own RC low-pass filter and similarly to the voltage measurement (see the previous chapter) are adjusted to 3.4 MHz, approximately (f3db):

NOTE Filter capacitors (C24, C29) must always be placed as close as possible to the ADC inputs (layouts in the Appendix section). This requirement is also valid for filter C30 in the voltage section. Notice that all the signal levels in this section are raised above Vref/2 (0.6 V), because of the DC bias circuit.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 52 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board

TP10 R20 C23 SHUNT_LO SHUNT_LO 47 C24 1.2V +/-0.6V 10 PF 1000pF R22 47k C27 GNDA LPF CUTOFF 3.4MHz 10 PF R23 GNDA 100k TP12 LINE_OUT 4 R24 2 C28 R26 R27

1.8K U3A 1 6 - SHUNT_HI Shunt 150uOhm R25 3 4.7K U3B 7

1.8K 10UF 5 - 47 C29

LINE_IN +

MC33502DG 1.2V +/-0.6V +

8 MC33502DG 1000pF 47k R28 VDDA GNDA DC_BIAS R31 0.6V 100k LPF CUTOFF 3.4MHz Figure 4-14. Shunt resistor signal conditioning part schematic

4.4.4 CT current measurement A current measurement through the CT sensor works in two modes: • Basic (low-cost) mode without an external OpAmp — One-gained measurement • Full-configuration mode with four OpAmps — Two-gained measurement The basic component in both of these modes is a burden resistor(s) R40||R45. Other circuits are not needed for adjustment of the voltage drop on the burden resistor up to the Vref voltage level (for maximum input current). In fact, only two balancing resistors are used, R42 and R48, which are connected from its midpoint to the DC bias voltage level made by the DC bias circuit (see Section 4.4.2 DC Bias circuit). The reason for this, is the same as in the previous measurement section, for shifting the voltage level above Vref/2 (0.6 V). For the basic (low-cost) configuration an RC low-pass filter which consist of two resistors R44, R49, and capacitor C35 are still only needed. The output signals from this filter (CT_I1+, CT_I1-) are fully-differential in comparison to the shunt resistor current measurement. Finally, for proper activation of the basic CT current measurement mode to bypass the first gain stage around U4 operational amplifier is still needed. For doing this, the jumpers J10 and J13 must be set to position 1–2. Both of these jumpers are not original components. They are made as small tin SMD shapes on the printed circuit board. For a basic CT current measurement only a few passive components in this section are needed, therefore it is called low-cost configuration. It has only one gain set by the value of burden resistors R40||R45 (see Figure 4-15).

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 53 Signal conditioning

TP14 J10 3 PAD JUMPER

TP16 1 2 3 1.2V +0.6V 1.8K R44 CON_2_TB R42 CT_I1+ 2 CT_IN+ 47 B R45 R40 DC_BIAS C35 1 CT_IN- 39 39 0.6V 1000pF A J11 R49 CT_I1- CT= 1:2500 1.8K R48 47 1.2V -0.6V

TP18 1 2 3 J13 LPF CUTOFF 1.7MHz TP19 3 PAD JUMPER Figure 4-15. CT signal conditioning part schematic in low-cost configuration A full-configuration mode in the case of CT current measurement means a two-gained input current measurements, similar to current measurement via a shunt resistor (see Section 4.4.3 Shunt resistor current measurement). A schematic for this configuration can be seen in Figure 4-16. For proper activation of this mode, jumpers J10 and J13 must be switched to position 2-3. The full-configuration mode is done by two independent cascaded sections with instrumentation amplifiers. Each instrumentation amplifier section is created by two simple operational amplifiers housed in one package. A total of four OpAmp are used (two IC). The instrumentation amplifier is a type of differential amplifier with a low DC offset, low drift, high open-loop gain, high CMRR, and high input impedances. The first instrumentation amplifier section is made from OpAmp U4 and the resistive feedback network (R38, R46, and R54) which gives this gain:

Although the gain ratio of this first stage is set to 17.7 the ohm value of the input burden resistor R40||R45 must be adequately decreased in this case (approximately 18 x). Filters C32 and C42 connected in parallel to the feedback resistors are used only for maintaining the signal stability (against the signal oscillation). Resistors R41 and R51 are used only for input bias current adjustment and their values are not critical. The second instrumentation amplifier section consists of the OpAmp U5 and a resistive feedback network (R37, R47, R55) which gives this gain:

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 54 Freescale Semiconductor, Inc. Chapter 4 Hardware Design of the Metering Board

J10 3 PAD JUMPER

C31 1 2 3 C32 10 PF R37 10 PF R38 R39 100k 100k TP14 VDDA VDDA 10K TP15 R41 8 8 3 TP16 3 1.2V +0.6V + + U4A 1 U5A 1 R43 2 1.2V +0.6V 2 - - CT_I2+ 1.8K 10K MC33502DG R44 MC33502DG CON_2_TB R42 CT_I1+ 47 2

CT_IN+ 4

4 47 B DC_BIAS R47 C33 R45 R40 R46 GNDA C35 GNDA 1 CT_IN- 39 39 0.6V 12k 1000pF 12k 1000pF A J11 R49 CT_I1- 1.8K 6 6 1.2V -0.6V

CT= 1:2500 R48 R51 7 U5B 7 R52

U4B 47 1.2V -0.6V - 5 - 5

CT_I2-

TP18 + + R53 47 MC33502DG MC33502DG 10K R54 10K R55 TP17 TP19 100k 100k C42 LPF CUTOFF=1.7MHz C43 10 PF 1 2 3 10 PF J13

3 PAD JUMPER Figure 4-16. CT signal conditioning part schematic in full configuration Others components, such as filters C31, C43 and resistors R39, and R53 perform the same function as in the first gain stage. The simple RC low-pass filters terminate both of these measurement sections. The cut-off frequency is computed as:

NOTE Filters C35 and C33 must be placed as close as possible to the MCU (U1) where the ADC is (see layouts in the Appendix section). The first gain stage is used for amplifying higher levels of input current signals and as a pre-amplifier for the second gain stage, which is used for amplifying lower levels of input current signals.

4.4.5 Input protection An input protection section is an important part of the power meter—it protects the integrated circuits against overvoltages and spikes that sometimes occur in the power line. A high-energy spikes are absorbed primarily by varistor RS1. A low-energy spike is

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 55 Signal conditioning absorbed by diodes D10–D14 (see Figure 4-17). All of these diodes do not allow an input voltage in each measurement input part to be higher than 3.3 V and lower than 0 V (in respect to the voltage drop on the diode).

D10 1

3 VLINE GNDA 2 VDDA BAV99LT1

D11 LINE_IN 1

3

LINE_OUT 2

BAV99LT1

D12 LINE_OUT 1

3

LINE_IN 2

BAV99LT1 D13 1

3 CT_IN+ GNDA 2 VDDA BAV99LT1 D14 1

3 CT_IN- GNDA 2 VDDA BAV99LT1 Figure 4-17. Schematic of input protection diodes

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 56 Freescale Semiconductor, Inc. Chapter 5 Application Set-Up

5.1 Setting-up the demo hardware The following section is focused on setting-up the metering demo hardware. For better orientation in the power meter demo see Figure 3-9. • Connect the power meter plug directly to the power line • Green power LED turns-on at this time • Connect an external load to the single phase outlet • LCD shows the RMS line current in Amp after a power-on (default state) • User can also see other values on the LCD by pressing push-buttons SW1 or SW2. These values include: • Active energy in kWh • Reactive energy in kVArh — Value with R symbol on the left side of the LCD • Actual time — Format is, hour, min, sec, plus the TIME symbol • Actual date — Format is, day of week, day, month, year plus the DATE symbol • Line frequency — Is the value with Hz symbol on the right side of the LCD • RMS line voltage — Value with U symbol on the left side of the LCD, plus the volts symbol • RMS line current — Value with I symbol on the left side of the LCD, plus the Amps symbol • Active power — Value with W symbol on the right side of the LCD • Reactive power — Value with Var symbol on the right side of the LCD • Apparent power — Value with VA symbol on the right side of the LCD • Power factor — Value with PF symbol on the left side of the LCD

• Both the energies (active and reactive) are saved in non-volatile memory. These energies remain in the memory after resetting the power meter. For clearing energy counters, you must push both of the SW buttons during reset. • When you push only the SW1 button during any soft or hard reset, the LCD shows the actual version of the internal software.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 57 Setting-up the software demo • Press the Tamper button for a tampering simulation. There will be a Tampering text on the LCD after pressing this button and a fire symbol on the LCD appears. The fire symbol remains on the LCD after any reset, because this information is saved in the non-volatile memory. For clearing the tamper status you must push both of the SW buttons during any reset (soft or hard reset). NOTE Together with the tamper status, both energy counters are also erased. • A soft HW reset of the power meter is done by the Reset push-button, a hard HW reset is executed by disconnecting the power meter plug from the power line network. • Energy LEDs are flashing simultaneously with internal energy counters. • 3 V battery is used for the RTC function and the data storage (tamper plus energy counters). • RS232 plug is used for code flashing and for FreeMASTER data visualization and calibration

5.2 Setting-up the software demo The following section is focused on setting-up the metering demo software.

5.2.1 FreeMASTER data visualization For FreeMASTER data visualization the RS232 cable between the power meter and the PC must first be connected. The FreeMASTER visualization script is the software for remote visualization and remote settings of the power meter up via an RS232 cable. This software runs on the PC that connects to the power meter via an RS232 cable. FreeMaster visualization script is the application that runs under FreeMASTER software. FreeMASTER software is one of the off-chip drivers which supports communication between the target microcontroller and a PC. This tool allows the programmer to remotely control an application using a user-friendly graphical environment running on a PC. It also provides the ability to view some real-time application variables in both textual and graphical form. FreeMASTER software runs under Windows 98, 2000, or XP. It is a versatile tool to be used for multipurpose algorithms and applications. It provides a lot of excellent features, including: • Real-time debugging • Diagnostic and a visualisation tool

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 58 Freescale Semiconductor, Inc. Chapter 5 Application Set-Up • Demonstration tool • Education tool Before running a visualization script, FreeMASTER software must be installed on your PC. After, a FreeMASTER visualization script may be started after double-clicking on the EM256kWh.pmp file in the current directory (EM256kWh project). Following this, a visualization script will appear on your PC (see Figure 5-1). You must now set the proper serial communication port and speed in the menu Project/ Option (see Figure 5-2). To do this, you must click on the Start/Stop Communication button. After, you must set the proper Project.abs project file in the menu Project/Option/ MAPfiles (see Figure 5-3). This file is accessible in the Bin directory of the EM256kWh project. If all previous settings are correctly done, the FreeMASTER visualization script for the power meter is now running. At this point you can see the voltage and current diagram in the time domain and in the frequency domain (in FFT window). You may also see other variables in a text format like frequency, VRMS, IRMS, and so on.

Figure 5-1. FreeMASTER visualization script (GUI)

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 59

Setting-up the software demo

Figure 5-2. FreeMASTER communication port setting

Figure 5-3. FreeMASTER project file setting

5.2.2 ZigBee communication ZigBee communication is only optional and is not implemented in every power meter demo. There is a 2.4 GHz 1322x daughter card inside the power meter. The ZigBee module and the power meter are connected through the IIC. For joining the power meter

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0

60 Freescale Semiconductor, Inc. Chapter 5 Application Set-Up to the ZigBee network, you will need the 1322x-SRB module, this is like a ZigBee coordinator (see Figure 5-4). The power meter can now easily become part of the smart grid.

Figure 5-4. 1322x-SRB as ZigBee Coordinator Here is a standard communication procedure for joining the power meter to smart grid: • Install the latest version of the BeeKit from the Freescale web page. There is also a ZeD monitor and is a separate part of the BeeKit. Use the ZeD monitor for demonstrating ZigBee communication between the power meter and the PC • Switch the power meter on and connect some load to the power meter outlet • Connect the ZigBee coordinator (1322x-SRB) to the PC through a USB cable and switch the coordinator on. The coordinator must be powered. To do this, plug the AC adaptor to the coordinator (you may also use the internal battery inside of the coordinator module), or use a USB power line from the PC side (this is the best choice). You will have to install the software driver for this equipment after the first connection of the 1322x-SRB to the PC. The driver is on the CD in directory Drivers \LuminaryFTDI or alternatively on the FTDI web page • Push the button SW1 on the coordinator – it is looks up all ZigBee equipment connected to the ZigBee network at this time. Two red LEDs on the coordinator are then lit (see Figure 5-4) • Start the ZeD monitor and then click on the OK button. Before running the ZeD GUI, the ZigBee coordinator must be connected to the PC through a USB cable. • At this moment there are several icons of all the devices connected to the ZigBee network, and only power meter plus the coordinator (see Figure 5-5) in this case. If there is no icon for the power meter, you must reset the power meter using the reset button and reset the ZeD GUI using the F5 key. You may also repeat the installation from point 2 in this case

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 61 Setting-up the software demo • In the ZeD GUI menu you may open a new window for showing the ZigBee data transfer. This is in Tools/Start SE Utility Control Panel menu. You must address the meter by clicking the Add New Household ESP Connection, and then click on the Connect icon (see Figure 5-6) • For showing data (only kWh) you must click on the Metering icon and a kWh data table is now refreshed (every 5 seconds). The most important is the meter report column, where active energy from the power meter is displayed (see Figure 5-7). These numbers are in HEX format to 0.0001 kWh resolution, but the kWh-number on the LCD of the power meter is to 0.001kWh resolution. It is ten times lower then the numbers in the ZeD GUI. The reason for this is as follows: there are not many LCD digits for the kWh data displaying in the power meter LCD module.

Figure 5-5. ZeD GUI

Figure 5-6. Add new household ESP connection dialog box

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 62 Freescale Semiconductor, Inc. Chapter 5 Application Set-Up

Figure 5-7. Metering report in ZeD GUI

5.2.3 Code reprogramming via serial bootloader There is a developer’s serial bootloader in the power meter that allows in-circuit reprogramming of the Power Meter MCU using the standard SCI port. A detailed description of this bootloader is out of content of this design reference manual. It is described in the application note titled Developer’s Serial Bootloader for M68HC08 and HCS08 MCUs (document AN2295). Firstly, you must connect an RS232 cable between the power meter and the PC. Then you must double-click on file BootLoaderControl.exe in the directory BootLoader. This program is a GUI for bootloader (see Figure 5-8). In this program you must first select the correct communication port of the PC, where the RS232 cable is connected. Then you must open the *.s19 file of the actual code which you want to flash to the MCU of the power meter. Originally, this file is accessible in the Bin directory of the EM256kWh project. Finally, you must click on the Bootload icon in the GUI. Then turn the power meter on (soft or hard reset) and if all the connections are OK, the PC begins to communicate with the MCU in the power meter. This takes approximately 1 minute. After flashing, the Reset push-button must be clicked, the MCU program then automatically runs with a new code.

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 63 Setting-up the software demo

Figure 5-8. Serial bootloader GUI

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 64 Freescale Semiconductor, Inc. Appendix A Schematics

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 65 Schematics for Full Configuration of the Metering Board

A.1 Schematics for Full Configuration of the Metering Board D C B A

RTS C47 C47 0.1UF 0.1UF C12 C12 0.1UF 0.1UF 2 4 6 8 10 GND

VREFO GNDA

C46 C46 10UF 10UF C11 0.1UF 0.1UF J5 CON_2X5 C11

RS232 Interface 1 3 5 7 9

VREFH GNDA 1 2 3 4 5

C48 GND C48 10UF DTR 10UF RXD TXD MMSD4148T1G U6 MMSD4148T1G U6 INT NC1

AVSS D6 D6 AVDD 1 +3.3VA 2 GNDA

1 1

B A

C10 CON_2_TB J7 0.1UF C10 MMA7660FC MMA7660FC 0.1UF MMSD4148T1G RESERVED MMSD4148T1G 2 1

D7 D7 1 +3.3VA 2 GNDA 2 NC2 DVDD DVSS SDA SCL

pulse interface pulse C9 R7 4.7K 10UF C9 10UF Energy output Energy 9 8 7 6 10 D8 Isolation barrier EOC_OE C19 C19 R13 470 2.2UF 2.2UF EOC_OC + + (+12V) GND RS232 isolated RS232 (Half Duplex, max 19200 Bd) 19200 max Duplex, (Half +3.3V

MMSD4148T1G 1

0.1UF C45 C45 0.1UF 3 4 3 4 2 1 GND C8 Accelerometer Interface Accelerometer C8 0.1UF 0.1UF

ISO2 Filters for MCU for Filters package 0805 in caps All GND C44 C44 10UF 10UF +3.3V R60 1.0K Place as close as possible to U1! to possible as close as Place R61 1.0K 3 +3.3V 6 5 4 6 5 4 6 5 4 SFH6106-4 SFH6106-4 SFH6106-4

D16 V_BAT BAT54CLT1 1 2 ISO3 4.7K ISO1

R1 2 1 2 1 3 4 GND GND R9 1.0K

6 4 2 TP6

3 Buttons 3 P12S1LZ SW1 P12S1LZ P12S1LZ RESET1 P12S1LZ SW2 RESET1 P12S1LZ SW1 P12S1LZ SW2

+3.3V 330 R6 R6 330 1 2 3 1 2 3 1 2 3 +3.3V 330 J4 HDR2X3 R14 R14 330 +3.3V TP9 2 2 5 3 1

TP7

TP5 SCL 100PF C2 0.1UF C17 R8 680.0 R8 680.0 0.1UF C13 C17 100PF C13 100PF 100PF C2

SDA GND GND GND D9 TSAL4400 D9 TSAL4400 2 1 /INT SCLSCL GND SDASDA SW2 SW1

RESET EOC_PULSE IRQ RF_RTXEN RF_RTXEN SPI1_MOSI RF_CE +3.3V Q3 Q3

OP506B OP506B 1 2 GND +3.3V 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 RESET GND R10 R10 +3.3V 22K R12 1.0K 6 4 2 CON_2X20 R58 10K

+3.3V IR_RX LCD12 LCD13 LCD14 LCD15 LCD16 LCD17 LCD18 LCD19 LCD20 LCD21 LCD22 LCD23 LCD24 LCD25 LCD26 LCD27 LCD43 LCD42 LCD41 LCD40 LCD39 LCD38 C21 C21 0.1UF J3 HDR2X3 0.1UF 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 GND J8 5 3 1

Infrared interface Infrared 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 TP8 GND IRQ RF/ZigBee Interface RF/ZigBee BDM Interface RF_RTXEN FP8 FP9 FP10 FP11 FP12 FP13 FP14 FP15 FP16 FP17 FP18 FP19 FP20 FP21 FP22 FP23 FP39 FP38 FP37 FP36 FP35 FP34 RF_CE +3.3V RF_RESET C20 100PF GD-3980P GND RT IR_TX LED_USR VCCPRESENT IR_TX LED_kVarh /INT LED_kWh EOC_PULSE S3_X RS232_TXD RS232_RXD RS232_TXD RS232_RXD BKGD RESET SW1 SW2 GND LCD5 LCD4 LCD3 LCD2 LCD1 LCD0 IR_RX

R11 10K R11 V_OUT +3.3V FP30 FP31 FP32 FP33 BP0 BP1 BP2 BP3 FP0 FP1 FP2 FP3 FP4 FP5 FP6 FP7 FP24 FP25 FP26 FP27 FP28 FP29 C22 C22 0.1UF 0.1UF LCD1

GND 1 2 3 4 5 6 7 8 9 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 18 19 20 21 22 10 11 12 13 14 15 16 17 3 3 +3.3V VSS VDD LCD0 LCD1 LCD2 LCD3 LCD4 LCD5 LCD6 LCD7 LCD8 LCD9 LCD10 LCD11 LCD28 LCD29 LCD30 LCD31 LCD32 LCD33 LCD34 LCD35 LCD36 LCD37 2 7 RESET Display SPI1_SCK SPI1_MISO RF_ATTN RF_RESET

SPI1_MOSI PTE7/LCD5 PTC7/LCD4 9 SO PTE5/SCLK3 GND MCF51EM256 EXP PTE2/CMP1P2 HOLD PTE6/SSB3/TX2 BKGD/MS/PTC2 GND 8 MRAM 4 V_OUT PTC4/LCD1/CMP2O PTC3/LCD0/CMP1O PTE4/MISO3/MOSI3 PTE3/MOSI3/MISO3 VDD 1UF 1UF PTC6/LCD3/CMP2P5 PTC5/LCD2/CMP1P5 VSS U2

SI SCK CS WP PTC1/KBI1P7/XTAL2/TX3

PTC0/KBI1P6/EXTAL2/RX3

C49 C49

5 6 1 3

LCD6/MOSI2

PTB4/RGPIO12/SCL/CMP2P3 PTA7/RGPIO7/TPMCLK/CMP1P3/AD13 PTB5/RGPIO13/SDA/CMP2P4 5.1V LCD6 76 50

LCD7/MISO2 D3 MMSZ5231BT1G PTA6/RGPIO6/TPMCH1/AD12

LCD7 RF_CE 77

PTB1/RGPIO9/KBI1P1/SSB3/TX2 49 LCD8/SCLK2 PTA5/RGPIO5/TPMCH0/AD11

MR25H10CDC LCD8 RF_RTXEN 78

48 +3.3V

LCD9/SSB2

PTB0/RGPIO8/KBI1P0/CMP1P1/RX2 PTA4/RGPIO4/SSB1

LCD9 PTB3/RGPIO11/KBI1P3/CMP2P2/TX1 SPI1_SS 79

PTB2/RGPIO10/KBI1P2/CMP2P1/RX1 47

LCD10 PTA3/RGPIO3/SCLK1

LCD10 SPI1_SCK 80 PTB7/RGPIO15/KBI1P5/TMRCLK2/AD15 PTB6/RGPIO14/KBI1P4/TMRCLK1/AD14 46 LCD11

C7 C7 LCD11 81

LCD12

+ PTA2/RGPIO2/MISO1/AD10 +

47UF 47UF LCD12 SPI1_MISO 82 45

LCD13 PTA1/RGPIO1/MOSI1

LCD13 SPI1_MOSI 83 44

LCD14 PTE1/CMP1P4/AD9

LCD14 RF_ATTN 84 43

LCD15 PTE0/CMP1O/AD8

LCD15 RF_RESET 85 42

LCD16 PTA0/RGPIO0/IRQ/CLKOUT

C6 100PF LCD16 IRQ 86 41

LCD17 TAMPER

LCD17 TAMPER 87 40

LCD18 VBAT

LCD18 VBAT 88 39

LCD19 XTAL1

R18 10K LCD19 XTAL1 89

38 2 LCD20 EXTAL1

+3.3V C5 0.1UF LCD20 EXTAL1 90

37 GND

LCD21

VSSA TAMPER

LCD21 91

+3.3VA 36 GNDA

LCD22 VREFL

LCD22 92

2 35 2 LCD23 VREFO

Y1 4 4

Y1 LCD23 VREFO 93

34 1 2 3 LCD24 AD7

GND 32.768KHz 32.768KHz LCD24 94 33

VSS DADM3

1uH 1uH 95

32 1 VLL3 DADP3

96 31

VLL2 AD6

L1 L2 97 30

VLL1 DADM2

98

1 29 1 VCAP2 DADP2

C16 0.1UF

0.1UF C16 99

28 GNDA VCAP1 AD5

C4 100PF 100 27

DADM1 26

P12S1LZ TAMPER1 GND P12S1LZ R15 10K TAMPER1 +3.3V 0.1UF C15 0.1UF C15 6 5 4

C1 0.1UF C1 C18 0.1UF 0.1UF C18

V_OUT SHUNT_LO CT_I2- SHUNT_HI GND 0.1UF C14 C14 0.1UF PTF7/LCD43/AD19 VDDA VREFH DADP0 DADM0 AD4 DADP1 PTF5/LCD41/AD17 PTF6/LCD42/AD18 PTD1/LCD28/KBI2P1 PTD2/LCD29/KBI2P2 PTD3/LCD30/KBI2P3 PTD4/LCD31/KBI2P4/TMRCLK1 PTD5/LCD32/KBI2P5/TMRCLK2 PTD6/LCD33/KBI2P6 PTD7/LCD34/KBI2P7 LCD35/CLKOUT PTF0/LCD36 PTF1/LCD37/EXTRIG PTF2/LCD38/RX3 PTF3/LCD39/TX3 PTF4/LCD40/AD16 LCD25 LCD26 PTD0/LCD27/KBI2P0

U1

SJ1 C3 2 C3 47UF 47UF DC_BIAS 1 2 3 4 5 6 7 8 9 18 19 20 21 22 23 24 25 16 17 11 12 13 14 15 10 + +

GND DC_BIAS 1 1

CT_I1- 2PAD JUMPER V_OUT CT_I1+ LCD40 LCD41 LCD42 LCD43 +3.3VA VREFH LCD29 LCD30 LCD31 LCD32 LCD33 LCD34 LCD35 LCD36 LCD37 LCD38 LCD39 LCD25 LCD26 LCD27 LCD28

330 TP2 R2 TP3 R2 330

CT_I2+ CT_I2- SHUNT_LO SHUNT_HI D2 WP7104LGD D2 WP7104LGD BT1 BT1 1 2 GND BATTERY BATTERY +3.3V 2

3V Battery 3V +3.3VA MMSZ5231BT1G MMSZ5231BT1G GND

CT_I1- CT_I2-

CT_I1+ CT_I2+ V_OUT GNDA 1 1 GNDA CON_2_TB DC_BIAS B A SHUNT_HI

5.1V +3.3VA 5 5 J2 D1 SHUNT_LO

GNDA VDDA D15 D5 D5 GND 2 1

20S0271 RS1 20S0271 Q1 MMBTA42 3 2

+3.3VA

2 GND 1 LINE_IN LINE_OUT N_IN 2 2 WP7104LSRD WP7104LSRD WP7104LSRD GND PAGE01 ANALOGSENSING TP4 TP1 TP1 1

+3.3V GND R5 R59 330 330 330 330 R3 220 R5 R59 User Interface User N_IN L_IN 1 2 2 1 2 1

GND D4 WP7104LYD 220 R4 A B

2 1 B A B A J1 GND +3.3V LED_kVarh LED_kWh LED_USR J6 CON_2_TB J9 switched mode +3.3V, 200mA Optical Interface Optical External isolated power supply CON_2_TB CON_2_TB D C B A Figure A-1. Full digital configuration of the metering board schematic

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 66 Freescale Semiconductor, Inc. Appendix A Schematics D C B A

CT_IN+ CT_IN- VLINE C51 C51 100PF 100PF 3 3 3 3 3

C50 0.1UF 0.1UF C50 VDDA GNDA BAV99LT1 D12 BAV99LT1 D14 BAV99LT1 D14 BAV99LT1 D10 BAV99LT1 1 1 D11 BAV99LT1 D11 BAV99LT1 D13 BAV99LT1 D13 BAV99LT1 1 2 1 2 1 2 1 2 1 2

C41 100PF 100PF C41

GNDA VDDA LINE_IN LINE_IN LINE_OUT LINE_OUT C40 0.1UF C40 0.1UF GNDA GNDA VDDA VDDA VDDA GNDA

100PF C39 C39 100PF

SHUNT_HI 0.1UF C38 C38 0.1UF 1.2V +/-0.6V 1.2V VDDA GNDA

C29 1000pF C29 1000pF VDDA GNDA TP12 GNDA

C37 100PF LPF CUTOFF 3.4MHz LPF CUTOFF 100PF C37 47 R27

VDDA GNDA 0.1UF C36 C36 0.1UF Supply connection Input protection Input connection Supply Bypass capacitors Bypass

VDDA GNDA

7 SHUNT_LO 2 2 - MC33502DG + - R23 100k + MC33502DG

Place it as close as possible to ADC (U1) ! Note: C24,C29,C30,C33,C35 are low-pass filter capacitors. U3B 1.2V +/-0.6V U3B

6 5 C27 C27 10PF G2=R23/R26 G2=21.3 10PF

SHUNT_LO

C24 C24 1000pF 1000pF

CT_I2+ CT_I2- R31 100k R26 4.7K TP10 GNDA

1.2V +0.6V 1.2V -0.6V 1.2V 1000pF C33 C33 1000pF

47 LPF CUTOFF 3.4MHz LPF CUTOFF 10UF R20 C28 C28 10UF

TP15 TP17 Gtotal=556 1 R43 47 R52 47

LPF CUTOFF frequency CUTOFF LPF f3dB = 1/(2PI*(R43+R52)*C33) = f3dB f3dB = 1.7MHz = f3dB VDDA GNDA

C23 10PF 10PF C23

R22 47k R22 MC33502DG MC33502DG - + - + 4 8

U3A U3A 1 7 2 3

VDDA GNDA MC33502DG 3 3 MC33502DG G1=R22/R24=R28/R25 47k 47k R28 G1=26.1

- + 10PF - + R37 100k R55 100k 10PF MC33502DG MC33502DG 4 8

+ - + - U5A U5A U5B U5B

C43 C43 3 2 6 5 C31 C31 10PF 10PF R47 12k R24 1.8K 1.8K R25 1.8K

DC_BIAS 0.6V

R53 R39 CT_I1+ CT_I1- 10K 10K G2 = (1+2*R37/R47) = G2 G2 = 17.7 = G2 R55 = R47 = R55 LINE_IN

LINE_OUT Shunt 150uOhm Shunt CURRENT SENSING USING SHUNT USING SENSING CURRENT C35 C35 1000pF 1000pF 1.2V +0.6V 1.2V -0.6V 1.2V TP18 TP18 TP16

R49 47 R44 47 3 3

2 2 V_OUT 1.2V +/-0.6V

3PAD JUMPER 1 1 3PAD JUMPER J13 J10 LPF CUTOFF 3.4MHz CUTOFF LPF Gtotal=312

7 1 4 4 1000pF C30 C30 1000pF VDDA GNDA V_OUT MC33502DG MC33502DG

R38 100k R38 - 100k R54 100k + - MC33502DG + MC33502DG TP13 4 8

GNDA

- + - + U4A U4B U4B U4A 6 5 3 2

R35 47 R46 12k 10PF 10PF C32 C42 C32 10PF C42 10PF 1k R36 R30 4.7K R30 R51 R41 VDDA GNDA 10K 10K DC_BIAS

VLINEVLINE

0.6V R29 100k DC_BIAS

R34 47k R34 0.6V R54 = R46 = R54 G1 = (1+2*R38/R46) = G1 G1 = 17.7 = G1 1.8K R48 TP11 1.8K R42 1.8K R42

DC_BIAS

1 R33 100k 39 R40 39

MC33502DG MC33502DG

U7A U7A R45 39 4 8

+ - + - GNDA 3 2 TP19 TP14 220K R32 220K 5 5 VDDA

CT_IN- CT_IN+ C25 C25 1UF 1UF

2 1 GNDA B A R56 390 R56 390 R57 220K R21 1.8K J11 CON_2_TB GNDA CT= 1:2500 CT= RC= 0.8mV/A RC= N_IN CURRENT SENSING USING CURRENT USING SENSING CURRENT TRANSFORMER OR ROGOWSKI COIL ROGOWSKI OR TRANSFORMER Voltage measurement Voltage DC bias voltage 0.6 V 0.6 voltage bias DC D C B A Figure A-2. Full analog schematic of the metering board

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 67 Schematics for Low-Cost Configurations of the Metering Board

A.2 Schematics for Low-Cost Configurations of the Metering Board D C B A

RTS 0.1UF C12 0.1UF C12 2 4 6 8 10

VREFO GNDA

C11 C11 0.1UF 0.1UF J5 CON_2X5 J5 Interface RS232 1 3 5 7 9

VREFH GNDA

TXD C48 10UF GND 10UF DTR C48 RXD MMSD4148T1G MMSD4148T1G

D6 D6 1 +3.3VA 2 GNDA

1 1

C10 0.1UF C10 0.1UF MMSD4148T1G MMSD4148T1G

D7 D7 1 +3.3VA 2 GNDA 2

10UF C9 R7 4.7K C9 10UF R13 470 2.2UF 2.2UF D8 C19 C19 Isolation barrier + + GND (+12V) RS232 isolated RS232 (Half Duplex, max 19200 Bd) 19200 max Duplex, (Half +3.3V MMSD4148T1G 1

3 4 2 1 0.1UF C8 C8 0.1UF GND Filters for MCU for Filters package 0805 in caps All ISO2 +3.3V Place as close as possible to U1! to possible as close as Place +3.3V 6 5 4 6 5 4 6 5 4 SFH6106-4 SFH6106-4 SFH6106-4

4.7K ISO1

R1 2 1 3 4 GND R9 1.0K

TP6

3 Buttons 3 SW1 P12S1LZ P12S1LZ SW1 P12S1LZ SW2 RESET1 P12S1LZ SW2 P12S1LZ RESET1 P12S1LZ R6 330 330 R6 1 2 3 1 2 3 1 2 3 +3.3V 2 2

TP5 C13 100PF C17 100PF C2 100PF 100PF C2 0.1UF C13 0.1UF C17 GND GND GND SW2 SW1 RESET +3.3V RESET GND +3.3V 6 4 2 R58 10K R58 LCD12 LCD13 LCD14 LCD15 LCD16 LCD17 LCD18 LCD19 LCD20 LCD21 LCD22 LCD23 LCD24 LCD25 LCD26 LCD27 LCD43 LCD42 LCD41 LCD40 LCD39 LCD38 J3 HDR2X3 5 3 1

44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 BDM Interface FP8 FP9 FP10 FP11 FP12 FP13 FP14 FP15 FP16 FP17 FP18 FP19 FP20 FP21 FP22 FP23 FP39 FP38 FP37 FP36 FP35 FP34 +3.3V GD-3980P C20 100PF C20 GND LED_USR VCCPRESENT LED_kVarh S3_X RS232_TXD LED_kWh RS232_TXD BKGD GND S3_X RS232_RXD RESET SW1 SW2 RS232_RXD LCD5 LCD4 LCD3 LCD2 LCD1 LCD0

R11 10K V_OUT BP0 BP1 BP2 BP3 FP0 FP1 FP2 FP3 FP4 FP5 FP6 FP7 FP24 FP25 FP26 FP27 FP28 FP29 FP30 FP31 FP32 FP33 LCD1 1 2 3 4 5 6 7 8 9 75 74 73 72 71 70 69 68 67 66 65 64 62 61 60 59 63 58 57 56 55 54 53 52 51 10 11 12 13 14 15 16 17 18 19 20 21 22 3 3 VSS VDD LCD0 LCD1 LCD2 LCD3 LCD4 LCD5 LCD6 LCD7 LCD8 LCD9 LCD10 LCD11 LCD28 LCD29 LCD30 LCD31 LCD32 LCD33 LCD34 LCD35 LCD36 LCD37 RESET Display PTE7/LCD5 PTC7/LCD4 PTE5/SCLK3 GND MCF51EM256 PTE2/CMP1P2 PTE6/SSB3/TX2 BKGD/MS/PTC2 V_OUT PTC4/LCD1/CMP2O PTC3/LCD0/CMP1O PTE4/MISO3/MOSI3 PTE3/MOSI3/MISO3 1UF 1UF PTC6/LCD3/CMP2P5 PTC5/LCD2/CMP1P5

PTC1/KBI1P7/XTAL2/TX3

PTC0/KBI1P6/EXTAL2/RX3 C49 C49

LCD6/MOSI2

PTB4/RGPIO12/SCL/CMP2P3 PTA7/RGPIO7/TPMCLK/CMP1P3/AD13 PTB5/RGPIO13/SDA/CMP2P4 5.1V LCD6 76 50

LCD7/MISO2 D3 MMSZ5231BT1G PTA6/RGPIO6/TPMCH1/AD12 D3 MMSZ5231BT1G

LCD7 77

PTB1/RGPIO9/KBI1P1/SSB3/TX2 49 LCD8/SCLK2 PTA5/RGPIO5/TPMCH0/AD11

LCD8 78 48

LCD9/SSB2

PTB0/RGPIO8/KBI1P0/CMP1P1/RX2 PTA4/RGPIO4/SSB1

LCD9 PTB3/RGPIO11/KBI1P3/CMP2P2/TX1 79

PTB2/RGPIO10/KBI1P2/CMP2P1/RX1 47

LCD10 PTA3/RGPIO3/SCLK1

LCD10 80 PTB7/RGPIO15/KBI1P5/TMRCLK2/AD15 46 PTB6/RGPIO14/KBI1P4/TMRCLK1/AD14 LCD11

C7 C7 LCD11 81

LCD12

+ PTA2/RGPIO2/MISO1/AD10 +

47UF 47UF LCD12 82 45

LCD13 PTA1/RGPIO1/MOSI1

LCD13 83 44

LCD14 PTE1/CMP1P4/AD9

LCD14 84 43

LCD15 PTE0/CMP1O/AD8

LCD15 85 42

LCD16 PTA0/RGPIO0/IRQ/CLKOUT

C6 100PF LCD16 86 41

LCD17 TAMPER

LCD17 TAMPER 87 40

LCD18 VBAT

LCD18 VBAT 88 39

LCD19 XTAL1

R18 10K LCD19 XTAL1 89

38 2 LCD20 EXTAL1

+3.3V C5 0.1UF LCD20 EXTAL1 90

37 GND

LCD21

VSSA TAMPER

LCD21 91

+3.3VA 36 GNDA

LCD22 VREFL

LCD22 92

2 35 2 LCD23 VREFO

Y1 4 4 Y1 LCD23 VREFO 93

34 1 2 3 LCD24 AD7

GND 32.768KHz 32.768KHz LCD24 94 33

VSS DADM3

1uH 1uH 95

32 1 VLL3 DADP3

96 31

VLL2 AD6

L1 L2 97 30

VLL1 DADM2

98

1 29 1 VCAP2 DADP2

C16 C16 0.1UF 0.1UF 99

28 GNDA VCAP1 AD5

C4 100PF C4 100PF 100 27

DADM1 26

GND TAMPER1 TAMPER1 P12S1LZ R15 10K P12S1LZ +3.3V C15 C15 0.1UF 0.1UF 6 5 4

C1 0.1UF 0.1UF C18 C18 0.1UF

SHUNT_LO V_OUT CT_I2- SHUNT_HI GND 0.1UF C14 0.1UF C14 DADP0 DADM0 AD4 DADP1 PTF6/LCD42/AD18 PTF7/LCD43/AD19 VDDA VREFH LCD25 LCD26 PTD0/LCD27/KBI2P0 PTD1/LCD28/KBI2P1 PTD2/LCD29/KBI2P2 PTD3/LCD30/KBI2P3 PTD4/LCD31/KBI2P4/TMRCLK1 PTD5/LCD32/KBI2P5/TMRCLK2 PTF0/LCD36 PTF1/LCD37/EXTRIG PTF2/LCD38/RX3 PTF3/LCD39/TX3 PTF4/LCD40/AD16 PTF5/LCD41/AD17 PTD6/LCD33/KBI2P6 PTD7/LCD34/KBI2P7 LCD35/CLKOUT

U1 47UF 47UF C3 C3 DC_BIAS 1 2 3 4 5 6 7 8 9 22 23 24 25 17 18 19 20 21 11 12 13 14 15 16 10 + +

GND DC_BIAS 1

CT_I1- V_OUT LCD40 LCD41 LCD42 LCD43 +3.3VA VREFH CT_I1+ LCD31 LCD32 LCD33 LCD34 LCD35 LCD36 LCD37 LCD38 LCD39 LCD25 LCD26 LCD27 LCD28 LCD29 LCD30

R2 TP2 R2 330 TP3 330

CT_I2+ CT_I2- SHUNT_HI SHUNT_LO BT1 D2 WP7104LGD 1 2 BATTERY GND +3.3V 2

+3.3VA 3V Battery 3V MMSZ5231BT1G MMSZ5231BT1G GND

CT_I1- CT_I2-

CT_I1+ CT_I2+ V_OUT GNDA 1 1 GNDA DC_BIAS SHUNT_HI

5.1V +3.3VA SHUNT_LO 5 5 D1

GNDA VDDA D5 D15 GND RS1 20S0271

+3.3VA

1 2 LINE_IN LINE_OUT N_IN 2 2 WP7104LSRD WP7104LSRD WP7104LSRD GND TP1 PAGE01 ANALOGSENSING TP4

GND R5 330 R5 330 R59 330 330 R59 N_IN L_IN 1 2 2 1 2 1 GND A B B A B A J1 +3.3V LED_kVarh LED_kWh J9 J6 J6 CON_2_TB switched mode CON_2_TB Optical Interface Optical +3.3V, 200mA CON_2_TB CON_2_TB External isolated power supply D C B A Figure A-3. Low-cost configuration of the digital schematic of the metering board

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 68 Freescale Semiconductor, Inc. Appendix A Schematics D C B A

SHUNT_HI V_OUT 1.2V +/-0.6V 1.2V +/-0.6V 1.2V 1 1

1000pF C29 1000pF LPF CUTOFF 3.4MHz LPF CUTOFF C29

TP12 GNDA C30 1000pF C30 1000pF LPF CUTOFF 3.4MHz LPF CUTOFF V_OUT 47 R27 TP13 GNDA

R35 47

7 SHUNT_LO 1k R36 R30 4.7K - R23 100k - + + MC33502DG MC33502DG VDDA GNDA

1.2V +/-0.6V U3B U3B

VLINEVLINE 6 5 C27 C27 G2=R23/R26 G2=21.3 R29 100k 10 PF 10 10 PF 10

SHUNT_LO 2 2 R34 47k C24 C24 1000pF 1000pF R26 4.7K R31 100k TP10 GNDA

47 R33 100k R20 C28 10UF C28 10UF LPF CUTOFF 3.4MHz CUTOFF LPF

Gtotal=556 R32 220K 1

VDDA GNDA

C23 C23 PF 10 10 PF 10

R22 47k R22 47k R57 220K - MC33502DG - + MC33502DG + 4 8

U3A U3A 2 3 G1=R22/R24=R28/R25 47k R28 G1=26.1 3 3 N_IN Voltage measurement R24 1.8K R25 1.8K

C51 C51 100PF 100PF DC_BIAS 0.6V

0.1UF C50 0.1UF C50 LINE_IN VDDA GNDA LINE_OUT Shunt 150uOhm Shunt CURRENT SENSING USING SHUNT

C41 C41 100PF 100PF

C40 C40 0.1UF 0.1UF Bypass capacitors 4 4 VDDA GNDA VDDA GNDA DC_BIAS VDDA GNDA 0.6V Supply connection DC_BIAS TP11 1 VLINE 3 3 3

MC33502DG MC33502DG

U7A U7A 4 8

+ - + - GNDA 3 2 5 5 D11 BAV99LT1 D11 BAV99LT1 D12 BAV99LT1 D12 BAV99LT1 D10 BAV99LT1 D10 BAV99LT1 1 2 1 2 1 2 VDDA

1UF C25 1UF C25 GNDA R56 R21 1.8K R56 390 GNDA VDDA LINE_IN LINE_OUT LINE_OUT LINE_IN Input protection DC bias voltage 0.6 V GNDA D C B A Figure A-4. Low-cost analog schematic of the metering board with shunt resistor configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 69 Schematics for Low-Cost Configurations of the Metering Board D C B A VLINE CT_IN+ CT_IN- DC_BIAS 1 1

3 3 3

0.6V DC_BIAS TP11 D13 BAV99LT1 D14 BAV99LT1 D10 BAV99LT1 BAV99LT1 1 2 1 2 1 2 1

GNDA VDDA MC33502DG MC33502DG

U7A U7A 4 8

GNDA GNDA VDDA VDDA - - + + Input protection GNDA 3 2

VDDA

2 2 C25 C25 1UF 1UF GNDA

C51 C51 100PF 100PF R21 1.8K R56 390 VDDA GNDA GNDA

0.1UF C50 C50 0.1UF DC bias voltage 0.6 V VDDA GNDA VDDA GNDA Bypass capacitors Supply connection

V_OUT 1.2V +/-0.6V 3 3 LPF CUTOFF 3.4MHz LPF

C30 1000pF C30 1000pF V_OUT TP13 GNDA LPF CUTOFF 1.7MHz LPF CUTOFF R35 47

CT_I1- CT_I1+ 1k R36 R30 4.7K

C35 C35 1000pF 1000pF VDDA GNDA 1.2V -0.6V 1.2V +0.6V 1.2V

VLINEVLINE TP16 TP18 R29 100k 4 4

R44 47 R49 47 3 3

R34 47k 47k

2 2

3 3 PAD JUMPER 1 1 3 3 PAD JUMPER 0.6V 1.8K R42 J10 1.8K R48 J13 DC_BIAS R33 R33 100k R40 39

R45 39 R32 R32 220K TP14 TP19 CT_IN+ CT_IN- 5 5 R57 220K 2 1 B A J11 J11 CON_2_TB CON_2_TB CT= 1:2500 N_IN Voltage measurement Current sensing using Current Transformer D C B A Figure A-5. Low-cost analog schematic of the metering board with low-cost CT configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 70 Freescale Semiconductor, Inc. D C B A

C51 100PF 100PF C51

0.1UF C50 C50 0.1UF VDDA GNDA

1 1

VLINE CT_IN+ CT_IN- 100PF C39 100PF C39 3 3 3

VDDA GNDA

C38 C38 0.1UF 0.1UF VDDA GNDA D13 BAV99LT1 D14 BAV99LT1 D14 BAV99LT1 D10 BAV99LT1 D10 BAV99LT1 1 2 1 2 1 2

VDDA GNDA 100PF Supply connection C37 C37 100PF

GNDA VDDA C36 C36 0.1UF 0.1UF Input protection GNDA GNDA VDDA VDDA Bypass capacitors VDDA GNDA

DC_BIAS

2 2

0.6V CT_I2+ CT_I2- DC_BIAS

C33 1.2V +0.6V 1.2V 1.2V -0.6V 1.2V C33 1000pF 1000pF TP11 TP15 TP17 1

MC33502DG MC33502DG

U7A U7A R43 47 R52 47 4 8

+ - + - GNDA

3 2 LPF CUTOFF frequency f3dB = 1/(2PI*(R43+R52)*C33) f3dB = 1.7MHz 1 7 VDDA

GNDA VDDA 1UF MC33502DG C25 MC33502DG C25 1UF

10PF - + MC33502DG R37 100k - 10 PF10 + R55 100k MC33502DG 4 8

GNDA

+ - + - U5A U5B U5A U5B

R56 390 R21 1.8K C43 C43 3 2 6 5

C31 10PF 10PF C31 R47 12k GNDA 3 3

DC bias voltage 0.6 V

R39 R53 CT_I1- CT_I1+ 10K 10K

C35 1000pF 1000pF C35 1.2V -0.6V 1.2V 1.2V +0.6V 1.2V G2 = (1+2*R37/R47) G2 = 17.7 R55 = R47 TP18 TP16 V_OUT 1.2V +/-0.6V 1.2V

R44 47 R49 47 3 3

LPF CUTOFF 3.4MHz CUTOFF LPF

2 2 1000pF C30 C30 1000pF

3 PAD3 JUMPER 3 PAD3 JUMPER 1 1 V_OUT 3 PAD3 JUMPER Gtotal=312 TP13 J10 J10 J13 GNDA 7 1 VDDA GNDA 4 4 MC33502DG R35 47 MC33502DG

- + MC33502DG - R38 100k + MC33502DG R54 100k 4 8

+ - + - U4A U4B R30 4.7K 1k R36 U4A U4B 6 5 3 2 VDDA GNDA

R46 12k

VLINEVLINE 10PF C42 C32 10 PF10 C42 10 PF10 C32 10 PF10

R29 100k R51 R41 10K 10K R34 R34 47k G1 = (1+2*R38/R46) G1 = 17.7 R54 = R46 1.8K R48 1.8K R42

DC_BIAS 0.6V R33 100k R40 39 39 R45 39

R32 220K TP19 TP14 5 5 CT_IN+ CT_IN- 2 1 R57 220K B A J11 CON_2_TB N_IN Voltage measurement CT= 1:2500 CURRENT SENSING USING CURRENTTRANSFORMER D C B A Figure A-6. Low-cost analog schematic of the metering board with full CT configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 71 MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 72 Freescale Semiconductor, Inc. Appendix B Layouts

B.1 Layouts for full configuration

Figure B-1. Top side of the PCB

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 73 Layouts for full configuration

Figure B-2. Bottom side of the PCB

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 74 Freescale Semiconductor, Inc. Appendix B Layouts

B.2 Layouts for Low-Cost Configuration with CT

Figure B-3. Top Side of the PCB with CT Low-Cost Configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 75 Layouts for Low-Cost Configuration with CT

Figure B-4. Bottom Side of the PCB with CT Low-Cost Configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 76 Freescale Semiconductor, Inc. Appendix B Layouts

B.3 Layouts for Low-Cost Configuration with Shunt Resistor

Figure B-5. Top side of the PCB with shunt resistor configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 77 Figure B-6. Bottom side of the PCB with shunt resistor configuration

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 78 Freescale Semiconductor, Inc. Appendix C BOM

C.1 Bill of Materials for Full Configuration Table C-1. BOM report for full configuration

Part Reference Quantity Description Manufacturer Part Number BT1 1 Battery holder CR2032 Renata Batteries SMTU2032-LF 3V ROHS COMPLIANT C1,C2,C5,C8,C10,C11, 19 CAP CER 0.1UF 25V SMEC MCCC104K2NRTF C12,C14,C15,C16,C18 10% X7R 0805 ,C21,C22,C36,C38,C4 0,C45,C47,C50 C3,C7 2 CAP ALEL 47UF 6.3V PANASONIC EEE0JA470SR 20% -- CASE C SMT C4,C6,C13,C17,C20,C 9 CAP CER 100PF 50V AVX 08055A101KAT2A 37,C39,C41,C51 10% C0G 0805 C9,C28,C44,C46,C48 5 CAP CER 10UF 16V AVX 0805YD106KAT2A 10% X5R 0805 C19 1 CAP TANT 2.2UF 16V KEMET T491A225K016AT 10% -- 3216-18 C23,C27,C31,C32,C42 6 CAP CER 10PF 50V KEMET C0805C100J5GAC ,C43 5% C0G 0805 C24,C29,C30,C33,C35 5 CAP CER 1000PF 50V AVX 08055C102KAT2A 10% X7R 0805 C25,C49 2 CAP CER 1UF 25V Panasonic ECJ2FB1E105K 10% X5R 0805 D1,D3 2 DIODE ZNR 5.1V 0.5W ON MMSZ5231BT1G SOD123 SEMICONDUCTOR D2 1 LED GRN SGL 2mA Kingbright WP7104LGD TH D4 1 LED YEL SGL 2mA TH Kingbright WP7104LYD D5,D15 2 LED RED SGL 2mA Kingbright WP7104LSRD TH

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 79 Bill of Materials for Full Configuration Table C-1. BOM report for full configuration (continued)

Part Reference Quantity Description Manufacturer Part Number D6,D7,D8 3 DIODE SW 100V ON MMSD4148T1G SOD-123 SEMICONDUCTOR D9 1 LED IR SGL 100MA VISHAY TSAL4400 TH INTERTECHNOLOGY D10,D11,D12,D13,D14 5 DIODE DUAL SW ON BAV99LT1G 215MA 70V SOT23 SEMICONDUCTOR D16 1 DIODE SCH DUAL CC ON BAT54CLT1G 200MA 30V SOT23 SEMICONDUCTOR ISO1,ISO2,ISO3 3 IC OPTOCOUPLER VISHAY SFH6106-4 100MA 70V SMD INTERTECHNOLOGY J1,J2,J6,J7,J9,J11 6 CON 1X2 TB TH 5MM LUMBERG INC KRM 02 SP 394H -- J3,J4 2 HDR 2X3 TH 100MIL SAMTEC TSW-103-07-S-D CTR 335H AU 95L J5 1 CON 2X5 PLUG SHRD ADAM BHR-10-VUA TH 100MIL CTR 358H TECHNOLOGIES AU 118L J8 1 CON 2X20 SKT TH SAMTEC SSW-120-01-T-D 100MIL CTR 335H SN J10,J13 2 JUMPER 3 PAD 40MIL N/A N/A SQUARE SMT - NO PART TO ORDER LCD1 1 LCD DISPLAY 3V S-TEK INC GD-3980P 64HZ TH L1,L2 2 IND CHIP TDK MLZ2012A1R0PT 1UH@10MHZ 220MA 25% Q1 1 TRAN NPN AMP 0.5A FAIRCHILD MMBTA42 300V SOT-23 Q3 1 TRAN PHOTO NPN OPTEK OP506B 250mA 30V TH TECHNOLOGY INC TAMPER1,SW1,RESE 4 SW SPDT PB 0.1A ZIPPY TECHNOLOGY P12S1LZ T1,SW2 30V TH CORP RS1 1 RES VARISTOR epcos B72220S0271K101 275VRMS 10% 4.5kA 151J TH R1,R7 2 RES MF 4.70K 1/8W BOURNS CR0805-FX-4701ELF 1% 0805 R2,R5,R6,R14,R59 5 RES MF 330 OHM VISHAY CRCW0805330RJNEA 1/8W 5% 0805 INTERTECHNOLOGY R3,R4 2 RES MF 220 OHM YAGEO AMERICA RC0805JR-07220RL 1/8W 5% 0805 R8 1 RES MF 680 OHM YAGEO AMERICA RC0805FR-07680RL 1/8W 1% 0805

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 80 Freescale Semiconductor, Inc. Appendix C BOM Table C-1. BOM report for full configuration (continued)

Part Reference Quantity Description Manufacturer Part Number R9,R12,R60,R61 4 RES MF 1.00K 1/8W KOA SPEER RK73H2ATTD1001F 1% 0805 R10 1 RES MF 22K 1/8W 5% BOURNS CR0805-JW-223ELF 0805 R11,R15,R18,R39,R41 8 RES MF 10K 1/8W 5% VENKEL COMPANY CR0805-8W-103JT ,R51,R53,R58 0805 R13 1 RES MF 470.0 1/8W BOURNS CR0805-JW-471ELF 5% 0805 R20,R27,R35,R43,R44 7 RES MF 47 OHM 1/8W Rohm MCR10EZPJ470 ,R49,R52 5% 0805 R21,R24,R25,R42,R48 5 RES MF 1.8K 200V WELWYN WRM0204Y-1K8BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R22,R28,R34 3 RES MF 47K 200V WELWYN WRM0204Y-47KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R23,R29,R31,R33,R37 8 RES MF 100K 200V WELWYN WRM0204Y-100KBI ,R38,R54,R55 0.1% 15PPM COMPONENTS MELF0204 LIMITED R26,R30 2 RES MF 4.7K 200V WELWYN WRM0204Y-4K7BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R32,R57 2 RES MF 220K 1/4W WELWYN WRM0204C-220KFI 1% 50ppm MELF0204 COMPONENTS LIMITED R36 1 RES MF 1K 200V 0.1% WELWYN WRM0204Y-1KBI 15PPM MELF0204 COMPONENTS LIMITED R40,R45 2 RES MF 39 OHM 200V WELWYN WRM0204C-39RFI 1% 50PPM MELF0204 COMPONENTS LIMITED R46,R47 2 RES MF 12K 200V WELWYN WRM0204Y-12KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R56 1 RES MF 390 200V WELWYN WRM0204Y-390RBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED SJ1 1 JUMPER 2 PAD 40 N/A N/A MIL SQUARE SMT;NO PART TO ORDER TP1,TP2,TP3,TP4,TP5 19 TEST POINT TH PAD NA NO PART TO ORDER ,TP6,TP7,TP8,TP9,TP 60 DRILL 35 DIAM, NO 10,TP11,TP12,TP13,T PART TO ORDER P14,TP15,TP16,TP17, TP18,TP19

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 81 Bill of Materials — Others Components Table C-1. BOM report for full configuration (continued)

Part Reference Quantity Description Manufacturer Part Number U1 1 IC MCU 32 BIT FREESCALE MCF51EM256CLL ColdFire VI 256K SEMICONDUCTOR FLASH 16K RAM 2.5-3.6V/1.8-2.5V LQFP100 U2 1 IC MEM MRAM 1Mb EVERSPIN MR25H10CDC SPI 2.7-3.6V DFN8 TECHNOLOGIES, INC U3,U4,U5,U7 4 IC LIN OPAMP DUAL ON MC33502DG RAIL-TO-RAIL SEMICONDUCTOR 1.0-7.0V SO8 U6 1 IC SENSOR FREESCALE MMA7660FC ACCELEROMETER SEMICONDUCTOR 2.4-3.6V DFN10 Y1 1 XTAL 32.768KHZ PAR Citizen CMR200T32.768KDZF 20PPM -- SMT -UT

C.2 Bill of Materials — Others Components Table C-2. BOM report —other components (non included in schematics)

QUANTITY DESCRIPTION MANUFACTURER PART NUMBER 1 Current Transformer Vacuumschmelze T60404-E4626-X131 1 Shunt 150 microOhm Zhongshan Weiqi Electronics WL150 Co 1 Enclosure FIBOX PC 17/16-3 1 Open-frame AC/DC power XP Power ECL05US03-T supply 1 Receptacle Cannon 9-pin Tyco Electronics 1658609-4 2 Buttons termination - white ZIPPY TECHNOLOGY - CORP 1 Buttons termination - black ZIPPY TECHNOLOGY - CORP 1 Buttons termination - red ZIPPY TECHNOLOGY - CORP 1 Receptacle 10-pin, ribbon Tyco Electronics 1658622-1 crimp 1 3V battery GP CR2032 20 cm Flat cable any acceptable - 2 m Extension Cord 250V/16A any acceptable - 1 Outlet 250V/16A any acceptable - 1 Power connector SEZ HSV 35

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 82 Freescale Semiconductor, Inc. Appendix C BOM

C.3 Bill of Materials for Low-Cost (Basic) CT Configuration Table C-3. BOM report for low-cost (basic) CT configuration

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER BT1 1 BATTERY HOLDER RENATA BATTERIES SMTU2032-LF CR2032 3V ROHS COMPLIANT C1,C2,C5,C8,C10,C11, 12 CAP CER 0.1UF 25V SMEC MCCC104K2NRTF C12,C14,C15,C16,C18 10% X7R 0805 ,C50 C3,C7 2 CAP ALEL 47UF 6.3V PANASONIC EEE0JA470SR 20% -- CASE C SMT C4,C6,C13,C17,C20,C 6 CAP CER 100PF 50V AVX 08055A101KAT2A 51 10% C0G 0805 C9,C48 2 CAP CER 10UF 16V AVX 0805YD106KAT2A 10% X5R 0805 C19 1 CAP TANT 2.2UF 16V KEMET T491A225K016AT 10% -- 3216-18 C30,C35 2 CAP CER 1000PF 50V AVX 08055C102KAT2A 10% X7R 0805 C25,C49 2 CAP CER 1UF 25V Panasonic ECJ2FB1E105K 10% X5R 0805 D1,D3 2 DIODE ZNR 5.1V 0.5W ON MMSZ5231BT1G SOD123 SEMICONDUCTOR D2 1 LED GRN SGL 2mA Kingbright WP7104LGD TH D5,D15 2 LED RED SGL 2mA Kingbright WP7104LSRD TH D6,D7,D8 3 DIODE SW 100V ON MMSD4148T1G SOD-123 SEMICONDUCTOR D10,D13,D14 3 DIODE DUAL SW ON BAV99LT1G 215MA 70V SOT23 SEMICONDUCTOR ISO1,ISO2 2 IC OPTOCOUPLER VISHAY SFH6106-4 100MA 70V SMD INTERTECHNOLOGY J1,J9,J11 3 CON 1X2 TB TH 5MM LUMBERG INC KRM 02 SP 394H -- J3 1 HDR 2X3 TH 100MIL SAMTEC TSW-103-07-S-D CTR 335H AU 95L J5 1 CON 2X5 PLUG SHRD ADAM BHR-10-VUA TH 100MIL CTR 358H TECHNOLOGIES AU 118L J10,J13 2 JUMPER 3 PAD 40MIL N/A N/A SQUARE SMT - NO PART TO ORDER

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 83 Bill of Materials for Low-Cost (Basic) CT Configuration Table C-3. BOM report for low-cost (basic) CT configuration (continued)

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER LCD1 1 LCD DISPLAY 3V S-TEK INC GD-3980P 64HZ TH L1,L2 2 IND CHIP TDK MLZ2012A1R0PT 1UH@10MHZ 220MA 25% TAMPER1,SW1,RESE 4 SW SPDT PB 0.1A ZIPPY TECHNOLOGY P12S1LZ T1,SW2 30V TH CORP RS1 1 RES VARISTOR EPCOS B72220S0271K101 275VRMS 10% 4.5kA 151J TH R1,R7 2 RES MF 4.70K 1/8W BOURNS CR0805-FX-4701ELF 1% 0805 R2,R5,R6,R59 4 RES MF 330 OHM VISHAY CRCW0805330RJNEA 1/8W 5% 0805 INTERTECHNOLOGY R9 1 RES MF 1.00K 1/8W KOA SPEER RK73H2ATTD1001F 1% 0805 R11,R15,R18,R58 4 RES MF 10K 1/8W 5% VENKEL COMPANY CR0805-8W-103JT 0805 R13 1 RES MF 470.0 1/8W BOURNS CR0805-JW-471ELF 5% 0805 R35,R44,R49 3 RES MF 47 OHM 1/8W Rohm MCR10EZPJ470 5% 0805 R21,R42,R48 3 RES MF 1.8K 200V WELWYN WRM0204Y-1K8BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R34 1 RES MF 47K 200V WELWYN WRM0204Y-47KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R29,R33 2 RES MF 100K 200V WELWYN WRM0204Y-100KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R30 1 RES MF 4.7K 200V WELWYN WRM0204Y-4K7BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R32,R57 2 RES MF 220K 1/4W WELWYN WRM0204C-220KFI 1% 50ppm MELF0204 COMPONENTS LIMITED R36 1 RES MF 1K 200V 0.1% WELWYN WRM0204Y-1KBI 15PPM MELF0204 COMPONENTS LIMITED R40,R45 2 RES MF 39 OHM 200V WELWYN WRM0204C-39RFI 1% 50PPM MELF0204 COMPONENTS LIMITED

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 84 Freescale Semiconductor, Inc. Appendix C BOM Table C-3. BOM report for low-cost (basic) CT configuration (continued)

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER R56 1 RES MF 390 200V WELWYN WRM0204Y-390RBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED U1 1 IC MCU 32 BIT FREESCALE MCF51EM256CLL ColdFire VI 256K SEMICONDUCTOR FLASH 16K RAM 2.5-3.6V/1.8-2.5V LQFP100 U7 1 IC LIN OPAMP DUAL ON MC33502DG RAIL-TO-RAIL SEMICONDUCTOR 1.0-7.0V SO8 Y1 1 XTAL 32.768KHZ PAR Citizen CMR200T32.768KDZF 20PPM -- SMT -UT

C.4 Bill of Materials for Low-Cost Shunt Resistor Configuration Table C-4. BOM report for shunt resistor configuration

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER BT1 1 BATTERY HOLDER RENATA BATTERIES SMTU2032-LF CR2032 3V ROHS COMPLIANT C1,C2,C5,C8,C10,C11, 17 CAP CER 0.1UF 25V SMEC MCCC104K2NRTF C12,C14,C15,C16,C18 10% X7R 0805 ,C21,C22,C40,C45,C4 7,C50 C3,C7 2 CAP ALEL 47UF 6.3V PANASONIC EEE0JA470SR 20% -- CASE C SMT C4,C6,C13,C17,C20,C 7 CAP CER 100PF 50V AVX 08055A101KAT2A 41,C51 10% C0G 0805 C9,C28,C44,C46,C48 5 CAP CER 10UF 16V AVX 0805YD106KAT2A 10% X5R 0805 C19 1 CAP TANT 2.2UF 16V KEMET T491A225K016AT 10% -- 3216-18 C23,C27 2 CAP CER 10PF 50V KEMET C0805C100J5GAC 5% C0G 0805 C24,C29,C30 3 CAP CER 1000PF 50V AVX 08055C102KAT2A 10% X7R 0805 C25,C49 2 CAP CER 1UF 25V Panasonic ECJ2FB1E105K 10% X5R 0805 D1,D3 2 DIODE ZNR 5.1V 0.5W ON MMSZ5231BT1G SOD123 SEMICONDUCTOR

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 85 Bill of Materials for Low-Cost Shunt Resistor Configuration Table C-4. BOM report for shunt resistor configuration (continued)

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER D2 1 LED GRN SGL 2mA Kingbright WP7104LGD TH D5,D15 2 LED RED SGL 2mA Kingbright WP7104LSRD TH D6,D7,D8 3 DIODE SW 100V ON MMSD4148T1G SOD-123 SEMICONDUCTOR D10,D11,D12 3 DIODE DUAL SW ON BAV99LT1G 215MA 70V SOT23 SEMICONDUCTOR ISO1,ISO2 2 IC OPTOCOUPLER VISHAY SFH6106-4 100MA 70V SMD INTERTECHNOLOGY J1,J6,J9 3 CON 1X2 TB TH 5MM LUMBERG INC KRM 02 SP 394H -- J3 1 HDR 2X3 TH 100MIL SAMTEC TSW-103-07-S-D CTR 335H AU 95L J5 1 CON 2X5 PLUG SHRD ADAM BHR-10-VUA TH 100MIL CTR 358H TECHNOLOGIES AU 118L J10,J13 2 JUMPER 3 PAD 40MIL N/A N/A SQUARE SMT - NO PART TO ORDER LCD1 1 LCD DISPLAY 3V S-TEK INC GD-3980P 64HZ TH L1,L2 2 IND CHIP TDK MLZ2012A1R0PT 1UH@10MHZ 220MA 25% Q1 1 TRAN NPN AMP 0.5A FAIRCHILD MMBTA42 300V SOT-23 Q3 1 TRAN PHOTO NPN OPTEK OP506B 250mA 30V TH TECHNOLOGY INC TAMPER1,SW1,RESE 4 SW SPDT PB 0.1A ZIPPY TECHNOLOGY P12S1LZ T1,SW2 30V TH CORP RS1 1 RES VARISTOR EPCOS B72220S0271K101 275VRMS 10% 4.5kA 151J TH R1,R7 2 RES MF 4.70K 1/8W BOURNS CR0805-FX-4701ELF 1% 0805 R2,R5,R6,R59 4 RES MF 330 OHM VISHAY CRCW0805330RJNEA 1/8W 5% 0805 INTERTECHNOLOGY R8 1 RES MF 680 OHM YAGEO AMERICA RC0805FR-07680RL 1/8W 1% 0805 R9,R12 2 RES MF 1.00K 1/8W KOA SPEER RK73H2ATTD1001F 1% 0805 R10 1 RES MF 22K 1/8W 5% BOURNS CR0805-JW-223ELF 0805

Table continues on the next page...

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 86 Freescale Semiconductor, Inc. Table C-4. BOM report for shunt resistor configuration (continued)

PART REFERENCE QUANTITY DESCRIPTION MANUFACTURER PART NUMBER R11,R15,R18,R58 4 RES MF 10K 1/8W 5% VENKEL COMPANY CR0805-8W-103JT 0805 R13 1 RES MF 470.0 1/8W BOURNS CR0805-JW-471ELF 5% 0805 R20,R27,R35 3 RES MF 47 OHM 1/8W Rohm MCR10EZPJ470 5% 0805 R21,R24,R25 3 RES MF 1.8K 200V WELWYN WRM0204Y-1K8BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R22,R28,R34 3 RES MF 47K 200V WELWYN WRM0204Y-47KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R23,R29,R31,R33 4 RES MF 100K 200V WELWYN WRM0204Y-100KBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R26,R30 2 RES MF 4.7K 200V WELWYN WRM0204Y-4K7BI 0.1% 15PPM COMPONENTS MELF0204 LIMITED R32,R57 2 RES MF 220K 1/4W WELWYN WRM0204C-220KFI 1% 50ppm MELF0204 COMPONENTS LIMITED R36 1 RES MF 1K 200V 0.1% WELWYN WRM0204Y-1KBI 15PPM MELF0204 COMPONENTS LIMITED R56 1 RES MF 390 200V WELWYN WRM0204Y-390RBI 0.1% 15PPM COMPONENTS MELF0204 LIMITED U1 1 IC MCU 32 BIT FREESCALE MCF51EM256CLL ColdFire VI 256K SEMICONDUCTOR FLASH 16K RAM 2.5-3.6V/1.8-2.5V LQFP100 U3,U7 2 IC LIN OPAMP DUAL ON MC33502DG RAIL-TO-RAIL SEMICONDUCTOR 1.0-7.0V SO8 Y1 1 XTAL 32.768KHZ PAR Citizen CMR200T32.768KDZF 20PPM -- SMT -UT

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 87 MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 88 Freescale Semiconductor, Inc. Appendix D References

D.1 References 1. http://cache.freescale.com/files/32bit/doc/ref_manual/MCF51EM256RM.pdf? fpsp=1&WT_TYPE=Reference Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET =Documentation 2. http://cache.freescale.com/files/sensors/doc/data_sheet/MMA7660FC.pdf?fpsp=1 3. http://cache.freescale.com/files/rf_if/doc/ref_manual/1322xLPNRM.pdf? fsrch=1&sr=1 4. http://cache.freescale.com/files/rf_if/doc/ref_manual/1322xSNRM.pdf? fsrch=1&sr=1 5. http://en.wikipedia.org/wiki/Electricity_meter. 6. http://en.wikipedia.org/wiki/File:WorldMap_Voltage%26Frequency.png 7. http://en.wikipedia.org/wiki/Power_factor 8. http://en.wikipedia.org/wiki/AC_power 9. http://en.wikipedia.org/wiki/Current_transformer 10. http://en.wikipedia.org/wiki/Rogowski_coil 11. http://www.powerstudies.com/articles/PowerFactorBasics.pdf 12. http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295.pdf? fsrch=1&sr=1 13. http://cache.freescale.com/files/rf_if/doc/user_guide/ZEDESDUG.pdf?fsrch=1&sr=1 14. AN4255: FFT-based Algorithm for Metering Application 15. Utility Meters/How To/Hacking in Energy Meters, Stephen Pickering 16. Utility Meters/How To/What Does an Electricity Meter Measure, Stephen Pickering

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 89 MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 90 Freescale Semiconductor, Inc. Appendix E

E.1 Glossary Analog to Digital Converter — ADC Analog Front-End — AFE — AMR Bill of Materials — BOM Common-Mode Rejection Ratio — CMRR Current Transformer — CT Fast Fourier Transform — FFT General Purpose Input Output — GPIO Graphical User Interface — GUI Human Machine Interface — HMI Integrated Circuit — IC Inter-Integrated Circuit — IIC Keyboard Interrupt — KBI Light Emitting Diode — LED Liquid Crystal Display — LCD Microcontroller Unit — MCU Open-Collector — OC Printed Circuit Board — PCB Programmable Delay Block — PDB Programmable Analog Comparator — PRACMP

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 Freescale Semiconductor, Inc. 91 Root Mean Square — RMS Real Time Clock — RTC Serial Communication Interface — SCI Surface Mounted Device — SMD Switch Mode Power Supply — SMPS Serial Peripheral Interface — SPI Zero-Cross Detection — ZCD

MQX-Enabled MCF51EM256 Single-Phase Electricity Meter Reference Design, Rev. 0 92 Freescale Semiconductor, Inc. How to Reach Us: Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductors products. There are no express or implied Home Page: copyright licenses granted hereunder to design or fabricate any integrated circuits or www.freescale.com integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any Web Support: products herein. Freescale Semiconductor makes no warranty, representation, or http://www.freescale.com/support guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any USA/Europe or Locations Not Listed: product or circuit, and specifically disclaims any liability, including without limitation Freescale Semiconductor consequential or incidental damages. "Typical" parameters that may be provided in Technical Information Center, EL516 Freescale Semiconductor data sheets and/or specifications can and do vary in different 2100 East Elliot Road applications and actual performance may vary over time. All operating parameters, including "Typicals", must be validated for each customer application by customer's Tempe, Arizona 85284 technical experts. Freescale Semiconductor does not convey any license under its patent +1-800-521-6274 or +1-480-768-2130 rights nor the rights of others. Freescale Semiconductor products are not designed, www.freescale.com/support intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other Europe, Middle East, and Africa: application in which failure of the Freescale Semiconductor product could create a Freescale Halbleiter Deutschland GmbH situation where personal injury or death may occur. Should Buyer purchase or use Technical Information Center Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify Freescale Semiconductor and its officers, employees, subsidiaries, Schatzbogen 7 affiliates, and distributors harmless against all claims, costs, damages, and expenses, and 81829 Muenchen, Germany reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury +44 1296 380 456 (English) or death associated with such unintended or unauthorized use, even if such claims alleges +46 8 52200080 (English) that Freescale Semiconductor was negligent regarding the design or manufacture of the part. +49 89 92103 559 (German) +33 1 69 35 48 48 (French) RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and www.freescale.com/support electrical characteristics as their non-RoHS-complaint and/or non-Pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale Japan: sales representative. Freescale Semiconductor Japan Ltd. For information on Freescale's Environmental Products program, go to Headquarters http://www.freescale.com/epp. ARCO Tower 15F Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. 1-8-1, Shimo-Meguro, Meguro-ku, All other product or service names are the property of their respective owners. Tokyo 153-0064 © 2011 Freescale Semiconductor, Inc. Japan 0120 191014 or +81 3 5437 9125 [email protected] Asia/Pacific: Freescale Semiconductor China Ltd. Exchange Building 23F No. 118 Jianguo Road Chaoyang District Beijing 100022 China +86 10 5879 8000 [email protected] For Literature Requests Only: Freescale Semiconductor Literature Distribution Center 1-800-441-2447 or +1-303-675-2140 Fax: +1-303-675-2150 [email protected]

Document Number: DRM121 Rev. 0