mqx-enabled mk30x256 single- phase electricity meter reference

83
MQX-Enabled MK30X256 Single- Phase Electricity Meter Reference Design Using the MK30X256, MC1322x, and MAG3110 Document Number: DRM122 Rev. 0

Upload: tranngoc

Post on 01-Jan-2017

242 views

Category:

Documents


1 download

TRANSCRIPT

MQX-Enabled MK30X256 Single-Phase Electricity Meter Reference

DesignUsing the MK30X256, MC1322x, and MAG3110

Document Number: DRM122Rev. 0

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

2 Freescale Semiconductor, Inc.

Contents

Section Number Title Page

Chapter 1Introduction

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 MK30X256 microcontroller series...................................................................................................................................9

1.3.1 Peripheral application usage..................................................................................................................................11

1.4 1322x Low Power Node (LPN)........................................................................................................................................13

1.5 MAG3110 3-axis digital magnetometer...........................................................................................................................15

Chapter 2Basic Theory

2.1 Definition of terms...........................................................................................................................................................17

2.1.1 Power.....................................................................................................................................................................17

2.1.2 Energy....................................................................................................................................................................19

2.1.3 Power factor...........................................................................................................................................................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 Voltage and current measurement....................................................................................................................................24

2.4.1 Voltage divider......................................................................................................................................................25

2.4.2 Shunt resistor.........................................................................................................................................................26

2.4.3 Current transformer...............................................................................................................................................26

2.4.4 Rogowski coil........................................................................................................................................................28

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

Freescale Semiconductor, Inc. 3

Section Number Title Page

Chapter 3System 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 sensor connection........................................................................................................................34

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

3.1.5 Power meter case...................................................................................................................................................35

3.2 Application usage.............................................................................................................................................................37

3.2.1 Power meter hardware configuration.....................................................................................................................37

Chapter 4Hardware Design of the Metering Board

4.1 Introduction to hardware implementation........................................................................................................................39

4.2 Power supply section .......................................................................................................................................................39

4.3 Digital hardware ..............................................................................................................................................................41

4.3.1 MCU core..............................................................................................................................................................41

4.3.2 RS232 interface.....................................................................................................................................................41

4.3.3 Infrared interface (IEC1107).................................................................................................................................42

4.3.4 Open collector interface.........................................................................................................................................43

4.3.5 LED interface.........................................................................................................................................................43

4.3.6 SPI interface...........................................................................................................................................................44

4.3.7 Magnetometer interface.........................................................................................................................................44

4.3.8 I2C interface..........................................................................................................................................................45

4.3.9 MRAM interface....................................................................................................................................................45

4.4 Signal conditioning ..........................................................................................................................................................46

4.4.1 Voltage measurement............................................................................................................................................46

4.4.2 DC bias connection................................................................................................................................................47

4.4.3 Shunt resistor current measurement.......................................................................................................................48

4.4.4 Zero-cross detection circuit...................................................................................................................................49

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

4 Freescale Semiconductor, Inc.

Section Number Title Page

Chapter 5Application Set-Up

5.1 Setting-Up the Demo Hardware ......................................................................................................................................51

5.2 Setting up the software demo...........................................................................................................................................53

5.2.1 FreeMASTER data visualization ..........................................................................................................................53

5.2.2 ZigBee communication .........................................................................................................................................55

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

Freescale Semiconductor, Inc. 5

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

6 Freescale Semiconductor, Inc.

Chapter 1Introduction

1.1 OverviewThis design reference manual describes the solution for a single-phase electricity meterbased on the MK30X256 microcontroller (MCU). The design demonstrates thecapabilities of this MCU for electricity metering applications. There are also additionalFreescale components used in this design, including the RF (ZigBee®) and magnetometersolution (interface).

The reference design provides a high performance solution for power measurement insingle phase two-wire installations. The target market is residential metering. Thereference design has the ability to connect to a ZigBee network thanks to the integrated1322x low power node, hence it can easily become part of the smart grid network.Besides this development, this design uses the MQX real time operating system, toimprove the code structure and to serve as a proof of concept for true real-timeapplications, such as a power meter. Because of the MQX, this power meter is designedfor use in advanced markets.

In addition, two measurement methods are explored, implemented, and compared in thisreference design (FFT, filter-based method). This reference design manual describes onlythe hardware solution for the power meter. Software solutions, mainly meteringalgorithms, are described in associated documents, like application note AN4255, FFT-based Algorithm for Metering Applications.

The power meter reference design is prepared for use in a real customer metering area, assuggested by its implementation of a Human Machine Interface (HMI) andcommunication interfaces for remote data collecting. Finally, it provides both hardwareand software solutions for customer applications.

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

Freescale Semiconductor, Inc. 7

1.2 General platform featuresThis chapter describes the main hardware and software features of the MK30X256 PowerMeter Reference Design. See also Table D-1.

1.2.1 Hardware design features• 5 (60) A current range, nominal current is 5 A, peak current is 60 A

• 120/230 V AC, 50/60 Hz operational range

• Active and reactive power (energy) measurement

• Accurate metering function for active and reactive energy: IEC50470-3 class B, 1%

• Meter constants (imp/kWh, imp/kVArh): 500, 1000, 2000, 5000, 10000

• Four-quadrant measurement

• Line frequency measurement (for precision zero-cross detection)

• Cost-effective shunt resistor sensing circuit implementation without an externalOpAmp

• Voltage sensing is executed by an inexpensive resistor divider

• Cost-effective bill of materials (BOM) due to low-cost hardware configuration

• Low-power modes effectively implemented, including the use of a built-in real-timeclock (RTC)

• 3 V internal battery for proper RTC function

• 4 × 31 segment LCD, including charge pump. Values shown on the LCD: V, A, W,VAr, VA, kWh, kVArh, cos , Hz, time, date

• Object identification system (OBIS) identifier on the LCD

• Tamper detection via:• Two built-in hidden buttons• 3-axis MAG3110 digital magnetometer (optional)

• Built-in user push-button

• LED pulse outputs (kWh, kVArh)

General platform features

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

8 Freescale Semiconductor, Inc.

• Optically isolated open-collector pulse output

• IEC1107 infrared hardware interface

• Optically isolated RS232 interface (19200 Bd, 8 data bits, no parity)

• JTAG debug interface (non-optically isolated)

• 2.4 GHz RF interface through a 1322x low power node daughter card

• Powered by a 3.3 V SMPS open-frame module (3rd party solution)

• All components—board, sensors, and switch mode power supply (SMPS)—are builtinto a plastic box with a transparent cover

• EMC proven design (EN61000-4-2, EN61000-4-4, EN6100-4-5, EN6100-4-6,EN6100-4-8, EN6100-4-11)

1.2.2 Software features of the design• Application C/ASM source code for IAR Embedded WorkBench is available.

• MQX-based design for advanced markets.

• Multiple advanced metering algorithms for precise energy measurements:• Fast Fourier Transform• Filter based method (optional only)

• ZigBee SE1.0 stack implemented in 1322x low power node for connection to aZigBee network.

• FreeMASTER visualization script for calibration, watching, and so on.

1.3 MK30X256 microcontroller seriesThe MK30X256 is a member of the 32-bit Kinetis family of MCUs. This familyrepresents the most scalable portfolio of ARM® CortexTM-M4 MCUs in the industry.Enabled by innovative 90nm Thin Film Storage (TFS) flash memory technology withunique FlexMemory (configurable embedded EEPROM), Kinetis features the latest low-power innovations and high performance, high precision mixed-signal capability with abroad range of connectivity, human-machine interface, and safety & security peripherals.The MK30X256 comes with a full suite of hardware and software tools to makedevelopment quick and easy. There is a block diagram of this MCU in Figure 1-1.

Chapter 1 Introduction

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

Freescale Semiconductor, Inc. 9

The MK30X256 MCU provides the following main features:

• Up to 100 MHz ARM Cortex-M4 core delivering 1.25 DMIPS/MHz with DSPinstructions

• Voltage range of 1.713.6 V

• 256 KB of program flash memory

• 256 KB of FlexNVM and 4 KB FlexRAM

• 64 KB of SRAM

• 16 independently-selectable DMA channels

• Integrated high-precision 16-bit successive approximations register (SAR) analog-to-digital converters (ADCs) with programmable gain amplifiers (PGAs)

• Two integrated 12-bit digital-to-analog converters (DACs)

• Programmable 1.2 V voltage reference

• High-speed analog comparator with 6-bit DAC

• Timers: FlexTimer, PDB, PIT, LPT, CMT, RTC

• Hardware CRC module to support fast cyclic redundancy check

• Hardware random-number generator

• 128-bit unique identification number per chip

• Human-Machine Interfaces: segment LCD, touch-sensing interface, and GPIO

• Communication interfaces: CAN, SPI, I2C, UART, SDHC, I2S

• –40° C to +105° C operating temperature range

Typical target applications of this MCU are:

• Smart meters

• Thermostats

• Heart rate monitors

• Blood gas analyzers

MK30X256 microcontroller series

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

10 Freescale Semiconductor, Inc.

Figure 1-1. Kinetis MK30 family block diagram

1.3.1 Peripheral application usage

The power meter concept benefits greatly from plenty of integrated internal peripherals inthe MK30X256 MCU.

In this application, the Analog-to-Digital Controller (ADC):

• Employs two channels: one is differential with an internal PGA (x32) for shuntresistor current measurement, the second is single-ended for voltage measurement.

• Includes a linear successive approximation algorithm with a 16-bit resolution.• Allows high-speed conversion (up to 128 samples per one period).• Provides a 12-MHz module clock (with 48 MHz bus clock).• Creates a proper ADC result with 16 hardware-averaged samples.

In this application, the General Purpose Input/Output (GPIO):

• Directly controls some peripherals such as LEDs, open-collector, and so on.

Chapter 1 Introduction

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

Freescale Semiconductor, Inc. 11

In this application, the Inter-Integrated Circuit (I2C):

• Primarily provides a method for internal communication between the meter (slave)and the 1322x-LPN daughter card (master)—prepared for ZigBee communication.

• Secondarily, allows internal communication with the 3-axis digital magnetometerMAG3110 (optional only)—prepared for tamper detection.

• Drives interrupts with byte-by-byte data transfer.• Communicates at up to 100 kbit/s with software selectable-slave address.

In this application, the Low-Leakage Wake-up Unit (LLWU):

• Allows button and tamper pins to wake the MCU from low-power mode.

In this application, the Liquid Crystal Display (LCD) controller:

• Allows up to 320 segments (4 × 31 is currently used).• Displays data.

In this application, the 16-bit FlexTimer Module (FTM):

• Allows a free-running mode with interrupt.• Generates precision time marks for zero-crossing.

In this application, the Comparator Module (CMP):

• Compares the input voltage signal with a bias voltage (reference).• Allows interrupts on rising edges.• Generates capture flags for zero-cross voltage signal detection. Due to this, a variable

time window for the PDB is generated.• Measures line frequency.

In this application, the Programmable Delay Block (PDB):

• Allows hardware triggering of the ADC channels.• Provides two individually-controlled trigger conditions (one for each ADC channel)

depending on the phase shift of the sensors.

In this application, the Real-Time Clock (RTC):

• Provides an ultra-low power independent real-time clock with calendar features(iRTC).

In this application, the Universal Asynchronous Receiver/Transmitter (UART):

• Provides a communication interface with an external PC (for calibration, watching).Communication settings are 19200 Bd, 8 data bits, one stop bit, and no parity.

• Provides communication interface for the IEC1107 infrared communication port(optional).

MK30X256 microcontroller series

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

12 Freescale Semiconductor, Inc.

In this application, the Serial Peripheral Interface (SPI):

• Provides a communication interface with the MRAM (optional).

In this application, the Voltage Reference (VREF):

• Provides a reference voltage for internal analog peripherals such as the ADC andCMP.

• Uses a low-power buffer mode.

1.4 1322x Low Power Node (LPN)The 1322x-LPN is one of the Freescale 1322x development kits designed for connectingto a ZigBee network. The 1322x low power node is designed as a stand-alonedevelopment board, including an MC1322x, two LEDs, two push buttons, a GPIOconnector, header pins, and a programming and debug port. Note that the ZigBeecapabilities of this board are only used in the MK30X256 metering concept; because ofthis feature, the power meter can easily become part of the smart grid. The Low PowerNode board is internally connected to an MK30X256 metering board through an I2Cinterface. 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 (PiP)• Hardware acceleration for both the IEEE® 802.15.4 MAC and AES security• Printed F antenna• Over-the-air data rate of 250 kbit/s• Typical range (outdoors, line of sight) is 300 meters• Onboard expansion capabilities for external application-specific development

activities• Programmable flash memory• JTAG port for reprogramming and in-circuit hardware debugging• Buttons and LEDs for demonstration and control• Connections for battery or external power supply

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 simpleproprietary point-to-point connectivity to complete ZigBee mesh networking. TheMC1322x is designed to provide a highly-integrated, total solution, with premierprocessing capabilities and very low power consumption. A full 32-bit ARM7TDMI-Score operates up to 26 MHz. The RF radio interface provides for low cost and highdensity as shown in Figure 1-2.

Chapter 1 Introduction

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

Freescale Semiconductor, Inc. 13

Figure 1-2. MC1322x RF interface

As described above, the 1322x low power node is used for connecting an MK30X256power meter to a ZigBee network. ZigBee, an IEEE 802.15.4 standards-based solution, asdefined by ZigBee Alliance, was developed specifically to support sensing, monitoring,and control applications. The ZigBee solution offers significant benefits, such as lowpower, robust communication, and a self-healing mesh network. The ZigBee solutionfrequencies are typically in the 868/915 MHz or 2.4 GHz spectrums.

The ZigBee data rate for technology solutions is 250 Kbps. ZigBee technologytheoretically 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

NOTEFor connection of the power meter to a ZigBee network via the1322x-LPN daughter card, it is necessary to program the1322x-LPN with the correct firmware. That description isbeyond the scope of this design reference manual.

1322x Low Power Node (LPN)

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

14 Freescale Semiconductor, Inc.

1.5 MAG3110 3-axis digital magnetometerThe MAG3110 is a small, low-power, digital 3-axis magnetometer. It features a standardI2C serial interface output and smart embedded functions. The device can be used inconjunction with a 3-axis accelerometer to produce orientation-independent, accuratecompass heading information.

The MK30X256 metering concept is prepared for tamper detection or any illegal openingof the power meter's cover. However, the tamper function using a 3-axis I2Cmagnetometer is optional.

The MAG3110 provides the main following features:

• 1.95–3.6 V supply voltage (VDD)• 1.62 V–VDD IO voltage (VDDIO)• Ultra small 2 × 2 × 0.85 mm DFN 10-pin package• Full scale range ±1000 μT• Sensitivity of 0.1 μT• Noise down to 0.25 μT rms• Output Data Rates (ODR) up to 80 Hz• I2C digital output interface (operates up to 400 kHz fast mode)• 7-bit I2C address = 0x0E• Sampled low power mode• RoHS compliant

Typical applications for this magnetometer are:

• Electronic compass• Dead-reckoning assistance for GPS backup• Location-based services

There is a simplified magnetometer functional block diagram in Figure 1-3.

Chapter 1 Introduction

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

Freescale Semiconductor, Inc. 15

Figure 1-3. Simplified magnetometer functional block diagram

MAG3110 3-axis digital magnetometer

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

16 Freescale Semiconductor, Inc.

Chapter 2Basic Theory

2.1 Definition of termsThis section defines basic terms of electricity metering theory.

2.1.1 Power

AC power flow has three components: real power (P) measured in watts (W), apparentpower (S) measured in volt-amperes (VA), and reactive power (Q) measured in reactivevolt-amperes (VAr).

Active power (P), also known as real or working power, is the power that actually powersthe 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 asystem arising from the production of electric and magnetic fields. Although reactiveloads such as inductors and capacitors dissipate no power, they drop voltage and drawcurrent, creating 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 capacitor, current leadsvoltage; for an inductor, current lags voltage) and there is no net power flow. This energyflowing backwards and forwards is known as reactive power. Reactive power is thusproduced 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 functionof a circuit's reactance (X).

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

Freescale Semiconductor, Inc. 17

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

These three types of power—true, reactive, and apparent—relate to one another in atrigonometric form. This is called a power triangle (see Figure 2-1). The opposite angle isequal to the circuit's impedance (Z) phase angle. Apparent power is often computed fromthis 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 involt-amperes (VA). Total apparent power is a product of the RMS voltage and RMScurrent, and is defined as:

Definition of terms

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

18 Freescale Semiconductor, Inc.

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 line, apparent power is not the same as totalapparent power, because the simple vector sum in apparent power computing is lessaccurate. 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 hour.

Active energy means the electrical energy produced, flowing, or supplied by an electriccircuit during a time interval, being integral with respect to time of the instantaneousactive power and measured in units of watt-hours (Wh). For practical use in powermeters, 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-ampere-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 powerflowing to the load to the apparent power in the circuit, and is a dimensionless numberbetween 0 and 1 (frequently expressed as a percentage, that is 0.5 pf = 50% pf). Realpower is the capacity of the circuit for performing work in a particular time. Apparentpower is the product of the current and voltage of the circuit. Due to energy stored in theload and returned to the source, or due to a nonlinear load that distorts the wave shape ofthe 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 aload with a high power factor for the same amount of useful power transferred. Thehigher currents increase the energy lost in the distribution system and require larger wiresand other equipment. Because of the costs of larger equipment and wasted energy,

Chapter 2 Basic Theory

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

Freescale Semiconductor, Inc. 19

electrical utilities usually charge a higher rate to industrial or commercial customerswhere there is a low power factor. Therefore, a modern electronic smart power metermust 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 theload returns to the source on each cycle. When the power factor is 1, all the energysupplied by the source is consumed by the load. Power factors are usually stated asleading or lagging to show the sign of the phase angle. It is often desirable to adjust thepower factor of a system to near 1.0.

2.2 Electricity distributionElectricity distribution is the final stage in the delivery of electricity to end users. Adistribution system's network carries electricity from the transmission system anddelivers it to consumers. Part of what determines the design of the electricity meter is thetransmission 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 theworld. Finally, more than 80% of the population in the world uses a 1-phase 2-wireinstallation of 230 V/50 Hz (see at Figure 2-2). Much of the US installation is 110 V/60Hz 1-phase 2-wire. The electricity meter described in this design reference manual isdesigned for use in 1P2W installations.

Electricity distribution

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

20 Freescale Semiconductor, Inc.

Figure 2-2. Residential voltage and frequency worldwide

2.3 Electricity metersAn electric meter or energy meter is a device that measures the amount of electricalenergy consumed by a residence, business, or an electrically powered device. Electricmeters are typically calibrated in billing units, the most common of which is the kilowatthour (kWh). Periodic readings of electric meters establish billing cycles and energy usedduring a cycle.

A kilowatt hour is equal to the amount of active energy used by a load of one kilowattover a period of one hour, or 3,600,000 joules. Some electricity companies use the SImegajoule instead. Similarly to active energy in kWh, there is also reactive energy(kVArh) and apparent energy (kVAh). See Section 2.1.2 Energy .

Electricity meters operate by continuously measuring the instantaneous voltage (volts)and current (amperes) and finding the product of these to give instantaneous electricalpower (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) canbe connected directly in-line between source and customer. For larger loads of more thanabout 200 amps, current transformers are used so that the meter does not have to belocated in-line with the service conductors.

Standard electricity meters fall into two basic categories, electromechanical andelectronic.

Chapter 2 Basic Theory

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

Freescale Semiconductor, Inc. 21

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 metersbecause of their many additional advantages (see Section 2.3.2 Electronic meters).

The electromechanical induction meter operates by counting the revolutions of analuminium disc that is made to rotate at a speed proportional to the power. The number ofrevolutions 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 itproduces a magnetic flux in proportion to the voltage, and the other produces a magneticflux in proportion to the current. The field of the voltage coil is delayed by 90 degreesusing a lag coil. This produces eddy currents in the disc and the effect is such that a forceis exerted on the disc in proportion to the product of the instantaneous current andvoltage. A permanent magnet exerts an opposing force proportional to the speed ofrotation of the disc. The equilibrium between these two opposing forces results in the discrotating at a speed proportional to the power being used. The disc drives a registermechanism that integrates the speed of the disc over time by counting revolutions, muchlike the odometer in a car, to render a measurement of the total energy used over a periodof time.

2.3.2 Electronic meters

Electronic meters display the energy used on an LCD or LED display, and can alsotransmit readings to remote places. In addition to measuring energy used, electronicmeters can also record other parameters of the load and supply such as maximumdemand, power factor, reactive power used, and so on. They can also support time-of-daybilling, for example, recording the amount of energy used during on-peak and off-peakhours.

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, amicrocontroller), and other add-on modules such as RTC, LCD, communication ports andmodules, and so on. For a basic block outline of the electronic power meter, see Figure2-3.

Electricity meters

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

22 Freescale Semiconductor, Inc.

SignalConditioning

MCU

voltage

currentanalog

ADC

digital LCD

AMRCommunications

AFE

UserSelection

Figure 2-3. Basic outline of the electronic power meter

The signal conditioning circuitry is used for adapting a high-amplitude signal from theline to a lower one accepted by the Analog Front End (AFE) and Analog-to-DigitalConverter (ADC).

The metering engine is given the voltage and current inputs, has a voltage reference,samplers, and quantizers followed by an ADC section to yield the digitized equivalents ofall the inputs. All of this is sometimes called the Analog Front End (AFE). These inputsare then processed using a DSP or MCU to calculate the various metering parameterssuch as powers, energies, and so on.

The processing and communication section has the responsibility of calculating thevarious derived quantities from the digital values generated by the metering engine. Thisalso has the responsibility of communication using various protocols and interfaces withother add-on modules connected as slaves.

RTC and other add-on modules are attached as slaves to the processing andcommunication 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 automatic meterreading (AMR) technology. AMR is the technology of automatically collectingconsumption, diagnostic, and status data from energy metering devices and transferringthat data to a central database for billing, troubleshooting, and analyzing. This advancemainly saves utility providers the expense of periodic trips to each physical location to

Chapter 2 Basic Theory

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

Freescale Semiconductor, Inc. 23

read a meter. Another advantage is that billing can be based on near real-timeconsumption rather than on estimates based on previous or predicted consumption. Thistimely information, coupled with analysis, can help both utility providers and customersto better control the use and production of electric energy. Electronic meters with AMRtechnology can read and communicate through several mechanisms such as:

• Infrared• Radio frequency• Data modem (via a telephone line)• Power line carrier• Serial port (RS-485)• Broadband

AMR meters often have sensors that can report the meter cover opening, magneticanomalies, extra clock setting, stuck buttons, inverted installation, reversed or switchedphases, and so on. These events may be immediately sent to the utility company thanks toAMR technology.

Smart meters go a step further than simple AMR. They offer an additional function,including a real-time or near real-time reading, power outage notification, and powerquality monitoring. They allow price setting agencies to introduce different prices forconsumption based on the time of day and the season. The feedback they provide toconsumers has also been shown to cut overall energy consumption.

In comparison to the 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• Easier calibration• Anti-tampering protection, including traditional or modern solutions• Automated meter reading (AMR)• Advanced billing methods (prepay, time-of-use, and so on)

2.4 Voltage and current measurementIn electricity meters, the energy is calculated from two measured signals, voltage andcurrent. For line voltage and line current measurement, systems that are generally calledsensors are used. Whichever sensor is used, voltage and current measurements result inan AC voltage with a magnitude proportional to the signal being measured.

Voltage and current measurement

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

24 Freescale Semiconductor, Inc.

The voltage sensor results in a sine wave with a fundamental frequency of typically either50 or 60 Hz depending upon the power distribution used. See Section 2.2 Electricitydistribution.

For current measurement, the sensor provides a fundamentally sinusoidal signal (possiblywith 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-wireinstallation is shown in Figure 2-4. There are three typical sensors used for sensingcurrent and voltage in power meters. All of these sensors are also used in the electronicpower meter described in this manual.

Figure 2-4. Typical measurement circuit in 1P2W installation

The following sections describe the commonly used methods for sensing the voltage andcurrent used in 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 R1 to limit the power dissipation and reducethe heat generated, thus improving accuracy. See Figure 2-4.

The equation for computing output voltage of the voltage divider is defined as:

Chapter 2 Basic Theory

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

Freescale Semiconductor, Inc. 25

Where Vin is the phase voltage and Vout is the voltage measured by the ADC (voltagedrop 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 because it does not distort the signal and itcosts less than other current measurement methods. The downside of using a shuntresistor is primarily the power dissipation that can create inaccuracies in the measurementdue to resistive changes, and due to temperature and the waste of power. To limit the self-heating effect of the shunt, the resistor is made using a metal with suitable properties. Theresistance of the shunt is kept very low to reduce power dissipation.

Typically, shunt resistors are in the range of 100–300 μΩ, and as such, the voltagedeveloped across them is very small. For example, 100 A drawn through a 200 μΩ shuntdevelops only 20 mV (voltage = current × resistance). Through a 300 μΩ shunt, thiswould be 30 mV, which entails 2 W power loss and 3 W, respectively.

The problem with this approach is the very small voltages derived from the shunt resistorand the even smaller resolution of valid measurements. Therefore, a signal derived fromthe shunt resistor must be amplified to keep the correct measurement precision.Operational amplifiers are frequently used for this purpose in most applications, but theMK30X256 power meter uses an internal PGA for this.

There are several rules for the right selection of a shunt resistor in the application:

• A shunt resistor must have good thermal properties (that is, Manganin® alloy with alow temperature coefficient of resistance).

• The shunt size must be selected to maximize the dynamic range of the ADC input.• The shunt resistor must be selected to minimize power dissipation.

NOTEPower dissipated by the shunt resistor, plus the power supplyused by the meter, must be below the specification for the meter(IEC1036 specifies a 2 W/10VA total power loss).

Voltage and current measurement

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

26 Freescale Semiconductor, Inc.

2.4.3 Current transformer

Current transformers (CT) are used extensively for measuring current and monitoring thepower grid. Like any other transformer, a current transformer has a primary winding, amagnetic core, and a secondary winding. The alternating current flowing in the primaryproduces a magnetic field in the core, which then induces a current in the secondarywinding circuit, as in 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 anexternal current to a voltage converter, such as a burden resistor Rb (see Figure 2-4), insystems where the voltage input of the ADC is used in the majority of applications. Theprimary objective of the current transformer design is to ensure that the primary andsecondary circuits are efficiently coupled, so that the secondary current bears an accuraterelationship to the primary current.

The benefits of using a CT are that the output voltage can easily be matched to thecapability of the ADC input by selecting the appropriate winding or appropriate burdenresistor (Rb), and because of this, an external OpAmp is not necessary. Another importantbenefit of using a CT is that this sensor isolates the measuring engine from the line;therefore, the CTs may be easily used in polyphase meters.

A typical feature of a CT is the time shift between the primary and secondary currents inthe windings. For using this in the power meters, it is good to know that the power metersmust wait a specific time after the voltage measurement before reading the current fromthe CT. The delay required is specific to each CT, and is established during calibration ofthe meter and programmed into the meter, as a part of the calibration constants.

CT coils have the negative effect of distorting the current measurement. Considering themagnetic core of the CT, it is necessary to respect a maximum recommended current inthe primary winding (rating factor) because of saturation of its core. A good accuracy inthe case of CT current measurement is directly related to other factors, including externalelectromagnetic fields and a change of temperature.

Figure 2-5. Current transformer principle

Chapter 2 Basic Theory

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

Freescale Semiconductor, Inc. 27

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 endreturning through the centre of the coil to the other end, so that both terminals are at thesame end of the coil, as in Figure 2-6. The whole assembly is then wrapped around thestraight conductor whose current is to be measured. Because the voltage that is induced inthe coil is proportional to the rate of change (derivative) of current in the straightconductor, the output of the Rogowski coil is usually connected to an electrical, orelectronic, 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 canbe made open-ended and flexible, allowing it to be wrapped around a live conductorwithout disturbing it. Because a Rogowski coil has an air core rather than an iron core, ithas a low inductance and can respond to fast-changing currents. Also, because it has noiron core to saturate, it is highly linear even when subjected to large currents, such asthose used in electric power transmission, welding, or pulsed power applications. Acorrectly formed Rogowski coil with equally spaced windings is largely immune toelectromagnetic interference.

The benefits of using a Rogowski coil are similar to using a CT; namely, the outputvoltage can more easily be matched to the capability of the ADC input by selecting anappropriate winding, load resistor, and filter. Another advantage of a Rogowski coil isthat it costs less than a traditional CT, although it requires an integrator and additionalphase compensation.

Figure 2-6. Rogowski coil principle

Voltage and current measurement

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

28 Freescale Semiconductor, Inc.

Chapter 3System Concept

3.1 Application descriptionA standard system block diagram of the MK30X256 power meter concept is shown inFigure 3-1. The full-metering system solution—that is, all the components within theouter black-dashed rectangle—incorporates the following parts:

• Metering board (inside the diagram's inner black-dashed rectangle). The mainmetering engine, this is the concentrated majority of metering components.

• Switch Mode Power Supply boardv(SMPS). This board is used for supplying themetering engine and the 1322x-LPN daughter card.

• External current sensor (shunt resistor). Located directly at the line power connectorinside the metering case.

• 1322x-LPN. Daughter card for ZigBee communication.• Power meter case with an integrated line power connector and an RS232

communication connector.

Some common parts of the power meter in the block diagram have the same color forbetter function identification. The voltage signal conditioning and current sensor, forinstance, are colored red. See Figure 3-1. There is one current sensor in the power meter(shunt resistor), that is located near the line power connector inside the terminalcompartment of the power meter case, outside the metering board. There is a voltagemeasurement signal conditioning part (voltage divider) that is located directly on themetering board.

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

Freescale Semiconductor, Inc. 29

Figure 3-1. MK30X256 power meter block diagram

3.1.1 Metering board

The metering engine (board) is the main part of the power meter. It is comprised ofcomponents such as the MCU with the AFE, signal conditioning part, LCD, button,LEDs, optical interface for the IEC1107 and RS232, voltage signal conditioning, tamperbutton, 3 V battery, magnetometer, and some communication connectors. The meteringboard is designed on a two-sided printed circuit board. Most of the components aresoldered on its top side (see Figure 3-2), while some components are soldered on thebottom side of the printed circuit board (see Figure 3-3).

Application description

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

30 Freescale Semiconductor, Inc.

User Button

Crystal

MCU

MRAM

RS232interface

OC interface

User LED

Infraredinterface

Display

Battery

Voltage conditioning part

LED KVArhLED KWh

Magnetometerinterface

Tamper 1

JTAG interface

VBIAS

selectionShunt

interfaceMains

interface Power supply interface

Tamper 2 interface

Figure 3-2. Metering board, top view

RS232interface

I2Cinterface

Currentconditioning part

OCinterface

SPIinterface

Figure 3-3. Metering board, bottom view

Chapter 3 System Concept

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

Freescale Semiconductor, Inc. 31

The core of the metering engine placed on the top side of the board is the MK30X256, a32-bit ARM Cortex-M4 MCU. (For a description, see Section 1.3 MK30X256microcontroller series.) All of the MCU peripherals used in the application, except for theJTAG interface, are pictured in the block diagram in Figure 3-1.

A simplified function of the MCU in the application is as follows:

The ADC, which is a part of the MCU, reads data from voltage and current sensors. TheMCU computes other values such as powers, energies, power factor, and line frequencyconsecutively. Moreover, the MCU communicates with the user through the built-in HMI(LCD and button) or several communication interfaces (RS232, ZigBee, IEC1107, LEDs,OC). A description of the metering algorithm is beyond the scope of this design referencemanual, but is described in application note AN4255, FFT-based Algorithm for MeteringApplications.

The HMI of this power meter is comprised of the following parts: an LCD, a push-button,and one (red) LED. The LCD displays plenty of computed values, such as the RMS valueof line voltage and current, powers, energies, power factor, line frequency, and also theactual time and date. The push-button allows you to select one of these values to beshown on the LCD.

NOTEThere is only one main value shown on the LCD at a time.

The next important part of the metering engine board is signal conditioning. This part isused for adapting the signal level from sensors to the AFE (part of the MCU including theADC and PGA). There are two different types of signal conditioning with regards tosensors used: the part for voltage measurement is made of a simple voltage divider. Thepart for current measurement via a shunt resistor is made from a simple resistor bridge,which is used for shifting the signal on the shunt above 0 V. Thanks to the internal PGA,no external operational amplifier is needed.

There are several communication interfaces on the metering board. The interface forRS232 is optically isolated by optocouplers, and the interface for the IEC1107 is opticallyisolated by infrared components. The open-collector is an optically-isolated output of thepower meter; this may be used for switching some small loads. One of the mostinteresting types of communication in this power meter is RF or ZigBee. Communicationthrough RF/ZigBee is accomplished by the external 1322x-LPN daughter card (outsidethe metering engine), which communicates with the metering board through the I2Cinterface. Finally, two red LEDs are used for optical communication with the utilityservice provider. This is the energy output interface; the first LED here is for activeenergy counting and the second LED is for reactive energy counting.

Application description

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

32 Freescale Semiconductor, Inc.

The essential parts of the metering board are components for the proper functioning ofthe MCU's real-time clock (RTC), including the 3 V battery (for saving date and time)and crystal. Two hidden tamper buttons recognize any illegal opening of the cover orterminal compartment section of the meter, one soldered directly on the metering board,and the second outside of the board in the terminal compartment section.

The power meter also offers another method of tamper detection through the use of a 3-axis I2C magnetometer (the MAG3110 silicon may be used for this). The MK30X256power meter does not currently use this type of tamper detection; however, the interfacefor it is now prepared. An illegal cover opening can cause a 3-axis motion that is detectedby the magnetometer and interpreted as an illegal opening by an algorithm sophisticatedenough to distinguish it from the ordinary motions of the meter. But this type of operationis optional, since the tamper push-buttons are used for tamper detection.

3.1.2 Switch Mode Power Supply board connection

The SMPS board is used for supplying the metering board engine. The SMPS used in thisapplication is a 3rd party open-frame solution for the power supply that produces onegalvanic-isolated level of output voltage. This open-frame SMPS module has a widerange of input AC voltages (85–264 V, RMS) with a wide range of line frequencies (47–63 Hz) as well. Thanks to these input parameters of the SMPS, the whole power metercan work with line voltages and frequencies in these ranges. The output voltage is fixedto a 3.7 V DC level with a 1.16 A nominal output current and a power rating of 4.3 W.Figure 3-4 provides an overview of the board. There are two power connectors on thisboard: 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 ishoused in the left part of the power meter case (under the metering board) and connectedto the line and metering board by two thin cables.

N_inp

L_inp

+3.7V

GND

Figure 3-4. SMPS Board View

Chapter 3 System Concept

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

Freescale Semiconductor, Inc. 33

NOTEDefault output voltage level for this type of SMPS is 3.3 V.Other output voltage levels are adjusted by small trimmer onthe SMPS board (in the 3.0–3.6 V range, approximately) or byadding an SMD resistor in parallel to the output voltage divideron the SMPS board (27 kΩ for +3.7 V).

3.1.3 External current sensor connection

The MK30X256 power meter uses a shunt resistor as the external current sensor forphase current measurement.

The shunt resistor is specifically a Manganin resistor of an accurately known resistance,in this case 300 μΩ . This shunt resistor is intended for current measurement of up to 60A RMS. The voltage drop across the shunt resistor is proportional to the phase currentflowing through it; because its resistance is known, a small voltage drop is amplified bythe internal PGA of the MCU, and then measured by the internal ADC of the MCU. For aphoto of the shunt resistor, see Figure 3-5. The terminal connection of this shunt resistoris divided into two parts—power connection and sense connection—and because of this,a 4-wire current measurement may be done. The power connection is intended for aconnection between the phase input (L_inp) and phase output (L_out) connectors. Thesense connection of this shunt resistor is intended only for measuring its voltage drop.

GND

L_inp L_out

LINE_OUTLINE_IN

Figure 3-5. Shunt resistor description

Application description

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

34 Freescale Semiconductor, Inc.

NOTEThere is also a separated ground terminal (GND) in the senseconnection area for the metering board ground connection. Thisground terminal is located on the same side as the power phaseinput (L_inp).

3.1.4 1322x-LPN connection

The 1322x-LPN is intended for use as a ZigBee node for the power meter. It works as anintermediator between the power meter and a ZigBee coordinator, which is based at theutility provider area, for example. The ZigBee coordinator scans data from variousequipment (power meter, home thermostat, sensor, dimmer switch, and so on) in theZigBee network and sends it to the central (PC) station. The 1322x Low Power Node isscrewed onto the bottom part of the power meter case, near the SMPS, and connected as adaughter card to the metering engine through a thin flat cable. The board overview is inFigure 3-6. There are two pairs of wires for connection to the metering board: the firstpair is for supplying the node (3.3 V, GND), and the second pair is for the I2Ccommunication lines (SCL, SDA).

Powerconnection

arrea

I2C connections

+

-

Figure 3-6. 1322x-LPN board view

Chapter 3 System Concept

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

Freescale Semiconductor, Inc. 35

3.1.5 Power meter case

All the components mentioned (boards, sensor, and so on) are housed in a power metercase. This is made as a base with transparent main and terminal compartment covers. It isintended primarily for mounting in a vertical position (on a wall, for example) by threescrews. Because of the transparent cover, the metering board with the main components,including the LCD primarily, are easily visible.

Shunt Resistor

Metering Board

Phase input

Phase output

Neutral

SMPS

Flat cable + RS232 connector

Mounting hole

Mounting hole

1322x-LPNdaughter card

Figure 3-7. Power meter case, inside view

Figure 3-7 shows a photo of the metering case without either of the transparent covers.You can see the boards and the current sensor placements. There are also four powerterminals in the terminal compartment section; the first is for phase input, the second isfor phase output, and the remaining two terminals are for neutral connections. The mainmetering board is mounted onto four plastic columns (spacers) on the front side of thepower meter case. On the left side of the case, there is the SMPS, and on the bottom sideof the case there is the 1322x-LPN daughter card. The shunt sensor is soldered directlybetween the two left power terminals, namely the phase input (L_inp) and the phaseoutput (L_out). On the right side of this case, there is an RS232 connector, which isconnected to the main board by a thin 9-pin flat cable.

Application description

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

36 Freescale Semiconductor, Inc.

3.2 Application usage

3.2.1 Power meter hardware configuration

The MK30X256 power meter is pictured in Figure 3-8. This power meter is primarilyintended to demonstrate the MCU in a single-phase, two-wire installation. For a betterpractical demonstration of the power meter, it is placed on a perspex base with an outlet(for load connection) and a cable with a plug (for connection to the power line). Thewhole configuration, shown in Figure 3-9, is also called the power meter demo.

Terminal compartment

Reactive energy LEDDisplay

Active energy LED

RS232 connector

Tamper button 1 (hidden)

User button

Tamper button 2 (hidden)

User LED

Battery

Open-collector output

Figure 3-8. Power meter view

Chapter 3 System Concept

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

Freescale Semiconductor, Inc. 37

Cable with plug

Outlet

Terminalcompartment

Pedestal

Meteringengine

Figure 3-9. Power meter demo view

Although the current range of this power meter is internally set for a measurement of upto 60 A, for practical use this range is reduced to approximately 16 A, adequate fordemonstration purposes. This is due to a maximum current rating of the outlet and theplug used. For those who want to use the entire metering range of up to 60 A, both theplug and outlet must be replaced by more powerful ones.

For remote data communication, either the RS232 port or the in-built ZigBee node maybe used .

NOTEAn open-collector communication interface is not directlyaccessible.You must first open the cover of the case to accessits connections.

Application usage

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

38 Freescale Semiconductor, Inc.

Chapter 4Hardware Design of the Metering Board

4.1 Introduction to hardware implementationThis chapter describes the design of the application hardware, that is, the design of themetering board (engine). The main hardware is divided into two main parts, digitalhardware (HW) and analog hardware. Analog hardware is also called signal conditioningin this manual. Digital hardware is configurable depending on the customer request, froma low-cost solution to a high-performance (full) configuration. The stand-alone section ofthe metering board is the power supply section, and this is a mandatory part of eachconfiguration of the power meter.

With regards to various digital hardware configurations, there are also various powermeter configurations. These power meter configurations are differentiated:

• Full power meter configuration. For a schematic view, see Figure A-1. For layoutviews, see Figure B-1 and Figure B-2. For the BOM, see Table C-1.

• Low-cost power meter configuration with only the necessary components. For aschematic view, see Figure A-2. For layout views, see Figure B-3 and Figure B-4.For the BOM, see Table C-2.

4.2 Power supply sectionThe power supply section is used mainly for adapting the voltage level from the externalSMPS (3.7 V) to the internal board, and also includes the overvoltage protection (seeFigure 4-1). The 3 V battery is also a part of the power supply section; it is used forsupplying the MCU in case of a power outage. Connector J4 placed on the bottom side ofthe printed-circuit board is the input power supply connector of the board. This connectormust be joined to the external SMPS; that is, pin 2 of connector J4 to 3.7 V on the SMPSand pin 1 of the connector J4 to the GND of the SMPS.

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

Freescale Semiconductor, Inc. 39

As you can see, there is a simple overvoltage protection including the Zener diodes D12and D13. These diodes protect against a reversal of polarity.

The power supply section of the metering board produces four power supply levels forindividual blocks of the metering board:

• VDDMCU—digital voltage 3.3 V for the MCU only• VDDAMCU—analog voltage 3.3 V for the MCU only (for AFE)• VDD—digital voltage 3.7 V for all peripherals• VDDA—analog voltage 3.7 V for the DC bias circuit only

Some circuits in the design require two separated power supply levels, a digital and ananalog power supply. The analog power supply level of the MCU is separated from itsdigital power supply by the chip inductor L2 with cooperation of filters C45―C47. Theanalog power supply level of the DC bias circuit is separated from the digital part of thepower supply by the chip inductor L1 with cooperation of filters C37―C39. Power supplylevels for the peripherals and for the MCU are separated by diode D11. Because of this,the peripherals are not powered in the case of a power outage (in this case, only the MCUis powered, via the 3 V battery). The voltage drop on this diode is approximately 0.4 V;therefore, analog and digital voltage levels for peripherals are far above this voltage levelin comparison to voltage levels at the MCU.

There are two separated grounds in the design, a digital ground (GND) and an analogground (GNDA). Both of these grounds are joined together through the chip inductormarked L3 in the schematic.

3.6V

3V

3.3V

3.3V

R3010K

C37

0.1UF

SJ2 2 PAD JUMPER

1 2

3VGNDA

VCC_PRESENT

C43

0.1UF

C39

100PF

D13

MMSZ5231BT1G

VDD

L1 1uH1 2

VDDA

TP11

TP14TP12

TP16

GNDA

VDDAMCU

GND

VDDMCU

+C47

47UF

GND

D12

MM

SZ

5231

BT

1G

C46

100PF

GND

VDDAMCU

GND

C410.1UF

VDDMCU

C45

0.1UF

GNDA

L2 1uH1 2

GND

+ C4047UF L3 1uH

1 2

C42100PF

GND

J4

CON_2_TB

A1

B2

C44

10UF

R3147K

D11

BAT54CLT1

2

3

1C38

10UF

GND

BT1

BATTERY

12

TP15TP13

TP10VDDA

TP17

GND

VDD

GNDA

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

Power supply section

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

40 Freescale Semiconductor, Inc.

The presence of an external power supply level (from the SMPS) is shown through asimple voltage divider (R30, R31) in the power supply section. Logic 0 on theVCC_PRESENT pin means there is a power outage. In this case, the metering board issupplied from the internal 3 V battery, and the software causes a power down for most ofthe MCU peripherals.

NOTEThe peripheral supply voltage level on the metering board is thesame as that of the external SMPS. The MCU supply voltagelevel is consequently lower around the voltage drop on diodeD11.

4.3 Digital hardware

4.3.1 MCU core

The MCU is the core of the metering board. It is marked as U1 in the schematic. TheMCU core, with all key components, is displayed in both Figure A-1 and Figure A-2. Forthe MCU to function correctly, several components are necessary:

• Filters C2–C8, C10–C12, C19• RC filter for resetting the MCU, including R20 and C16• Crystal Y1 with filters C20 and C21

Another part of the the MCU core, which we may simply assign to it, is the HumanMachine Interface (HMI). This includes components such as the display DS1 and the userpush-button SW1, with the simple filter C23. There is one tamper button, SW2, on theboard, and connector J5 for connecting the second tamper which is placed in the terminalcompartment section. Pull-up resistors for the button and tampers are software selectableby the MCU; therefore, no external pull-ups on the board are needed. The charge pumpfor the LCD is a part of the MCU. Therefore, the LCD requires minimal externalcomponents—in fact, only capacitors C28, C31, C32, and C33.

Connector J1 is the JTAG interface for MCU programming. Be careful aboutprogramming the MCU through this interface in a configuration where the power meterdemo is fed from the line. This interface is not isolated from the line, and an electricshock can arise. To prevent this, use an external optically isolated JTAG interface.

Chapter 4 Hardware Design of the Metering Board

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

Freescale Semiconductor, Inc. 41

4.3.2 RS232 interface

This interface is used primarily for a basic set-up of software for the meter, includingcalibration, checking sensor outputs, and visualization. Communication is opticallyisolated through optocouplers ISO1 and ISO2. Because two additional signals are used onthe serial data line, RTS and DTR, the secondary side of ISO1 and the primary side ofISO2 are powered from the RS232 data line (from the PC side). These signals arenormally used for transmission control, but this function is not used in the application. Asthere is a fixed voltage level on the control lines, it may be used to supply theoptocouplers, in cooperation with other components. These components include D6, D7,D9, C15, R19, and R13. The part of the schematic including the RS232 communicationinterface can be seen in Figure 4-2.

RS

232_

RX

D

R161.0K

R12390

ISO1

SFH6106-4

1

2 3

4

ISO2

SFH6106-4

1

23

4

J8

CON_2X5

1 23 4

657 89 10

D6M

MS

D41

48T

1G

21

GND

D7

MM

SD

4148

T1G

21

(+12V)

D9

MMSD4148T1G

21+

C15

2.2UF

RTS

R19470

RXD

R134.7K

DTRTXD

GND

RS

232_

TX

D

VDD

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

4.3.3 Infrared interface (IEC1107)

This interface uses infrared components, the high efficiency IR emitting diode D10, andthe NPN phototransistor Q1. Both of these are through-hole assembled. Apart from these,some necessary passive components are used, such as R27, R28, R29, and C36. The partof the schematic including the IEC1107 communication interface can be seen in Figure4-3.

Digital hardware

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

42 Freescale Semiconductor, Inc.

C36

0.1UF

R2822K

TP8

TP9

VDD

GND GND

D10

TS

AL4

400

AC

R27680.0

R291.0K Q1

OP506B

21

GND

IR_RXIR_TX

Figure 4-3. IEC1107 part of the metering board

4.3.4 Open collector interface

The open collector interface portion of the schematic can be seen in Figure 4-4. This is agalvanic-isolated interface thanks to optocoupler ISO3. It may be used for switchingsome small loads with a maximum collector-to-emitter voltage of VCEO of up to 70 V,and a maximum collector current of up to 50 mA. Output from this interface is accessibleon connector J6.

R23390

ISO3

SFH6106-4

1

2 3

4

EOC_OC

EOC_OE

J6

CON_2_TB

A1

B2

EO

C

VDD

Figure 4-4. Open collector interface of the metering board

4.3.5 LED interface

The two high-efficiency LEDs in this part are used for energy counting: D2 for activeenergy counting and D1 for reactive energy counting. They are used primarily forcalibration of the meter; the number of flashes of the LEDs is proportional to totalaccumulated energy, that is, the sum of import and export energy. Both of these LEDs arethrough-hole assembled for a better placement near the cover. The final LED used in thispart of the schematic is the user LED D3, which may be used for detecting some programstates, for example. Each of these LEDs is lit by logic 0 from the MCU. The part of theschematic including the LED interface can be seen in Figure 4-5.

Chapter 4 Hardware Design of the Metering Board

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

Freescale Semiconductor, Inc. 43

R2390

R3390

R8390

D1

WP7104LSRD

AC

D2

WP7104LSRD

AC

D3

LED RED

AC

LED_kWh

LED_kVarh

VDD

LED_USR

Figure 4-5. LED part of the metering board

4.3.6 SPI interface

The SPI interface is optional. It is not used at this time, but it has been prepared for futureusage. It is connected to the MCU by the 6-pin header J9. Apart from the supply voltage,all the SPI data lines are connected (SOUT, SIN, CLK and CS) . The part of theschematic including the SPI communication interface can be seen in Figure 4-6.

VDD

SPI2_SCKSPI2_CS0

GNDJ9

HDR 2X3

1 23 4

65

C220.1UF

SPI2_SOUTSPI2_SIN

Figure 4-6. SPI interface part of the metering board

4.3.7 Magnetometer interface

The magnetometer function in this power meter is described in detail in Section 3.1.1Metering board. The section of the schematic including the magnetometer interface canbe seen in Figure 4-7. In this schematic, the magnetometer is marked as U3. Themagnetometer may be used in this power meter for tamper detection (optional) instead ofthe standard button.The magnetometer communicates with the MCU through I2C datalines; therefore, external pull-ups R25 and R26 on the SDA and SCL lines are required.The magnetometer uses the same I2C data lines as the 1322x-LPN daughter card;therefore, the software selectable addresses of both of these peripherals are required(done by the MCU).

NOTEBecause of very the small supply current of this chip, it may bepowered directly through the GPIO pin of the MCU (seeVDDMAG net in the schematic).

Digital hardware

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

44 Freescale Semiconductor, Inc.

U3

MAG3110

CAP_A1 V

DD

2

NC3

CAP_R4

GN

D1

5

SDA6SCL7

VD

DIO

8

INT19

GN

D2

10

GND

C290.1UF

VDDMAG

C300.1UF

GND

C260.1UF

C27

0.1UF

C241UF

GND GND

I2C1_SCLI2C1_SDA

INT1

TP7

Figure 4-7. Magnetometer interface part of the metering board

4.3.8 I2C interface

The I2C interface is used for joining the 1322x-LPN daughter card and the MCU. Thisdaughter card is used primarily for RF/ZigBee communication. The 1322x-LPN board isconnected by a thin flat cable directly to the 6-pin header J7 of the metering board. Pull-ups for I2C data lines are required (R25, R26). It is better to use hardware pull-ups thansoftware configurable pull-ups inside the MCU. A schematic of the connection betweenthe metering engine and the daughter card can be seen in Figure 4-8.

J1

90122-12

1 23 45 67 89 10

11 12

+

BC11

2468

2

J7

HDR 2X3

1 23 4

65

I2C_SDA I2C_SCL

VDD

Metering board

1322x-LPN

GND

2xAAA Cells

-+3.3VGND

R254.7K

R264.7K

C25 0.1UF

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

Chapter 4 Hardware Design of the Metering Board

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

Freescale Semiconductor, Inc. 45

4.3.9 MRAM interfaceThe MR25H10 (U2 in the schematic) is a 1-Mbit magnetoresistive random accessmemory (MRAM) device organized as 131072 words of 8 bits. The MR25H10 offersserial EEPROM and serial flash memory compatible read/write timing with no writedelays and unlimited read/write endurance. It allows the use of more data memory in theapplication than the standard MCU can offer. Using this memory in the design isoptional, because the capacity of the internal SRAM of the MCU is enough for mostapplications. The section of the schematic including the MRAM interface can be seen inFigure 4-9. The MRAM communicates with the MCU through a standard SPI interface.

NOTEBecause of the very small active read/write current of this chip,it may be powered directly through the GPIO pin of the MCU(see VDDMRAM net in the schematic).

MRAM

VDDMRAM

SPI0_SCK

MRAM_CTRLSPI0_SIN

SPI0_SOUT

SPI0_CS0

U2

MR25H10CDC

CS1

SO2

WP3

VSS

4

SI5

SCK6

HOLD7

VDD

8

EXP

9

GND

C13

0.1UF

GND

Figure 4-9. MRAM interface part of the metering board

4.4 Signal conditioning

4.4.1 Voltage measurement

There is a simple voltage divider used for the line voltage measurement in Figure 4-10.This is a basic and key part of each configuration of the power meter. In the basic blockdiagram (see Figure 3-1), there is a voltage divider, based on two simple resistors. In apractical implementation it is better to design this divider from several resistorsconnected serially due to the power-loss spread. One half of this total resistor consists ofR5, R7, R9, and R11, the second half consists of resistor R6. The basic voltage dividerdescribed produces a sine voltage signal around ground. This is not acceptable for theADC, because all voltage signals connected to it must be above ground (single-endedconfiguration). Therefore, a further voltage divider that raises the signals is added to theconnection. This second divider is made from R4 and R6 (a part of the line divider). The

Signal conditioning

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

46 Freescale Semiconductor, Inc.

ratio of this second divider allows a voltage on the ADC input from 0—1.2 V (Vref). Thesine voltage signal from the line is then shifted to Vref ÷ 2; that is, approximately 0.6 V.See Figure 4-10.

R5220K

R7220K

R11100K

R4

4.7K

R61K

N

D4

BA

V99

LT1

1

3

2

GNDAVDDAMCU

R9100K

C91000pF

0.6V+/-0.5V

LPF CUTOFF 3.4MHz

V_OUTR1047

TP2

V_BIAS

J2

CON_2_TB

A1

B2

RS120S0271

12

GND

Figure 4-10. Voltage signal conditioning part of the metering board

Finally, there is a simple RC low-pass filter (R10 + C9) at the end of the voltage divider.The cut-off frequency for that is set to 3.4 MHz according to this relation:

NOTESome components in the voltage measurement part of theschematic are depicted for a 3.7 V DC bias supply net. For a 1.2V DC bias supply voltage level, see the resistors selection inFigure 4-11.

4.4.2 DC bias connection

The DC bias voltage (V_BIAS net in the schematic) is used for supplying some circuitsin the analog signal conditioning parts. These parts are: a voltage divider in the voltagemeasurement section, a resistor bridge in the current measurement section, and a zero-cross detection circuit. The correct DC bias voltage is selected by the SJ1 jumper on theboard, which assigns one of the following power nets to V_BIAS:

• 3.7 V (VDDA) analog peripheral supply voltage net (default configuration used inthe schematic)

• 1.2 V (VREF_OUT) reference output of the MCU

Chapter 4 Hardware Design of the Metering Board

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

Freescale Semiconductor, Inc. 47

Because of the different voltage levels of individual configurations, some resistors inrelevant blocks must be reconfigured, particularly R4, R6, R11, R22, R24. The part of theschematic including the jumper for the DC bias selection and the right resistor selectiontable is in Figure 4-11.

NOTEThe 1.2 V reference output of the MCU is powerful enough tosupply all analog peripherals of the MK30X256 power meterwhich are tied on the V_BIAS net.

SJ1

1

2

3

V_BIAS

VREF_OUT

VDDA

2-32K22K2220K4K74K7

1-24K71K100K4K71K

R4R6R11R22R24

SJ1

Figure 4-11. DC bias circuit and resistors selection

4.4.3 Shunt resistor current measurement

Because there is a very small voltage drop at the shunt resistor, the drop must beamplified before it is processed in the ADC. This operation is carried out by an externaloperational amplifier mostly, though in the MK30X256 power meter it is possible to usethe internal PGA. The upshot of this solution is obvious: the designed power meter mightbe cheaper in comparison to a traditional one that uses an external OpAmp. Since thevoltage drop at the shunt is around ground, and the internal PGA accepts voltages aboveground, the voltage drop on the shunt must be shifted above ground. A simple resistorbridge is used for this. The bridge is made from resistors R14, R15, R17, and R18. Theoriginal zero voltage level is then shifted to 75 or 25 mV, respectively, depending on thecorrect DC bias voltage (for selection, see Section 4.4.2 DC bias connection). Differentialoutput of this resistor bridge (L_DP, L_DN) is joined directly to an analog pin (PGA0) ofthe MCU. Finally, two protection diodes D5 and D8 are used. These diodes, inconjunction with half of the resistor bridge (R14, R18), protect inputs of the MCU againstspikes from the line. The schematic of the shunt resistor current measurement block is inFigure 4-12.

NOTEFilter capacitor C14 should be placed as close as possible to thechip inputs (see the layout in the Appendix section). Thisrequirement is also valid for filter C9 in the voltage section.

Signal conditioning

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

48 Freescale Semiconductor, Inc.

D5BA

V99

LT1

1

32

VDDAMCU

GNDA

R174.7K

R154.7K

75mV-20.4mV

75mV+20.4mVR14

100R18

100

V_BIAS

TP3

TP4

L_DMJ3

CON_2_TB

A1

B2

D8

BA

V99

LT1

1

32

LINE_IN

C14

220PF

L_DP

25mV-20.4mV

25mV+20.4mV

LINE_OUT

VDDAMCUGNDA

Figure 4-12. Shunt resistor signal conditioning part of the metering board

4.4.4 Zero-cross detection circuitThe MK30X256 power meter can measure the line frequency. In order to do so, the zero-crossing of the input line voltage must be measured. The main principle for doing this isto compare output voltage from the voltage conditioning part (see Section 4.4.1 Voltagemeasurement) with a known voltage level (the DC bias voltage in this case). This is doneby the analog comparator (CMP) of the MCU. The first input of this comparator isconnected to the DC bias voltage through a voltage divider that divides the DC biasvoltage to 0.6 V, and the second input of the comparator is joined to the line through avoltage divider (V_OUT net in the schematic). The part of the schematic including thezero-cross detection circuit can be seen in Figure 4-13. For proper operation of the analogcomparator, there should be also two filters, C17 and C18.

NOTESome components in the schematic of the zero-cross detectioncircuit are depicted for a 3.7 V DC bias supply net. For a 1.2 VDC bias supply voltage level, see the resistors selection inFigure 4-11.

R241K

R22

4.7K0.6V

GNDA

GNDA

C18

0.1UF

R2110K

C17

100PF

CMP2_IN0 V_OUT

CMP2_IN1 V_BIAS

Figure 4-13. Zero-cross detection circuit

Chapter 4 Hardware Design of the Metering Board

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

Freescale Semiconductor, Inc. 49

Signal conditioning

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

50 Freescale Semiconductor, Inc.

Chapter 5Application Set-Up

5.1 Setting-Up the Demo HardwareThe following section is focused on setting up the metering demo hardware.

Load up to 60 A

NEUTRALNEUTRAL

PHASE

PHASEMains 120/230V

50/60 Hz

Figure 5-1. Power meter line connection

• Connect the power meter directly to the line (see Figure 5-1).• Connect an external load to the power meter (see Figure 5-1).• For a better practical demonstration of the power meter, the metering case may

alternatively be placed on an acrylic base with an outlet (for a load connection) and acable with a plug (for connection to the power line). The whole configuration is alsocalled the power meter demo (see Figure 3-9).

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

Freescale Semiconductor, Inc. 51

• After connecting the power meter to the line, the display turns on and shows the lastvalue that was there before turning it off. Apart from the main value, the displayshows the other symbols (see Figure 5-2), such as OBIS codes, tamper identifiers,actual tariff, and unit (regarding the main value).

• You can also select other values to be shown on the display by pressing the push-button. The following is a list of these values:

Table 5-1. Power meter display values

Value Units Format OBIS code

Line voltage VRMS 0.01V 32.7.0

Line current ARMS 0.001A 31.7.0

Signed active power W 0.1W (+ forward, - reverse) 1.7.0

Signed reactive power VAr 0.1VAr (+ lag, - lead) 3.7.0

Apparent power VA 0.1VA 9.7.0

Power factor — 0.0001 13.7.0

Active energy—import kWh (Wh) 0.0001kWh, 0.01Wh, 0.001Wh 1.8.0

Active energy—export kWh (Wh) 0.0001kWh, 0.01Wh, 0.001Wh 2.8.0

Reactive energy—import kVArh (VArh) 0.0001kVArh, 0.01VArh, 0.001VArh 3.8.0

Reactive energy—export kVArh (VArh) 0.0001kVArh, 0.01VArh, 0.001VArh 4.8.0

Frequency Hz 0.001Hz 14.7.0

Time hour,min,sec HH:MM:SS 0.9.1

Date year,month,day YYYY:MM:DD 0.9.2

SW version — x.x.x 0.2.0

• All of the energies (four counters) are saved into the non-volatile memory. Theseenergies remain in memory after resetting the power meter. To clear the energycounters, you must use the FreeMASTER application (see Section 5.2.1FreeMASTER data visualization ) and apply a Clear Energies command.

• There are two tampers hidden under the cover. When you remove the cover, tampersymbol(s) is/are shown on the LCD. These symbols remain on the LCD even after areset, because this information is saved in the non-volatile memory. To clear thetamper status you must use the FreeMASTER application (see Section 5.2.1FreeMASTER data visualization ) and apply a Clear Tampers command.

• When you push the user button during power-on, the LCD shows the actual versionof the internal software.

• Both energy LEDs flash simultaneously with the internal energy counters. Thismeans that flashes of each energy LED are proportional to the sum of import andexport energy (active or reactive).

• A 3-V battery is used for the proper RTC function.• RS232 plug is used for FreeMASTER data visualization and calibration.

Setting-Up the Demo Hardware

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

52 Freescale Semiconductor, Inc.

Tamper for device cover

OBIS identifier

Tamper for terminal cover

Actual tariff

Unit

Value

Figure 5-2. MK30X256 power meter display description

5.2 Setting up the software demoThe following section focuses 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 thePC must first be connected. The FreeMASTER visualization script is the software forremote visualization and remotely setting up the power meter via an RS232 cable. Thissoftware runs on the PC that connects to the power meter via an RS232 cable. TheFreeMaster visualization script is the application that runs under the FreeMASTERsoftware. FreeMASTER software is one of the off-chip drivers that supportscommunication between a target microcontroller and a PC. This tool allows theprogrammer to remotely control an application with a user-friendly graphicalenvironment running on a PC. It also provides the ability to view some real-timeapplication variables in both textual and graphical form. FreeMASTER software runsunder Windows 98, 2000, or XP. It is a versatile tool to be used for multipurposealgorithms and applications, providing a lot of excellent features, including:

• Real-time debugging• Diagnostic and visualisation tools• Demonstration tool• Educational tool

Before running a visualization script, FreeMASTER software must be installed on yourPC. After that, a FreeMASTER visualization script may be started after double-clickingon the MK30X.pmp file in the Visualisation directory. Following this, a visualizationscript will appear on your PC. For more information, see Figure 5-3.

Chapter 5 Application Set-Up

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

Freescale Semiconductor, Inc. 53

Figure 5-3. FreeMASTER Visualization Script (GUI)

You should set the proper serial communication port and speed in the Project/Optionmenu (see Figure 5-4) now. After doing so, you must set the proper Project.out projectfile in the menu Project/Option/MAPfiles (see Figure 5-5). This file is accessible insubdirectory FLASH_256KB_PFLASH_256KB_DFLASH. If all previous settings arecorrectly done, the FreeMASTER visualization script for the power meter is nowprepared for running. To do this, you must click on the Start/Stop Communication button.At this time, you can see the voltage and current diagrams in the time domain and in thefrequency domain (in an FFT window) too. You may also see other variables in a textualformat, such as frequency, VRMS, IRMS, energies, and so on.

Alternatively, you may set some values, such as an impulse number, clock and date, andso on. After setting the appropriate value in the column cell, use the right command fortransferring this value to the meter's RAM. Only the following commands are allowable:clock setting, impulse number setting, clear energies, clear tampers. After application ofthese commands, it is also suitable to use the flash save command to save these valuesinto a non-volatile memory of the MK30X256. You are not allowed to change "red"values in the Calibration section of the FreeMASTER visualization script, because of theloss of calibration constants. These values include: voltage and current gain, voltagephase delay, and power offset.

Setting up the software demo

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

54 Freescale Semiconductor, Inc.

NOTEAll system (FreeMASTER) values are saved automaticallyduring meter power-down. Therefore, the flash save commanddoesn't have to be used.

Figure 5-4. FreeMASTER communication port setting

Figure 5-5. FreeMASTER project file setting

Chapter 5 Application Set-Up

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

Freescale Semiconductor, Inc. 55

5.2.2 ZigBee communication

ZigBee communication is optional and is not implemented in every power meter demo.There is a 2.4 GHz 1322x-LPN daughter card inside the power meter. The ZigBeemodule and the power meter are connected through the I2C. For joining the power meterto the ZigBee network, you will need the 1322x-SRB module, which is like a ZigBeecoordinator (see Figure 5-6). The power meter can now easily become part of a smartgrid.

Figure 5-6. 1322x-SRB as a ZigBee coordinator

The following is a standard communication procedure for joining the power meter to asmart grid:

• Install the latest version of the BeeKit from the Freescale web page. There is also aZeD monitor as a separate part of the BeeKit. Use the ZeD monitor fordemonstrating ZigBee communication between the power meter and the PC.

• Switch the power meter on and connect a load to it.• Connect the ZigBee coordinator (1322x-SRB) to the PC with a USB cable and

switch the coordinator on. The coordinator must be powered. To do this, plug the ACadaptor to the coordinator (you may also use the internal battery inside thecoordinator module), or use a USB power line from the PC side (this is the bestchoice). You will have to install the software driver for this equipment after the firstconnection of the 1322x-SRB to the PC. The driver is on the CD in theDrivers \LuminaryFTDI directory, or alternatively on the Future Technology DevicesInternational (FTDI) web page.

• Push the SW1 button on the coordinator—it looks up all ZigBee equipmentconnected to the ZigBee network at this time. Two red LEDs on the coordinator arethen lit (see Figure 5-6).

• 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.

Setting up the software demo

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

56 Freescale Semiconductor, Inc.

• At this moment, there are icons for all of the devices connected to the ZigBeenetwork—the power meter plus the coordinator, in this case (see Figure 5-7). If thereis no icon for the power meter, you must reset the power meter by disconnectingfrom the line and reset the ZeD GUI using the F5 key. You may also repeat theinstallation from point 2 in this case.

• In the ZeD GUI menu, you may open a new window for showing the ZigBee datatransfer. This is in Tools/Start SE Utility Control Panel menu. You must address themeter by clicking the Add New Household ESP Connection, and then click on theConnect icon (see Figure 5-8).

• To show data (only import active energy at this time), click on the Metering icon—akWh data table is now refreshed every 5 seconds. The Meter Report column displaysactive energy from the power meter (see Figure 5-9). These numbers are in HEXformat with a widely variable resolution that may be changed by the FreeMASTERGUI (ZigBee kWh divider dialogue box). Therefore, the kWh-number on the LCD ofthe power meter may have a different resolution in comparison to the number in theZeD GUI metering data report.

NOTEImpulse number setting command in the FreeMASTERGUI (see FreeMASTER data visualization ) should be usedafter modification of ZigBee kWh divider number.

Figure 5-7. ZeD GUI

Chapter 5 Application Set-Up

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

Freescale Semiconductor, Inc. 57

Figure 5-8. Add New Household ESP Connection dialog box

Figure 5-9. Metering report in ZeD GUI

Setting up the software demo

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

58 Freescale Semiconductor, Inc.

Appendix ASchematics

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

Freescale Semiconductor, Inc. 59

A.1 Schematic for full configuration of the metering board

RS232_TXD

V_OUT

CMP2_IN1

D5BA

V99

LT11

3

2

VDDAMCU

GNDA

RS

232_

RX

D

IR_TXIR_RX

C19

0.1UFGND

R174.7K

R154.7K

R5220K

R7220K

VDDMCU

75mV-20.4mV

75mV+20.4mV

R11100K

3.6V

3V

3.3V

R4

4.7K

U3

MAG3110

CAP_A1 V

DD

2

NC3

CAP_R4

GN

D1

5

SDA6SCL7

VD

DIO

8

INT19

GN

D2

10

3.3V

1.2V

R241K

R3010K

R22

4.7K

R61K

R26

4.7K

R25

4.7K

N

R14100

R18100

CMP2_IN0

R2390

R3390

R8390

C37

0.1UF

MRAM

V_BIAS

SJ1

3 PAD JUMPER

1

2

3

D4

BA

V99

LT1

1

3

2

V_BIAS

VREF_OUT

VDDA

Bias selection

VDD

SJ2 2 PAD JUMPER

1 2

3V

0.6V

R161.0K

R12390

ISO1

SFH6106-4

1

2 3

4

R23390

ISO2

SFH6106-4

1

23

4

Energy outputpulse interface

RS232 Interface

TP3

ISO3

SFH6106-4

1

2 3

4

TP4

R110K

J8

CON_2X5

1 23 4

657 89 10

D6

MM

SD

4148

T1G

21

GND

D7

MM

SD

4148

T1G

21

(+12V)

D9

MMSD4148T1G

21

+

C15

2.2UF

EOC_OE

EOC_OC

J6

CON_2_TB

A1

B2

RTS

SPI0_SCK

R19470

RXD

VDDMAG

R134.7K

DTR

RS232 isolated (Half Duplex, max 19200 Bd)

TXD

GND

I2C1_SCL

GNDA

I2C1_SDA

VDD

GNDA

VDDMRAM

GND

VCC_PRESENT

C43

0.1UF

MRAM_CTRL

C39

100PF

C290.1UF

VDDMAG

VDDAMCU

C300.1UF

GND

GND

VDD

D13

MMSZ5231BT1G

LCD0

LCD2LCD1

LCD17LCD3

Port B

Port A

Port C

Port D

Port E

U1

MK40X256VLQ100

JTAG_TCLK/SWD_CLK/EZP_CLK/TSI0_CH1/PTA0/UART0_CTS/FTM0_CH550

JTAG_TDI/EZP_DI/TSI0_CH2/PTA1/UART0_RX/FTM0_CH651

JTAG_TDO/TRACE_SWO/EZP_DO/TSI0_CH3/PTA2/UART0_TX/FTM0_CH752

JTAG_TMS/SWD_DIO/TSI0_CH4/PTA3/UART0_RTS/FTM0_CH053

NMI/EZP_CS/TSI0_CH5/PTA4/FTM0_CH154

JTAG_TRST/PTA5/FTM0_CH2/CMP2_OUT/I2S0_RX_BCLK55

PTA6/FTM0_CH3/FB_CLKOUT/TRACE_CLKOUT58

ADC0_SE10/PTA7/FTM0_CH4/FB_AD18/TRACE_D359

ADC0_SE11/PTA8/FTM1_CH0/FB_AD17/FTM1_QD_PHA/TRACE_D260

PTA9/FTM1_CH1/FB_AD16/FTM1_QD_PHB/TRACE_D161

PTA10/FTM2_CH0/FB_AD15/FTM2_QD_PHA/TRACE_D062

PTA11/FTM2_CH1/FB_OE/FTM2_QD_PHB63

CMP2_IN0/PTA12/CAN0_TX/FTM1_CH0/FB_CS5/FB_TSIZ1/FB_BE23_16_BLS15_8/I2S0_TXD/FTM1_QD_PHA64

CMP2_IN1/PTA13/CAN0_RX/FTM1_CH1/FB_CS4/FB_TSIZ0/FB_BE31_24_BLS7_0/I2S0_TX_FS/FTM1_QD_PHB65

PTA14/SPI0_PCS0/UART0_TX/FB_AD31/I2S0_TX_BCLK66

PTA15/SPI0_SCK/UART0_RX/FB_AD30/I2S0_RXD67

PTA16/SPI0_SOUT/UART0_CTS/FB_AD29/I2S0_RX_FS68

ADC1_SE17/PTA17/SPI0_SIN/UART0_RTS/FB_AD28/I2S0_MCLK/I2S0_CLKIN69

EXTAL/PTA18/FTM0_FLT2/FTM_CLKIN072

XTAL/PTA19/FTM1_FLT0/FTM_CLKIN1/LPT0_ALT173

PTA24/FB_AD1475

PTA25/FB_AD1376

PTA26/FB_AD1277

PTA27/FB_AD1178

PTA28/FB_AD1079

PTA29/FB_AD1980

LCD_P0/ADC0_SE8/ADC1_SE8/TSI0_CH0/PTB0/I2C0_SCL/FTM1_CH0/FTM1_QD_PHA81

LCD_P1/ADC0_SE9/ADC1_SE9/TSI0_CH6/PTB1/I2C0_SDA/FTM1_CH1/FTM1_QD_PHB82

LCD_P2/ADC0_SE12/TSI0_CH7/PTB2/I2C0_SCL/UART0_RTS/FTM0_FLT383

LCD_P3/ADC0_SE13/TSI0_CH8/PTB3/I2C0_SDA/UART0_CTS/FTM0_FLT084

LCD_P4/ADC1_SE10/PTB4/FTM1_FLT085

LCD_P5/ADC1_SE11/PTB5/FTM2_FLT086

LCD_P6/ADC1_SE12/PTB687

LCD_P7/ADC1_SE13/PTB788

LCD_P8/PTB8/UART3_RTS89

LCD_P9/PTB9/SPI1_PCS1/UART3_CTS90

LCD_P10/ADC1_SE14/PTB10/SPI1_PCS0/UART3_RX/FTM0_FLT191

LCD_P11/ADC1_SE15/PTB11/SPI1_SCK/UART3_TX/FTM0_FLT292

VDD15

VDD216

VDD343

VDD456

VDD570

VDD694

VDDA31

VREFH32

VREFL33

VSSA34

VREF_OUT37

ADC0_DP123

ADC0_DM124

ADC1_DP125

ADC1_DM126

PGA0_DP/ADC0_DP0/ADC1_DP327

PGA0_DM/ADC0_DM0/ADC1_DM328

PGA1_DP/ADC1_DP0/ADC0_DP329

PGA1_DM/ADC1_DM0/ADC0_DM330

DAC0_OUT38

DAC1_OUT39

ADC1_SE1635

ADC0_SE1636

RESET74

VREGIN22

VOUT3321

USB0_DP19

USB0_DM20

VBAT42

EXTAL3241 XTAL3240

VLL1110

VLL2109

VLL3108

VCAP1112

VCAP2111

VSS26

VSS317

VSS444

VSS557

VSS671

VSS793

VSS8107

VSS9136

LCD_P12/TSI0_CH9/PTB16/SPI1_SOUT/UART0_RX/EWM_IN95

LCD_P13/TSI0_CH10/PTB17/SPI1_SIN/UART0_TX/EWM_OUT96

LCD_P14/TSI0_CH11/PTB18/CAN0_TX/FTM2_CH0/I2S0_TX_BCLK/FTM2_QD_PHA97

LCD_P15/TSI0_CH12/PTB19/CAN0_RX/FTM2_CH1/I2S0_TX_FS/FTM2_QD_PHB98

LCD_P16/PTB20/SPI2_PCS0/CMP0_OUT99

LCD_P17/PTB21/SPI2_SCK/CMP1_OUT100

LCD_P18/PTB22/SPI2_SOUT/CMP2_OUT101

LCD_P19/PTB23/SPI2_SIN/SPI0_PCS5102

LCD_P20/ADC0_SE14/TSI0_CH13/PTC0/SPI0_PCS4/PDB0_EXTRG/I2S0_TXD103

LCD_P21/ADC0_SE15/TSI0_CH14/PTC1/SPI0_PCS3/UART1_RTS/FTM0_CH0104

LCD_P22/ADC0_SE4b/CMP1_IN0/TSI0_CH15/PTC2/SPI0_PCS2/UART1_CTS/FTM0_CH1105

LCD_P23/CMP1_IN1/PTC3/SPI0_PCS1/UART1_RX/FTM0_CH2106

LCD_P24/PTC4/SPI0_PCS0/UART1_TX/FTM0_CH3/CMP1_OUT113

LCD_P25/PTC5/SPI0_SCK/LPT0_ALT2/CMP0_OUT114

LCD_P26/CMP0_IN0/PTC6/SPI0_SOUT/PDB0_EXTRG115

LCD_P27/CMP0_IN1/PTC7/SPI0_SIN116

LCD_P28/ADC1_SE4b/CMP0_IN2/PTC8/I2S0_MCLK/I2S0_CLKIN117

LCD_P29/ADC1_SE5b/CMP0_IN3/PTC9/I2S0_RX_BCLK/FTM2_FLT0118

LCD_P30/ADC1_SE6b/CMP0_IN4/PTC10/I2C1_SCL/I2S0_RX_FS119

LCD_P31/ADC1_SE7b/PTC11/I2C1_SDA/I2S0_RXD120

LCD_P32/PTC12/UART4_RTS121

LCD_P33/PTC13/UART4_CTS122

LCD_P34/PTC14/UART4_RX123

LCD_P35/PTC15/UART4_TX124

LCD_P36/PTC16/CAN1_RX/UART3_RX125

LCD_P37/PTC17/CAN1_TX/UART3_TX126

LCD_P38/PTC18/UART3_RTS127

LCD_P39/PTC19/UART3_CTS128

LCD_P40/PTD0/SPI0_PCS0/UART2_RTS129

LCD_P41/ADC0_SE5b/PTD1/SPI0_SCK/UART2_CTS130

LCD_P42/PTD2/SPI0_SOUT/UART2_RX131

LCD_P43/PTD3/SPI0_SIN/UART2_TX132

LCD_P44/PTD4/SPI0_PCS1/UART0_RTS/FTM0_CH4/EWM_IN133

LCD_P45/ADC0_SE6b/PTD5/SPI0_PCS2/UART0_CTS/FTM0_CH5/EWM_OUT134

LCD_P46/ADC0_SE7b/PTD6/SPI0_PCS3/UART0_RX/FTM0_CH6/FTM0_FLT0135

LCD_P47/PTD7/CMT_IRO/UART0_TX/FTM0_CH7/FTM0_FLT1138

ADC1_SE4a/PTE0/SPI1_PCS1/UART1_TX/SDHC0_D1/FB_AD27/I2C1_SDA1

ADC1_SE5a/PTE1/SPI1_SOUT/UART1_RX/SDHC0_D0/FB_AD26/I2C1_SCL2

ADC1_SE6a/PTE2/SPI1_SCK/UART1_CTS/SDHC0_DCLK/FB_AD253

ADC1_SE7a/PTE3/SPI1_SIN/UART1_RTS/SDHC0_CMD/FB_AD244

PTE4/SPI1_PCS0/UART3_TX/SDHC0_D3/FB_CS3/FB_BE7_0_BLS31_24/FB_TA7

PTE5/SPI1_PCS2/UART3_RX/SDHC0_D2/FB_TBST/FB_CS2/FB_BE15_8_BLS23_168

PTE6/SPI1_PCS3/UART3_CTS/I2S0_MCLK/FB_ALE/FB_CS1/FB_TS/I2S0_CLKIN9

PTE7/UART3_RTS/I2S0_RXD/FB_CS010

PTE8/UART5_TX/I2S0_RX_FS/FB_AD411

PTE9/UART5_RX/I2S0_RX_BCLK/FB_AD312

PTE10/UART5_CTS/I2S0_TXD/FB_AD213

PTE11/UART5_RTS/I2S0_TX_FS/FB_AD114

PTE12/I2S0_TX_BCLK/FB_AD015

PTD10/UART5_RTS/FB_AD9139

PTD11/SPI2_PCS0/UART5_CTS/SDHC0_CLKIN/FB_AD8140

PTD12/SPI2_SCK/SDHC0_D4/FB_AD7141

PTD13/SPI2_SOUT/SDHC0_D5/FB_AD6142

PTD14/SPI2_SIN/SDHC0_D6/FB_AD5143

PTD15/SPI2_PCS1/SDHC0_D7/FB_RW144

ADC0_SE17/PTE24/CAN1_TX/UART4_TX/EWM_OUT45

ADC0_SE18/PTE25/CAN1_RX/UART4_RX/FB_AD23/EWM_IN46

PTE26/UART4_CTS/FB_AD22/RTC_CLKOUT/USB_CLKIN47

PTE27/UART4_RTS/FB_AD2148

PTE28/FB_AD2049

VSS118

VDD7137

LCD16

LCD11LCD12LCD13LCD14LCD15

LCD10

LCD4LCD5LCD6LCD7LCD8LCD9

LCD34

LCD26LCD27LCD28LCD29LCD30LCD31LCD32

LCD33

LCD18LCD19LCD20LCD21LCD22LCD23LCD24LCD25

I2C

SW2

D2F-01L

13

2

TAMPER1

TAMPER2

C340.1UF

GND

GND

VDDMCU

EOC

C260.1UF

C27

0.1UF

RS

232_

TX

D

J3

CON_2_TB

A1

B2

C241UF

GND

GNDA

GNDA

L_DM

EO

C

C16

0.1UF

R204.7K

GND

VDDMCU

GND

VDD

VDDMCU

D8

BA

V99

LT1

1

3

2

LINE_IN

J7

HDR 2X3

1 23 4

65

/RESET

C18

0.1UF

R2110K

C17

100PF

CMP2_IN0 V_OUT

CMP2_IN1

Zero-cross detect

R9100K

VDD

C36

0.1UF

R2822K

TP8

TP9

VDD

GND

Current measurement5(120)A

Infrared interfaceGND

D10T

SA

L440

0

AC

R27680.0

R291.0K Q1

OP506B

21

GND

L1 1uH1 2

VDDA

GND

VCC_PRESENT

C70.1UF

C35

0.1UF

TP12TP11

TP14TP16

GNDA

VDDAMCU

Externalisolated+3.7V,200mASMPS

GND

VDDMCU

+C47

47UF

GND

D12

MM

SZ

5231

BT

1G

C250.1UF

C46

100PF

GND

VDDAMCU

GND

TP18

TP19

C410.1UF

VDDMCU

C45

0.1UF

GNDA

I2C1_SCLI2C1_SDA

L2 1uH1 2

GND

+ C4047UF L3 1uH

1 2

3-axis IIC Magnetometer

INT1

C42100PF

GND

J4

CON_2_TB

A1

B2

Power section

GNDA

GND

C12

0.1UF

C3

0.1UF

C2

0.1UF

C11

0.1UF

SW1

LIGHT TOUCH PUSH BUTTON

1 4

2 3

C4

0.1UF

C5

0.1UF

C23

0.1UF

GND

D1

WP7104LSRD

AC

D2

WP7104LSRD

AC

SPI GNDJ9

HDR 2X3

1 23 4

65

C220.1UF

SW1

J1

HDR_19P

1234

6 58

91011121314151617181920

SPI0_SIN

R3247K

TP1

VDDMCU

SPI2_SOUT

VDDMCU

D3

LED RED

AC

SPI2_SIN

Tamper Detection

C8

0.1UF

GNDA

2-31-2SJ1

R11R6R4

R22

1K 2K22K24K7

4K74K7220K100K

4K71KR24

GND

IR_RX

C14

220PF

L_DP

C44

10UF

R3147K

Shunt 25mV-20.4mV

25mV+20.4mV

LINE_OUT

D11

BAT54CLT1

2

3

1

LCD0

LCD3LCD2LCD1

DS1

150020254

COM11

COM22

COM33

COM44

1G/T5/1E/1F5

1B/1D/1C/1A6

10G/P5/10E/10F7

10B/10D/10C/10A8

11G/T6/11E/11F9

11B/11D/11C/11A10

12G/P7-P6/12E/12F11

12B/12D/12C/12A12

T7/T8/P4/H19

2G/T3/2E/2F20

2B/2D/2C/2A21

3G/T2/3E/3F22

3B/3D/3C/3A23

4G/T1/4E/4F24

4B/4D/4C/4A25

5G/T4/5E/5F26

5B/5D/5C/5A27

6G/P1/6E/6F28

6B/6D/6C/6A29

7G/P2/7E/7F30

13G/13E/13F13

13B/13D/13C/13A14

14G/P8/14E/14F15

14B/14D/14C/14A16

1717

1818

7B/7D/7C/7A31

8G/COL1-COL2/8E/8F32

8B/8D/8C/8A33

9G/P3/9E/9F34

9B/9D/9C/9A35

LED_kWh

LED_kVarh

VDD

Optical Interface

C38

10UF

Y1

32.768KHz

1 2

Display

GND

BT1

BATTERY

12

C1

0.1UF

GND

C31

0.1UF

C28

0.1UF

C32

0.1UF

SPI0_SOUT

VREF_OUT

SPI2_SCK

C33

0.1UF

VDDAMCU

LCD33LCD5

SPI2_CS0

LCD10LCD17

LCD11LCD14

LCD8LCD6

LCD15LCD16

LCD13LCD12

LCD7LCD9

LCD18LCD19

LCD25LCD24LCD23LCD22LCD21LCD20

LCD28LCD27LCD26

LCD29

LED_USR

LCD30LCD31

LCD34LCD32

LCD4

V_BIAS

VDD

TP6

TP5

J5

CON_2_TB

A1

B2

C10

0.1UF

GNDA

JTAG

GNDA

C91000pF

0.6V+/-0.5V

LPF CUTOFF 3.4MHz

R1047

Voltage measurement

TP2

SPI0_CS0

V_BIASU2

MR25H10CDC

CS1

SO2

WP3

VSS

4

SI5

SCK6

HOLD7

VDD

8

EXP

9

SW1

INT1

TP15

TP10TP13

VDDA

TP17

GND

VDD

GNDA

J2

CON_2_TB

A1

B2

RS120S0271

12

IR_TX

C20

18PF

GND

C21

18PF

GND

GND

/RESET

LED_USRLED_kWh

C13

0.1UF

GND

LED_kVarh

VDDAMCUGNDA

TP7

C6

0.1UF

RS232_RXD

Figure A-1. Schematic for full configuration of the metering board

Schematic for full configuration of the metering board

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

60 Freescale Semiconductor, Inc.

A.2 Schematic for low-cost configuration of the meteringboard

RS232_TXD

V_OUT

CMP2_IN1

D5BA

V99

LT11

3

2

VDDAMCU

GNDA

RS

232_

RX

D

C19

0.1UFGND

R174.7K

R154.7K

R5220K

R7220K

VDDMCU

75mV-20.4mV

75mV+20.4mV

R11100K

3.6V

3V

3.3V

R4

4.7K

3.3V

1.2V

R241K

R3010K

R22

4.7K

R61K

N

R14100

R18100

CMP2_IN0

R2390

R3390

C37

0.1UF

V_BIAS

SJ1

3 PAD JUMPER

1

2

3

D4

BA

V99

LT1

1

3

2

V_BIAS

VREF_OUT

VDDA

Bias selection

SJ2 2 PAD JUMPER

1 2

3V

0.6V

R161.0K

R12390

ISO1

SFH6106-4

1

2 3

4

ISO2

SFH6106-4

1

23

4

RS232 Interface

TP3

TP4

R110K

J8

CON_2X5

1 23 4

657 89 10

D6

MM

SD

4148

T1G

21

GND

D7

MM

SD

4148

T1G

21

(+12V)

D9

MMSD4148T1G

21

+

C15

2.2UF

RTS

R19470

RXD

R134.7K

DTR

RS232 isolated (Half Duplex, max 19200 Bd)

TXD

GND

GNDA

GNDA

VCC_PRESENT

C43

0.1UF

C39

100PF

VDDAMCU

D13

MMSZ5231BT1G

LCD0

LCD2LCD1

LCD17LCD3

Port B

Port A

Port C

Port D

Port E

U1

MK40X256VLQ100

JTAG_TCLK/SWD_CLK/EZP_CLK/TSI0_CH1/PTA0/UART0_CTS/FTM0_CH550

JTAG_TDI/EZP_DI/TSI0_CH2/PTA1/UART0_RX/FTM0_CH651

JTAG_TDO/TRACE_SWO/EZP_DO/TSI0_CH3/PTA2/UART0_TX/FTM0_CH752

JTAG_TMS/SWD_DIO/TSI0_CH4/PTA3/UART0_RTS/FTM0_CH053

NMI/EZP_CS/TSI0_CH5/PTA4/FTM0_CH154

JTAG_TRST/PTA5/FTM0_CH2/CMP2_OUT/I2S0_RX_BCLK55

PTA6/FTM0_CH3/FB_CLKOUT/TRACE_CLKOUT58

ADC0_SE10/PTA7/FTM0_CH4/FB_AD18/TRACE_D359

ADC0_SE11/PTA8/FTM1_CH0/FB_AD17/FTM1_QD_PHA/TRACE_D260

PTA9/FTM1_CH1/FB_AD16/FTM1_QD_PHB/TRACE_D161

PTA10/FTM2_CH0/FB_AD15/FTM2_QD_PHA/TRACE_D062

PTA11/FTM2_CH1/FB_OE/FTM2_QD_PHB63

CMP2_IN0/PTA12/CAN0_TX/FTM1_CH0/FB_CS5/FB_TSIZ1/FB_BE23_16_BLS15_8/I2S0_TXD/FTM1_QD_PHA64

CMP2_IN1/PTA13/CAN0_RX/FTM1_CH1/FB_CS4/FB_TSIZ0/FB_BE31_24_BLS7_0/I2S0_TX_FS/FTM1_QD_PHB65

PTA14/SPI0_PCS0/UART0_TX/FB_AD31/I2S0_TX_BCLK66

PTA15/SPI0_SCK/UART0_RX/FB_AD30/I2S0_RXD67

PTA16/SPI0_SOUT/UART0_CTS/FB_AD29/I2S0_RX_FS68

ADC1_SE17/PTA17/SPI0_SIN/UART0_RTS/FB_AD28/I2S0_MCLK/I2S0_CLKIN69

EXTAL/PTA18/FTM0_FLT2/FTM_CLKIN072

XTAL/PTA19/FTM1_FLT0/FTM_CLKIN1/LPT0_ALT173

PTA24/FB_AD1475

PTA25/FB_AD1376

PTA26/FB_AD1277

PTA27/FB_AD1178

PTA28/FB_AD1079

PTA29/FB_AD1980

LCD_P0/ADC0_SE8/ADC1_SE8/TSI0_CH0/PTB0/I2C0_SCL/FTM1_CH0/FTM1_QD_PHA81

LCD_P1/ADC0_SE9/ADC1_SE9/TSI0_CH6/PTB1/I2C0_SDA/FTM1_CH1/FTM1_QD_PHB82

LCD_P2/ADC0_SE12/TSI0_CH7/PTB2/I2C0_SCL/UART0_RTS/FTM0_FLT383

LCD_P3/ADC0_SE13/TSI0_CH8/PTB3/I2C0_SDA/UART0_CTS/FTM0_FLT084

LCD_P4/ADC1_SE10/PTB4/FTM1_FLT085

LCD_P5/ADC1_SE11/PTB5/FTM2_FLT086

LCD_P6/ADC1_SE12/PTB687

LCD_P7/ADC1_SE13/PTB788

LCD_P8/PTB8/UART3_RTS89

LCD_P9/PTB9/SPI1_PCS1/UART3_CTS90

LCD_P10/ADC1_SE14/PTB10/SPI1_PCS0/UART3_RX/FTM0_FLT191

LCD_P11/ADC1_SE15/PTB11/SPI1_SCK/UART3_TX/FTM0_FLT292

VDD15

VDD216

VDD343

VDD456

VDD570

VDD694

VDDA31

VREFH32

VREFL33

VSSA34

VREF_OUT37

ADC0_DP123

ADC0_DM124

ADC1_DP125

ADC1_DM126

PGA0_DP/ADC0_DP0/ADC1_DP327

PGA0_DM/ADC0_DM0/ADC1_DM328

PGA1_DP/ADC1_DP0/ADC0_DP329

PGA1_DM/ADC1_DM0/ADC0_DM330

DAC0_OUT38

DAC1_OUT39

ADC1_SE1635

ADC0_SE1636

RESET74

VREGIN22

VOUT3321

USB0_DP19

USB0_DM20

VBAT42

EXTAL3241 XTAL3240

VLL1110

VLL2109

VLL3108

VCAP1112

VCAP2111

VSS26

VSS317

VSS444

VSS557

VSS671

VSS793

VSS8107

VSS9136

LCD_P12/TSI0_CH9/PTB16/SPI1_SOUT/UART0_RX/EWM_IN95

LCD_P13/TSI0_CH10/PTB17/SPI1_SIN/UART0_TX/EWM_OUT96

LCD_P14/TSI0_CH11/PTB18/CAN0_TX/FTM2_CH0/I2S0_TX_BCLK/FTM2_QD_PHA97

LCD_P15/TSI0_CH12/PTB19/CAN0_RX/FTM2_CH1/I2S0_TX_FS/FTM2_QD_PHB98

LCD_P16/PTB20/SPI2_PCS0/CMP0_OUT99

LCD_P17/PTB21/SPI2_SCK/CMP1_OUT100

LCD_P18/PTB22/SPI2_SOUT/CMP2_OUT101

LCD_P19/PTB23/SPI2_SIN/SPI0_PCS5102

LCD_P20/ADC0_SE14/TSI0_CH13/PTC0/SPI0_PCS4/PDB0_EXTRG/I2S0_TXD103

LCD_P21/ADC0_SE15/TSI0_CH14/PTC1/SPI0_PCS3/UART1_RTS/FTM0_CH0104

LCD_P22/ADC0_SE4b/CMP1_IN0/TSI0_CH15/PTC2/SPI0_PCS2/UART1_CTS/FTM0_CH1105

LCD_P23/CMP1_IN1/PTC3/SPI0_PCS1/UART1_RX/FTM0_CH2106

LCD_P24/PTC4/SPI0_PCS0/UART1_TX/FTM0_CH3/CMP1_OUT113

LCD_P25/PTC5/SPI0_SCK/LPT0_ALT2/CMP0_OUT114

LCD_P26/CMP0_IN0/PTC6/SPI0_SOUT/PDB0_EXTRG115

LCD_P27/CMP0_IN1/PTC7/SPI0_SIN116

LCD_P28/ADC1_SE4b/CMP0_IN2/PTC8/I2S0_MCLK/I2S0_CLKIN117

LCD_P29/ADC1_SE5b/CMP0_IN3/PTC9/I2S0_RX_BCLK/FTM2_FLT0118

LCD_P30/ADC1_SE6b/CMP0_IN4/PTC10/I2C1_SCL/I2S0_RX_FS119

LCD_P31/ADC1_SE7b/PTC11/I2C1_SDA/I2S0_RXD120

LCD_P32/PTC12/UART4_RTS121

LCD_P33/PTC13/UART4_CTS122

LCD_P34/PTC14/UART4_RX123

LCD_P35/PTC15/UART4_TX124

LCD_P36/PTC16/CAN1_RX/UART3_RX125

LCD_P37/PTC17/CAN1_TX/UART3_TX126

LCD_P38/PTC18/UART3_RTS127

LCD_P39/PTC19/UART3_CTS128

LCD_P40/PTD0/SPI0_PCS0/UART2_RTS129

LCD_P41/ADC0_SE5b/PTD1/SPI0_SCK/UART2_CTS130

LCD_P42/PTD2/SPI0_SOUT/UART2_RX131

LCD_P43/PTD3/SPI0_SIN/UART2_TX132

LCD_P44/PTD4/SPI0_PCS1/UART0_RTS/FTM0_CH4/EWM_IN133

LCD_P45/ADC0_SE6b/PTD5/SPI0_PCS2/UART0_CTS/FTM0_CH5/EWM_OUT134

LCD_P46/ADC0_SE7b/PTD6/SPI0_PCS3/UART0_RX/FTM0_CH6/FTM0_FLT0135

LCD_P47/PTD7/CMT_IRO/UART0_TX/FTM0_CH7/FTM0_FLT1138

ADC1_SE4a/PTE0/SPI1_PCS1/UART1_TX/SDHC0_D1/FB_AD27/I2C1_SDA1

ADC1_SE5a/PTE1/SPI1_SOUT/UART1_RX/SDHC0_D0/FB_AD26/I2C1_SCL2

ADC1_SE6a/PTE2/SPI1_SCK/UART1_CTS/SDHC0_DCLK/FB_AD253

ADC1_SE7a/PTE3/SPI1_SIN/UART1_RTS/SDHC0_CMD/FB_AD244

PTE4/SPI1_PCS0/UART3_TX/SDHC0_D3/FB_CS3/FB_BE7_0_BLS31_24/FB_TA7

PTE5/SPI1_PCS2/UART3_RX/SDHC0_D2/FB_TBST/FB_CS2/FB_BE15_8_BLS23_168

PTE6/SPI1_PCS3/UART3_CTS/I2S0_MCLK/FB_ALE/FB_CS1/FB_TS/I2S0_CLKIN9

PTE7/UART3_RTS/I2S0_RXD/FB_CS010

PTE8/UART5_TX/I2S0_RX_FS/FB_AD411

PTE9/UART5_RX/I2S0_RX_BCLK/FB_AD312

PTE10/UART5_CTS/I2S0_TXD/FB_AD213

PTE11/UART5_RTS/I2S0_TX_FS/FB_AD114

PTE12/I2S0_TX_BCLK/FB_AD015

PTD10/UART5_RTS/FB_AD9139

PTD11/SPI2_PCS0/UART5_CTS/SDHC0_CLKIN/FB_AD8140

PTD12/SPI2_SCK/SDHC0_D4/FB_AD7141

PTD13/SPI2_SOUT/SDHC0_D5/FB_AD6142

PTD14/SPI2_SIN/SDHC0_D6/FB_AD5143

PTD15/SPI2_PCS1/SDHC0_D7/FB_RW144

ADC0_SE17/PTE24/CAN1_TX/UART4_TX/EWM_OUT45

ADC0_SE18/PTE25/CAN1_RX/UART4_RX/FB_AD23/EWM_IN46

PTE26/UART4_CTS/FB_AD22/RTC_CLKOUT/USB_CLKIN47

PTE27/UART4_RTS/FB_AD2148

PTE28/FB_AD2049

VSS118

VDD7137

LCD16

LCD11LCD12LCD13LCD14LCD15

LCD10

LCD4LCD5LCD6LCD7LCD8LCD9

LCD34

LCD26LCD27LCD28LCD29LCD30LCD31LCD32

LCD33

LCD18LCD19LCD20LCD21LCD22LCD23LCD24LCD25

SW2

D2F-01L

13

2

TAMPER1

TAMPER2 C340.1UF

GND

GND

VDDMCU

RS

232_

TX

D

J3

CON_2_TB

A1

B2

GNDA

GNDA

L_DM

C16

0.1UF

R204.7K

VDDMCU

GND

VDDMCU

D8

BA

V99

LT1

1

3

2

LINE_IN

/RESET

C18

0.1UF

R2110K

C17

100PF

CMP2_IN0 V_OUT

CMP2_IN1

Zero-cross detect

R9100K

VDD

Current measurement5(120)A

L1 1uH1 2

VDDA

GND

VCC_PRESENT

C70.1UF

C350.1UF

TP12TP11

TP14TP16

GNDA

VDDAMCU

Externalisolated+3.7V,200mASMPS

GND

VDDMCU

+C47

47UF

GND

D12

MM

SZ

5231

BT

1G

C46

100PF

GND

VDDAMCU

GND

TP18

TP19

C410.1UF

VDDMCU

C45

0.1UF

GNDA

L2 1uH1 2

GND

+ C4047UF L3 1uH

1 2

C42100PF

GND

J4

CON_2_TB

A1

B2

Power section

GNDA

GND

C12

0.1UF

C3

0.1UF

C2

0.1UF

C11

0.1UF

SW1

LIGHT TOUCH PUSH BUTTON

1 4

2 3

C4

0.1UF

C5

0.1UF

C23

0.1UF

GND

D1

WP7104LSRD

AC

D2

WP7104LSRD

AC

J1

HDR_19P

1234

6 58

91011121314151617181920

R3247K

TP1

VDDMCU

VDDMCU

D3

Tamper Detection

C8

0.1UF

GNDA

2-31-2SJ1

R11R6R4

R22

1K 2K22K24K7

4K74K7220K100K

4K71KR24

GND

C14

220PF

L_DP

C44

10UF

R3147K

Shunt 25mV-20.4mV

25mV+20.4mV

LINE_OUT

D11

BAT54CLT1

2

3

1

LCD0

LCD3LCD2LCD1

DS1

150020254

COM11

COM22

COM33

COM44

1G/T5/1E/1F5

1B/1D/1C/1A6

10G/P5/10E/10F7

10B/10D/10C/10A8

11G/T6/11E/11F9

11B/11D/11C/11A10

12G/P7-P6/12E/12F11

12B/12D/12C/12A12

T7/T8/P4/H19

2G/T3/2E/2F20

2B/2D/2C/2A21

3G/T2/3E/3F22

3B/3D/3C/3A23

4G/T1/4E/4F24

4B/4D/4C/4A25

5G/T4/5E/5F26

5B/5D/5C/5A27

6G/P1/6E/6F28

6B/6D/6C/6A29

7G/P2/7E/7F30

13G/13E/13F13

13B/13D/13C/13A14

14G/P8/14E/14F15

14B/14D/14C/14A16

1717

1818

7B/7D/7C/7A31

8G/COL1-COL2/8E/8F32

8B/8D/8C/8A33

9G/P3/9E/9F34

9B/9D/9C/9A35

LED_kWh

LED_kVarh

VDD

Optical Interface

C38

10UF

Y1

32.768KHz

1 2

Display

GND

BT1

BATTERY

12

C1

0.1UF

GND

C31

0.1UF

C28

0.1UF

C32

0.1UF

VREF_OUT

C33

0.1UF

VDDAMCU

LCD33LCD5LCD10LCD17

LCD11LCD14

LCD8LCD6

LCD15LCD16

LCD13LCD12

LCD7LCD9

LCD18LCD19

LCD25LCD24LCD23LCD22LCD21LCD20

LCD28LCD27LCD26

LCD29LCD30LCD31

LCD34LCD32

LCD4

V_BIAS

VDD

TP6

TP5

J5

CON_2_TB

A1

B2

C10

0.1UF

GNDA

JTAG

GNDA

C91000pF

0.6V+/-0.5V

LPF CUTOFF 3.4MHz

R1047

Voltage measurement

TP2

V_BIAS

SW1

TP15

TP10TP13

VDDA

TP17

GND

VDD

GNDA

J2

CON_2_TB

A1

B2

RS120S0271

12

C20

18PF

GND

C21

18PF

GND

/RESET

LED_USRLED_kWhLED_kVarh

VDDAMCUGNDA

C6

0.1UF

RS232_RXD

Figure A-2. Schematic for low-cost configuration of the metering board

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

Freescale Semiconductor, Inc. 61

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

62 Freescale Semiconductor, Inc.

Appendix BLayouts

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

Freescale Semiconductor, Inc. 63

B.1 Layouts for full configuration of the metering board

Figure B-1. Top side of the board for full configuration

Layouts for full configuration of the metering board

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

64 Freescale Semiconductor, Inc.

Figure B-2. Bottom side of the board for full configuration

Appendix B Layouts

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

Freescale Semiconductor, Inc. 65

B.2 Layouts for low-cost configuration of the metering board

Figure B-3. Top side of the board for low-cost configuration

Layouts for low-cost configuration of the metering board

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

66 Freescale Semiconductor, Inc.

Figure B-4. Bottom side of the board for low-cost configuration

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

Freescale Semiconductor, Inc. 67

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

68 Freescale Semiconductor, Inc.

Appendix CBOM

C.1 Bill of materials for full configuration of the meteringboard

Table C-1. BOM report for full configuration

Part Reference Quantity Description Manufacturer Part Number

BT1 1 Battery holder CR2032 3VROHS COMPLIANT

Renata Batteries SMTU2032-LF

C1 C2 C3 C4 C5 C6 C7C8 C10 C11 C12 C13

C16 C18 C19 C22 C23C25 C26 C27 C28 C29C30 C31 C32 C33 C34C35 C36 C37 C41 C43

C45

33 CAP CER 0.1UF 25V10% X7R 0805

SMEC MCCC104K2NRTF

C9 1 CAP CER 1000PF 50V10% X7R 0805

AVX 08055C102KAT2A

C14 1 CAP CER 220PF 100V5% C0G 0805

AVX 08051A221JAT2A

C15 1 CAP TANT 2.2UF 16V10% -- 3216-18

KEMET T491A225K016AT

C17 C39 C42 C46 4 CAP CER 100PF 50V10% C0G 0805

AVX 08055A101KAT2A

C20 C21 2 CAP CER 18PF 50V 5%C0G 0805

AVX 08055A180JAT2A

C24 1 CAP CER 1UF 25V 10%X5R 0805

KEMET C0805C105K3RAC7800

C38 C44 2 CAP CER 10UF 16V 10%X5R 0805

AVX 0805YD106KAT2A

C40 C47 2 CAP ALEL 47UF 6.3V20% -- CASE C SMT

PANASONIC EEE0JA470SR

D1 D2 2 LED RED SGL 30mA TH Kingbright WP7104LSRD

D3 1 LED RED SGL 30MASMT

Kingbright KPT-3216ID

Table continues on the next page...

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

Freescale Semiconductor, Inc. 69

Table C-1. BOM report for full configuration (continued)

Part Reference Quantity Description Manufacturer Part Number

D4 D5 D8 3 DIODE DUAL SW 215MA70V SOT23

ON SEMICONDUCTOR BAV99LT1G

D6 D7 D9 3 DIODE SW 100VSOD-123

ON SEMICONDUCTOR MMSD4148T1G

D10 1 LED IR SGL 100MA TH VISHAYINTERTECHNOLOGY

TSAL4400

D11 1 DIODE SCH DUAL CC200MA 30V SOT23

ON SEMICONDUCTOR BAT54CLT1G

D12 D13 2 DIODE ZNR 5.1V 0.5WSOD123

ON SEMICONDUCTOR MMSZ5231BT1G

ISO1 ISO2 ISO3 3 IC OPTOCOUPLER100MA 70V SMD

VISHAYINTERTECHNOLOGY

SFH6106-4

J1 1 HDR 19P SMT 50MIL SP251H AU

SAMTEC ASP-159234-03

J2 J3 J4 J5 J6 5 CON 1X2 TB TH 5MM SP394H --

LUMBERG INC DON'T POPULATE

J7 J9 2 HDR 2X3 TH 100MILCTR 335H AU 95L

SAMTEC TSW-103-07-S-D

J8 1 CON 2X5 PLUG SHRDTH 100MIL CTR 358H AU

118L

ADAM TECHNOLOGIES BRH-10-VUA

L1 L2 L3 3 IND CHIP 1UH@10MHZ220MA 25%

TDK MLZ2012A1R0PT

DS1 1 LCD DISPLAY 3.3V TH MAK-SAY 150020254

Q1 1 TRAN PHOTO NPN250mA 30V TH

OPTEK TECHNOLOGYINC

OP506B

R1 R21 R30 3 RES MF 10K 1/8W 5%0805

VENKEL COMPANY CR0805-8W-103JT

R2 R3 R8 R12 R23 5 RES MF 390 OHM 1/8W5% 0805

BOURNS CR0805-JW-391ELF

R4 R15 R17 R22 4 RES MF 4.7K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-4K7FI

R5 R7 2 RES MF 220K 1/4W 1%50ppm MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-220KFI

R6 R24 2 RES MF 1K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-1K0FI

R9 R11 2 RES MF 100K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-100KFI

R10 1 RES MF 47 OHM 1/8W5% 0805

Rohm MCR10EZPJ470

R13 R20 R25 R26 4 RES MF 4.70K 1/8W 1%0805

BOURNS CR0805-FX-4701ELF

Table continues on the next page...

Bill of materials for full configuration of the metering board

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

70 Freescale Semiconductor, Inc.

Table C-1. BOM report for full configuration (continued)

Part Reference Quantity Description Manufacturer Part Number

R14 R18 2 RES MF 100 OHM 1/4W1% 50PPM MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-100RFI

R16 R29 2 RES MF 1.00K 1/8W 1%0805

KOA SPEER RK73H2ATTD1001F

R19 1 RES MF 470.0 1/8W 5%0805

BOURNS CR0805-JW-471ELF

R27 1 RES MF 680 OHM 1/8W1% 0805

YAGEO AMERICA RC0805FR-07680RL

R28 1 RES MF 22K 1/8W 5%0805

BOURNS CR0805-JW-223ELF

R31 R32 2 RES MF 47K 1/8W 5%0805

SMEC RC73L2D473JTF

RS1 1 RES VARISTOR275VRMS 10% 4.5kA

151J TH

EPCOS B72220S0271K101

SJ1 1 JUMPER 3 PAD 40MILSQUARE SMT

N/A NO PART TO ORDER

SJ2 1 JUMPER 2 PAD 40 MILSQUARE SMT

N/A NO PART TO ORDER

SW1 1 SW SPST MOM NO PB20MA 15V TH

PANASONIC EVQPAC05R

SW2 1 SW SPDT SNAP ACTION0.1A 30V TH

OMRON D2F-01L

TP1 TP2 TP3 TP4 TP5TP6 TP7 TP8 TP9 TP10TP11 TP12 TP13 TP14TP15 TP16 TP17 TP18

TP19

19 TEST POINT TH PAD 60DRILL 35 DIAM, NOPART TO ORDER

N/A NO PART TO ORDER

U1 1 IC MCU P2 MARCONI32BIT 96K FLASH 16KRAM 2.7-5.5V LQFP144

FREESCALESEMICONDUCTOR

PK40X256VLQ100

U2 1 IC MEM MRAM 1Mb SPI2.7-3.6V DFN8

EVERSPINTECHNOLOGIES, INC

MR25H10CDC

U3 1 IC 3-AXIS DIGITALMAGNETOMETER1.95-3.6V DFN10

FREESCALESEMICONDUCTOR

MAG3110

Y1 1 XTAL 32.768KHZ PAR20PPM -- SMT

Citizen CMR200T32.768KDZF-UT

Appendix C BOM

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

Freescale Semiconductor, Inc. 71

C.2 Bill of materials for low-cost configuration of themetering board

Table C-2. BOM report for low-cost configuration

Part Reference Quantity Description Manufacturer Part Number

BT1 1 Battery holder CR2032 3VROHS COMPLIANT

Renata Batteries SMTU2032-LF

C1 C2 C3 C4 C5 C6 C7C8 C10 C11 C12 C16

C18 C19 C23 C28 C31C32 C33 C34 C35 C37

C41 C43 C45

25 CAP CER 0.1UF 25V10% X7R 0805

SMEC MCCC104K2NRTF

C9 1 CAP CER 1000PF 50V10% X7R 0805

AVX 08055C102KAT2A

C14 1 CAP CER 220PF 100V5% C0G 0805

AVX 08051A221JAT2A

C15 1 CAP TANT 2.2UF 16V10% -- 3216-18

KEMET T491A225K016AT

C17 C39 C42 C46 4 CAP CER 100PF 50V10% C0G 0805

AVX 08055A101KAT2A

C20 C21 2 CAP CER 18PF 50V 5%C0G 0805

AVX 08055A180JAT2A

C38 C44 2 CAP CER 10UF 16V 10%X5R 0805

AVX 0805YD106KAT2A

C40 C47 2 CAP ALEL 47UF 6.3V20% -- CASE C SMT

PANASONIC EEE0JA470SR

D1 D2 2 LED RED SGL 30mA TH Kingbright WP7104LSRD

D4 D5 D8 3 DIODE DUAL SW 215MA70V SOT23

ON SEMICONDUCTOR BAV99LT1G

D6 D7 D9 3 DIODE SW 100VSOD-123

ON SEMICONDUCTOR MMSD4148T1G

D11 1 DIODE SCH DUAL CC200MA 30V SOT23

ON SEMICONDUCTOR BAT54CLT1G

D12 D13 2 DIODE ZNR 5.1V 0.5WSOD123

ON SEMICONDUCTOR MMSZ5231BT1G

ISO1 ISO2 2 IC OPTOCOUPLER100MA 70V SMD

VISHAYINTERTECHNOLOGY

SFH6106-4

J1 1 HDR 19P SMT 50MIL SP251H AU

SAMTEC ASP-159234-03

J2 J3 J4 J5 4 CON 1X2 TB TH 5MM SP394H --

N/A DON'T POPULATE

J8 1 CON 2X5 PLUG SHRDTH 100MIL CTR 358H AU

118L

ADAM TECHNOLOGIES BRH-10-VUA

Table continues on the next page...

Bill of materials for low-cost configuration of the metering board

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

72 Freescale Semiconductor, Inc.

Table C-2. BOM report for low-cost configuration (continued)

Part Reference Quantity Description Manufacturer Part Number

L1 L2 L3 3 IND CHIP 1UH@10MHZ220MA 25%

TDK MLZ2012A1R0PT

DS1 1 LCD DISPLAY 3.3V TH MAK-SAY 150020254

R1 R21 R30 3 RES MF 10K 1/8W 5%0805

VENKEL COMPANY CR0805-8W-103JT

R2 R3 R12 3 RES MF 390 OHM 1/8W5% 0805

BOURNS CR0805-JW-391ELF

R4 R15 R17 R22 4 RES MF 4.7K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-4K7FI

R5 R7 2 RES MF 220K 1/4W 1%50ppm MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-220KFI

R6 R24 2 RES MF 1K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-1K0FI

R9 R11 2 RES MF 100K 1/4W 1%MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-100KFI

R10 1 RES MF 47 OHM 1/8W5% 0805

Rohm MCR10EZPJ470

R13 R20 2 RES MF 4.70K 1/8W 1%0805

BOURNS CR0805-FX-4701ELF

R14 R18 2 RES MF 100 OHM 1/4W1% 50PPM MELF0204

WELWYNCOMPONENTS LIMITED

WRM0204C-100RFI

R16 1 RES MF 1.00K 1/8W 1%0805

KOA SPEER RK73H2ATTD1001F

R19 1 RES MF 470.0 1/8W 5%0805

BOURNS CR0805-JW-471ELF

R31 R32 2 RES MF 47K 1/8W 5%0805

SMEC RC73L2D473JTF

RS1 1 RES VARISTOR275VRMS 10% 4.5kA

151J TH

EPCOS B72220S0271K101

SJ1 1 JUMPER 3 PAD 40MILSQUARE SMT

N/A NO PART TO ORDER

SJ2 1 JUMPER 2 PAD 40 MILSQUARE SMT

N/A NO PART TO ORDER

SW1 1 SW SPST MOM NO PB20MA 15V TH

PANASONIC EVQPAC05R

SW2 1 SW SPDT SNAP ACTION0.1A 30V TH

OMRON D2F-01L

TP1 TP2 TP3 TP4 TP5TP6 TP7 TP8 TP9 TP10TP11 TP12 TP13 TP14TP15 TP16 TP17 TP18

TP19

19 TEST POINT TH PAD 60DRILL 35 DIAM, NOPART TO ORDER

N/A NO PART TO ORDER

Table continues on the next page...

Appendix C BOM

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

Freescale Semiconductor, Inc. 73

Table C-2. BOM report for low-cost configuration (continued)

Part Reference Quantity Description Manufacturer Part Number

U1 1 IC MCU P2 MARCONI32BIT 96K FLASH 16KRAM 2.7-5.5V LQFP144

FREESCALESEMICONDUCTOR

PK40X256VLQ100

Y1 1 XTAL 32.768KHZ PAR20PPM -- SMT

Citizen CMR200T32.768KDZF-UT

C.3 Bill of materials: other componentsTable C-3. BOM report: other components (not included in schematics)

QUANTITY DESCRIPTION MANUFACTURER PART NUMBER

1 Shunt-resistor 300 μΩ MAK-SAY -

1 Enclosure MAK-SAY M310

1 Open-frame AC/DC power supply XP Power ECL05US03-T

1 Receptacle Cannon 9-pin Tyco Electronics 1658609-4

1 Receptacle 10-pin, ribbon crimp Tyco Electronics 1658622-1

1 3V battery GP CR2032

10 cm Flat cable any acceptable -

1.5 m Extension Cord 250V/16A any acceptable -

1 Outlet 250V/16A any acceptable -

Bill of materials: other components

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

74 Freescale Semiconductor, Inc.

Appendix DTechnical Specification

D.1 MK30X256 power meter specificationsTable D-1. MK30X256 power meter specifications

Parameter Specification

Type of meter Single phase residential

Type of measurement 4-quadrant

Metering algorithm Fast Fourier Transform (FFT)

Accuracy (active & reactive energy) IEC50470-3 Class B, 1%

Voltage range 85 ... 264 VRMS

Current range 0.02 ... 60 ARMS or 5(60) ARMS

Frequency range 47 ... 63 Hz

Meter constant (imp/kWh,imp/kVArh) 500, 1000, 2000, 5000, 10000

Functionality V, A, kW, kVAr, kVA, kWh (import/export), kVArh (lead/lag), cos , Hz, time, date

Current sensor Shunt-resistor 300 μΩ

Energy output interface Two high-efficiency red LEDs (active, reactive)

Open-collector output (optional only) Optically-isolated, IC=50mA, VCEO=70V

User interface (HMI) LCD, push button, user LED

Tamper detection Two buttons, magnetometer (optional only)

Infrared interface (optional only) For metering data reading (IEC1107)

Serial communication interface (RS232) Optically-isolated, 19200Bd, 8 data bits, 1 stop bit, no parity

ZigBee interface (optional only) RF 2.4 GHz 1322x-LPN internal daughter card (SE1.0 stack implemented)

Internal battery 3V, type CR2032

Total power consumption < 1.4 W

Mechanical dimensions (w x l x h) 110 × 190 × 55

Weight (bare meter) 370 g

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

Freescale Semiconductor, Inc. 75

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

76 Freescale Semiconductor, Inc.

Appendix EReferences

E.1 References1. Kinetis® K30 Device Summary Page, available at freescale.com2. 3-Axis, Digital Magnetometer Data Sheet (MAG3110), available at freescale.com3. 1322x-Low Power Node Reference Manual (1322xLPNRM), available at

freescale.com4. 1322x Sensor Node Reference Manual (1322xSNRM), available at freescale.com5. Wikipedia articles "AC power," "Current transformer," "Electricity meter," "Power

factor," "Rogowski coil," and "World Map: Voltage and Frequency," available aten.wikipedia.org

6. Power Factor—The Basics, available at powerstudies.com7. ZigBee Environment Demonstration (ZEDESDUG), available at freescale.com8. FFT-based Algorithm for Metering Applications (AN4255), available at

freescale.com

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

Freescale Semiconductor, Inc. 77

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

78 Freescale Semiconductor, Inc.

Appendix F

F.1 GlossaryAlternating Current—AC

Advanced Encryption Standard—AES

Analog-to-Digital Converter—ADC

Analog Front-End—AFE

Automatic Meter Reading—AMR

Bill of Materials—BOM

Carrier Modulator Transmitter—CMT

Common-Mode Rejection Ratio—CMRR

Cyclic Redundancy Check—CRC

Current Transformer—CT

Direct Current—DC

Digital-to-Analog Converter—DAC

Dual Flat No leads—DFN

Dhrystone Million Instructions Per Second—DMIPS

Digital Signal Processing—DSP

Fast Fourier Transform—FFT

Flex Timer Module—FTM

General Purpose Input/Output—GPIO

Global Positioning System—GPS

Graphical User Interface—GUI

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

Freescale Semiconductor, Inc. 79

Human Machine Interface—HMI

Institute of Electrical and Electronics Engineers—IEEE

Integrated Circuit—IC

Integrated Interchip Sound—I2S

Inter-Integrated Circuit—I2C

Keyboard Interrupt—KBI

Land Grid Array—LGA

Low Leakage Wake-up Unit—LLWU

Low-Power Timer—LPT

Light Emitting Diode—LED

Liquid Crystal Display—LCD

Media Access Control—MAC

Magnetoresistive Random Access Memory—MRAM

Microcontroller Unit—MCU

Object Identification System—OBIS

Operational Amplifier—OpAmp

Open Collector—OC

Periodic Interrupt Timer—PIT

Printed-Circuit Board—PCB

Programmable Delay Block—PDB

Programmable Gain Amplifier—PGA

Random Access Memory—RAM

Root Mean Square—RMS

Real Time Clock—RTC

Successive Approximations Register—SAR

Secured Digital Host Controller—SDHC

Serial Communication Interface—SCI

Glossary

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

80 Freescale Semiconductor, Inc.

Surface Mounted Device—SMD

Switch Mode Power Supply—SMPS

Serial Peripheral Interface—SPI

Static Random Access Memory—SRAM

Universal Asynchronous Receiver/Transmitter—UART

Voltage Reference—VREF

Zero-Cross Detection—ZCD

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

Freescale Semiconductor, Inc. 81

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

82 Freescale Semiconductor, Inc.

How to Reach Us:

Home Page:www.freescale.com

Web Support:http://www.freescale.com/support

USA/Europe or Locations Not Listed:Freescale SemiconductorTechnical Information Center, EL5162100 East Elliot RoadTempe, Arizona 85284+1-800-521-6274 or +1-480-768-2130www.freescale.com/support

Europe, Middle East, and Africa:Freescale Halbleiter Deutschland GmbHTechnical Information CenterSchatzbogen 781829 Muenchen, Germany+44 1296 380 456 (English)+46 8 52200080 (English)+49 89 92103 559 (German)+33 1 69 35 48 48 (French)www.freescale.com/support

Japan:Freescale Semiconductor Japan Ltd.HeadquartersARCO Tower 15F1-8-1, Shimo-Meguro, Meguro-ku,Tokyo 153-0064Japan0120 191014 or +81 3 5437 [email protected]

Asia/Pacific:Freescale Semiconductor China Ltd.Exchange Building 23FNo. 118 Jianguo RoadChaoyang DistrictBeijing 100022China+86 10 5879 [email protected]

For Literature Requests Only:Freescale Semiconductor Literature Distribution Center1-800-441-2447 or +1-303-675-2140Fax: [email protected]

Document Number: DRM122Rev. 0

Information in this document is provided solely to enable system and softwareimplementers to use Freescale Semiconductors products. There are no express or impliedcopyright licenses granted hereunder to design or fabricate any integrated circuits orintegrated circuits based on the information in this document.

Freescale Semiconductor reserves the right to make changes without further notice to anyproducts herein. Freescale Semiconductor makes no warranty, representation, orguarantee regarding the suitability of its products for any particular purpose, nor doesFreescale Semiconductor assume any liability arising out of the application or use of anyproduct or circuit, and specifically disclaims any liability, including without limitationconsequential or incidental damages. "Typical" parameters that may be provided inFreescale Semiconductor data sheets and/or specifications can and do vary in differentapplications and actual performance may vary over time. All operating parameters,including "Typicals", must be validated for each customer application by customer'stechnical experts. Freescale Semiconductor does not convey any license under its patentrights nor the rights of others. Freescale Semiconductor products are not designed,intended, or authorized for use as components in systems intended for surgical implantinto the body, or other applications intended to support or sustain life, or for any otherapplication in which failure of the Freescale Semiconductor product could create asituation where personal injury or death may occur. Should Buyer purchase or useFreescale Semiconductor products for any such unintended or unauthorized application,Buyer shall indemnify Freescale Semiconductor and its officers, employees, subsidiaries,affiliates, and distributors harmless against all claims, costs, damages, and expenses, andreasonable attorney fees arising out of, directly or indirectly, any claim of personal injuryor death associated with such unintended or unauthorized use, even if such claims allegesthat Freescale Semiconductor was negligent regarding the design or manufacture ofthe part.

RoHS-compliant and/or Pb-free versions of Freescale products have the functionality andelectrical characteristics as their non-RoHS-complaint and/or non-Pb-free counterparts.For further information, see http://www.freescale.com or contact your Freescalesales representative.

For information on Freescale's Environmental Products program, go tohttp://www.freescale.com/epp.

Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.All other product or service names are the property of their respective owners.

© 2011 Freescale Semiconductor, Inc.