Kinetis-M Three-Phase Power Meter Reference Design

Freescale Semiconductor, Inc.
Design Reference Manual
Document Number: DRM147
Rev. 0, 08/2014
Kinetis-M Three-Phase Power Meter
Reference Design
1
Introduction
This design reference manual describes a solution for a
three-phase electronic power meter based on the
MKM34Z128CLL5 microcontroller. This microcontroller is
part of the Freescale Kinetis-M microcontroller family. The
Kinetis-M microcontrollers are especially designed for
electronic power meter applications. Thus the Kinetis-M
family offers a high-performance analog front-end (24-bit
AFE) combined with an embedded Programmable Gain
Amplifier (PGA). In addition to high-performance analog
peripherals such as an auxiliary 16-bit SAR ADC, these new
devices integrate memories, input-output ports, digital
blocks, and a variety of communication options. Moreover,
the ARM® Cortex®-M0+ core, with support for 32-bit math,
enables fast execution of metering algorithms.
The commonly used three-phrase meter topology is based on
the six or seven channels of sigma-delta (SD) ADC
converters. Kinetis-M microcontrollers use different
topology because of the 24-bit AFE (four channels of the
24-bit SD ADC) convertors and the 16-bit successive
approximation (SAR) ADC converter with an input analog
multiplexer.
© 2014 Freescale Semiconductor, Inc. All rights reserved.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
A.
B.
C.
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
MKM34Z128 microcontroller series . . . . . . . . . . . . . 3
Basic theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Hardware design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Software design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Application set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
FreeMASTER visualization . . . . . . . . . . . . . . . . . . . 27
Accuracy and performance . . . . . . . . . . . . . . . . . . . . 30
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Board electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Board layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Bill of materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Introduction
The main purpose of a three-phrase meter implementation on the KM3x devices is based on the signal’s
dynamic range analysis. The current signal in metering is typically from 50mA to 120A, thus the current
must be digitalized by a very precise and linear ADC with wide dynamic range, typically 24 bits. The SD
method is an ideal solution to solve current dynamic range requirements. On the other hand, the voltage
signal in metering is in the range of 80V to 280V. So the voltage dynamic range is approximately 60 times
smaller than current dynamic range. The voltage requirements can be easily solved by a high-resolution
SAR converter.
The common reason for using six or seven independent ADC channels is for easier converter
synchronization—that is, all channels are able to begin precisely at the defined time. The KM3x devices
solve this problem by the peripheral called XBAR. The XBAR is an internal connection matrix among of
the peripherals. Internal signals such as conversion complete from the SD converter can be used for starting
SAR conversion. So the complete signal sampling process based on the combination of three or four SDs
and one SAR with an input multiplexer is fully supported by the device’s hardware and only the conversion
results must be read by the microcontroller core or by DMA.
The three-phase power meter reference design is intended for the measurement and registration of active
and reactive energies in three-phase four-wire networks. It is pre-certified according to the European
EN50470-1, EN50470-3, classes B and C, and also to the IEC 62053-21 and IEC 62052-11 international
standards for electronic meters of active energy classes 2 and 1.
The integrated Switched-Mode Power Supply (SMPS) enables an efficient operation of the power meter
electronics and provides enough power for optional modules, such as non-volatile memories (NVM) for
data logging and firmware storage, a low-power magnetic field sensor for electronic tamper detection, and
an RF communication module for AMR and remote monitoring. The power meter electronics are
backed-up by a 3.6 V Li-SOCI2 battery when disconnected from the power mains. This battery activates
the power meter whenever the user button is pressed or a tamper event occurs. The permanent triggers for
tamper events include two tamper switches protecting the main and terminal covers. An additional optional
tamper event is generated by a low-power 3-axis magnetometer sensor. The 3-axis magnetometer is useful
to check for magnetic field changes which is important because current sensing is widely used with current
transformers. This type of sensor guarantees the static magnetic field generated by the permanent magnet.
The power meter reference design is prepared for use in real applications, as suggested by its
implementation of a Human Machine Interface (HMI) and communication interfaces for remote data
collecting.
1.1
Specification
As already indicated, the Kinetis-M one-phase power meter reference design is ready for use in a real
application. More precisely, its metrology portion has undergone thorough laboratory testing using the test
equipment ELMA8303 [1]. Because of intensive testing, an accurate 24-bit AFE and 16-bit SAR ADC,
and continual algorithm improvements, the three-phase power meter calculates active and reactive energies
more accurately and over a higher dynamic range than required by common standards. All information,
including accuracies, operating conditions, and optional features, are summarized in Table 1.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
2
Freescale Semiconductor, Inc.
MKM34Z128 microcontroller series
Table 1. Kinetis-M one-phase power meter specifications
Description or Parameter
Feature or Condition
Type of meter
Three-phase residential
Type of measurement
4-Quadrant
Metering algorithm
Filter-based
Precision (accuracy)
IEC50470-3 class C, 0.5% (for active and reactive energy)
Voltage range
90–265 VRMS
Current range
0–120 A (5 A is nominal current, peak current is up to 154 A)
Frequency range
47–53 Hz
Meter constant (imp/kWh, imp/kVArh)
500, 1000, 2000, 5000 (default), 10000. Note, that pulse numbers 10000
are applicable only for low-current measurement.
Functionality
V, A, kW, kVAr, kVA, kWh (import/export), kVARh (lead/lag), Hz, time, date
Voltage sensor
Voltage divider
Current sensor
Current transformer (tested with different CT`s types)
Energy output pulse interface
Two red LEDs (active and reactive energy)
Energy output pulse parameters:
• Maximum frequency
• On-Time
• Jitter
• 600 Hz
• 20 ms (50% duty cycle for frequencies above 25 Hz)
• ±10 is at constant power
User interface
LCD, one push-button, one user LED (red)
Tamper detection
Two hidden buttons (terminal cover and main cover)
IEC1107 infrared interface
4800/8-N-1 FreeMASTER interface
Optoisolated pulse output (optional)
optocoupler (active or reactive energy)
Isolated RS232 serial interface (optional)
19200/8-N-1
RF interface (optional)
2.4 GHz RF 1322x-LPN internal daughter card
External NVMs (optional)
• EEPROM
AT24C32D, 32 KB
Electronic tamper detection (optional)
MAG3110, 3-axis digital magnetometer
Internal battery
1/2AA, 3.6 V Lithium-Thionyl Chloride (Li-SOCI2) 1.2 Ah
Power consumption @ 3.3V and 22°C:
• Normal mode (powered from mains)
• Standby mode (powered from battery)
• Power-down mode (powered from battery)
• 18.4 mA
• 260 μA
• 6.5 μA (both cover closed), 4.9 μA (covers opened)
2
MKM34Z128 microcontroller series
The Freescale Kinetis-M microcontroller series is based on the 90-nm process technology. It has on-chip
peripherals, and the computational performance and power capabilities to enable development of a
low-cost and highly integrated power meter (see Figure 1). It is based on the 32-bit ARM Cortex-M0+ core
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
3
MKM34Z128 microcontroller series
with CPU clock rates of up to 50 MHz. The measurement analog front-end is integrated on all devices; it
includes a highly accurate 24-bit Sigma Delta ADC, PGA, high-precision internal 1.2 V voltage reference
(VRef), phase shift compensation block, 16-bit SAR ADC, and a peripheral crossbar (XBAR). The XBAR
module acts as a programmable switch matrix, allowing multiple simultaneous connections of internal and
external signals. An accurate Independent Real-time Clock (IRTC), with passive and active tamper
detection capabilities, is also available on all devices.
Figure 1. Kinetis-M block diagram
In addition to high-performance analog and digital blocks, the Kinetis-M microcontroller series has been
designed with an emphasis on achieving the required software separation. It integrates hardware blocks
supporting the distinct separation of the legally relevant software from other software functions. The
hardware blocks controlling or checking the access attributes include:
• ARM Cortex-M0+ Core
• DMA Controller Module
• Miscellaneous Control Module
• Memory Protection Unit
• Peripheral Bridge
• General Purpose Input-Output Module
The Kinetis-M devices remain first and foremost highly capable and fully programmable microcontrollers
with application software driving the differentiation of the product. Nowadays, the necessary peripheral
software drivers, metering algorithms, communication protocols, and a vast number of complementary
software routines are available directly from semiconductor vendors or third parties. Because Kinetis-M
microcontrollers integrate a high-performance analog front-end, communication peripherals, hardware
blocks for software separation, and are capable of executing a variety of ARM Cortex-M0+ compatible
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
4
Freescale Semiconductor, Inc.
Basic theory
software, they are ideal components for development of residential, commercial, and light industrial
electronic power meter applications.
3
Basic theory
The critical task for a digital processing engine or a microcontroller within an electricity metering
application is the accurate computation of the active energy, reactive energy, active power, reactive power,
apparent power, RMS voltage, and RMS current. The active and reactive energies are sometimes referred
to as the billing quantities. The remaining quantities are calculated for informative purposes, and they are
referred to as non-billing.
3.1
Active energy
The active energy represents the electrical energy produced, flowing or supplied by an electric circuit
during a time interval. The active energy is measured in the unit of watt hours (Wh). The active energy in
a typical one-phase power meter application is computed as an infinite integral of the unbiased
instantaneous phase voltage u(t) and phase current i(t) waveforms.
Wh =
3.2
∞
0 u ( t )i ( t ) dt
Eqn. 1
Reactive energy
The reactive energy is given by the integral, with respect to time, of the product of voltage and current and
the sine of the phase angle between them. The reactive energy is measured in the unit of
volt-ampere-reactive hours (VARh). The reactive energy in a typical one-phase power meter is computed
as an infinite integral of the unbiased instantaneous shifted phase voltage u(t-90°) and phase current i(t)
waveforms.
VARh =
3.3
∞
0 u ( t – 90 ° )i ( t ) dt
Eqn. 2
Active power
The active power (P) is measured in watts (W) and is expressed as the product of the voltage and the
in-phase component of the alternating current. In fact, the average power of any whole number of cycles
is the same as the average power value of just one cycle. So, we can easily find the average power of a very
long-duration periodic waveform simply by calculating the average value of one complete cycle with
period T.
1 ∞
P = --- u ( t )i ( t ) dt
T 0

3.4
Eqn. 3
Reactive power
The reactive power (Q) is measured in units of volt-amperes-reactive (VAR) and is the product of the
voltage and current and the sine of the phase angle between them. The reactive power is calculated in the
same manner as active power, but in reactive power the voltage input waveform is 90 degrees shifted with
respect to the current input waveform.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
5
Basic theory
1 ∞
Q = --- u ( t – 90 ° )i ( t ) dt
T 0

3.5
Eqn. 4
RMS current and voltage
The Root Mean Square (RMS) is a fundamental measurement of the magnitude of an alternating signal.
In mathematics, the RMS is known as the standard deviation, which is a statistical measure of the
magnitude of a varying quantity. The standard deviation measures only the alternating portion of the signal
as opposed to the RMS value, which measures both the direct and alternating components.
In electrical engineering, the RMS or effective value of a current is, by definition, such that the heating
effect is the same for equal values of alternating or direct current. The basic equations for straightforward
computation of the RMS current and RMS voltage from the signal function are the following:
2
1 T
IRMS =
URMS =
3.6

--- [ i ( t ) ] dt
T 0
Eqn. 5
2
1 T
--- [ u ( t ) ] dt
T 0
Eqn. 6

Apparent power
Total power in an AC circuit, both absorbed and dissipated, is referred to as total apparent power (S). The
apparent power is measured in the units of volt-amperes (VA). For any general waveforms with higher
harmonics, the apparent power is given by the product of the RMS phase current and RMS phase voltage.
S = IRMS × URMS
Eqn. 7
For sinusoidal waveforms with no higher harmonics, the apparent power can also be calculated using the
power triangle method, as a vector sum of the active power (P) and reactive power (Q) components.
S =
2
2
P +Q
Eqn. 8
Due to better accuracy, we prefer to use Equation 7 to calculate the apparent power of any general
waveforms with higher harmonics. In purely sinusoidal systems with no higher harmonics, both
Equation 7 and Equation 8 will provide the same results.
3.7
Power factor
The power factor of an AC electrical power system is defined as the ratio of the active power (P) flowing
to the load, to the apparent power (S) in the circuit. It is a dimensionless number between -1 and 1.
P
cos ϕ = --S
Eqn. 9
where angle ϕ is the phase angle between the current and voltage waveforms in the sinusoidal system.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
6
Freescale Semiconductor, Inc.
Hardware design
Circuits containing purely resistive heating elements (filament lamps, cooking stoves, and so forth) have a
power factor of one. Circuits containing inductive or capacitive elements (electric motors, solenoid valves,
lamp ballasts, and others) often have a power factor below one.
The Kinetis-M one-phase power meter reference design uses a filter-based metering algorithm [2]. This
particular algorithm calculates the billing and non-billing quantities according to formulas given in this
section. Because of the use of digital filters, the algorithm requires only instantaneous voltage and current
samples to be provided at constant sampling intervals. After a slight modification to the application
software, it is also possible to use FFT based algorithms [3].
4
Hardware design
This section describes the power meter electronics. The power meter electronics are divided into three
parts:
• Power supply
• Digital circuits
• Analog signal conditioning circuits
The power supply part of the hardware design is comprised of an 85–265 V AC-DC SMPS, a low-noise
3.6 V linear regulator, and a power management block. This power supply topology has been chosen to
provide low-noise output voltages to supply the power meter electronics. The simple power management
block works autonomously—that is, it supplies the power meter electronics from either the 50 Hz (60 Hz)
mains or the 3.6 V Li-SOCI2 battery, which is also integrated. The battery serves as a backup supply in
cases when the power meter is disconnected from the mains, or the mains voltage drops below 85 V AC.
For more information, refer to Section 4.1, “Power supply.”
The digital part can be configured to support both basic and advanced features. The basic configuration
comprises only the circuits necessary for power meter operation—these are, the microcontroller
(MKM34Z128MCLL5), debug interface, LCD interface, LED interface, IR (IEC1107), isolated
open-collector pulse output, isolated RS232, push-button, and tamper detection. In contrast to the basic
configuration, all the advanced features are optional and require the following additional components to
be populated: 32 KB I2C EEPROM for data storage, 3-axis magnetometer for electronic tampering, and
UMI and RF MC1323x-IPB interfaces for AMR communication and remote monitoring. For more
information, see Section 4.2, “Digital circuits”.
The Kinetis-M devices allow differential analog signal measurements with a common mode reference of
up to 0.8 V and an input signal range of ±250 mV. The capability of the device to measure analog signals
with negative polarity brings a significant simplification to the phase current sensors’ hardware interfaces.
The phase voltage signal is simply connected to the SAR multiplexer, however, the external biasing circuits
must be added externally (see Section 4.1, “Power supply”).
The power meter electronics have been realized using a four-layer printed circuit board (PCB). We have
chosen the more expensive four-layer PCB, comparing to a cheaper two-layer one, in order to validate the
accuracy of the 24-bit SD ADC and 16-bit SAR ADC on the metering hardware optimized for
measurement accuracy. Figure B-1and Figure B-2 show the top and bottom views of the power meter PCB.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
7
Hardware design
4.1
Power supply
The user can use the 85–265 V AC-DC SMPS, which is directly populated on the PCB, or any other
modules with different power supply topologies. If a different AC-DC power supply module is to be used,
then the AC (input) side of the module must be connected to JP1, JP2, JP3, JP4, and the DC (output) side
to JP1, JP5. The output voltage of the suitable AC-DC power supply module must be 4.0 V ±5%.
As already noted, the reference design is pre-populated with an 85–265 V AC-DC SMPS power supply.
This SMPS is non-isolated and capable of delivering a continuous current of up to 80 mA at 4.125 V [4].
The SMPS supplies the SPX3819 low dropout adjustable linear regulator, which regulates the output
voltage (VPWR) by using two resistors (R20 and R21) according to the formula:
R20
VPWR = 1.235 1 + ---------R21
Eqn. 10
The resistor values R20 = 45.3 kΩ and R21 = 23.7 kΩ were chosen to produce a regulated output voltage
of 3.6 V. The following supply voltages are all derived from the regulated output voltage (VPWR):
• VDD—digital voltage for the microcontroller and digital circuits
• VDDA—analog voltage for the microcontroller’s 24-bit SD ADC and 1.2 V VREF
• SAR_VDDA—analog voltage for the microcontroller’s 16-bit SAR ADC
The regulated output voltage also supplies those circuits with higher current consumption: Isolated RS232
interface (U301 and U302), Isolated pulse output (U303), and potential external modules attached to the
RF MC1323x-IPB connector (J350). All of these circuits operate in normal mode when the power meter
is connected to the mains.
The battery voltage (VBAT) is separated from the regulated output voltage (VPWR) using the D20 and
D21 diodes. When the power meter is connected to the mains, then the electronics are supplied through
the bottom D21 diode from the regulated output voltage (VPWR). If the power meter is disconnected from
the mains, then D20 and the upper D21 diodes start conducting and the microcontroller device, including
a few additional circuits operating in standby and power-down modes, are supplied from the battery
(VBAT). The switching between the mains and battery voltage sources is performed autonomously, with
a transition time that depends on the rise and fall times of the regulated output voltage supply (VPWR).
The analog circuits within the microcontroller usually require decoupled power supplies for the best
performance. The analog voltages (VDDA and SAR_VDDA) are decoupled from the digital voltage
(VDD) by the chip inductors L20 and L21 and the small capacitors next to the power pins (C26, C27, C28,
C29, C30, and C31). Using chip inductors is especially important in mixed signal designs such as a power
meter application, where digital noise can disrupt precise analog measurements. The L20 and L21
inductors are placed between the analog supplies (VDDA and SAR_VDDA) and digital supply (VDD) to
prevent noise from the digital circuitry from disrupting the analog circuitries.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
8
Freescale Semiconductor, Inc.
Hardware design
VD D
DN P
85-265V A C-DC SMPS MODULE
A
D9 0
C
1
L9 0 15 0 0u H
2
U 90
MR A40 0 7T3G
S1
S2
S3
S4
1
LN K3 02D N
+ C 90
4. 7 u F
2
1
D9 4
R 93
2. 0 K
C 93
2 2uF
1%
1
J 20
H D R _1 X2
MR A 400 7 T3 G
V OUT
L91 1 50 0 uH
2
+ C 91
4 . 7uF
C9 4
1
C 20
JP 6
H DR 1 X1
1
D2 1
B AT54 C L T1
VP W R
C 21
3
1 0U F 10U F
1
10 0 U F
R 96
1. 6K
VD D A
1 L 20
D 20
MMS D 414 8 T1 G
A
C
Open J21 to
monitor BT1
current.
3.6 V Battery
2
D 95
ES 1J L
A
HD R 1 X1
DN P
0. 1 u F
5
6
7
8
JP 4
1%
C 92
J 21
H D R _1X2
BT20
BATTER Y
R 94 3 . 0 K
D
HD R 1 X1
V OUT
1
2
L1
VP W R
C
4
JP 1 DN P
1
D9 1
MR A40 0 7T3G
C
HD R 1 X1
A
A
VD D
1
MR A40 0 7T3G
L2
VP W R
C
JP 2 DN P
1
C
2
1
HD R 1 X1
JP 5
H D R 1 X1
DN P
U20
V IN
VOU T
5
ADJ
4
1 uH 2
C 26
1uF
VD D
C 27
1uF
C2 8
1uF
VD D
2
C 24
GN D
EN
J 22
H D R _1 X2
3
1
2
A
D9 2
1
2
L3
FB
BP
JP 3 DN P
1
R 20
45 . 3K
C 22
C 23
10U F
10UF
S AR _V D D A
C 25
1 0 U F 1 0 UF
1
L21
1u H
2
C 29
1uF
SPX38 19M5 -L
C 30
1uF
C3 1
1uF
R 21
23 . 7K
Figure 2. Power supply
NOTE
The digital and analog voltages VDD, VDDA and SAR_VDDA are lower
by a voltage drop on the diode D21 (0.35 V) than the regulated output
voltage VPWR.
4.2
Digital circuits
All the digital circuits are supplied from the VDD and VPWR voltages. The digital voltage (VDD),
because it is backed-up by the 1/2AA 3.6 V Li-SOCI2 battery (BT200), is active even if the power meter
electronics are disconnected from the mains. It supplies the microcontroller device (U1), 32KB EEPROM,
and the 3-axis magnetometer (U381). The regulated output voltage (VPWR) supplies the digital circuits
that can be switched off during the standby and power-down operating modes. These components are:
Isolated RS232 interface (U303), Isolated open-collector pulse output interface (U301 and U302), RF
MC1323x-IPB interfaces (J350), and the IR Interface (Q1), if in use.
4.2.1
MKM34Z128MCLL5
The MKM34Z128MCLL5 microcontroller (U1) is the most noticeable component on the metering board
(see Figure A-1). The following components are required for flawless operation of this microcontroller:
• Filtering ceramic capacitors C1–C7 and C8–C11
• External reset filter C13 and R1
• 32.768 kHz crystal Y1
An indispensable part of the power meter is the Human Machine Interface (HMI) consisting of an LCD
(DS300) and user push-button (SW371). The charge pump for the LCD is part of the MCU and it requires
four ceramic capacitors (C8–C11) on the board. Two connectors (J361 and J362) are also populated to
interface the terminal cover and the main cover switches to the MCU tamper detection circuit. Connector
J1 is the SWD interface for MCU programming.
CAUTION
The debug interface (J1) is not isolated from the mains supply. Use only
galvanically isolated debug probes for programming the MCU when the
power meter is supplied from the mains supply.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
9
Hardware design
4.2.2
Output LEDs
The microcontroller uses two GPIO pins or two timer channels to control the calibration LEDs (D351 and
D352). The timers’ outputs are routed to the respective device pins (QT2 and QT3). The LED’s drive
method is optional because the hardware supports both connections. The timer LED’s drive method is
usually chosen to produce a low-jitter and high dynamic range pulse output waveform; the method for
low-jitter pulse output generation using software and timer is being patented.
VDD
R 341
390
D351
WP7104LSR D
C
A
R 342
390
D352
WP7104LSR D
C
A
k W h_LED
k VArh_LED
R 343
1.0K
USER_LED
D353
C
A
HSMS-C170
Figure 3. Output LEDs control
The user LED (D343) is driven by software through the GPIO output pin (PTD6). It blinks when the power
meter enters the calibration mode, and turns solid after the power meter is calibrated and is operating
normally.
4.2.3
Isolated open-collector pulse output interface
Figure 4 shows the schematic diagram of the open collector pulse output. This may be used for switching
loads with a continuous current as high as 50 mA and with a collector-to-emitter voltage of up to 70 V. The
interface is controlled through the GPIO (PTF0) pin of the microcontroller, and hence it may be controlled
by a variety of internal signals, for example, the timer channels generate the pulse outputs. The isolated
open-collector pulse output interface is accessible on connector J302.
R307
390
PULSE_OU T
U303
SFH6106-4
2
3
2
1
VPW R
1
4
J 302
CO N TB 2
DN P
Figure 4. Open-collector pulse output control
The PTF0 pin also checks whether the VPWR is present. This use case is of PTF0 using the input mode.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
10
Freescale Semiconductor, Inc.
Hardware design
4.2.4
IR interface (IEC1107)
The power meter has a galvanically isolated optical communication port, as per IEC 1107 / ANSI / PACT,
so that it can be easily connected to a hand-held common meter reading instrument for data exchange. The
IR interface is driven by UART3. The UART3 pins are shared with the isolated RS232 interface. IR
interface selection is populated by R312 and R314. The IR interface schematic is shown in Figure 5.
R311
0
R312
0
DNP
UAR T3_R XD_IR
VPW R
UART3_RXD_IR
R322
1.0K
1
UART3_RXD
UAR T3_R XD_RS232
R321
10.0K
R314
0
DNP
UART3_TXD
C321
2200pF
UAR T3_TXD _R S232
Q321
OP506B
2
R313
0
UAR T3_TXD _IR
A
UART3_TXD_IR
R323
680
C
D 321
TSAL4400
Figure 5. IR control
4.2.5
Isolated RS232 interface
This communication interface is used primarily for real-time visualization using FreeMASTER [5]. The
communication is driven by the UART3 module of the microcontroller. Communication is optically
isolated through the optocouplers U301 and U302. In addition to the RXD and TXD communication
signals, the interface implements two additional control signals, RTS and DTR. These signals are typically
used for transmission control, however, this function is not used within this reference design. Because there
is a fixed voltage level on the control lines generated by the PC, the Isolated RS232 interface is used to
supply the secondary side of the U4 and the primary side of the U3 optocouplers. The communication
interface, including the D301–D302, C301, R305, and R306 components, that are required to supply the
optocouplers from the transition control signals, is shown in Figure 6.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
11
Hardware design
R311
0
R312
0
DNP
R313
0
R314
0
DNP
U301
SF H6106-4
2
3
1
4
R305
4.7K
R 304
1.0K
3
2
R306
470
J301
C301
2.2UF
D301
MMSD 4148T1G
D302
MMSD 4148T1G
1
3
5
7
9
2
4
6
8
10
A
U AR T3_RXD_RS232
SF H6106-4
U302
A
VPW R
UAR T3_TXD _IR
C
U AR T3_TXD_R S232
R 302
390
UAR T3_TXD _R S232
A
UART3_TXD
UAR T3_R XD_IR
C
UART3_RXD
UAR T3_R XD_RS232
HD R_2X5
4
1
C
D303
MMSD 4148T1G
Figure 6. RS232 control
The UART3 pins are shared with the Isolated RS232 interface. The Isolated RS232 interface selection
must be populated by R311 and R313.
4.2.6
MAG3110 3-axis magnetometer
This sensor is optional and can be used for advanced tamper detection for current transformers. In the
schematic diagram, the MAG3110 3-axis magnetometer is marked as U381 (see Figure 7). The
magnetometer communicates with the microcontroller through the I2C1 data lines; therefore, the external
pull-ups R3 and R4 on the SCL and SDA lines are required.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
12
Freescale Semiconductor, Inc.
Hardware design
C384
0.1UF
8
NC
INT1
GND1
C383
0.1UF
5
C382
0.1U F
SCL
SD A
7
6
I2C1_SCL
I2C1_SDA
9
C385
0.1U F
GN D2
3
C381
1.0U F
CAP_A
CAP_R
10
1
4
U381
VDD IO
VDD
2
VDD
MAG3110
Figure 7. MAG3110 sensor control
4.2.7
4 KB I2C EEPROM
The 32 KB I2C EEPROM U391 (AT24C32D) can be used for parameter storage. The microcontroller uses
I2C1 for communication with the EEPROM. The I2C1 is shared with a magnetometer sensor.
1
2
3
4
U 391
A0
A1
A2
GND
VCC
WP
SCL
SDA
8
7
6
5
VDD
I2C 1_SCL
I2C 1_SDA
AT24C32D
C391
0.1UF
Figure 8. 32 KB I2C EEPROM control
4.2.8
RF MC1323x-IPB interfaces
The RF MC1323x-IPB interface (J350) is intended to interface the power meter with the Freescale ZigBee
small-factor modules. This interface comprises connections to UART1 and the I2C1 peripherals, as well
as to several I/O lines for module reset, handshaking, and control.
VPW R
J 350
R F_RST
UART1_RTS
UART1_CTS
RF_IO
1
3
5
7
9
11
13
15
17
19
2
4
6
8
10
12
14
16
18
20
C 351
0.1UF
UART1_TXD
UART1_RXD
I2C1_SDA
I2C1_SCL
RF_CTR L
CON_2X10
Figure 9. RF MC1323x-IPB interfaces control
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
13
Hardware design
NOTE
RF MC1323x-IPB interfaces are designed to supply the external
communication modules from the regulated output voltage VPWR.
Therefore, use only communication modules with a supply voltage of 3.6 V
and a continuous current of up to 60 mA.
4.3
Analog circuits
Excellent performance of the metering AFE, including external analog signal conditioning, is crucial for
a power meter application. The most critical performance aspect is the phase current measurement due to
the high dynamic range of the current measurement (800:1 and higher) and the relatively low input signal
range (from hundredths of millivolts up to volts). All analog circuits are described in the following
subsections.
4.3.1
Phase current measurement
The Kinetis-M three-phase power meter reference design is optimized for current transformers, but a
variety of Rogowski coils can also be used. The only limitations are that the sensor output signal range
must be within ±0.5 V peak and within the dimensions of the enclosure. The interface of a current sensor
to the MKM34Z128MCLL5 device is very straightforward; a burden resistor for current-to-voltage
conversion and anti-aliasing low-pass filters attenuating signals with frequencies greater than the Nyquist
frequency must be populated on the board (see Figure 10). The cut-off frequency of the analog filters
implemented on the board is 72.3 kHz; such a filter has an attenuation of -33.3 dB at Nyquist frequency of
3.072 MHz. The burden resistor is a composite formed by two resistors with the same value. The middle
point of this is connected to ground.
TP231
R233
22
SD ADP0
J 231
C ON TB 2
R 231
4.7
C231
0.047UF
1
2
D NP
R 232
4.7
C232
0.047UF
R234
22
SD ADM0
TP232
Figure 10. Phase current signal conditioning circuit
Each of the three (or four) current channels use the same topology.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
14
Freescale Semiconductor, Inc.
Hardware design
Table 2. Current signal components
4.3.2
Channel
Component
1
R231, R232, R233, R234, C231, C232 and J231
2
R241, R242, R243, R244, C241, C242 and J241
3
R251, R252, R253, R254, C251, C252 and J251
4
R261, R262, R263, R264, C261, C262 and J261
neutral current measurement
Phase voltage measurement
R201
220K
J 201
C ON TB 2
R 204
100K
D 201
BAV99LT1
2
3
L1
R206
1k
R 207
47
TP201
SAR _AD0
SAR_AD0
1
RV201
20S0271
R205
1k
DN P
C 201
0.01UF
2
D NP
R203
100K
1
2
1
R202
220K
VREF/2
VD D
A simple voltage divider is used for the line voltage measurement. In a practical implementation, it is better
to design this divider from several resistors connected serially due to the power dissipation. One half of
this total resistor consists of R201, R202, R203, and R204, the second half consists of resistor R205
(channel 1), R211, R212, R213, R214 and R215 (channel 2) and R221, R222, R223, R224 and R2025
(channel 3). The resistor values were selected to scale down the 325.26 V peak input line voltage to the
0.52272 V peak input signal range of the 16-bit SAR ADC. The SAR ADC input is unipolar different to
bipolar SD ADC inputs, so for this case an external bias voltage must be added. External bias voltage is
derived from the on-chip reference voltage (taken from the VREF pin) and the value is the half of reference
voltage. The bias voltage is connected to the voltage diver through the second half resistors R205, R215
and R225. The voltage drop and power dissipation on each of the MELF02041 resistors are below 57.5 V
and 22 mW, respectively. The anti-aliasing low-pass filter of the phase voltage measurement circuit is set
to a cut-off frequency of 27.22 kHz. Such an anti-aliasing filter has an attenuation of -41.0 dB at Nyquist
frequency of 3.072 MHz.
Figure 11. Phase voltage signal conditioning circuit
4.3.3
Half reference voltage level generator
The reference voltage half value is generated from internal voltage reference. Reference voltage 1.2V is
available on the VREF pin. This voltage is simply divided by two through the voltage divider R281 and
R282. The half reference voltage is connected to the unity gain buffer where the optional filter capacity
C282 is added. The unity gain buffer is a low cost and simple instrumentation amplifier U281 LMV321.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
15
Software design
A unity gain buffer is placed for phase voltage channel decoupling, therefore, the buffer works like an
impedance transformer. Figure 12 shows the schematic diagram of the half reference voltage generator.
VPW R
5
VREF
R281
10K
3
-
1
+
U281
V+ LMV321
4
VR EF/2
C281
0.1UF
2
VR282
10K
C282
0.1UF
Figure 12. Half reference voltage level generator
4.3.4
Zero crossing circuits connection
The low level phase voltage from the voltage dividers is connected to the analog comparator inputs through
R271, R272 and R273. Optional capacitors C271, C272, and C273 are added to the signal path for
additional filtering.
SAR _AD0
R 271
10K
CMP0_P0
C271
1000pF
Figure 13. Zero crossing circuits
5
Software design
This section describes the software application of the Kinetis-M three-phase power meter reference design.
The software application consists of measurement, calculation, calibration, user interface, and
communication tasks.
5.1
Block diagram
The application software has been written in C-language and compiled using the IAR Embedded
Workbench for ARM (version 6.60.0) with full optimization for execution speed. The software application
is based on the Kinetis-M bare-metal software drivers [7] and the filter-based metering algorithm library
[2].
The software features are as follows:
• Transitions between operating modes,
• Performs a power meter calibration after first start-up,
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
16
Freescale Semiconductor, Inc.
Software design
•
•
•
•
•
Calculates all metering quantities,
Controls the active and reactive energies pulse outputs,
Runs the HMI (LCD display and button),
Stores and retrieves parameters from the NVMs,
Enables application remote monitoring and control.
The application monitoring and control is performed through FreeMASTER.
Figure 14 shows the software architecture of the power meter including interactions of the software
peripheral drivers and application libraries with the application kernel.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
17
Software design
Figure 14. Software architecture
All tasks executed by the Kinetis-M one-phase power meter software are briefly explained in the following
subsections.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
18
Freescale Semiconductor, Inc.
Software design
5.2
Software tasks
The software tasks are part of the application kernel. They’re driven by events (interrupts) generated either
by the on-chip peripherals or the application kernel. The list of all tasks, trigger events, and calling periods
are summarized in Table 3.
Table 3. List of software tasks
Task name
Power meter
calibration
Description
Source file(s)
Performs power meter
calibration and stores
calibration parameters
config.c
config.h
Function name
Trigger
source
CONFIG_UpdateOffsets device reset
CONFIG_CalcCalibData
Interrupt
priority
Calling period
—
after first device
reset, and a
special load point
is applied by the
test equipment
Operating mode Controls transitioning
control
between power meter
operating modes
mk341ph.c
main
device reset
—
after every
device reset
Data processing Reads digital values
from the AFE, SAR,
and performs scaling
main.c
afech0_callback
afech1_callback
afech2_callback
AFE CH0
AFE CH1
AFE CH2
conversion
complete
interrupt
Level 0
(highest)
periodic
166.6 μs
Calculation;
Calculates billing and
billing quantities non-billing quantities
—
auxcalc_callback
—
Level 1
periodic
833.3 μs
Calculation;
non-billing
quantities
—
—
—
—
—
—
HMI control
Updates LCD with new
values and transitions
to new LCD screen
after user button is
pressed
—
display_callback
—
Level 3
(lowest)
periodic
250 ms
Application monitoring freemaster_*.c
and control
freemaster_*.h
FreeMASTER
communication
Recorder
Parameter
management
Writes/reads
parameters from the
Flash
5.2.1
FMSTR_Init
UART3 Rx/Tx Level 2
interrupts
asynchronous
—
FMSTR_Recorder
AFE CH2
conversion
complete
interrupt
Level 1
periodic
833.3 μs
config.c
config.h
CONFIG_SaveFlash
CONFIG_ReadFlash
after
successful
calibration or
controlled by
user
—
—
Power meter calibration
The power meter is calibrated with the help of test equipment. The calibration task runs whenever a
non-calibrated power meter is connected to the mains. The running calibration task measures the phase
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
19
Software design
voltage and phase current signals generated by the test equipment; it scans for a 230 V phase voltage and
5.0 A phase current waveforms with a 45 degree phase shift. If the calibration task detects such a load
point, then, after 35 s of collecting data, the calibration task calculates the calibration offsets, gains, and
phase shift using the following formulas:
gain u = 230 ⁄ URMS
Eqn. 11
gain I = 5.0 ⁄ IRMS
-1 Q
θ comp = 45° – tan  ----
R
Eqn. 12
Eqn. 13
where gainu , gainI are calibration gains, θcomp, is the calculated phase shift caused by current transformers,
and URMS, IRMS, Q, P are quantities measured by the non-calibrated meter.
Contrary to the gain and phase shift calculations that are based on RMS values, the calibration offsets are
calculated from instantaneous measured samples, as follows:
n
n
max 
u ( k ) – min 
u ( k )




k =0
k =0
offset u = ---------------------------------------------------------------------------------------------------2
n
n
max 
i ( k ) – min 
i ( k )




k =0
k =0
offset I = ------------------------------------------------------------------------------------------------2



Eqn. 14

Eqn. 15
where offsetu, offsetI are calculated calibration offsets, u(k), i(k) are respectively the instantaneous phase
voltage and phase current samples in measurement steps k=0,1, … n.
The calibration task terminates by storing calibration gains, offsets and phase shift into the flash and by
resetting the microcontroller device. The recalibration of the power meter can also be initiated from
FreeMASTER.
5.2.2
Operating mode control
The transitioning of the power meter electronics between operating modes helps maintain a long battery
lifetime. The power meter software application supports the following operating modes:
• Normal (electricity is supplied, causing the power meter to be fully-functional)
• Standby (electricity is disconnected, and the user navigates through menus)
• Power-down (electricity is disconnected, but there is no user interaction)
Figure 15 shows the transitioning between supported operating modes. After a battery or the main power
is applied, the power meter transitions to the device reset state. If the mains have been applied, then the
software application enters normal mode and all software tasks including calibration, measurements,
calculations, HMI control, parameter storage, and communication are executed. In this mode, the
MKM34Z128MCLL5 device operates in run mode. The system clock frequency is generated by the FLL
and is 48 MHz. The power meter electronics consume 18.4 mA.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
20
Freescale Semiconductor, Inc.
Software design
If the mains have not been applied, then the software application enters standby mode. In this mode, the
power meter runs from battery. All software tasks are stopped except HMI control. In this mode, the
MKM34Z128MCLL5 device executes in VLPR mode. The system clock frequency is downscaled to
125 kHz from the 4 MHz internal relaxation oscillator. Because of the slow clock frequency, the limited
number of enabled on-chip peripherals, and the Flash module operating in a low-power run mode, the
power consumption of the power meter electronics is 260 µA.
Finally, when the power meter runs from battery but the user does not navigate through the menus, then
the software transitions automatically to the power-down mode. The MKM34Z128MCLL5 device is
forced to enter VLLS2 mode, where recovery is only possible when either the user button is pressed or the
mains is supplied. The power-down mode is characterized by a current consumption of 6.5 µA.
Figure 15. Operating modes
5.3
Data processing
Reading the phase voltage from the SAR ADC and phase current samples from the analog front-end (AFE)
occurs periodically every 166.6 µs. This task runs on the highest priority level (Level 0) and is triggered
asynchronously when the AFE result registers receive new samples. The task reads the phase voltage and
phase current samples from the AFE result registers, scales the samples to the full fractional range, and
writes the values to the temporary variables for use by the calculation task.
5.3.1
Data sampling
The phase voltage and phase current must be sampled at the same time, because the power calculations are
defined as are the multiplication of the immediate voltage and current values in Equation 7 and Equation 8.
The voltage signal is sampled by the one SAR ADC with an input multiplexor, because of this, all six
signals (3x phase voltage and 3x phase current) cannot be sampled at the same time. The sampling of the
different phase signals must be time shifted. This can be easily implemented by using the AFE delay start
function. Each AFE channel start is delayed from the previous channel. CH0 begins conversion at the time
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
21
Software design
0 × FDL, CH1 begins conversion at the time 1 × FDL, and CH2 begins conversion at the time 2 × FDL.
The FDL (Fix Delay) constant is longer than the SAR conversion time plus multiplexor switching time.
The internal interconnection between AFE and SAR is implemented through the XBAR peripherals. The
AFE COCO CHx (COCO—conversion complete, for continued AFE mode conversion start) is used for
the hardware trigger conversion start for SAR. Typically, current sensors generate phase shift between
phase voltage and phase current, because current signal is converted on the voltage signal. Voltage signal
is needed for ADC. The voltage to current conversion takes time, called phase shift error. The sensor phase
shift error can be compensated to add delay time between the AFE COCO signal and the SAR hardware
conversion trigger. This requirement can also be resolved through the XBAR. The signal chain AFE
COCO and SAR hardware trigger should be extended by adding the next block between AFE and SAR to
generate the time delay. The ideal hardware resource for this task is a Quad Timer, because it can operate
in One-Shot mode. The signal chain for the sensor’s phase shift compensation is; AFE connected to the
TMR which is connected to the SAR. AFE COCO signal begins the TMR and then TMR, after a delay,
passes the signal to SAR which generates the hardware trigger signal. The three phase application uses
three current sensors with different phase shift errors, for this reason, it is during the calibration process
that the three compensation times for each channel are calculated.
166us OSR1024
166us OSR1024
Sigma-Delta CH0
166us OSR1024
Sigma-Delta CH0
Sigma-Delta CH0
COCO S-D CH0
9us + x
166us OSR1024
FDL
COCO S-D CH0
166us OSR1024
Sigma-Delta CH1
166us OSR1024
Sigma-Delta CH1
Sigma-Delta CH1
COCO S-D CH1
2 * (9us + x)
FDL
166us OSR1024
FDL
t
166us OSR1024
Sigma-Delta CH2
t
COCO S-D CH1
166us OSR1024
Sigma-Delta CH2
Sigma-Delta CH2
COCO S-D CH2
TMR
0
COCO S-D CH2
t
TMR
0
TMR
1
TMR
1
TMR
2
TMR
2
9us
9us
9us
9us
9us
9us
SAR
CH0
SAR
CH1
SAR
CH2
SAR
CH0
SAR
CH1
SAR
CH2
0
t
Figure 16. Three-phase sampling signal chain with HW based phase shift error compensation
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
22
Freescale Semiconductor, Inc.
Software design
The other possible method to compensate for current sensor phase shift error is a software based solution.
The sample’s value is scaled with respect to the phase shift error. This correction algorithm can also be
implemented in the time and frequency domains.
166us OSR1024
166us OSR1024
Sigma-Delta CH0
166us OSR1024
Sigma-Delta CH0
COCO S-D CH0
9us + x
166us OSR1024
FDL
Sigma-Delta CH0
COCO S-D CH0
166us OSR1024
Sigma-Delta CH1
166us OSR1024
Sigma-Delta CH1
COCO S-D CH1
2 * (9us + x)
FDL
166us OSR1024
FDL
Sigma-Delta CH1
COCO S-D CH1
166us OSR1024
Sigma-Delta CH2
t
t
166us OSR1024
Sigma-Delta CH2
COCO S-D CH2
Sigma-Delta CH2
COCO S-D CH2
9us
9us
9us
9us
9us
9us
SAR
CH0
SAR
CH1
SAR
CH2
SAR
CH0
SAR
CH1
SAR
CH2
0
t
t
Figure 17. Two Three-phase sampling signal chain with SW based phase shift error compensation
Both methods offer advantages and disadvantages. The hardware based method uses pure sampling for the
next calculation, therefore no calculation rounding error is incurred. The software based method saves the
microcontroller’s resources (three channels of TMR). For example, the TMRs can be used for direct drive
output LEDs to produce very low jitter of the output pulses.
5.4
Calculations
The execution of the calculation task is carried out periodically every 833.3 µs. The calculation task scales
the samples using calibration offsets and calibration gains obtained during the calibration phase:
u_sample scaled = gain u ( u_sample – offset u )
i_sample scaled = gain I ( i_sample – offset I )
Eqn. 16
Eqn. 17
where u_sample and i_sample are measured samples, offsetu, offsetI, gainu, and gainI are calibration
parameters.
The scaled samples are then used by the metering algorithm.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
23
Software design
NOTE
We found experimentally that increasing the calculation update rate beyond
1200 Hz doesn’t improve the accuracy of the measurement or calculations.
5.5
HMI control
The Human Machine Interface (HMI) control task executes in a 250 ms loop and on the lowest priority
(Level 3). It reads the real-time clock, calculates the mains frequency, and formats data into a string that is
displayed on the LCD. The interaction with the user is arranged through an asynchronous event, which
occurs when the user button is pressed. By pressing the user button, you may scroll through menus and
display all measured and calculated quantities (see Table 5).
5.6
FreeMASTER communication
FreeMASTER establishes a data exchange with the PC. The communication is fully driven by the UART3
Rx/Tx interrupts, which generate interrupt service calls with priority Level 2. The power meter acts as a
slave device answering packets received from the master device (PC). The recorder function is called by
the calculation task every 833.3 µs. The priority setting guarantees that data processing and calculation
tasks are not impacted by the communication. For more information about using FreeMASTER, refer to
Subsection 6.6-Error: Reference source not found.
5.7
Parameter management
The current software application uses the last 1024 bytes sector of the internal Flash memory of the
MKM34Z128MCLL5 device for parameter storage. By default, parameters are written after a successful
calibration and read following a device reset. In addition, storing and reading parameters can be initiated
through FreeMASTER.
5.8
Performance
Table 4 shows the memory requirements of the Kinetis-M one-phase power meter software application1.
Table 4. Memory requirements
Flash size
[KB]
RAM size
[KB]
Complete application without the metering
library and FreeMASTER
21.6
0.3
Filter-based metering algorithm library
Filter-based metering algorithm library
8.3
2.8
FreeMASTER
FreeMASTER protocol and
serial communication driver
4.1
2.2
34.0
5.3
Function
Description
Application framework
Total:
1. The application is compiled using the IAR Embedded Workbench for ARM (version 6.60) with full optimization
for execution speed.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
24
Freescale Semiconductor, Inc.
Software design
The software application reserves the 4.0 KB RAM for the FreeMASTER recorder. If the recorder is not
required, or a fewer number of variables will be recorded, you may reduce the size of this buffer by
modifying the FMSTR_REC_BUFF_SIZE constant (refer to the freemaster_cfg.h header file, line 72).
The system clock for AFE is generated by the PLL. In normal operating mode, the PLL multiplies the clock
of an external 32.768 kHz crystal by a factor of 375, hence generating a low-jitter clock with a frequency
of 12.288 MHz.
NOTE
The filter-based metering algorithm configuration tool estimates the
minimum system clock frequency for the ARM Cortex-M0+ core to
calculate billing and non-billing quantities with an update rate of 1200 Hz
to approximately 8.4 MHz for one phase calculation. As shown in
Figure 18, by slowing down the update rate of the non-billing calculations
from 1200 to 600 Hz and further reducing the Hilbert-filter length from 49
to 39-taps, the required performance will eventually decrease by 32.14% to
5.7 MHz for one-phase calculation.
Figure 18. Minimum system clock requirements for the filter-based metering algorithm
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
25
Application set-up
6
Application set-up
Figure 19 shows the wiring diagram of the Kinetis-M three-phase power meter.
User LED
User button
Re-active
energy LED
Active
energy LED
L1
L2
L3
N
Figure 19. Kinetis-M Three-phase power meter – wiring diagram
Among the main capabilities of the power meter, is registering the active and reactive energy consumed by
an external load. After connecting the power meter to the mains, or when you press the user button, the
power meter transitions from the power-down mode to either the normal mode or standby mode,
respectively. In normal and standby modes, the LCD is turned on and shows the last quantity. The user can
navigate through the menus and display other quantities by pressing the user button. All configuration and
informative quantities accessible through the LCD are summarized in Table 5.
Table 5. Quantities shown on the LCD
Value
Units
Format
OBIS Code
Date
year, month, day
YYYY:MM:DD
0.9.2
Time
hour, min, sec
HH:MM:SS
0.9.1
Line voltage; L1, L2, L3
VRMS
#.# V
—
Line current; L1, L2, L3
IRMS
#.### A
—
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
26
Freescale Semiconductor, Inc.
FreeMASTER visualization
Table 5. Quantities shown on the LCD (continued)
Value
Units
Format
OBIS Code
W
#.### W (+ forward, - reverse)
1.6.0
Signed reactive power;
L1, L2, L3
VAr
#.### VAr (+ lag, - lead)
—
Apparent power:
L1, L2, L3
VA
#.### VA
—
kWh
#.### kWh (+ import, - export)
1.9.0
kVArh
#.### kVArh (+ import, - export)
—
Frequency
Hz
##.# Hz
—
Software revision-product
serial number
—
#.#.# - ### (revision – meter
serial number)
—
Class according to
EN50470-3
—
C # #-###A (example C 5-120A)
—
Signed active power;
L1, L2, L3
Signed active energy
Signed reactive energy
7
FreeMASTER visualization
The FreeMASTER data visualization and calibration software is used for data exchange [5]. The
FreeMASTER software running on a PC communicates with the Kinetis-M three-phase power meter over
an isolated RS232 interface. The communication is interrupt driven and is active when the power meter is
powered from the mains. The FreeMASTER software enables remote visualization, parameterization, and
calibration of the power meter. It runs visualization scripts which are embedded into a FreeMASTER
project file.
Before running a visualization script, the FreeMASTER software must be installed on your PC. After
installation, a visualization script may be started by double-clicking on the monitor.pmp file. Once started,
the visualization script shown in Figure 20 will appear on your computer screen.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
27
FreeMASTER visualization
Figure 20. FreeMASTER visualization software
Next, you should set the proper serial communication port and communication speed in the Project/Option
menu (see Figure 21). After communication parameters are properly set and the Stop button is released,
the communication is initiated. A message on the status bar signals the communication parameters and
successful data exchange.
Figure 21. Communication port setting
Now you can see the measured phase voltages, phase current, active, reactive, and apparent powers, pulse
numbers, and additional status information in FreeMASTER. You may also visualize some variables in a
graphical representation by selecting the respective scope or recorder item from the tree.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
28
Freescale Semiconductor, Inc.
FreeMASTER visualization
The visualization script enables you to monitor and parameterize the majority of the power meter features.
To eliminate inappropriate and unwanted changes, some key parameters are protected by a 5-digit system
password. These key parameters are as follows:
• Set Calendar
• Set Imp/kWh
• Set Imp/kVARh
• Recalibration
All the remaining parameters and commands can be executed anytime, without the need for entering the
system password:
• LCD Screen Select
• Software Reset
• Clear Energy Counters
• Clear Tampers
Most of all, FreeMASTER will be used for monitoring the power meter operation and analyzing the phase
voltages and phase currents waveforms in real-time. The visualization script file contains the following
visualization objects:
• Recorders (833 µs update rate, the number of samples is optional but limited to 4096 bytes)
— Raw instantaneous phase voltage and current samples
— High-pass filtered instantaneous phase voltage and current samples
• Scopes (10 ms update rate, the number of samples unlimited)
— Energy profile (kWh and kVARh counters with resolution 10-5)
— RMS voltage, RMS current, active power, reactive power, and apparent power.
— Power meter’s actual date and time
— Mains frequency
• Variables and Enumerations (shown in text form)
— Password set-up
— Tamper status
— Remote command
Figure 22 shows the high-pass filtered phase voltage and phase current waveforms with shorted input
terminals. The waveform samples are captured every 833 µs and stored in a dedicated buffer of the
MKM34Z128MCLL5 device. When the buffer is full, the data is sent to the PC via the optical port
interface. The FreeMASTER visualization tool then displays the data on the PC screen.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
29
Accuracy and performance
Figure 22. Recorded phase voltage and phase current waveforms
Advanced users benefit from FreeMASTER’s built-in, active-x interface that serves to exchange data with
other signal processing and programming tools, such as Matlab, Excel, LabView, and LabWindows.
8
Accuracy and performance
As already indicated, the Kinetis-M three-phase reference designs have been calibrated using the test
equipment ELMA8303 [1]. All power meters were tested according to the EN50470-1 and EN50470-3
European standards for electronic meters of active energy classes B and C, the IEC 62053-21 and IEC
62052-11 international standards for electronic meters of active energy classes 2 and 1, and the IEC
62053-23 international standard for static meters of reactive energy classes 2 and 3.
During accuracy calibration and testing, the power meter measured electrical quantities generated by the
test bench, calculated active and reactive energies, and generated pulses on the output LEDs; each
generated pulse was equal to the active and reactive energy amount kWh (kVARh)/imp3. The deviations
between pulses generated by the power meter and reference pulses generated by test equipment defined
the measurement accuracy.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
30
Freescale Semiconductor, Inc.
Accuracy and performance
8.1
Room temperature accuracy testing
Figure 23 shows the calibration protocol of the power meter S/N: 35. The protocol indicates the results of
the power meter calibration performed at 25°C. The accuracy and repeatability of the measurement for
various phase currents and angles between phase current and phase voltage are shown in these graphs.
The first graph (on the top) indicates the accuracy of the active and reactive energy measurement after
calibration. The x-axis shows variation of the phase current, and the y-axis denotes the average accuracy
of the power meter computed from five successive measurements; the gray lines define the Class C
(EN50470-3) accuracy margins.
The second graph (on the bottom) shows the measurement repeatability; i.e. standard deviation of error of
the measurements at a specific load point. Similarly to the power meter accuracy, the standard deviation
has also been computed from five successive measurements.
1
ERR [%] - Active and Reactive Energies
0.8
(unity an d o th er power fa ctors PF)
0.6
0.4
PF=1
PF=0.8C(R)
PF=0.8C(A)
PF=0.707L(R)
PF=0.707L(A)
PF=0.5L(R)
PF=0
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.015 0.05 0.1 0.25 0.375 0.5
1
2
5
10
In [A]
25
40
60
80
100 120
0.2
STDEV [%] - Standard Deviation
0.18
(calcu lated from 5 per-two p ulses measurements)
0.16
0.14
PF=1
PF=0.8C(R)
PF=0.8C(A)
PF=0.5L(R)
PF=0.5L(A)
PF=0
0.12
0.1
0.08
0.06
0.04
0.02
0
0.05
0.1
0.25
0.5
1
2
5
10
25
40
60
80
In [A]
Figure 23. Calibration protocol at 25°C
By analyzing the protocols of several Kinetis-M three-phase power meters, it can be said that this
equipment measures active and reactive energies at all power factors, at 25°C ambient temperature, and in
the current range 0.25–120 A4, more or less with an accuracy range ±0.25%.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
31
Summary
9
Summary
This design reference manual describes a solution for a three-phase electronic power meter based on the
MKM34Z128CLL5 microcontroller.
Freescale Semiconductor offers filter and FFT based metering algorithms for use in customer applications.
The former calculates metering quantities in the time domain, the latter in the frequency domain. This
reference manual explains the basic theory of power metering and lists all the equations to be calculated
by the power meter.
The hardware platform of the power meter is algorithm independent, so application firmware can leverage
any type of metering algorithm based on customer preference. To extend the power meter uses, the
hardware platform comprises a 32 KB I2C EEPROM for data storage, an MAG3110 3-axis multifunction
digital magnetometer for enhanced tampering, and RF MC1323x-IPB interfaces for AMR communication
and monitoring.
The application software has been written in C-language and compiled using the IAR Embedded
Workbench for ARM (version 6.60), with full optimization for the execution speed. It is based on the
Kinetis-M bare-metal software drivers [7]. The application firmware automatically calibrates the power
meter, calculates all metering quantities, controls active and reactive energy pulse outputs, runs the HMI
(LCD and button), stores and retrieves parameters from Flash memory, and enables monitoring of the
application, including recording selected waveforms through FreeMASTER. An application software of
such complexity requires 29.9 KB of flash and 6.6 KB of RAM. The system clock frequency of the
MKM34Z128CLL5 device must be 48 MHz to calculate all metering quantities with an update rate of
1200 Hz.
The power meter is designed to transition between three operating modes. It runs in normal mode when it
is powered from the mains. In this mode, meter electronics consume 18.4 mA. The second mode, standby
mode, is entered when the power meter runs from the battery and the user navigates through the menus. In
this particular mode, the 3.6V Li-SOCI2 (1.2Ah) battery is discharged by 260 µA, resulting in 4,100 hours
of operation (0.47 year battery lifetime). Finally, when the power meter runs from the battery but no
interaction with the user occurs, the power meter electronics automatically transition to the power-down
mode. The power-down mode is characterized by a current consumption as low as 6.5 µA, which results
in 143,000 hours of operation (16.3 year battery lifetime).
The application software enables you to monitor measured and calculated quantities through the
FreeMASTER application running on your PC. All internal static and global variables can be monitored
and modified using FreeMASTER. In addition, some variables, for example phase voltages and phase
currents, can be recorded in the RAM of the MKM34Z128CLL5 device and sent to the PC afterwards. This
power meter capability helps you to understand the measurement process.
The Kinetis-M three-phase power meters were tested according to the EN50470-1 and EN50470-3
European standards for electronic meters of active energy classes B and C, the IEC 62053-21 and IEC
62052-11 international standards for electronic meters of active energy classes 2 and 1, and the IEC
62053-23 international standard for static meters of reactive energy classes 2 and 3. After analyzing several
power meters, we can state that this equipment measures active and reactive energies at all power factors,
a 25°C ambient temperature, and in the current range 0.25–120 A, more or less with an accuracy range
±0.25%.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
32
Freescale Semiconductor, Inc.
References
In summary, the capabilities of the Kinetis-M three-phase power meter fulfill the most demanding
European and international standards for electronic meters.
10 References
1. Electricity Meter Test Equipment ELMA 8x01, from Applied Precision s.r.o,
www.appliedp.com/en/elma8x01.htm
2. Filter-Based Algorithm for Metering Applications, by Martin Mienkina, Freescale Semiconductor,
(Document number: AN4265), www.freescale.com/files/32bit/doc/app_note/AN4265.pdf
3. FFT-Based Algorithm for Metering Applications, by Ludek Slosarcik, Freescale Semiconductor,
(Document number AN4255), www.freescale.com/files/32bit/doc/app_note/AN4255.pdf
4. LinkSwitch-TN Family Design Guide—AN37, from Power Integrations, April 2009,
www.powerint.com/sites/default/files/product-docs/an37.pdf
5. FreeMASTER Data Visualization and Calibration Software, Freescale Semiconductor,
www.freescale.com/webapp/ sps/site/prod_summary.jsp?code=FREEMASTER
6. UMI-S-001 - Main UMI specification, from Cambridge Consultants Ltd,
http://umi.cambridgeconsultants.com
7. Kinetis M Bare-metal Software Drivers, from Freescale Semiconductor, September 2013,
www.freescale.com/webapp/Download?colCode=KMSWDRV_SBCH
11 Revision history
Revision 0 is the initial release of this document.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
33
Board electronics
I2C Pul l-up`s
UART3_TX
/RESED
T
I2C1_SDA
I2C1_SCL
RF_ CTRL
USER_B
TN
SWD_IO
VDD
R3
4.7K
SWD_CLK
R4
4.7K
I2 C1_ SCL
I2 C1_ SDA
R5
0
R6
0
PTI0
LCD_15
LCD_16
LCD_17
LCD_18
LCD_19
LCD_20
UA
RT1_CTS
UART1_RTS
CMP0_P5
DNP
External Pul l-up`s for open-drain pins
PTI0
UART1_TXD
R9
4.7K
91
92
93
94
UART1_RTS
UART1_TXD
SDADP0
SDADM0
35
36
SDADP1
SDADM1
VBAT
VDDA
42
43
C4
0.1UF
SDADP3
SDADM3
41
VREFH
SAR_VDDA
61
SAR_VDDA
VBAT
37
VREF
VREF
VREF
VREFH
C6
0.1UF
VREFL
C7
0.1UF
LC D BIAS and charge pump capac itors
VCAP1
PTG0/LCD7/QT1/LPTIM2
PTG1/LCD8/AD10/ LLWU_P2/LPTIM0
PTG2/LCD9/AD11/ SPI0_SS/LLWU_P1
PTG3/LCD10/SPI0_SCK/I 2C0 _SCL
PTG4/LCD11/SPI0_MOSI /I2C0_SDA
PTG5/LCD12/SPI0_MISO/LPTIM1
PTG6/LCD13/LLWU_P0/L PTIM2
PTG7/LCD14
VCAP2
C9
0.1UF
VLL2
PTI0/CMP0P5/SCI1_RXD/PXBAR_I N8/ SPI1_MISO/ SPI1_MOSI
PTI1/SCI1_TXD/PXBAR_OUT8/ SPI 1_MOSI/SPI 1_MISO
PTI2/LCD21
PTI3/LCD22
C1 0
0.1UF
VLL3
C1 1
0.1UF
PKM34Z128CLL5
UART1_RXD
JP5
HDR 1X1
C
DNP
L90 15 00uH
2
0.1uF
D94
R93
2.0 K
1%
C93
22uF
LNK30 2DN
1
+ C91
4.7uF
L91 1500uH
2
D95
ES1JL
C94
1 00UF
R96
1.6K
A
+ C90
4. 7uF
Connec t phase and neutral to the
JP1, J P2, JP3 and JP4 he aders,
respec tively:
JP1, J P2 and JP3: Phase v oltage
JP4: N eutral voltage
J20
HDR_1X2
MRA4007T3G
VOUT
VOUT = 1.65V x [ (R40+R41)/R41] (4.12 V)
Don't populate AC-D C SMPS if external power supply module is used instead. C onnect input
of the external po wer supply module t o JP1, JP2 and JP3 (Line Input) and JP 4 (Neutral).
Output voltage of t he external power s upply module must b e connected to JP5 (Vout) and JP6
(GND).
1
D21
BAT54CLT1
1
C21
10UF 10UF
2
3
U20
VI N
VOUT
5
ADJ
4
C22
C23
10UF
10UF
C25
10UF 10UF 1
SPX3819M5-L
DNP
Open J2 0 to power
board f rom +5V
laborat ory power
supply.
C26
1uF
VDD
2
R20
45.3K
TP1
TP2
TP3
C27
1uF
C28
1uF
VDD
VDDA SAR_VDDA VBAT
TP4
TP5
TP6
TP7
TP8
/RESET
VDD
C24
GND
EN
J22
HDR_1X2
3
VDDA
1 L20 1u H 2
Open J22 to monitor
MCU + RTC currents.
VPWR
C20
JP6
HDR 1X1
D20
MMSD4148T1G
A
C
Open J21 to
monitor B T1
current.
3.6 V Ba ttery
C
1
HDR 1X1
DNP
1%
C92
1
1
2
S1
S2
S3
S4
Keep > =5mm distance
betwee n JP1 and JP3
C
U90
MRA4007T3G
D
HDR 1X1
2
Place clo se to VDDA
pin of th e MCU
J21
HDR_1X2
BT20
BATTERY
R94 3. 0K
A
C 1
4
D9 0
VOUT
1
2
85-265V AC -DC SMPS MO DU LE
2
1
A
Tes t Points
C
MRA4007T3G
L1
FB
BP
A
HDR 1X1
D9 1
C1 4
0.1UF
1
MRA4007T3G
L2
VREF
VDD
VPWR VPWR
1
2
A
D9 2
1
L3
HDR 1X1
JP4
C8
0.1UF
VLL1
PTH0/LCD15
PTH1/LCD16
PTH2/LCD17
PTH3/LCD18
PTH4/LCD19
PTH5/LCD20
PTH6/SCI1_ CTS/SPI1_SS/ PXBAR_IN7
PTH7/SCI1_ RTS/SPI1_SCK/PXBAR_OUT7
Vref dec oupli ng
JP1 DNP
1
SAR_VDDA
C5
0.1UF
VDD
JP2 DNP
1
VDDA
SDADP2
SDADM2
UART1_TXD
UART1_RXD
JP3 DNP
1
VDD
C3
0.1UF
VREFL
UART1_CTS
UART1_RTS
33
34
PTF0/AD7/RTCCLKOUT/QT2/ CMP0OUT
PTF1/L CD0/ AD8/QT0/PXBAR_OUT6
PTF2/L CD1/ AD9/CMP1OUT/RTCCLKOUT
PTF3/L CD2/ SPI 1_SS/LPTIM1/SCI0 _RXD
PTF4/L CD3/ SPI 1_SCK/LPTI M0/SCI0_TXD
PTF5/L CD4/ SPI 1_MISO/I 2C1_SCL/LLWU_P4
PTF6/L CD5/ SPI 1_MOSI/I 2C1_SDA/LLWU_P3
PTF7/L CD6/ QT2 /CLKOUT
R10
4. 7K
UART1_CTS
TAMPER0
TAMPER1
PTE0/I 2C0_SDA/PXBAR_OUT4/SCI3_TXD/CLKOUT
PTE1/RESET
PTE2/EXTAL 1/EWM_IN/PXBAR_IN6/I2C1_SDA
PTE3/XTAL1/EWM_OUT/AFE_CLK/ I2C1_SCL
PTE4/L PTIM0/SCI2_CTS/ EWM_IN
PTE5/QT3/ SCI2_RTS/EWM_OUT/LLWU_P6
PTE6/CMP0P2/PXBAR_IN5/SCI2_RXD/LLWU_P5/SWD_I O
PTE7/AD6/PXBAR_OUT5/ SCI2_TXD/SWD_CLK
11
27
59
95
R8
4. 7K
LCD_21
LCD_22
83
84
85
86
87
88
89
90
30
29
28
SAR_VDDA
PTD0/CMP0P0/SCI0_ RXD/ PXBAR_IN2/LLWU_P11
PTD1/SCI1_ TXD/SPI0_SS/PXBAR_ OUT3/ QT3
PTD2/CMP0P1/SCI1_ RXD/ SPI0_SCK/PXBAR_IN3/ LLWU_P10
PTD3/SCI1_ CTS/SPI0_MOSI
PTD4/AD3/SCI1_RTS/SPI0_MISO/ LLWU_P9
PTD5/AD4/L PTIM2/QT0/ SCI3_CTS
PTD6/AD5/L PTIM1/CMP1OUT/SCI3_RTS/LLWU_P8
PTD7/CMP0P4/I2C0_SCL /PXBAR_IN4/ SCI3_RXD/LLWU_P7
VSS1
VSS2
VSS3
VSS4
VDD
R7
4.7K
75
76
77
78
79
80
81
82
LCD_7
LCD_8
LCD_9
LCD_10
LCD_11
LCD_12
LCD_13
LCD_14
Shared pi ns selec tion
UART1_RXD
67
68
69
70
71
72
73
74
PULSE_OUT
LCD_0
LCD_1
LCD_2
LCD_3
LCD_4
LCD_5
LCD_6
I 2C1_SCL
I 2C1_SDA
55
56
57
58
63
64
65
66
C2
0.1UF
SAR_VSSA
C18
18PF
DNP
VDD
XTAL32K
EXTAL32K
39
40
SDADP3/ CMP1P4
SDADM3/ CMP1P5
60
32. 768KHz
C17
18PF
DNP
CMP0_P0
kWh_LED
CMP0_P1
RF_ RST
RF_IO
kVArh_LED
USER_LED
UART3_RXD
1
47
48
49
50
51
52
53
54
SDADP1
SDADM1
SDADP2/ CMP1P2
SDADM2/ CMP1P3
PTC0/LCD39/SCI 3_RTS/PXBAR_IN1
PTC1/LCD40/CMP1P1/SCI 3_CTS
PTC2/LCD41/SCI 3_TXD/PXBAR_OUT1
PTC3/LCD42/CMP0P3/SCI 3_RXD/ LLWU_P13
PTC4/LCD43
PTC5/AD0/SCI0_RTS/LLWU_ P12
PTC6/AD1/SCI0_CTS/QT1
PTC7/AD2/SCI0_TXD/PXBAR_OUT2
VDD
VDD2
25
XTAL32K 26
EXTAL32K
SDADP0
SDADM0
VREFL
Y1
2
19
20
21
22
23
44
45
46
LCD_39
LCD_40
LCD_41
LCD_42
LCD_43
SAR_AD0
SAR_AD1
SAR_AD2
XTAL32K
Watch crystal
EXTAL32 K
C13
0 .1UF
VDD1
C1
0.1UF
TAMPER0
TAMPER1
TAMPER2
VSSA
/RESET
Bypass Capac itors
PTB0/L CD31
PTB1/L CD32
PTB2/L CD33
PTB3/L CD34
PTB4/L CD35
PTB5/L CD36
PTB6/L CD37/ CMP1P0
PTB7/L CD38/ AFE_CLK
32
R2
820
9
12
13
14
15
16
17
18
LCD_31
LCD_32
LCD_33
LCD_34
LCD_35
LCD_36
LCD_37
LCD_38
5
6
7
8
Freescale Semiconductor, Inc.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
SWD_RESET
R1
4.7K
38
VDD
External MCU Res et
PTA0/L CD23
PTA1/L CD24
PTA2/L CD25
PTA3/L CD26
PTA4/L CD27/ LLWU_P15/NMI
PTA5/L CD28/ CMP0OUT
PTA6/L CD29/ PXBAR_IN0/LLWU_P14
PTA7/L CD30/ PXBAR_OUT0
VREFH
VLL1
VLL2
VLL3
24
U1
1
2
3
4
5
6
7
8
LCD_23
LCD_24
LCD_25
LCD_26
LCD_27
LCD_28
LCD_29
LCD_30
VDDA
SWD_RESET
HDR 2X5
VBAT
VCAP1
VCAP2
98
97
96
SWD_IO
SWD_CLK
VDD1
VDD2
C12
0. 1UF
2
4
6
8
10
VLL1
VL L2
VLL3
VDDA
100
99
J1
1
3
5
7
9
VDD
VCAP1
VCAP2
31
MC U Ki netis M
VDD1
VDD2
SWD C ON NECTOR
10
62
34
Appendix A
R21
23.7K
VPWR = 1.2 35V x [ 1 + R23/R24 ] (3.5956 V)
1% resisto rs R24=23.7k, R23=4 5.3k
Figure A-1. Schematic diagram 01_MCU
A ut om ot i ve , I ndu st ria l & M ul ti m a rk e t S ol ut i ons G ro up
SAR_VDDA
L21 1uH
VPWR
6501 William Cannon Dr v
i e West
Austin, TX 78735-8598
2
C29
1uF
C30
1uF
C31
1uF
This document cont ains infor mation p roprietary to Frees cale and sha l no t be used for engineering de sign ,
procur ement or man ufact ure in whole or in part without t he expres s wr ti ten permission of Fre escale.
ICAP Classificat o
i n:
FCP: ____
Designer:
Lukas Vaculik
Drawing Title:
Drawn by :
Lukas Vaculik
Page Title:
Approve d:
Pavel Lajsner
Size
C
Document Number
Date:
Thursday, December 05, 201 3
FIUO: X
PUBI: ____
3PM ET-KM34Z128
0 1 _ MC U
Rev
A
SCH-27826 PDF: SPF-27 826
Sheet
2
of
4
L1
L2
L2
L3
R201
220K
J 201
CON TB 2
VDD
R2 03
1 00K
L1
R204
100K
D201
BAV99LT1
DNP
Current inputs
R206
1k
R207
47
2
3
TP231
TP2 01
R233
22
SAR_AD0 SAR_ AD0
SDADP0
1
1
2
1
R202
220 K
L3
VREF/2
L1
VDD
Voltage inputs
R205
1k
DNP
C201
0.01 UF
J231
CON TB 2
R231
4. 7
C231
0.0 47UF
1
2
2
RV201
2 0S0 271
R232
4. 7
DNP
C232
0.0 47UF
R234
22
R211
220K
J 211
CON TB 2
R2 13
1 00K
L2
R214
100K
D211
BAV99LT1
DNP
R216
1k
R217
47
2
3
TP2 11
TP241
SAR_AD1
R243
22
SAR_ AD1
SDADP1
1
1
2
1
R212
220 K
VREF/2
VDD
SDADM0
TP232
R215
1k
DNP
C211
0.01 UF
J241
CON TB 2
2
RV211
2 0S0 271
R241
4. 7
DNP
L3
R2 23
1 00K
R224
100K
D221
BAV99LT1
2
3
C242
0.0 1UF
R244
22
SDADM1
TP242
R226
1k
R227
47
TP251
TP2 21
R253
22
SAR_AD2 SAR_ AD2
SDADP2
1
1
2
1
R222
220 K
R242
4. 7
VREF/2
VDD
R221
220K
J 221
CON TB 2
C241
0.0 1UF
1
2
DNP
R225
1k
DNP
RV221
2 0S0 271
J251
CON TB 2
C221
0.01 UF
R251
4. 7
C251
0.0 1UF
1
2
2
R252
4. 7
DNP
C252
0.0 1UF
R254
22
SDADM2
TP252
Zero crossing
TP261
R264
22
SAR_AD 0
SDADP3
R27 1
10 K
J261
CON TB 2
CMP0 _P0
R261
4. 7
1
2
C271
1000p F
R262
4. 7
DNP
SAR_AD 1
C261
0.0 1UF
C262
0.0 1UF
R265
22
R272
10K
SDADM3
CMP0 _P1
TP262
C272
1000p F
R273
10K
CMP0 _P5
C273
1000p F
Vref/2
VPWR
VREF
5
SAR_AD 2
R281
10K
3
1
R282
10K
-
U281
V+ LMV321
4
+
V-
C281
0.1UF
Automotive, Industrial & Multimarket Solutions Group
6501 William Cannon Driv e West
Aust in, TX7873 5-859 8
VREF/ 2
Th s
i docu ment cont ains inf ormation prop rietar y to Frees cale and sh all not be u sed f or enginee ring de sign,
pr ocure ment or man ufa cture in whole o r in p art with out t he e xpress written permission of Fr eescale.
2
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
VDD
C2 82
0 .1UF
35
Figure A-2. Schematic diagram 02_ANALOG
ICAPClas sifica tion:
FCP: ____
Designer :
Lukas Vac ulik
Drawing Tit e
l :
Drawn by :
Lukas Vac ulik
Pag e Title:
Appr ov ed:
Pav el La s
j ner
Size
C
Document Numb er
Date:
Thur sday , Dec embe r 05, 2013
FIUO: X
PUBI: ____
3P ME T-K M34Z128
02_Analog
Re v
A
SCH- 27826 PDF: SPF- 27826
Sheet
3
of
4
VDD
VPWR
VPWR
I2C1 _SCL
I2C1 _SCL
I2C1 _SDA
I 2C1_SDA
R313
0
2
VDD
A
A
IR interface
D351
WP7 104LSRD
C
A
R342
390
D352
WP7 104LSRD
C
A
kVAr h_LED
J301
C3 01
2 .2UF
D301
MMSD414 8T1G
D302
MMSD41 48T1G
C
R306
470
1
3
5
7
9
2
4
6
8
10
R343
1.0K
R321
10.0K
USER_L ED
D303
MMSD41 48T1G
A
HSMS- C170
UART3 _RXD_IR
R322
1.0K
1
C
1
D35 3
C
VPWR
HDR_2X5
4
R341
390
k Wh _LED
A
2
Q3 21
OP506B
2
C321
2200pF
U303
SFH610 6-4
UART3 _TXD_IR
3
VPWR
LCD_0
LCD_1
LCD_2
LCD_3
LCD_4
LCD_5
LCD_6
LCD_7
LCD_8
LCD_9
LCD_10
LCD_11
LCD_12
LCD_13
LCD_14
LCD_15
LCD_16
LCD_17
LCD_18
LCD_19
LCD_20
LCD_21
J35 0
1
3
5
7
9
11
13
15
17
19
RF_RST
UART1_RTS
UART1_CTS
RF_I O
2
4
6
8
10
12
14
16
18
20
Tampers conection and switch
LCD
RF MC1323x-IPB Connector
C351
0.1UF
UART1_TXD
UART1_RXD
I 2C1_SDA
I 2C1_SCL
RF_CTRL
CON_2X1 0
P opulate J350 on the bot tom laye r
b elow LCD accord ingly to the siz e
o f the MC 1322X-I PB board .
Magnetic Field Tamper sensor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
R361
1.0M
DS300
LK- LCD-REV2
S3/ S7/ S15 /S16
S1/ S4/ S8/ S12
S5/ S9/ S11 /S13
S2/ S6/ S10 /S14
15D/15 E/1 5F/1 5A
RMS/ 15C/15G/ 15B
S35 /S1 8/S17/S19
10D/10 E/1 0F/1 0A
P4/ 10C/10 G/ 10B
11D/11 E/1 1F/1 1A
P5/ 11C/11 G/ 11B
12D/12 E/1 2F/1 2A
P6/ 12C/12 G/ 12B
13D/13 E/1 3F/1 3A
P7/ 13C/13 G/ 13B
14D/14 E/1 4F/1 4A
T1/14 C/14G/14 B
1D/1E/1F/1A
T2/1C/ 1G/1B
S20 /S2 1/S22/S23
S27 /S2 4/S25/S26
2D/2E/2F/2A
COM4
COM3
COM2
COM1
S31/S39/ S30/ S28
S3 2/9C/9 G/9B
9 D/9E/9F/9A
S3 3/8C/8 G/8B
8 D/8E/8F/8A
S3 4/7C/7 G/7B
7 D/7E/7F/7A
S37/S38/ S39/ S40
L3/ L2/L1/ S36
P3/6C/6 G/6B
6 D/6E/6F/6A
P2/5C/5 G/5B
5 D/5E/5F/5A
T4/4C/4 G/4B
4 D/4E/4F/4A
P1/3C/3 G/3B
3 D/3E/3F/3A
T3/2C/2 G/2B
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
LCD_43
LCD_42
LCD_41
LCD_40
LCD_39
LCD_38
LCD_37
LCD_36
LCD_35
LCD_34
LCD_33
LCD_32
LCD_31
LCD_30
LCD_29
LCD_28
LCD_27
LCD_26
LCD_25
LCD_24
LCD_23
LCD_22
VDD
R371
220K
R362
10K
TAMPER0
1
2
C361
220 0pF
VDD
J 361
CON TB 2
R3 72
1 0K
USER_BTN
DNP
1
4
D32 1
TSAL4400
CON TB 2
DNP
2
1
J302
SW371
TL3 301AF160QG
R363
1.0M
VDD
C371
0. 1UF
R364
10K
TAMPER1
C362
220 0pF
1
2
J 362
CON TB 2
3
2
1
VPWR
R323
680
A
2
C
R307
390
PULSE_OUT
DNP
4kB I2C EEPROM
2
C383
0.1UF
C384
0.1UF
VDDI O
VDD
C382
0. 1UF
U38 1
SCL
SDA
NC
INT1
7
6
I 2C1_SCL
I 2C1_SDA
9
GND2
C381
1. 0UF
GND1
3
CAP_A
CAP_R
5
1
4
8
VDD
10
Freescale Semiconductor, Inc.
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
SFH610 6-4
U302
3
UART3 _RXD_RS2 32
UART3_TXD_ IR
4
R305
4.7K
R304
1.0K
LED outputs
UART3_RXD_I R
UART3_TXD_ RS232
R314
0
DNP
UART3_TXD
3
1
VPWR
UART3_RXD_RS232
R312
0
DNP
UART3_RXD
U301
SFH610 6-4
C
UART3 _TXD_RS232
R302
390
R311
0
USART
selector
RS232 and Pulse output
4
36
VDD
C385
0.1UF
1
2
3
4
U3 91
A0
VCC
A1
WP
A2
SCL
GND SDA
AT24C32D
8
7
6
5
VDD
I 2C1_SCL
I 2C1_SDA
Automotive, Industrial & Multimarket Solutions Group
6501 William Cannon Drive West
Au stin, TX7873 5-8598
C3 91
0 .1UF
This doc ument cont ains inf ormation p ropriet ary to Fre escale and sh all not be used f or en gineering design,
procur emen t or manu fac ture in wh ole or in par t wit hout the express wr itten permis sion of Freesc ale.
ICAP Classif c
i ation:
MAG3110
Figure A-3. Schematic diagram 03_DIGITAL
FCP: _ ___
Designer :
Lukas Va culik
Drawing Title:
Drawn by :
Lukas Va culik
Page Title:
Ap prov ed:
Pa vel L ajsner
Size
C
Docume nt Number
Date:
Thursda y, Decemb er 05 , 2013
FIUO: X
PUBI : ____
3P ME T- KM34Z128
03_Digital
Rev
A
SCH- 27826 PDF: SPF-27 826
She et
4
of
4
Board layout
Appendix B
Board layout
Figure B-1. Top side view
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
37
Board layout
Figure B-2. Bottom side view
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
38
Freescale Semiconductor, Inc.
Bill of materials
Appendix C
Bill of materials
Table C-1. provides the Bill of Material report.
Table C-1. BOM report
Part Reference
Quantity
Value
Description
Manufacturer
Part Number
BT20
1
BATTERY
BATTERY HOLDER
CR2032 3V ROHS
COMPLIANT
C1,C2,C3,C4,C5,C6,C7,C8
,C9,C10,C11,C12,C13,C28
1,C282,C371
16
0.1UF
CAP CER 0.1UF 25V
10% X7R 0805
SMEC
MCCC104K2NRTF
C17,C18
2
18PF
CAP CER 18PF 100V 5%
C0G 0805
KEMET
C0805C180J1GACTU
C20,C21,C22,C23,C24,C2
5
6
10UF
CAP CER 10UF 16V 10%
X5R 0805
AVX
0805YD106KAT2A
C26,C27,C28,C29,C30,C3
1
6
1uF
CAP CER 1UF 50V 10%
X7R 0805
SMEC
MCCE105K2NRTF
C90,C91
2
4.7uF
CAP ALEL 4.7uF 400V
20% -- SMT
C92
1
0.1uF
CAP CER 0.10UF 50V
5% X7R 0805
SMEC
MCCE104J2NRTF
C93
1
22uF
CAP CER 22UF 16V 10%
X5R 0805
TDK
C2012X5R1C226K
C94
1
100UF
CAP CER 100UF 6.3V
20% X5R 1206
Murata
GRM31CR60J107ME39L
C201,C211,C221,C241,C2
42,C251,C252,C261,C262
9
0.01UF
CAP CER 0.01UF 100V
5% X7R 0805
KEMET
C0805C103J1RACTU
C231,C232
2
0.047UF
CAP CER 0.047UF 50V
5% X7R 0805
KEMET
C0805C473J5RAC
C271,C272,C273
3
1000pF
CAP CER 1000pF 1000V
10% X7R 0805
Kemet
C0805C102KDRACTU
C301
1
2.2UF
CAP CER 2.2UF 10V
10% X5R 0805
AVX
C321,C361,C362
3
2200pF
CAP CER 2200PF 25V
10% X7R CC0805
C351,C382,C383,C384,C3
85,C391
6
0.1UF
CAP CER 0.10UF 25V
10% X7R 0603
KEMET
C0603C104K3RAC
C381
1
1.0UF
CAP CER 1.0UF 10V
10% X7R 0805
SMEC
MCCB105K2NRTF
DS300
1
LK-LCD-REV2
D20,D301,D302,D303
4
MMSD4148T1G
DIODE SW 100V
SOD-123
D21
1
BAT54CLT1
DIODE SCH DUAL CC
200MA 30V SOT23
ON
BAT54CLT1G
SEMICONDUCTOR
D90,D91,D92,D94
4
MRA4007T3G
DIODE PWR RECT 1A
1000V SMT 403D-02
ON
MRA4007T3G
SEMICONDUCTOR
D95
1
ES1JL
DIODE RECT 1A 600V
SMT
TAIWAN
ES1JL
SEMICONDUCTOR
RENATA BATTERIES SMTU2032-LF
NIC COMPONENTS NACV4R7M400V10x10.8TR13F
CORP
0805ZD225KAT2A
VENKEL COMPANY C0805X7R250-222KNE
LCD 3-PHASE POWER AR-ELEKTRONIK SRL LK-LCD-REV2
METER
ON
MMSD4148T1G
SEMICONDUCTOR
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
39
Bill of materials
Table C-1. BOM report (continued)
Part Reference
Quantity
Value
Description
Manufacturer
Part Number
D201,D211,D221
3
BAV99LT1
DIODE DUAL SW 215MA
70V SOT23
D321
1
TSAL4400
LED IR SGL 100MA TH
D351,D352
2
WP7104LSRD
LED RED SGL 30mA TH
Kingbright
D353
1
HSMS-C170
LED HER SGL 2.1V
20MA 0805
AVAGO
TECHNOLOGIES
JP1,JP2,JP3,JP4,JP5,JP6
6
HDR 1X1
HDR 1X1 TH -- 330H SN
115L
SAMTEC
TSW-101-23-T-S
J1
1
HDR 2X5
HDR 2X5 SMT 1.27MM
CTR 175H AU
SAMTEC
FTS-105-01-F-DV-P-TR
J20,J21,J22
3
HDR_1X2
HDR 1X2 SMT 100MIL
SP 380H AU
SAMTEC
TSM-102-01-SM-SV-P-TR
J201,J211,J221,J231,J241,
J251,J261,J302,J361,J362
10
CON TB 2
J301
1
HDR_2X5
HDR 2X5 SMT 100MIL
CTR 380H AU
SAMTEC
TSM-105-01-S-DV-P-TR
J350
1
CON_2X10
CON 2X10 SKT SMT
100MIL CTR 390H AU
SAMTEC
SSW-110-22-F-D-VS-N
L20,L21
2
1uH
IND CHIP 1UH@10MHZ
220MA 25%
TDK
MLZ2012A1R0PT
L90,L91
2
1500uH
IND PWR
1500UH@100KHZ
130MA 20% SMT
Coilcraft
LPS6235-155ML
Q321
1
OP506B
TRAN PHOTO NPN
250mA 30V TH
RV201,RV211,RV221
3
20S0271
RES VARISTOR
275VRMS 10% 4.5kA
151J TH
epcos
B72220S0271K101
R1,R3,R4,R7,R8,R9,R10
7
4.7K
RES MF 4.70K 1/10W
1% 0805
SMEC
RC73L2A4701FTF
R2
1
820
RES MF 820 OHM 1/8W
5% 0805
BOURNS
R5,R311,R313
3
0
RES MF ZERO OHM
1/8W -- 0805
YAGEO AMERICA
RC0805JR-070RL
R6,R312,R314
3
0
RES MF ZERO OHM
1/8W -- 0805
YAGEO AMERICA
RC0805JR-070RL
R20
1
45.3K
RES MF 45.3K 1/8W 1%
0805
BOURNS
R21
1
23.7K
RES MF 23.7K 1/10W
1% 0603
KOA SPEER
R90,R91,R92
3
8.2
RES MF 8.2 OHM 2W
10% AXL
WELWYN
COMPONENTS
LIMITED
R93
1
2.0K
RES MF 2.00K 1/10W
1% 0805
SPC TECHNOLOGY MC0805WAF2001T5E-TR
R94
1
3.0K
RES MF 3.00K 1/10W
1% 0805
SPC TECHNOLOGY MC0805WAF3001T5E-TR
ON
BAV99LT1G
SEMICONDUCTOR
VISHAY
TSAL4400
INTERTECHNOLOGY
WP7104LSRD
HSMS-C170
CON 1X2 TB TH 200MIL PHOENIX CONTACT 1711725
SP 709H - 197L
OPTEK
OP506B
TECHNOLOGY INC
CR0805-JW-821ELF
CR0805-FX-4532ELF
RK73H1JTTD2372F
EMC2-8R2K
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
40
Freescale Semiconductor, Inc.
Bill of materials
Table C-1. BOM report (continued)
Part Reference
Quantity
Value
Description
R96
1
1.6K
RES TF 1.6K 1/8W 5%
0805
R201,R202,R211,R212,
R221,R222
6
220K
RES MF 220K 1/4W 1%
50ppm MELF0204
WELWYN
COMPONENTS
LIMITED
WRM0204C-220KFI
R203,R204,R213,R214,
R223,R224
6
100K
RES MF 100K 1/4W 1%
MELF0204
WELWYN
COMPONENTS
LIMITED
WRM0204C-100KFI
R205,R215,R225
3
1k
RES MF 1K 200V 0.1%
15PPM MELF0204
WELWYN
COMPONENTS
LIMITED
WRM0204Y-1KBI
R206,R216,R226
3
1k
RES MF 1K 200V 0.1%
15PPM MELF0204
WELWYN
COMPONENTS
LIMITED
WRM0204Y-1KBI
R207,R217,R227
3
47
RES MF 47 OHM 1/8W
1% 0805
YAGEO AMERICA
232273464709L
R231,R232,R241,R242,
R251,R252,R261,R262
8
4.7
RES MF 4.7 OHM 1/4W
VISHAY
MMA02040C4708FB300
1% MELF0204
INTERTECHNOLOGY
R233,R234,R243,R244,
R253,R254,R264,R265
8
22
RES MF 22 OHM 1/8W
1% 0805
R271,R272,R273,R281,
R282,R362,R364,R372
8
10K
RES MF 10K 1/8W 5%
0805
R302,R307
2
390
RES MF 390 OHM 1/8W
5% 0805
BOURNS
CR0805-JW-391ELF
R304,R322,R343
3
1.0K
RES MF 1.00K 1/8W 1%
0805
KOA SPEER
RK73H2ATTD1001F
R305
1
4.7K
RES MF 4.70K 1/8W 1%
0805
BOURNS
CR0805-FX-4701ELF
R306
1
470
RES MF 470 OHM 1/8W
0.5% 0805
KOA SPEER
RK73H2ATTD4700D
R321
1
10.0K
RES MF 10.0K 1/8W 1%
0805
VENKEL COMPANY CR0805-8W-1002FT
R323
1
680
RES MF 680 OHM 1/8W
5% 0805
VENKEL COMPANY CR0805-8W-681JT
R341,R342
2
390
RES MF 390 OHM 1/10W SPC TECHNOLOGY MC0805WAF3900T5E-TR
1% 0805
R361,R363
2
1.0M
RES MF 1.0M 1/8W 5%
0805
BOURNS
R371
1
220K
RES TF 220K 1/8W 5%
0805
PANASONIC
ERJ6GEYJ224V
SW371
1
E SWITCH
TL6700AF160QG
TP1,TP2,TP3,TP4,TP5,
TP6,TP7,TP8,TP201,
TP211,TP221,TP231,
TP232,TP241,TP242,
TP251,TP252,TP261,
TP262
19
TL6700AF160QG SW SPST PB 50mA 12V
SMT
70 MIL
TEST PAD 70MIL
ROUND SMT; NO PART
TO ORDER
Manufacturer
Part Number
VENKEL COMPANY CR08058W162JT
YAGEO AMERICA
RC0805FR-0722RL
VENKEL COMPANY CR0805-8W-103JT
CR0805-JW-105ELF
—
—
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
Freescale Semiconductor, Inc.
41
Bill of materials
Table C-1. BOM report (continued)
Part Reference
Quantity
Value
Description
Manufacturer
Part Number
U1
1
PKM34Z128CLL5
IC MCU FLASH 128K
16K 50MHZ 1.71-3.6V
LQFP100
U20
1
SPX3819M5-L
IC VREG LDO ADJ
500MA 2.5-16V SOT23-5
Exar
U90
1
LNK302DN
IC VREG LINKSWITCH
65MA/80MA
85–265VAC/700V S0-8C
POWER
INTEGRATIONS
U281
1
LMV321
IC LIN OPAMP 130UA
2.7-5.5V SOT23-5
U301,U302,U303
3
SFH6106-4
IC OPTOCOUPLER
100MA 70V SMD
U381
1
MAG3110
IC 3-AXIS DIGITAL
MAGNETOMETER
1.95-3.6V DFN10
U391
1
AT24C32D
IC MEM EEPROM
4096X8 1MHZ 1.8-5.5V
SOIC8
ATMEL
AT24C32D-SSHM-B
Y1
1
32.768 KHz
XTAL 32.768KHZ PAR
20PPM -- SMT
Citizen
CMR200T32.768KDZF-UT
BT20
1
BATTERY
BATTERY HOLDER
CR2032 3V ROHS
COMPLIANT
FREESCALE
PKM34Z128CLL5
SEMICONDUCTOR
SPX3819M5-L
LNK302DN
NATIONAL
LMV321M5NOPB
SEMICONDUCTOR
VISHAY
SFH6106-4
INTERTECHNOLOGY
FREESCALE
MAG3110FC
SEMICONDUCTOR
RENATA BATTERIES SMTU2032-LF
Kinetis-M Three-Phase Power Meter Design Reference Manual, DRM147, Rev. 0
42
Freescale Semiconductor, Inc.
How to Reach Us:
Information in this document is provided solely to enable system and software
Home Page:
freescale.com
implementers to use Freescale products. There are no express or implied copyright
Web Support:
freescale.com/support
information in this document.
licenses granted hereunder to design or fabricate any integrated circuits based on the
Freescale reserves the right to make changes without further notice to any products
herein. Freescale makes no warranty, representation, or guarantee regarding the
suitability of its products for any particular purpose, nor does Freescale assume any
liability arising out of the application or use of any product or circuit, and specifically
disclaims any and all liability, including without limitation consequential or incidental
damages. “Typical” parameters that may be provided in Freescale data sheets and/or
specifications can and do vary in different applications, and actual performance may
vary over time. All operating parameters, including “typicals,” must be validated for each
customer application by customer’s technical experts. Freescale does not convey any
license under its patent rights nor the rights of others. Freescale sells products pursuant
to standard terms and conditions of sale, which can be found at the following address:
freescale.com/SalesTermsandConditions.
Freescale, the Freescale logo, and Kinetis are trademarks of Freescale Semiconductor,
Inc., Reg. U.S. Pat. & Tm. Off. All other product or service names are the property of
their respective owners. ARM and Cortex are the registered trademarks of ARM
Limited.
© 2014 Freescale Semiconductor, Inc.
Document Number: DRM147
Rev. 0
08/2014