Vous êtes sur la page 1sur 43

Application Report

SLAA577G January 2013 Revised August 2015

Implementation of a Three-Phase Electronic Watt-Hour


Meter Using the MSP430F677x(A)

Mekre Mesganaw and Kripasagar Venkat ................................................................. Metering Applications

ABSTRACT
This application report describes the implementation of a three-phase electronic electricity meter using the
Texas Instruments MSP430F677x(A) metering processor. This application report includes the necessary
information with regard to metrology software, hardware procedures for this single-chip implementation.
The MSP430F677x source code that is described in this application report can be downloaded from
http://www.ti.com/lit/zip/slaa577.
The MSP430F677xA source code can be downloaded from http://www.ti.com/tool/TIDM-
THREEPHASEMETER-F6779.

WARNING
Failure to adhere to these steps and/or not heed the safety
requirements at each step may lead to shock, injury, and damage
to the hardware.

Contents
1 Introduction ................................................................................................................... 2
2 System Diagrams ............................................................................................................ 3
3 Hardware Implementation .................................................................................................. 5
4 Software Implementation ................................................................................................... 7
5 Energy Meter Demo........................................................................................................ 18
6 Results and Calibration .................................................................................................... 27
7 Schematics .................................................................................................................. 37

List of Figures
1 Typical Per-Phase Connections Inside an Electronic Meter ........................................................... 3
2 3-Phase 4-Wire Star Connection Using MSP430F677x(A) ............................................................ 4
3 Simple Capacitive Power Supply for the MSP430 Energy Meter ..................................................... 5
4 Switching-Based Power Supply for the MSP430 Energy Meter ....................................................... 6
5 Analog Front End for Voltage Inputs ...................................................................................... 6
6 Analog Front End for Current Inputs ...................................................................................... 7
7 Foreground Process ......................................................................................................... 8
8 Background Process ....................................................................................................... 12
9 Phase Compensation Using PRELOAD Register ...................................................................... 13
10 Frequency Measurement .................................................................................................. 14
11 Pulse Generation for Energy Indication ................................................................................. 15
12 Top View of the Three Phase Energy Meter EVM ..................................................................... 18
13 Top View of the EVM With Components Highlighted.................................................................. 19

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 1
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Introduction www.ti.com

14 Top View of the EVM With Test Setup Connections .................................................................. 21


15 Front View of the EVM With Test Setup Connections ................................................................. 21
16 Source Folder Structure ................................................................................................... 25
17 Toolkit Compilation in IAR................................................................................................. 25
18 Metrology Project Build in IAR ............................................................................................ 25
19 LCD Display ................................................................................................................. 28
20 ZigBee Radio ............................................................................................................... 28
21 TI Designed IHD430 ....................................................................................................... 29
22 GUI Config File Changed to Communicate With Meter ............................................................... 30
23 GUI Startup Window ....................................................................................................... 30
24 Results Window ............................................................................................................ 31
25 Calibration Factors Window ............................................................................................... 32
26 Manual Calibration Window ............................................................................................... 32
27 Calibration Factors Window ............................................................................................... 34
28 Meter Features Window ................................................................................................... 34
29 Energy Measurement Error Across Current With Customized CTs on EVM430-F6779 .......................... 35
30 Energy Measurement Error Across Current With High-End CTs .................................................... 36
31 Schematics (1 of 4) ........................................................................................................ 37
32 Schematics (2 of 4) ........................................................................................................ 38
33 Schematics (3 of 4) ........................................................................................................ 39
34 Schematics (4 of 4) ........................................................................................................ 40

List of Tables
1 Header Names and Jumper Settings on the F677x(A) EVM ......................................................... 22
2 Displayed Parameters ..................................................................................................... 27
3 Energy Measurement Error With Customized CTs on EVM430-F6779 (%)........................................ 35
4 Energy Measurement Error With High-End CTs (%) .................................................................. 36

1 Introduction
The MSP430F677x(A) devices are the latest metering system-on-chip (SoC) that belongs to the
MSP430F67xx family of devices. This family of devices belongs to the powerful 16-bit MSP430F6xx
platform, which brings in many new features and provides flexibility to support robust poly-phase
metrology solutions. These devices find their application in energy measurement and have the necessary
architecture to support them.
The F677x(A) has a powerful 25-MHz CPU with MSP430CPUX architecture. The analog front-end
consists of up to seven independent 24-bit analog to digital converters (ADC) based on a second-order
sigma-delta architecture that supports differential inputs. The sigma-delta ADCs (SD24_B) operate
independently and are capable of 24-bit results. They can be grouped together for simultaneous sampling
of voltages and currents on the same trigger. In addition, it also has an integrated gain stage to support
gains up to 128 for amplification of low-output current sensors. A 32-bit x 32-bit hardware multiplier on this
chip can be used to further accelerate math intensive operations during energy computation. The software
energy library supports calculation of various parameters for up to three-phase energy measurement. The
key parameters calculated during energy measurements are: RMS current and voltage, active and
reactive power and energies, power factor, and frequency. The library also provides the option to obtain
raw samples of voltages and currents for advanced metering data such as harmonic analysis and total
harmonic distortion (THD).
Complete metrology source code is provided. The MSP430F677x-based software can be downloaded
from http://www.ti.com/lit/zip/slaa577. The MSP430F677xA-based software can be downloaded from
http://www.ti.com/tool/TIDM-3PHMTR-TAMP-ESD.
MSP430 is a trademark of Texas Instruments.
ZigBee is a trademark of ZigBee Alliance.
All other trademarks are the property of their respective owners.

2 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com System Diagrams

2 System Diagrams
Figure 1 shows typical connections for one-phase electronic electricity (energy/e-) meters in real life
applications. For poly-phase meters, the connection in Figure 1 is duplicated for each phase. The ac
voltages supported are 120 V/230 V at 50/60 Hz with the associated currents. The labels Line (L) and
Neutral (N) are interchangeable and are indicative of ac mains voltage source from the energy utilities.

Figure 1. Typical Per-Phase Connections Inside an Electronic Meter

The following sections provide more information on the current and voltage sensors, ADCs, and other
features.
Figure 2 shows a block diagram of the high level interface used for a three-phase energy meter
application using the F677x(A). A three-phase four-wire star connection to the ac mains is shown in this
case. Current sensors are connected to each of the current channels and a simple voltage divider is used
for corresponding voltages. The CT has an associated burden resistor that must be connected at all times
to protect the measuring device. The choice of the CT and the burden resistor is done based on the
manufacturer and current range required for energy measurements. The CTs can be easily replaced by
Rogowski coils with minimal changes to the front-end. The choice of voltage divider resistors for the
voltage channel is selected to ensure the mains voltage is divided down to the normal input ranges that
are valid for the 24. See the MSP430x5xx and MSP430x6xx Family User's Guide (SLAU208) and the
device-specific data sheet for these values.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 3
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
System Diagrams www.ti.com

Load A +
B

C
-

se
TOTAL kWh
Phase A a
Ph
VCC MSP430F677x(A) Sx,
Neutral
Ph

RST COMx
a
se

VSS LCDCAP
R33
B

+
CT I 6' Modulator
A - Px.x STATUS LEDs

+
CT I 6' Modulator
B
-

+ PULSE LEDs
I Px.y
CT 6' Modulator
C -

24
I 6' Modulator
CT N
- XIN
V 32768 Hz
A
+ XOUT
V 6' Modulator
N -
V USCIA0 UART or SPI
B +
USCIA1 UART or SPI
V 6' Modulator
N - USCIA2 UART or SPI
V USCIA3 UART or SPI
C
+
V
N
6' Modulator USCIB0 I2C or SPI
-
USCIB1 I2C or SPI
Neutral

Vref
B
e
as
Ph
Ph

Phase A
a
se
C

Source From Utility


Figure 2. 3-Phase 4-Wire Star Connection Using MSP430F677x(A)

Other signals of interest in Figure 2 are the PULSE LEDS. They are used to transmit active and reactive
energy pulses used for accuracy measurement and calibration. In addition, the pulses are used to transmit
the active power consumed for each individual phase.

4 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Hardware Implementation

3 Hardware Implementation
This section describes the hardware for the design of a working 3-phase energy meter that uses the
F677x(A).

3.1 Power Supply


The MSP430 family of devices comprises ultralow-power microcontrollers from Texas Instruments.
These devices support a number of low-power modes and also have low-power consumption during active
mode when the CPU and other peripherals are active. The low-power feature of this device family allows
design of the power supply to be simple and inexpensive. The power supply allows the operation of the
energy meter powered directly from the mains. The next sections describe the various power supply
options that are available to users to support their design.

3.1.1 Resistor Capacitor (RC) Power Supply


Figure 3 shows a capacitor power supply that provides a single output voltage of 3.3 V directly from the
mains of 120/230 V RMS ac at 50/60 Hz.

0.1uF
C47
1mH
VCC_PL
L7
P1+1 C39
0.22uF/305VAC R92 U3
D18 C62
1N4007 Vsupply TPS54060_DGQ_10

B160

51.1
R96
100

D23
47uF
P2+1 0.22uF/305VAC C46 R93 D20 1 10
BOOT PH
100 1N4007 2 VIN GND 9
C50 3 EN COMP 8
P3+1 0.22uF/305VAC R94 D22 4 7
100uF/100V

SS/TR VSENSE NEUTRAL


100 D21 1N4007 5 RT/CLK PWRGD 6

22.1k
R95
1N4757A
C102

C48
+

R35
1M

1N4757A D19
2.2uF

31.6k
D17
R38

R97
1N4757A
1M

C45
33.2K

NEUTRAL C60 C61


R37

NEUTRAL 0.01uF
.056uF 100pF

NEUTRAL
NEUTRAL

R98
10k
R39
0
NEUTRAL DGND

Figure 3. Simple Capacitive Power Supply for the MSP430 Energy Meter

Appropriate values of resistors (R92, R93, and R94) and capacitors (C39, C46, and C50) are chosen
based on the required output current drive of the power supply. Voltage from mains is directly fed to a RC
based circuit followed by a rectification circuit to provide a dc voltage for the operation of the MSP430.
This dc voltage is regulated to 3.3 V for full-speed operation of the MSP430. The design equations for the
power supply are given in the application report Improved Load Current Capability for Cap-Drop Off-Line
Power Supply for E-Meter (SLVA491). The above configuration allows all three phases to contribute to the
current drive, which is approximately three times the drive available from only one phase. If even higher
output drive is required, the same circuitry can be used followed by an NPN output buffer. Another option
would be to replace the above circuitry with a transformer-based or switching-based power supply.

3.1.2 Switching Power Supply


Figure 4 shows a switching-based power supply that provides a single output voltage of 3.3 V directly from
the ac mains at 100 V to 230 V RMS. In the configuration shown, the meter is powered as long as there is
ac voltage on Phase C, corresponding to pad LINE 3 on the hardware and P3+1 on the schematic. The
internal circuitry of a switching power supply is omitted from this application report. For the drive of the
power supply, refer to the documentation of the power supply module.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 5
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Hardware Implementation www.ti.com

P3+1 L 26
L 26

N N
C100 4.7u/400V
22 22
NEUTRAL

VO+ VO+ VCC_ISO

0.1uF
150uF
C101

C42
+

ZD3
SMAJ5.0ABCT
NC NC VO- VO- DGND

Figure 4. Switching-Based Power Supply for the MSP430 Energy Meter

3.2 Analog Inputs


The MSP430 analog front end, which consists of the ADC, is differential and requires that the input
voltages at the pins do not exceed 930 mV (gain = 1). To meet this specification, the current and voltage
inputs must be divided down. In addition, the 24 allows a maximum negative voltage of -1 V. Therefore,
ac signals from mains can be directly interfaced without the need for level shifters. This section describes
the analog front end used for voltage and current channels.

3.2.1 Voltage Inputs


The voltage from the mains is usually 230 V or 120 V and must be brought down to a range of 930 mV.
The analog front end for voltage consists of spike protection varistors followed by a simple voltage divider
and a RC low-pass filter that acts like an anti-alias filter.
LINE3 L5 P3+1 R11 R12 R13 R18 V3+
S20K275

LINE3 EXCML20A 330k 330k 330k 1k


C3 C12
R3

2.37K

47p
R19

V3 15n

AGND
L6 R34 V3-
N3
NEUTRAL EXCML20A 1k
C13
AGND
47p

AGND
Figure 5. Analog Front End for Voltage Inputs

Figure 5 shows the analog front end for the voltage inputs for a mains voltage of 230 V. The voltage is
brought down to approximately 549 mV RMS, which is 779 mV peak, and fed to the positive input. This
voltage is within the MSP430 analog limits by a safety margin greater than 15%. This margin allows
accurate measurements even during voltage spike conditions.

3.2.2 Current Inputs


The analog front-end for current inputs is slightly different from the analog front end for the voltage inputs.
Figure 6 shows the analog front end used for a current channel.

6 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

AVCC

D47
I1+1 D44 0 1k
CUR1+ CUR1+ I1+
R/L1 R105

D45

SMAJ5.0CA
C64

R104
TVS5
AGND C66
47p

13
D48
AVCC D49 15n

D46
AGND
I1-1 0 1k
CUR1- CUR1- I1-
R/L2 R106

D51
C65
AGND
D50 47p
AGND
AGND

Figure 6. Analog Front End for Current Inputs

Resistor R104 is the burden resistor that is selected based on the current range used and the turns ratio
specification of the CT. The value of the burden resistor for this design is approximately 13 . The
antialiasing circuitry, which consists of resistors and capacitors, follows the burden resistor. The input
signal to the converter is a fully differential input with a voltage swing of 919 mV maximum when the gain
of the converter is set to 1.

4 Software Implementation
The software for the implementation of 3-phase metrology is described in this section. The Section 4.1
describes the setup of various peripherals of the MSP430. Next, the entire metrology software is
described as two major processes: the foreground process (see Section 4.2) and background process
(see Section 4.3).

4.1 Peripherals Setup


The major peripherals are the 24-bit sigma delta (SD24_B) ADC, clock system, timer, LCD, and watchdog
timer (WDT).

4.1.1 24 Setup
The F677x(A) family has up to seven independent sigma delta data converters. For a three-phase system,
at least six s are necessary to independently measure three voltages and currents. The code that
accompanies this application report is designed for the metrology of a 3-phase system with limited anti-
tampering features. However, the code supports the measurement of the neutral current. The clock to the
24 (fM) is derived from system clock, which is configured to run at 16 MHz. The sampling frequency is
defined as fs = fM/OSR, the OSR is chosen to be 256 and the modulation frequency fM, is chosen as
1.048576 MHz, resulting in a sampling frequency of 4.096 ksps. The 24s are configured to generate
regular interrupts every sampling instance.
The following are the channels associations:
A0.0+ and A0.0- Voltage V1
A1.0+ and A1.0- Voltage V2
A2.0+ and A2.0- Voltage V3
A4.0+ and A4.0- Current I1
A5.0+ and A5.0- Current I2
A6.0+ and A6.0- Current I3
Optional neutral channel can be processed via channel A3.0+ and A3.0-.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 7
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Software Implementation www.ti.com

4.1.2 Real-Time Clock (RTC_C)


The RTC_C is a real-time clock module that is configured to give precise 1 second interrupts. Based on
these 1second interrupts, the time and date are updated in software, as necessary.

4.1.3 LCD Controller


The LCD controller on the MSP430F677x(A) can support up to 8-mux displays and 320 segments. It is
also equipped with an internal charge pump that can be used for good contrast. In the current design, the
LCD controller is configured to work in 4-mux mode using 160 segments with a refresh rate set to
ACLK/64, which is 512 Hz. For information, about the parameters that are displayed on the LCD, see
Section 6.1.

4.2 Foreground Process


The foreground process includes the initial setup of the MSP430 hardware and software immediately after
a device RESET. Figure 7 shows the flowchart for this process

RESET

HW setup:
Clock, SD24_B, Port pins,
RTC_C, eUSCI, LCD

1 second of Energy
accumulated? Wait for
acknowledgement from N
Background process

Calculate RMS Current, RMS


Voltage, Active Power, Apparent
Power, Reactive Power,
Frequency(Hz), and Power
Factor

LCD Display Management

Send Cumulative Three-Phase


Total Active Power to ZigBee
Transmitter (OPTIONAL)

Figure 7. Foreground Process

The initialization routines involve the setup of the analog to digital converter, clock system, general
purpose input/output (port) pins, RTC module for clock functionality, LCD, and the USCI_A0 for UART
functionality. In addition, if ZigBee communication is enabled, USCI_A3 is configured.

8 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

After the hardware is setup, the foreground process waits for the background process to notify it to
calculate new metering parameters. This notification is done through a status flag every time a frame of
data is available for processing. The data frame consists of processed current, voltage, active energy, and
reactive energy accumulated for one second. This is equivalent to accumulation of 50 or 60 cycles of data
synchronized to the incoming voltage signal. In addition, a sample counter keeps track of how many
samples have been accumulated over this frame period. This count can vary as the software synchronizes
with the incoming mains frequency.
The set of data samples consists of processed current, voltage, active energy, and reactive energy.
Processed voltages are accumulated in 48-bit registers. In contrast, processed currents, active energies,
and reactive energies are accumulated in separate 64-bit registers to further process and obtain the RMS
and mean values. Using the foreground's calculated values of active and reactive power, the apparent
power is calculated. The frequency (in Hertz) and power factor are also calculated using parameters
calculated by the background process using the formulas in Section 4.2.1.

4.2.1 Computation Formulas


This section briefly describes the formulas used for the voltage, current, and energy calculations.

4.2.1.1 Voltage and Current


As described in the previous sections, simultaneous voltage and current samples are obtained from seven
independent converters at a sampling rate of 4096 Hz. All of the samples that are taken in 1 second
are kept and used to obtain the RMS values for voltage and current for each phase. The RMS values are
obtained by the following formulas:
Sample
count
v ph (n) * v ph (n)
n =1
VRMS , ph = K v, ph *
Sample count

Sample
count
i ph (n) * i ph (n)
n =1
I RMS , ph = Ki , ph *
Sample count (1)
Where,
ph = Phase whose parameters are being calculated [that is, Phase A(=1), B(=2), or C(=3)]
vph(n) = Voltage sample at a sample instant n
iph(n) = Each current sample at a sample instant n
Sample count = Number of samples in one second
Kv,ph = Scaling factor for voltage
Ki,ph = Scaling factor for each current

4.2.1.2 Power and Energy


Power and energy are calculated for one frame's worth of active and reactive energy samples. These
samples are phase corrected and passed on to the foreground process, which uses the number of
samples (sample count) to calculate phase active and reactive powers by the formulas in Equation 2.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 9
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Software Implementation www.ti.com

Sample
count
v(n) i ph (n)
n =1
PACT , ph = K ACT , ph
Sample count

Sample
count
v90 (n) i ph (n)
n =1
PREACT , ph = K REACT , ph
Sample count (2)
Where,
v90,ph (n) = Voltage sample at a sample instant n shifted by 90 degrees, and
KACT,ph = Scaling factor for active power
KREACT,ph = Scaling factor for reactive power
Active energy is calculated from the active power by Equation 3.
E ACT , ph = PACT , ph SampleCount
EREACT , ph = PREACT , ph SampleCount (3)
For reactive energy, the 90 phase shift approach is used for two reasons:
1. It allows accurate measurement of the reactive power for very small currents.
2. It conforms to the international specified measurement method.
The calculated mains frequency is used to calculate the 90 degrees-shifted voltage sample. Because the
frequency of the mains varies, it is important to first measure the mains frequency accurately to phase
shift the voltage samples accordingly (see Section 4.3.3).
To get an exact 90 phase shift, interpolation is used between two samples. For these two samples, a
voltage sample slightly more than 90 degrees before the current sample and a voltage sample slightly less
than 90 degrees before the current sample are used. The application's phase shift implementation
consists of an integer part and a fractional part. The integer part is realized by providing an N samples
delay. The fractional part is realized by a one-tap FIR filter. In the software, a lookup table provides the
filter coefficients that are used to create the fractional delays.
After calculating the active and reactive power, each phase's apparent power is calculated by the following
formula:
PAPP, ph = PACT , ph 2 + PREACT , ph 2
(4)
In addition to calculating the per-phase active and reactive power and energy, the cumulative sum of
these parameters are calculated by .
3
PACT , Cumulative = PACT , ph
ph =1

3
PREACT , Cumulative = PREACT , ph
ph =1
3
E ACT, Cumulative = E ACT,ph
ph=1

3
EREACT, Cumulative = EREACT,ph
ph-1

10 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

4.2.1.3 Frequency (Hz)


The background process calculates the frequency in terms of samples per mains cycle. The foreground
process then converts this to Hertz by Equation 5.
Sampling Rate (samples / second)
Frequency (Hz) =
Frequency (samples / cycle) (5)

4.2.1.4 Power Factor


After the active power and apparent power have been calculated, the absolute value of the power factor is
calculated. In the meter's internal representation of power factor, a positive power factor corresponds to a
capacitive load and a negative power factor corresponds to an inductive load. The sign of the internal
representation of power factor is determined by whether the current leads or lags voltage, which is
determined in the background process. Therefore, the internal representation of power factor is calculated
by the following formula:
PAct
P ,if capacitive load
Apparent
Internal Representation of Power Factor =
- PAct ,if inducitive load
PApparent
(6)

4.3 Background Process


The background process uses the interrupt as a trigger to collect voltage and current samples (seven
values in total). These samples are used to calculate intermediate results. Because 16-bit voltage samples
are used, the voltage samples are further processed and accumulated in dedicated 48-bit registers. In
contrast, since 24-bit current samples are used, the current samples are processed and accumulated in
dedicated 64-bit registers. Per-phase active power and reactive power are also accumulated in 64-bit
registers.
The background function deals mainly with timing critical events in software. After sufficient samples
(approximately one second's worth) have been accumulated, then the foreground function is triggered to
calculate the final values of VRMS, IRMS, active, reactive, and apparent powers, active, reactive, and
apparent energy, frequency, and power factor. The background process is also wholly responsible for the
calculation of energy proportional pulses, frequency (in samples/cycle), and determining current lead and
lag conditions. Figure 8 shows the flow diagram of the background process.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 11
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Software Implementation www.ti.com

SD24_B Interrupts at
4096/second

Read Voltages VA, VB, and VC


Read Currents IA, IB, IC

For each phase:


a. Remove residual DC
b. Accumulate for IRMS and VRMS
c. Accumulate samples for instantaneous Power
d. Calculate frequency in samples per cycle
e. Keep track of whether current lags or leads
voltage

N 1 second of
energy calculated?

Store readings and notify foreground


process

N
All three phases done?

Pulse generation in accordance to


power accumulation
Calculate frequency
Calculate power factor

Return from Interrupt

Figure 8. Background Process

The following sections describe the various elements of electricity measurement in the background
process.

4.3.1 Voltage and Current Signals


The converter has fully differential input architecture and each pin can accept negative inputs;
therefore, no level-shifting is necessary for the incoming ac voltage (unlike single-ended or pseudo-
differential converters).
The output of each is a signed integer and any stray dc or offset value on these s are removed
using a dc tracking filter. Separate dc estimates for all voltages and currents are obtained using the filter
and voltage and current samples, respectively. These estimates are then subtracted from each voltage
and current sample.

12 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

The resulting instantaneous voltage and current samples are used to generate the following intermediate
results:
Accumulated squared values of voltages and currents, which is used for VRMS and IRMS calculations,
respectively.
Accumulated energy samples to calculate active energies.
Accumulated energy samples using current and 90 phase shifted voltage to calculate reactive
energies.
These accumulated values are processed by the foreground process.

4.3.2 Phase Compensation


When a current transformer (CT) is used as a sensor, it introduces additional phase shift on the current
signals. Also, the voltage and current input circuit's passive components may introduce additional phase
shift. The relative phase shift between voltage and current samples must be compensated to ensure
accurate measurements. The converters have programmable delay registers (24PREx) that can be
applied to a particular channel. This built-in feature (PRELOAD) is used to provide the phase
compensation required. Figure 9 shows the use of PRELOAD to delay sampling on a particular channel.

Figure 9. Phase Compensation Using PRELOAD Register

The fractional delay resolution is a function of input frequency (fIN), OSR, and the sampling frequency (fS).
360 o f IN 360 o f IN
Delay resolutionDeg = =
OSR f S fM (7)
In this application, for input frequency of 60 Hz, OSR of 256, and sampling frequency of 4096, the
resolution for every bit in the preload register is approximately 0.02 with a maximum of 5.25 (maximum
of 255 steps). Because the sampling of the seven channels are group triggered, a commonly used method
is to apply 128 steps of delay to all channels and then increase or decrease from this base value. This
allows adding or subtracting a delay time to compensate for phase lead or lag. This puts the practical limit
in the current design to 2.62. When using CTs that provide a larger phase shift than this maximum,
sample delays along with fractional delay must be provided. This phase compensation can also be
modified while the application is running to accommodate temperature drifts in CTs, but conversions on
the must be stopped while changes are made to the phase compensation.

4.3.3 Frequency Measurement and Cycle Tracking


The instantaneous voltage of each phase is accumulated in 48-bit registers. In contrast, the instantaneous
current, active power, and reactive power are accumulated in 64-bit registers. A cycle tracking counter and
sample counter keep track of the number of samples accumulated. When approximately one second's
worth of samples have been accumulated, the background process stores these accumulation registers
and notifies the foreground process to produce the average results such as RMS and power values. Cycle
boundaries are used to trigger the foreground averaging process since it produces very stable results.
For frequency measurements, a straight line interpolation is used between the zero crossing voltage
samples. Figure 10 shows the samples near a zero cross and the process of linear interpolation.
SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 13
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Software Implementation www.ti.com

noise corrupted samples

good samples

linear interpolation

Figure 10. Frequency Measurement

Because noise spikes can also cause errors, the application uses a rate of change check to filter out the
possible erroneous signals and make sure that the two points are interpolated from are genuine zero
crossing points. For example, with two negative samples, a noise spike can make one of them positive,
and therefore, make the negative and positive pair looks as if there is a zero crossing.
The resultant cycle-to-cycle timing goes through a weak low-pass filter to further smooth out cycle-to-cycle
variations. This results in a stable and accurate frequency measurement that is tolerant of noise.

4.3.4 LED Pulse Generation


In electricity meters, the energy consumed is normally measured in fraction of kilowatt-hour (kWh) pulses.
This information can be used to calibrate any meter for accurate measurement. Typically, the measuring
element (the MSP430 microcontroller) is responsible to generate pulses proportional to the energy
consumed. To serve both these tasks efficiently, pulse generation must be accurate with relatively little
jitter. Although, time jitters are not an indication of bad accuracy, they give a negative indication on the
overall accuracy of the meter. Hence the jitter must be averaged out.
This application uses average power to generate these energy pulses. The average power (calculated by
the foreground process) is accumulated every interrupt, thereby spreading the accumulated energy
from the previous 1 second time frame evenly for each interrupt in the current 1 second time frame. This is
equivalent to converting it to energy. When the accumulated energy crosses a threshold, a pulse is
generated. The amount of energy above this threshold is kept and new energy value is added on top of it
in the next interrupt cycle. Because the average power tends to be a stable value, this way of generating
energy pulses are very steady and free of jitter.
The threshold determines the energy "tick" specified by meter manufacturers and is a constant. It is
usually defined in pulses per kWh or just in kWh. One pulse is generated for every energy "tick". For
example, in this application, the number of pulses generated per kWh is set to 6400 for active and reactive
energies. The energy "tick" in this case is 1 kWh/6400. Energy pulses are generated and available on a
header and also via LEDs on the board. General-purpose I/O (port) pins are used to produce the pulses.
In the EVM, the LEDs that are labeled LED1, LED2, LED3, and LED_ACT correspond to the active energy
consumption for phase A, phase B, phase C, and the cumulative three-phase sum, respectively.
LED_REACT corresponds to the cumulative three-phase reactive energy sum. The number of pulses per
kWh and each pulse duration can be configured in software. Figure 11 shows the flow diagram for pulse
generation.

14 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

SD interrupts at
4096 Hz

Energy
Accumulator+=
Average Power

N Energy Accumulator >


1 tick?

Energy Accumulator =
Energy Accumulator
1 tick

Generate 1
pulse

Proceed to other
tasks

Figure 11. Pulse Generation for Energy Indication

The average power is in units of 0.01 W and the 1 kWh threshold is defined as:
1 kWh threshold = (1 / 0.01) 1 kW (number of interrupts per second) (number of seconds in one
hour)
= 100000 4096 3600 = 0x15752A00000

4.4 Energy Meter Configuration


Include files are used to initialize and configure the energy meter to perform several metrology functions.
This section describes the user-configurable options. The file that needs modification is emeter-3ph-
neutral-6779(A).h, which is in the parent directory emeter-ng. This file includes macro definitions that are
used during the normal operation of the meter.
1. IHD430_SUPPORT: This macro allows ZigBee communication to an IHD430 in-home display. A
CC2530 transmitter must be placed in the EVM's RF connector to enable this. For more information,
see Section 6.2.
2. SERIAL_CALIBRATION_SUPPORT: This macro allows the meter to be calibrated using the GUI
provided and RS-232 interface to the PC.
3. MAINS_FREQUENCY_SUPPORT: The macro configures the meter to measure the frequency of the
ac mains.
4. MAINS_NOMINAL_FREQUENCY: The macro defines the default ac mains frequency
5. TOTAL_ENERGY_PULSES_PER_KW_HOUR: This macro defines the total number of pulses per
1 kWh of cumulative three-phase energy. In this application it is defined to 6400. It is important to note
that this value is not a standard. There could be a practical limit set on this number due to the
reference meter's ability to accept fast pulses (due to large currents). This number is true for total three
phase energy only.
6. PHASE_ENERGY_PULSES_PER_KW_HOUR: This macro defined the total number of pulses per
1 kWh of energy at each phase. In this application it is defined to 6400 if pulses generation for each
SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 15
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Software Implementation www.ti.com

individual phase has been enabled.


7. INHIBIT_NEGATIVE_PHASE_POWER_ACCUMULATION: This macro prevents negative energy from
being accumulated at individual phases. Negative energy could be a result of reversed connection at
the voltage or current but not both at any of the phases.
8. INHIBIT_NEGATIVE_TOTAL_POWER_ACCUMULATION: This macro prevents negative energy from
being accumulated for the three phases combined. Negative energy could be a result of reversed
connection at the voltage or current but not both at any of the phases.
9. ENERGY_PULSE_DURATION: This macro defines the duration of the LED ON time for an energy
pulse. This is measured in ADC samples (that is, increments of 1/4096 s). The maximum allowed is
255, giving a pulse of approximately 62.5 ms, while 163 gives a 40-ms pulse. This duration might be
too large with adjacent pulses overlapping when very high currents are measured. It is recommended
that this value be changed to a smaller number such as 20 if overlap is seen at the pulse outputs.
10. RESIDUAL_POWER_CUTOFF: Very low power levels should not be recorded at all, as they might
just be rounding errors, noise, or the consumption of the meter itself. This value is the cutoff level, in
0.01-W increments. In this application, it is set to 250, resulting in a start-energy of approximately
2.5 W.
11. NEUTRAL_MONITOR_SUPPORT: This macro enables support for neutral monitoring. The seventh
SD24_B is used for this purpose.
12. VRMS_SUPPORT: This macro is used to configure the meter to calculate VRMS from the voltage
samples.
13. IRMS_SUPPORT: This macro is used to configure the meter to calculate IRMS from the current
samples.
14. REACTIVE_POWER_SUPPORT: This macro is used to configure the meter to calculate the reactive
power from the voltage and current samples.
15. REACTIVE_POWER_BY_QUADRATURE_SUPPORT: This macro is used to configure the meter to
calculate the reactive power from the delayed voltage samples by 90 degrees and current samples
instead of using the power triangle method.
16. APPARENT_POWER_SUPPORT: This macro is used to configure the meter to calculate the apparent
power.
17. POWER_FACTOR_SUPPORT: This macro is used to configure the meter to calculate the power
factor for both lead and lag. A frequency independent method, based on the ratio of scalar dot
products, is used.
18. TOTAL_ACTIVE_ENERGY_SUPPORT: This macro is used to configure the meter to calculate the
total 3-phase active energy consumption.
19. PER_PHASE_ACTIVE_ENERGY_SUPPORT: This macro is used to configure the meter to calculate
the active energy consumption for individual phases in addition to the total 3-phase active energy.
20. TOTAL_REACTIVE_ENERGY_SUPPORT: This macro is used to configure the meter to calculate the
total 3-phase reactive energy consumption.
21. PER_PHASE_REACTIVE_ENERGY_SUPPORT: This macro is used to configure the meter to
calculate the reactive energy consumption for individual phases in addition to the total 3-phase reactive
energy.
22. RTC_SUPPORT: This macro is used to configure the meter to support a real-time clock. A software
RTC is implemented for this purpose.
23. CURRENT_PHASE_GAIN: This macro defines the gain of the SD24_B's internal programmable gain
amplifier (PGA) for all the three currents. In this application it is set to 1.
24. CURRENT_NEUTRAL_GAIN: This macro defines the gain of the SD24_B's internal PGA for neutral
current monitoring. In this application it is set to 16.
25. VOLTAGE_GAIN: This macro defines the gain of the SD24_B's internal programmable gain amplifier
(PGA) for all the three voltages. In this application it is set to 1.
26. PHASE_REVERSED_DETECTION_SUPPORT: This macro configures the meter to detect reversed
power condition.
27. PHASE_REVERSED_IS_TAMPERING: This macro configures the meter to treat phase reversed
connections as tampering.

16 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Software Implementation

28. DEFAULT_V_RMS_SCALE_FACTOR_A: This macro holds the scaling factor for voltage at phase A.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
29. DEFAULT_V_RMS_SCALE_FACTOR_B: This macro holds the scaling factor for voltage at phase B.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
30. DEFAULT_V_RMS_SCALE_FACTOR_C: This macro holds the scaling factor for voltage at phase C.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
31. DEFAULT_I_RMS_SCALE_FACTOR_A: This macro holds the scaling factor for current at phase A.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
32. DEFAULT_I_RMS_SCALE_FACTOR_B: This macro holds the scaling factor for current at phase B.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
33. DEFAULT_I_RMS_SCALE_FACTOR_C: This macro holds the scaling factor for current at phase C.
Set this factor to an approximately correct value, and it will be fine tuned during calibration.
34. DEFAULT_P_SCALE_FACTOR_A_LOW: This macro holds the scaling factor for active power at
phase A. Set this factor to an approximately correct value, and it will be fine tuned during calibration.
35. DEFAULT_P_SCALE_FACTOR_B_LOW: This macro holds the scaling factor for active power at
phase B. Set this factor to an approximately correct value, and it will be fine tuned during calibration.
36. DEFAULT_P_SCALE_FACTOR_C_LOW: This macro holds the scaling factor for active power at
phase C. Set this factor to an approximately correct value, and it will be fine tuned during calibration.
37. DEFAULT_I_RMS_SCALE_FACTOR_NEUTRAL: This macro holds the scaling factor for current at
neutral. Set this factor to an approximately correct value, and it will be fine tuned during calibration.
38. DEFAULT_P_SCALE_FACTOR_NEUTRAL: This macro holds the scaling factor for active power at
neutral. Set this factor to an approximately correct value, and it will be fine tuned during calibration.
39. DEFAULT_BASE_PHASE_A_CORRECTION_LOW: This macro holds the value for phase correction
to compensate for the delay coming from the current transformer at phase A. This can be set to a
value that is in fairly acceptable range, and it will be fine tuned under phase correction during
calibration.
40. DEFAULT_BASE_PHASE_B_CORRECTION_LOW: This macro holds the value for phase correction
to compensate for the delay coming from the current transformer at phase B. This can be set to a
value that is in fairly acceptable range, and it will be fine tuned under phase correction during
calibration.
41. DEFAULT_BASE_PHASE_C_CORRECTION_LOW: This macro holds the value for phase correction
to compensate for the delay coming from the current transformer at phase C. This can be set to a
value that is in fairly acceptable range, and it will be fine tuned under phase correction during
calibration.
42. DEFAULT_NEUTRAL_BASE_PHASE_CORRECTION: This macro holds the value for phase
correction to compensate for the delay at phase C. This can be set to a value that is in fairly
acceptable range, and it will be fine tuned under phase correction during calibration.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 17
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Energy Meter Demo www.ti.com

5 Energy Meter Demo


The energy meter evaluation module (EVM) associated with this application report has the
MSP430F677x(A) and demonstrates energy measurements. The complete demonstration platform
consists of the EVM that can be easily hooked to any test system, metrology software and a PC GUI,
which is used to view results and perform calibration.

5.1 EVM Overview


The following figures of the EVM show the hardware. Figure 12 is the top view of the energy meter.
Figure 13 shows the location of various pieces of the EVM based on functionality.

Figure 12. Top View of the Three Phase Energy Meter EVM

18 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Energy Meter Demo

Figure 13. Top View of the EVM With Components Highlighted

Danger High Voltage Electric shock is possible when connecting the board to live wires. The board
should be handed with care by a professional.
For safety, use of isolated test equipment with overvoltage and overcurrent
protection is highly recommended.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 19
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Energy Meter Demo www.ti.com

5.1.1 Connections to the Test Setup or AC Voltages

CAUTION
Do note leave EVM powered when unattended.

AC voltage or currents can be applied to the board for testing purposes at these points:
Pad LINE1 corresponds to the line connection for phase A.
Pad LINE2 corresponds to the line connection for phase B.
Pad LINE3 corresponds to the line connection for phase C.
Pad Neutral corresponds to the Neutral voltage.
The voltage between any of the three line connections to the neutral connection can be up to 230 V ac
at 50/60 Hz.
I1+ and I1- are the current inputs after the sensors for phase A. When a current sensor is used, make
sure that the voltage across I1+ and I1- does not exceed 930 mV. THIS IS CURRENTLY
CONNECTED TO A CT ON THE EVM.
I2+ and I2- are the current inputs after the sensors for phase B. When a current sensor is used, make
sure that the voltage across I2+ and I2- does not exceed 930 mV. THIS IS CURRENTLY
CONNECTED TO A CT ON THE EVM.
I3+ and I3- are the current inputs after the sensors for phase C. When a current sensor is used, make
sure that the voltage across I3+ and I3- does not exceed 930 mV. THIS IS CURRENTLY
CONNECTED TO A CT ON THE EVM.
IN+ and IN- are the current inputs after the sensors for the neutral current. When a current sensor is
used, make sure that the voltage across IN+ and IN- does not exceed 930 mV. THIS IS CURRENTLY
NOT CONNECTED TO THE EVM.
Figure 14 and Figure 15 show the various connections that need to be made to the test setup for proper
functionality of the EVM.
When a test ac source needs to be connected, the connections must be made according to the EVM
design. Figure 14 shows the connections from the top view. VA+ , VB+, and VC+ corresponds to the line
voltage for phases A, B, and C, respectively. VN corresponds to the neutral voltage from the test ac
source.

20 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Energy Meter Demo

Figure 14. Top View of the EVM With Test Setup Connections

Figure 15 shows the connections from the front view. IA+ and IA- correspond to the current inputs for
phase A, IB+ and IB- correspond to the current inputs for phase B, and IC+ and IC- correspond to the
current inputs for phase C. VN corresponds to the neutral voltage from the test setup. Although the EVM
hardware and software supports measurement for the neutral current, the EVMs obtained from Texas
Instruments do not have a sensor connected to the neutral ADC channel.

Figure 15. Front View of the EVM With Test Setup Connections

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 21
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Energy Meter Demo www.ti.com

5.1.2 Power Supply Options and Jumper Settings


The EVM can be configured to operate with different sources of power. The entire board can be powered
by a single dc voltage rail (DVCC), which can be derived either via JTAG, external power, or ac mains
through either the capacitive or switching power supplies. Various jumper headers and jumper settings are
present to add to the flexibility to the board. Some of these headers require that jumpers be placed
appropriately for the board to correctly function. Table 1 indicates the functionality of each jumper on the
board and the associated functionality.

Table 1. Header Names and Jumper Settings on the F677x(A) EVM


Header, Header Type Main Valid Use Case Comments
Option Name Functionality
The software does not output ACLK
ACLK (Not by default and must be modified to
1-pin ACLK Output Probe here to measure the frequency
isolated, do not output ACLK. This header is not
Header (WARNING) of ACLK.
probe) isolated from ac voltage so do not
connect any measuring equipment.
This header is not isolated from ac
ACT (Not Active Energy Probe between here and ground for voltage, so do not connect measuring
1-pin
isolated, do not Pulses cumulative three-phase active energy equipments unless isolators external
Header
probe) (WARNING) pulses to the EVM are available. See the
ISOLATED ACT header, instead.
Place a jumper here to connect AUXVCC1 to GND. This jumper must be
present if AUXVCC1 is not used as a backup power supply.
AUXVCC1
AUXVCC1 (Not Alternatively, it can be used to provide a backup power supply to the
2-pin Selection and
isolated, do not MSP430. To do so, connect the alternative power supply to this header and
Header External Power
probe) configure the software to use the backup power supply as needed.
(WARNING)
In addition, on the bottom of the board, a footprint is present that allows the
addition of a supercap.
Place a jumper here to connect AUXVCC2 to GND. This jumper must be
AUXVCC2
present if AUXVCC2 is not used as a backup power supply.
AUXVCC2 (Not 2-pin selection;
Alternatively, place a jumper at the VDSYS option to connect AUXVCC3 to
isolated, do not Jumper AUXVCC2
VDSYS so that it is powered from whichever supply (DVCC, AUXVCC1, or
probe) Header External Power
AUXVCC2) is powering the chip. If this jumper is placed, disable the internal
(WARNING)
charger in software.
To power the RTC externally regardless of whether or not DVCC is available,
provide external voltage at AUXVCC3, disable the internal AUXVCC3
charger in software, and do not connect a jumper at this header.
AUXVCC3 Alternatively, place a jumper here to connect AUXVCC3 to VDSYS so that it
AUXVCC3 (Not 2-pin
Selection and is powered from whichever supply (DVCC, AUXVCC1, or AUXVCC2) is
isolated, do not Jumper
External Power powering the chip. If this jumper is placed, disable the internal charger in
probe) Header
(WARNING) software.
To power the RTC externally only when DVCC is not available, enable the
internal charger, place a jumper at the Diode option, and apply external
voltage at the VBAT header.
Not a jumper header, probe here for Do not probe if board is powered
DGND (Not Ground Voltage GND voltage. Connect negative from ac mains, unless the ac mains
isolated, do not Header Header terminal of bench or external power are isolated. This voltage can be hot
probe) (WARNING) supply when powering the board or neutral if ac wall plug is connected
externally. to the meter
Not a jumper header, probe here for
DVCC (Not VCC Voltage VCC voltage. Connect positive Do not probe if board is powered
isolated, do not Header Header terminal of bench or external power from ac mains, unless the ac mains
probe) (WARNING) supply when powering the board are isolated.
externally.
DVCC
EXTERNAL (Do This Jumper option and the DVCC
JTAG External
not connect JTAG Jumper Place a jumper at this header option INTERNAL jumper option comprise
Power Selection
if ac mains is the Header to select external voltage for JTAG one three-pin header used to select
Option
power source Option programming. the voltage source for JTAG
(WARNING)
Isolated JTAG or programming.
supply is fine)

22 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Energy Meter Demo

Table 1. Header Names and Jumper Settings on the F677x(A) EVM (continued)
Header, Header Type Main Valid Use Case Comments
Option Name Functionality
DVCC This Jumper option and the DVCC
JTAG Internal Place a jumper at this header option
INTERNAL (Do Jumper EXTERNAL jumper option comprise
Power Selection to power the board using JTAG and
not connect JTAG Header one three-pin header used to select
Option to select the voltage from the USB
if ac mains is the Option the voltage source for JTAG
(WARNING) FET for JTAG programming.
power source). programming.
Place a jumper only if ac mains
voltage is needed to power the
Place a jumper at this header DVCC rail. This header option and
DVCC VCC_ISO Jumper
Switching-Mode position to power the board via ac the DVCC VCC_PL header option
(Not isolated, do Header
Supply Select mains using the switching power comprise one three-pin header that
not probe) Option
supply selects a capacitive power supply, a
switching-mode power supply, or
neither.
Place a jumper only if ac mains
voltage is needed to power the
DVCC rail. Do not debug using JTAG
Place a jumper at this header unless ac source is isolated or JTAG
DVCC VCC_PL Jumper Capacitor Power
position to power the board via ac is isolated. This header option and
(Not isolated, do Header Supply Select
mains using the capacitor power the DVCC VCC_ISO header option
not probe) Option (WARNING)
supply comprise one three-pin header that
selects a capacitive power supply, a
switching-mode power supply, or
neither.
This header is isolated from ac
Not a jumper header, probe between
1-pin Isolated Active voltage so it is safe to connect to
ISOLATED ACT here and ground for cumulative three-
Header Energy Pulses scope or other measuring equipment
phase active energy pulses
since isolators are already present.
This header is isolated from ac
Not a jumper header, probe between
ISOLATED 1-pin Isolate Reactive voltage so it is safe to connect to
here and ground for cumulative three-
REACT Header Energy Pulses scope or other measuring equipment
phase reactive energy pulses
since isolators are already present.
There are six headers that jumpers
must be placed at to select a JTAG
communication option. Each of these
J (Do not connect 4-wire JTAG Place jumpers at the J header
Jumper six headers have a J option and an S
JTAG if ac mains Programming options of all of the six JTAG
Header option to select either 4-wire JTAG or
is the power Option communication headers to select 4-
Option SBW. To enable 4-wire JTAG,
source) (WARNING) wire JTAG.
configure all of these headers for the
J option. To enable SBW, configure
all of the headers for the S option.
The software does not output MCLK
MCLK (Not
1-pin MCLK Output Probe here to measure the frequency by default and will have to be
isolated, do not
Header (WARNING) of MCLK. modified to output MCLK. Probe only
probe)
when ac mains is isolated.
This header is not isolated from ac
REACT (Not Reactive Energy Not a jumper header, probe between voltage so do not connect measuring
1-pin
isolated, do not Pulses here and ground for cumulative three- equipments unless isolators external
Header
probe) (WARNING) phase reactive energy pulses to the EVM are available. See the
ISOLATED REACT header, instead.
Probe here to measure the frequency The software does not output
1-pin
RTCCLK RTCCLK Output of RTCCLK, which is used for RTCCLK by default, and it must be
Header
calibrating the RTC. modified to output RTCCLK.
Jumper RS-232 Receive Place a jumper here to enable
RX_EN --
Header enable receiving characters using RS-232.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 23
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Energy Meter Demo www.ti.com

Table 1. Header Names and Jumper Settings on the F677x(A) EVM (continued)
Header, Header Type Main Valid Use Case Comments
Option Name Functionality
There are six headers where jumpers
must be placed at to select a JTAG
communication mode. Each of these
S (Do not SBW JTAG Place jumpers at the S header six headers that have a J option and
Jumper
connect JTAG if Programming options of all of the six JTAG an S option to select either 4-wire
Header
ac mains is the Option communication headers to select JTAG or SBW. To enable 4-wire
Option
power source) (WARNING) SBW JTAG, all of these headers must be
configured for the J option. To enable
SBW, all of the headers must be
configured for the S option.
SCL (Not 1-pin I2C/EEPROM
Probe only when ac mains is
isolated, do not Jumper SCL probe point Probe here to probe I2C SCL line
isolated.
probe) Header (WARNING)
SDA (Not 1-pin I2C/EEPROM
Probe only when ac mains is
isolated, do not Jumper SDA probe point Probe here to probe I2C SDA line
isolated.
probe) Header (WARNING)
The software does not output MCLK
SMCLK (Not
1-pin SMCLK Output Probe here to measure the frequency by default and must be modified to
isolated, do not
Header (WARNING) of SMCLK. output SMCLK. Probe only when ac
probe)
mains is isolated.
Jumper RS-232 Transmit Place a jumper here to enable RS-
TX_EN --
Header Enable 232 transmissions.
AUXVCC3
2-pin External Power When the Diode option is selected for AUXVCC3, apply voltage at this
VBAT Jumper For AUXVCC3 header so that the RTC is still powered when the voltage at DVCC is
Header Diode Option removed.
(WARNING)

24 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Energy Meter Demo

5.2 Loading the Example Code


The source code is developed in the IAR environment using IAR compiler version 6.x. Earlier versions of
IAR cannot open the project files. When the project is loaded in IAR version 6.x or later, the IDE prompts
you to create a backup. Click YES to proceed. There are three parts to the energy metrology software.
The toolkit that contains a library of mostly mathematics routines
The main code that is made of the source and include files
The GUI that is used for calibration
In this software package, there are two sets of directories: one for the MSP430F6779 and one for the
MSP430F6779A. Depending on the utilized device, open the proper directory. Section 5.2.1 describes
how to compile a project for the MSP430F6779 option. A similar set of instructions can be followed to
compile a project for the MSP430F6779A option.

5.2.1 Opening the Project


Figure 16 shows the contents of the Source folder.

Figure 16. Source Folder Structure

The emeter-ng folder contains multiple project files and for this application, the emeter-6779.ewp project
file is to be used. The folder emeter-toolkit has corresponding project file emeter-toolkit-6779.ewp. For first
time use, it is recommended that both the projects be completely rebuild by performing the following steps:
1. Open the IAR IDE.
2. Load the emeter_toolkit_6779.ewp project.
3. Click the Rebuild All option as shown in Figure 17.
4. Close the existing workspace and open the main project emeter-6779.ewp.
5. Click rebuild All as shown in Figure 18 and load this project onto the MSP430F6779.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 25
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Energy Meter Demo www.ti.com

Figure 17. Toolkit Compilation in IAR Figure 18. Metrology Project Build in IAR

26 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Results and Calibration

6 Results and Calibration

6.1 Viewing Results via LCD


The LCD display scrolls between metering parameter approximately every two seconds. For each
metering parameter that is displayed on the LCD, three items are actually displayed on the screen: the
corresponding phase of the parameter, a one or two character symbol used to distinguish which
parameter is being displayed, and the actual value of the parameter. The phase of the parameter is
displayed on the top line of the LCD. This may take the values of A, B, C, and t for phase A, phase B,
phase C, and the aggregate-sum of these phases, respectively. The parameter symbol is displayed on the
left of the second line of the LCD. To the right of the parameter symbol is the actual value of the
parameter.
Table 2 shows the different metering parameters that are displayed on the LCD and the associated units
in which they are displayed. The Symbol column shows which characters correspond to which metering
parameter. The Comments column provides a brief interpretation of the displayed metering parameters.

Table 2. Displayed Parameters


Parameter Name Symbol Units Comments

Voltage Volts (V) --

Current Amps (A)

Active Power Watt (W) --

Reactive Power Volt-Ampere Reactive (var) --

Apparent Power Volt-Ampere (VA) --

Frequency Hertz (Hz) --

The characters are used if the load is


determined to be a capacitive load.
Power Factor Constant between 0 and 1

The characters are used if the load is


determined to be an inductive load.

Total Consumed
100 "Tick" Every 10 ticks increments the tenths place by 1.
Active Energy

Total Consumed
100 "Tick" Every 10 ticks increments the tenths place by 1.
Reactive Energy

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 27
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Results and Calibration www.ti.com

Figure 19 shows an example of phase A's measured frequency of 49.99 Hz displayed on the LCD.

Figure 19. LCD Display

6.2 View Results Using RF Technology (ZigBee)


The CC2530 Evaluation Module (EM) (CC2530EMK) is an add-on (plug-in) daughter card that can be
purchased separately for ZigBee (IEEE Std 802.15.4) RF applications in the 2.4-GHz unlicensed ISM
band. The communication interface to any host or application processor is by UART. The instantaneous
power consumption is sent periodically to the ZigBee module for wireless transmission.

Figure 20. ZigBee Radio

This ZigBee module is connected by the UART, which is configured to 115.2 kbaud to the
MSP430F6779(A) on the transmit portion and the MSP430F4618 on the receive portion (IHD430)

6.2.1 In-Home Display (IHD)


Most IHDs have their own setup mechanism and all of them tend to join the ZigBee network when they
are turned on. In this section, it is assumed that TI's IHD430 is used as the in-home display. The IHD430
has a MSP430F461x as an application and host processor.

28 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Results and Calibration

Figure 21. TI Designed IHD430

View cumulative three-phase active power readings on the IHD430


Place a CC2530 module in the RF connector socket of the meter (EVM430-F6779). Make sure that it is
properly oriented. This CC2530 should be flashed with code to act as a transmitter. The IHD430 also has
a corresponding CC2530 flashed to act as a receiver.
Initialize the IHD430
Power must be provided by two AAA batteries or by an external supply. The power source is selected by
configuring jumpers on VCC and BATT headers and the power is supplied to the on-board MSP430 by
placing a jumper on PWR1 header. The power setup options are:
1. Jumper settings to provide Battery power are:
(a) Place a jumper on the BATT header.
(b) Place a jumper on the PWR1 header.
2. Jumper settings to provide Flash emulation tool power are:
(a) Place a jumper on pins [1-2] on VCC 3-pin header.
(b) Place a jumper on the PWR1 header.
3. Jumper settings to provide External power are:
(a) Place a jumper on pins [2-3] on the VCC 3-pin header.
(b) Place a jumper on the PWR1 header.
4. Place a jumper on the RF_PWR header, which enables or disables power to CC2530.
For the MSP430F677x(A) software to communicate the cumulative three-phase active power to the
IHD430, the IHD430_SUPPORT macro must be defined in the emeter-3ph-neutral-6779(A).h file. When
this macro is enabled, the cumulate three-phase active power reading is sent to the on-board CC2530
transmitter via 8N1 UART communication at a rate of 115.2 kbaud. The CC2530 then sends the data to
the CC2530 receiver. IHD430 receives the active power readings and displays them on the LCD. Note
that the transmitter (meter) must be turned on before the receiver to ensure proper ZigBee
communication. In addition, modifications can be made to MSP430F677x(A) software to send different
parameters for display onto the IHD430.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 29
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Results and Calibration www.ti.com

6.3 Calibrate and View Results With a PC

6.3.1 GUI Execution


To run the GUI:
1. Connect the EVM to a PC via an RS-232 cable.
2. Open the /Source/GUI folder and open calibration-config.xml in a text editor.
3. Change the "port name" field within the "meter" tag to the COM port connected to the meter. In
Figure 22, this field is changed to COM2.

Figure 22. GUI Config File Changed to Communicate With Meter

4. Run calibrator.exe in the /Source/GUI folder. If the COM port in calibration-config.xml was changed in
the previous step to the com port connected to the EVM, the GUI opens (see Figure 23).
If the GUI connects properly to the EVM, the top left button is green. If there are problems with
connections or if the code is not configured correctly, the button is red. Click the green button to view
the results.

Figure 23. GUI Startup Window

30 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Results and Calibration

6.3.2 View Results


When you click on the green button, the results window opens (see Figure 24). Note that there is a trailing
"L" or "C" on the Power factor values to indicate an inductive or capacitive load, respectively.

Figure 24. Results Window

6.3.3 Calibration
Calibration is key to any meter's performance, and it is absolutely necessary for every meter to go through
this process. Initially, every meter exhibits different accuracies due to silicon-to-silicon differences, sensor
accuracies, and other passive tolerances. To nullify the effects of these differences, every meter must be
calibrated. For calibration to be performed accurately, an accurate ac test source and a reference meter
must be available. The source should be able to generate any desired voltage, current, and phase shift
(between V and I). To calculate errors in measurement, the reference meter acts as an interface between
the source and the meter that is being calibrated. This section describes a simple and effective method of
calibration of this 3-phase EVM.
The GUI that is used for viewing results can also be used to calibrate the EVM. During calibration,
parameters called calibration factors are modified in software to give least error in measurement. For this
meter, there are four main calibration factors for each phase: voltage scaling factor, current scaling factor,
power scaling factor, and the phase compensation factor. The voltage, current, and power scaling factors
translate measured quantities in metrology software to real-world values represented in volts, amps, and
watts, respectively. The phase compensation factor is used to compensate any phase shifts introduced by
the current sensors and other passives.
When the meter software is flashed with the code (available in the zip file), default calibration factors are
loaded into these calibration factors (see items 28 to 42 in Section 4.4 for the macro definitions). These
values will be modified via the GUI during calibration. The calibration factors are stored in INFO_MEM,
and therefore, would remain the same if the meter is restarted. However, if code is re-flashed during
debug, the calibration factors will be replaced and the meter must be recalibrated. One way to save the
calibration values is by clicking on the "Meter calibration factors" button shown in Figure 24. The meter
calibration factors window displays the latest values and this could be used to directly replace the macro
definition of these factors in the source code.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 31
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Results and Calibration www.ti.com

Figure 25. Calibration Factors Window

Calibrating any of the scaling factors is referred to as gain correction. Calibrating any of the phase
compensation factors is referred to as phase correction. For the entire calibration process, the ac test
source must be on, meter connections must be made as shown in Section 5.1.1, and the energy pulses
must be connected to the reference meter.

6.3.3.1 Gain Calibration


Usually gain correction for voltage and current can be done simultaneously for all phases. However,
energy accuracy (%) from the reference meter for each individual phase is needed for gain correction for
active power. Also, when performing active power calibration for any given phase, the other two phases
must be turned off. Typically, switching off only the currents is good enough to disable a phase.

6.3.3.1.1 Voltage and Current Gain Calibration


To calibrate the voltage and current readings:
1. Connect the GUI to view results for voltage, current, active power, and the other metering parameters.
2. Configure the test source to supply the desired voltage and current for all phases. Make sure that
these are the voltage and current calibration points with a zero-degree phase shift between each
phase's voltage and current. For example: 230 V, 10 A, 0 (PF = 1). Typically, these values are the
same for every phase.
3. Click the "Manual cal." button in the Results window (see Figure 24) to open the window shown in
Figure 26.

Figure 26. Manual Calibration Window


32 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Results and Calibration

4. Calculate the correction values for each voltage and current. The correction values that need to be
entered for the voltage and current fields are calculated by:
valueobserved
Correction(%) = 1 *100
valuedesired (8)
Where valueobserved is the value measured by the TI meter, and valuedesired is the calibration point
configured in the ac test source.
5. After calculating Correction(%) for all voltages and currents, input these values as is () for the fields
Voltage and Current (low) for the corresponding phases.
6. Click Update meter and the observed values for the voltages and currents on the GUI settle to the
desired voltages and currents.

6.3.3.1.2 Active Power Gain Calibration


Note that this example is for one phase. Repeat these steps for other phases.
After performing gain correction for voltage and current, gain correction for active power must be done.
Gain correction for active power is different from voltage and current correction. Although, conceptually,
calculating Correction(%) using Step 4 with Active power readings (displayed on the ac test source) can
be done, it is not the most accurate method and should be avoided.
The best option to find the Correction(%) is directly from the reference meter's measurement error of the
active power. This error is obtained by feeding energy pulses to the reference meter. This error must be
recorded for each phase individually with the other phases disabled.
To perform active power calibration:
1. Turn off the meter and connect the meter's energy pulse output to the reference meter. Configure the
reference meter to measure the active power error based on these pulse inputs.
2. Turn on the ac test source.
3. Repeat Steps 1 to 3 from Section 6.3.3.1.1 with the identical voltages, currents, and 0 phase shifts
that were used for the voltage and current gain calibration.
4. Disable the other phases that are not currently being calibrated by setting the current of these phases
to 0 A.
5. Obtain the % error in measurement from the reference meter. Note that this value may be negative.
6. Enter the error obtained in the above step into the Active (low) field under the corresponding phase in
the GUI window. This error is already the Correction(%) value and does not need to be calculated.
7. Click Update meter and the error values on the reference meter settle to a value close to zero.

6.3.3.2 Phase Correction


Note that this example is for a given phase. Repeat these steps for other phases.
After performing power gain correction, phase calibration must be performed. Similar to active power gain
calibration, to perform phase correction on one phase, the other phases must be disabled. To perform
phase correction calibration, perform the following steps:
1. If the ac test source has been turned OFF or reconfigured, perform steps 1-3 from the voltage and
current gain section using the identical voltages and currents used in that section.
2. Disable all other phases that are not currently being calibrated by setting the current of these phases to
0 A.
3. Modify only the phase-shift of the calibrated phase to a non-zero value; typically, +60 is chosen. The
reference meter will now display a different % error for active power measurement. Note that this value
may be negative.
4. If this error is not close to zero, or is unacceptable, perform phase correction by following these steps:
(a) Enter a value as an update for the Phase (Low) field for the phase that is being calibrated. Usually,
a small positive or negative integer should be entered to bring the error close to zero. Additionally,
for a phase shift greater than 0 (for example, +60), a positive (negative) error would require a
positive (negative) number as correction.

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 33
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Results and Calibration www.ti.com

(b) Click Update meter and monitor the error values on the reference meter.
(c) If this measurement error (%) is not accurate enough, fine tune by incrementing or decrementing by
a value of 1 based on Step 4a and 4b. Note: When the error is very close to zero, changing the
fine-tuning value by 1 can result in the error oscillating on either side of zero. Select the value that
has the smallest absolute error.
(d) Change the phase to -60 and check if this error is still acceptable. Ideally, errors should be
symmetric for same phase shift on lag and lead conditions.
After performing phase correction, calibration is complete for one phase. Note that the gain calibration
and phase calibration are completed in sequence for each phase before moving on to other
phases. These two procedures must be repeated for each phase, unlike voltage and current
calibration.
This completes calibration of voltage, current, and power for all three phases. View the new calibration
factors by clicking the Meter Calibration factors button of the GUI metering results window (see Figure 24).

Figure 27. Calibration Factors Window

The configuration of the meter can also be viewed by clicking Meter features to open the screen shown in
Figure 28 (this is only an example).

Figure 28. Meter Features Window

34 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Results and Calibration

6.3.4 Metrology Results


In this section, metrology results are shown for cumulative three-phase active energy. Figure 29 shows
the results over a dynamic range of 2000:1 using the customized CTs that are provided with the EVM430-
F6779. Table 3 shows the values for the error. Changing the EVM's CTs may result in better performance.
Figure 30 shows the results over the same dynamic range using high-end CTs over the same current
range. Table 4 shows the values for the error. All results were calibrated at 230 V, 10 A, 50 Hz.

Figure 29. Energy Measurement Error Across Current With Customized CTs on EVM430-F6779

Table 3. Energy Measurement Error With Customized


CTs on EVM430-F6779 (%)
Current 0 60 -60
(A)
0.05 -0.02 0.0445 -0.147
0.1 -0.011 0.093 -0.1373
0.25 -0.0173 0.073 -0.131
0.5 -0.0187 0.0877 -0.1277
1 -0.0173 0.0853 -0.1077
2 -0.0157 0.0815 -0.1203
5 -0.014 0.0627 -0.0887
10 -0.006 0.0497 -0.0633
20 -0.0073 0.0377 -0.049
30 -0.001 0.018 -0.037
40 0.0003 0.026 -0.027
50 -0.006 -0.0197 0.0013
60 -0.007 -0.04 0.0297
70 -0.003 -0.0533 0.041
80 -0.0083 -0.0613 0.049
90 -0.0093 -0.0707 0.053
100 -0.0177 -0.0763 0.0497

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 35
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Results and Calibration www.ti.com

Figure 30. Energy Measurement Error Across Current With High-End CTs

Table 4. Energy Measurement Error With High-End CTs


(%)
Current 0 60 -60
(A)
0.05 0.048 0.1445 0.144
0.1 0.0857 0.1185 0.0725
0.25 0.011 0.05 -0.02
0.5 -0.006 0.0327 -0.0295
1 -0.0075 0.0365 -0.033
2 -0.015 0.0207 -0.0505
5 -0.009 0.006 -0.03
10 -0.002 0.0097 -0.012
20 0.0027 0.0023 -0.007
30 -0.0017 -0.0107 0.016
40 0.0015 -0.021 0.032
50 -0.003 -0.0473 0.0437
60 -0.001 -0.0687 0.066
70 0.0017 -0.0683 0.069
80 0.006 -0.0727 0.0747
90 0.001 -0.0683 0.078
100 -0.0007 -0.0527 0.0863

36 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Schematics

7 Schematics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

A Analog Power Digital Power Status LEDs A

VASYS1/2

VASYS1/2

DVSYS_VDSYS
AVCC

AUXVCC1

AUXVCC2

AUXVCC3
DVCC DVCC

VREF

VCORE
10R

DVCC
DVCC

R59

R60

R61

LED_REACT R58

R56

R55

R54

LED_ACT R57
100

100

100

100

100

100

100

100
R36
C29 C31 C32 C28 C22 C23 C30
B B
4.7uF 100nF 4.7uF 100nF 4.7uF 100nF 100nF
C26 C27 C24 C25 C44 C43 C35 C33 C34 C36 C38

LED4

LED5

LED6

LED3

LED2

LED1
4.7uF 100nF 4.7uF 100nF 0.47uF 100nF 4.7uF 100nF 4.7uF 100nF 0.47uF

AGND AGND

REACT
LED4

LED5

LED6

LED1

LED2

LED3

ACT
DGND
C C
I2C Pullups Watch Crystal
DVCC
AuxVcc Headers LCD Contrast LCD User Buttons
12pF
XIN LCD1

AUXVCC3
C37 3 DVSYS_VDSYS DNP R33 S39 S0

XT1
44 1 DVCC DVCC DVCC DVCC
12pF 2 AUXVCC3 + S38 S1
R40

R41

43 2
10k

10k

1 C49 D
D XOUT C63 S37 42 3 S2

560k
S36 S3

R42
41 4
SCL 1 JP2 C40 D44 4 3 AUXVCC1 4.7uF S35 40 5 S4
SDA 2 DNP HD1 2 1 AUXVCC2 S34 S5
DGND 39 6
2 R23 S33 S6

100K

100K

100K

100K
R53

R50

R49

R52
SV1 38 7
1 DGND DGND S32 37 8 S7
S31 36 9 S8
DVCC AVCC

560k
DGND S30 S9

R43
35 10
Clock Headers S29 34 11 S10 BTN1 BTN2 BTN3 BTN4
S28 33 12 S11
SV2 R13 S27 S12

BTN4

BTN2

BTN1

BTN3
E E

2
32 13
5 SMCLK S26 31 14 S13
4 MCLK S25 30 15 S14

1
560k
3 ACLK S24 S15

R46
29 16
DVSYS_VDSYS

2 RTCCLK COM0 COM0 17 S16


1 AGND COM1 S17
DGND COM1 18
COM2 COM2 19 S18
AUXVCC1
AUXVCC2
VASYS1/2

VASYS1/2

COM3 COM3 20 S19 DGND DGND DGND DGND


VCORE

DGND DGND S23 24 21 S20


DVCC

VREF

S22 23 22 S21
V3+
V2+
V1+
F F
IN+
V3-
V2-
V1-
I3+
I2+
I1+

IN-
I3-
I2-
I1-
128
127
126
125
124
123
122
121
120

109
108
107
106
105
104
103
119
118
117
116
115
114
113
112

110
111

DVCC / DGND Headers JTAG


AUXVCC1
AUXVCC2
VASYS1

VASYS2
VCORE

VDSYS

SDPN0
DVSS1

SD6N0

SD5N0

SD4N0

SD3N0

SD2N0

SD1N0
SD6P0

SD5P0

SD4P0

SD3P0

SD2P0

SD1P0

SD0P0
AVSS1

AVSS2
DVCC

AVCC

VREF

1 XIN SBWTDIO/NMI/RST 102 DRESET

1 JP10
XIN DVCC DVCC
2XOUT XOUT TCK/PJ.3 101 DTCK
3
AUXVCC3 AUXVCC3 TMS/PJ.2 100 DTMS

2
3
4BTN3 RTCCAP1 TCLK/TDI/PJ.1 99 DTDI
5 G
BTN4 TDO/PJ.0 98 DTDO
G
RTCCAP0 DVCC
6
SMCLK P1.5/SMCLK/CB0/A5 SBWTCK/TEST 97 TEST/SBWTCK TDO 1 2 INT
7MCLK PM_TA1.0/P2.3 96 RF_GPIO1 TDI 3 4 EXT

R51
47K
P1.4/MCLK/CB1/A4
8 P1.3/ADC10CLK/A3 PM_TA0.2/P2.2 95 RF_GPIO2 TMS 5 6
ACLK 9 P1.2/ACLK/A2 BSL_RX/PM_TA0.1/P2.194 RF_CS 1 1 TCK 7 8 TEST/SBWTCK
BTN2 10 P1.1/TA2.1/VEREF+/A1 BSL_TX/PM_TA0.0/P2.093 RF_SFD 2 2 9 10
BTN1 11 P1.0/TA1.1/VEREF-/A0 TRCCLK/TACLK/P11.592 RTCCLK 3 3 11 12
12 RESET
LED6 P2.4/PM_TA2.0 CBOUT/P11.4 91 CBOUT 4 4 13 14
SCL 13 TA2.1/P11.3 90 RF_CCA

1
P2.5/PM_UCB0SOMI/PM_UCB0SCL

RESET
SDA 14 P2.6/PM_UCB0SIMO/PM_UCB0SDA TA1.1/P11.2 89 RF_RESETCC DVCC DGND 0.1uF JTAG
15 H
H LED5 P2.7/PM_UCB0CLK CB3/TA3.1/P11.1 88 RF_VREG_EN DGND
C53

2
RS232_RXD 16 P3.0/PM_UCA0RXD/PM_UCA0SOMI S0/P11.0 87 S0 R48
RS232_TXD 17 P3.1/PM_UCA0TXD/PM_UCA0SIMO S1/P10.7 86 S1 TCK
18 P3.2/PM_UCA0CLK S2/P10.6 85 S2 Jumper Config 330 1 JP4
IR_SD 19
IR_RXD 20
IR_TXD 21
P3.3/PM_UCA1CLK
P3.4/PM_UCA1RXD/PM_UCA1SOMI
P3.5/PM_UCA1TXD/PM_UCA1SIMO
MSP430F6779IPEU S3/P10.5 84
S4/P10.4 83
S5/P10.3 82
S3
S4
S5
DVCC / DGND Headers
12 - SBW
23 - JTAG
DGND DGND
TEST/SBWTCK
2
3

COM0 22 COM0 S6/P10.2 81 S6


COM1 23 COM1 S7/P10.1 80 S7 JP13 TDO 1 JP5 1 JP6 1 JP7 1 JP8 1 JP9
COM2 24 S8/P10.0 79 S8 CBOUT 1 DRESET 2 DTCK 2 DTMS 2 DTDI 2 DTDO 2
P4.5/PM_UCB1SIMO/PM_UCB1SDA
P4.2/PM_UCA3TXD/PM_UCA3SIMO

P4.4/PM_UCB1SOMI/PM_UCB1SCL

P1.6/COM2
P4.1/PM_UCA3RXD/M_UCA3SOMI

I COM3 25 P1.7/COM3 S9/P9.7 78 S9 RESET 3 TCK 3 TMS 3 TDI 3 TDO 3 I


Vsupply 26
LED3 P5.0/COM4 S10/P9.6 77 S10
LED2 27 P5.1/COM5 S11/P9.5 76 S11
LED1 28 P5.2/COM6 S12/P9.4 75 S12
Voltage Monitor

ACT 29 P5.3/COM7 S13/P9.3 74 S13


R33 30 LCDCAP/R33 S14/P9.2 73 S14
31 AGND R4 DGND AGND R101 DGND
S15/P9.1 72
DNP

R23 S15
R45

P4.3/PM_UCA3CLK

P4.6/PM_UCB1CLK

P5.4/SDCLK/R23
R13 32 S16/P9.0 71 S16
P6.1/SD4DIO/S39

P6.3/SD6DIO/S37

P5.5/SD0DIO/LCDREF/R13
P6.2/SD5DIOS38

DGND 33 0 0
DVSS2 70
P4.7/PM_TA3.0

P5.6/SD1DIO/R03 R99 R102


K
VMON 34 P5.7/SD2DIO/CB2 DVSYS 69 DVSYS_VDSYS
35 P6.0/SD3DIO S17/P8.7 68 S17 K
EZ-RF_RXD 36 0 0
S18/P8.6 67
P6.4/S36
P6.5/S35
P6.6/S34
P6.7/S33
P7.0/S32
P7.1/S31
P7.2/S30
P7.3/S29
P7.4/S28
P7.5/S27
P7.6/S26
P7.7/S25
P8.0/S24
P8.1/S23
P8.2/S22
P8.3/S21

P3.6/PM_UCA2RXD/PM_UCA2SOMI S18 DGND R100 R103


EZ-RF_TXD 37 S19/P8.5 66
DNP

S19
R44

P3.7/PM_UCA2TXD/PM_UCA2SIMO
38 P4.0/PM_UCA2CLK S20/P8.4 65 S20 0 0
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

DGND MSP430F67791
RF_FIFOP

RF_SOMI
RF_SIMO
RF_FIFO

RF_CLK
REACT

LED4
S39
S38
S37
S36
S35
S34
S33
S32
S31
S30
S29
S28
S27
S26
S25
S24
S23
S22
S21

L L

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Figure 31. Schematics (1 of 4)


SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 37
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Schematics www.ti.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

A A

Analog Front-End (Current) Analog Front-End (Voltage)


AVCC
B LINE1 L1 P1+1 R5 R6 R7 R14 V1+ B

LINE1 EXCML20A 330k 330k 330k 1k


C1

S20K275
C8
PMLL4148

R1

2.37K
47p

R15
PMLL4148 D28 V1 15n
I1+ D3 0 1k
CUR1+ CUR1+ I1+ AGND
PMLL4148 R/L9 R26 R32

D11

SMAJ5.0CA
C16 AGND V1-
C C
PMLL4148 NEUTRAL 1k

TVS2
AGND C17

12.4
R21
47p C9
I1 D29
D30 15n AGND
47p

D4
PMLL4148PMLL4148 AGND
I1- 0 1k
CUR1- CUR1- I1- AGND
D12 R/L10 R27
PMLL4148 C5
PMLL4148D31 AGND D
D
47p
LINE2 L3 P2+1 R8 R9 R10 R16 V2+
D32
D5

PMLL4148PMLL4148 AGND LINE2 EXCML20A 330k 330k 330k 1k


I2+ 0 1k C2

S20K275
CUR2+ I2+ C10

2.37K
R/L11 R28 47p
D13

R17
V2 15n

R2
C18
SMAJ5.0CA

PMLL4148
PMLL4148D33
TVS3

47p AGND
E C19 E

12.4
R22
I2 AGND R33 V2-
D34 AGND 15n NEUTRAL 1k
D6

PMLL4148 C11
I2- PMLL4148 0 1k
CUR2- I2- AGND 47p
R/L12 R29
C6
PMLL4148
D14

PMLL4148 D35 AGND AGND


47p
F F
D36
PMLL4148 AGND
D7

PMLL4148 LINE3 L5 P3+1 R11 R12 R13 R18 V3+


I3+ 0 1k

S20K275
CUR3+ I3+ LINE3 330k 330k 330k 1k
EXCML20A
PMLL4148 R/L13 R30 C3
D15

C20 C12
PMLL4148 D37
SMAJ5.0CA

R3

2.37K
47p
TVS4

R19
47p V3 15n
G C21 G
12.4
R23

I3 D38 AGND
PMLL4148 AGND 15n
L6 R34 V3-
NEUTRAL
D8

PMLL4148
I3- 0 1k NEUTRAL EXCML20A 1k
CUR3- I3- C13
R/L14 R31 AGND
PMLL4148 C7 47p
D16

PMLL4148 D39 AGND


47p
H
H AGND
D40
PMLL4148 AGND
D1

PMLL4148
IN+ 0 1k
CURN+ IN+
PMLL4148 R/L7 R24
SMAJ5.0CA
D9

PMLL4148 D41 C14


TVS1

47p C15
I I
12.4
R20

IN 15n
D42 AGND
D2

PMLL4148 PMLL4148
IN- 0 1k
CURN- IN-
R/L8 R25
C4
D10

PMLL4148
PMLL4148D43 AGND
47p
K
K
AGND
AGND

L L

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Figure 32. Schematics (2 of 4)

38 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Schematics

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

A A

Resistor Capacitor (RC) Power Supply

B B

0.1uF
C47
1mH
VCC_PL
L7
P1+1 C39
0.22uF/305VAC R92 U3
D18 C62
C
1N4007 Vsupply TPS54060_DGQ_10 C

B160

51.1
R96
100

D23
47uF
P2+1 0.22uF/305VAC C46 R93 D20 1 10
BOOT PH
100 1N4007 2 VIN GND 9
C50 3 EN COMP 8
P3+1 0.22uF/305VAC R94 D22 4 7

100uF/100V
SS/TR VSENSE NEUTRAL
100 D21 1N4007 5 RT/CLK PWRGD 6

22.1k
R95
1N4757A

C102
C48

R35
1M
1N4757A D19
D D
2.2uF

31.6k
D17

R38

R97
1N4757A

1M
C45

33.2K
NEUTRAL C60 C61

R37
NEUTRAL 0.01uF
.056uF 100pF

NEUTRAL
NEUTRAL
E E

R98
10k
R39
0
NEUTRAL DGND

F F

Switching Power Supply


P3+1 L 26
L 26

N N G
G C100 4.7u/400V
22 22

NEUTRAL

VO+ VO+ VCC_ISO


0.1uF
150uF
C101

C42

ZD3
+

SMAJ5.0ABCT
H
H NC NC VO- VO- DGND

I I
VCC Select
DVCC
JP3
3
2
1

VCC_PL
K
VCC_ISO K

L L

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Figure 33. Schematics (3 of 4)

SLAA577G January 2013 Revised August 2015 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the 39
Submit Documentation Feedback MSP430F677x(A)
Copyright 20132015, Texas Instruments Incorporated
Schematics www.ti.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

A A

B B

Isolated RS232 Communication IR Pulse In/Out Act / React


DVCC VCC
OPTO2
VCC2 DVCC 1 4 2
C 1 C
IR_TXD

R47
47
TXD R72
IR_RXD RXD ACT 2 3 ACT
LL103A IR_SD SD JP121 1k
C51 VCC1 TIL191
2

R78
D26 4.7uF C52
GND VCC

1k
DVCC LL103A IRDA
DB9_+12V 0.1uF DGND OPTO1
U2 1 4 2
8 2 D25 1
R68 DVCC 2

LL103A
7 C55 3 D
D
R71 DGND DGND DGND REACT REACT

D27
C57 6 1k
10uF G2 JP111 TIL191
2.2k
0.1uF 5 3 DB9_GND 5 9 2
4 8
DNP
RX_EN

R70

PS8802 C56 3 7
DGND DGND 2 6 EEPROM DGND

0.1uF
10uF 1

C54
2
1

RS232_RXD D24 G1
UART_RX DB9_-12V RS-232 DVCC
E E

0.1uF
LL103A

C41
DVCC
U1
EZ-RF Connect

R63
R65

10k
2 8
7 R66 IC1 EZ-RF

8
68 R62 DGND
6 DNP Q1 SCL 6 SCL VCC EZ-RF_TXD 1

EEPROM
BC857BSMD 7 DVCC 2
TX_EN

1k WP
3 5 3
F 3 SDA 5 SDA 4 F

Array
A2
PS8802 2 A1 DGND 5
R69
2
1

RS232_TXD UART_TX Q2 1 EZ-RF_RXD 6

R64
A0

220
BC857BSMD GND
2.2k

4
R67 24C02CSN SL127L6TH

1.5k
DGND DGND DGND

G G

RF Daughter Card
DVCC
10uF
C58

H
H
0.1uF
C59

1 2 1 2
RF_VREG_EN R74 0 3 4 3 4 0 R73
RF_RESETCC R76 0 5 6 0 R75 RF_FIFO 5 6 0 R77
I RF_FIFO R80 0 7 8 0 R81 RF_FIFOP R79 0 7 8 I
RF_FIFOP R82 0 9 10 0 R83 RF_CCA 9 10
11 12 0 R84 RF_SFD 11 12 DGND
13 14 0 R85 RF_CS 13 14
15 16 0 R86 RF_CLK RF_RESETCC R87 0 15 16
17 18 0 R88 RF_SIMO 17 18 0 R89 RF_GPIO2
19 20 0 R91 RF_SOMI RF_GPIO1 R90 0 19 20

RF2 RF1
K DGND
K

L L

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Figure 34. Schematics (4 of 4)

40 Implementation of a Three-Phase Electronic Watt-Hour Meter Using the SLAA577G January 2013 Revised August 2015
MSP430F677x(A) Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
www.ti.com Revision History

Revision History

Changes from F Revision (May 2014) to G Revision ...................................................................................................... Page

Updated links and descriptions for associated source code ......................................................................... 1


Updated links to source code ............................................................................................................ 2

NOTE: Page numbers for previous revisions may differ from page numbers in the current version.

SLAA577G January 2013 Revised August 2015 Revision History 41


Submit Documentation Feedback
Copyright 20132015, Texas Instruments Incorporated
General Texas Instruments High Voltage Evaluation (TI HV EVM) User Safety Guidelines

WARNING

Always follow TI's setup and application instructions, including use of all interface components within their
recommended electrical rated voltage and power limits. Always use electrical safety precautions to help
ensure your personal safety and those working around you. Contact TI's Product Information Center
http://support/ti./com for further information.
Save all warnings and instructions for future reference.
Failure to follow warnings and instructions may result in personal injury, property damage, or
death due to electrical shock and burn hazards.
The term TI HV EVM refers to an electronic device typically provided as an open-framed unenclosed
printed circuit board assembly. It is intended strictly for use in development laboratory environments,
solely for qualified professional users having training, expertise, and knowledge of electrical
safety risks in development and application of high voltage electrical circuits. Any other use
and/or application are strictly prohibited by Texas Instruments. If you are not suitably qualified, you
should immediately stop from further use of the HV EVM.
1. Work Area Safety
(a) Keep work area clean and orderly.
(b) Qualified observer(s) must be present anytime circuits are energized.
(c) Effective barriers and signage must be present in the area where the TI HV EVM and its interface
electronics are energized, indicating operation of accessible high voltages may be present, for the
purpose of protecting inadvertent access.
(d) All interface circuits, power supplies, evaluation modules, instruments, meters, scopes and other
related apparatus used in a development environment exceeding 50Vrms/75VDC must be
electrically located within a protected Emergency Power Off EPO protected power strip.
(e) Use stable and nonconductive work surface.
(f) Use adequately insulated clamps and wires to attach measurement probes and instruments. No
freehand testing whenever possible.
2. Electrical Safety
As a precautionary measure, it is always a good engineering practice to assume that the entire EVM
may have fully accessible and active high voltages.
(a) De-energize the TI HV EVM and all its inputs, outputs and electrical loads before performing any
electrical or other diagnostic measurements. Revalidate that TI HV EVM power has been safely de-
energized.
(b) With the EVM confirmed de-energized, proceed with required electrical circuit configurations,
wiring, measurement equipment connection, and other application needs, while still assuming the
EVM circuit and measuring instruments are electrically live.
(c) After EVM readiness is complete, energize the EVM as intended.
WARNING: WHILE THE EVM IS ENERGIZED, NEVER TOUCH THE EVM OR ITS ELECTRICAL
CIRCUITS AS THEY COULD BE AT HIGH VOLTAGES CAPABLE OF CAUSING ELECTRICAL
SHOCK HAZARD.
3. Personal Safety
(a) Wear personal protective equipment (for example, latex gloves or safety glasses with side shields)
or protect the EVM in an adequate lucent plastic box with interlocks to protect from accidental
touch.
Limitation for safe use:
EVMs are not to be used as all or part of a production unit.
IMPORTANT NOTICE

Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as components) are sold subject to TIs terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TIs terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TIs goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or enhanced plastic are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.

Products Applications
Audio www.ti.com/audio Automotive and Transportation www.ti.com/automotive
Amplifiers amplifier.ti.com Communications and Telecom www.ti.com/communications
Data Converters dataconverter.ti.com Computers and Peripherals www.ti.com/computers
DLP Products www.dlp.com Consumer Electronics www.ti.com/consumer-apps
DSP dsp.ti.com Energy and Lighting www.ti.com/energy
Clocks and Timers www.ti.com/clocks Industrial www.ti.com/industrial
Interface interface.ti.com Medical www.ti.com/medical
Logic logic.ti.com Security www.ti.com/security
Power Mgmt power.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense
Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video
RFID www.ti-rfid.com
OMAP Applications Processors www.ti.com/omap TI E2E Community e2e.ti.com
Wireless Connectivity www.ti.com/wirelessconnectivity

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright 2015, Texas Instruments Incorporated