AN1151

AN1151
PIC18F2520 MCP3909 3-Phase Energy Meter Reference Design - Meter Test
Results and Adapting the Meter Design for other Requirements
Author:
Craig L. King
Microchip Technology Inc.
OVERVIEW
This application note shows how the PIC18F2520
MCP3909 3-phase energy meter performs under test
as designed, and also how it can be easily modified for
compatibility with a number of power measurement or
energy meter designs.
This demo board is intended to be a fully functional 3phase energy meter and is shipped calibrated as a
6400 imp/kWh 5(10)A / 220V meter. This document
details the production calibration process, design
limitations in terms of meter current, voltage, and
accuracy.
Applying this energy meter to alternate designs such as
single phase design, shunt based current measurement, and delta wiring will be discussed.
The accuracy results presented here were recorded
against an industry power meter standard test
equipment, the Fluke 6100A Electrical Power Standard. A description of the test setup will be initially presented, followed by a section describing the testing
conditions.
Figure 1 shows the PIC18F2520 MCP3909 3-phase
Energy Meter.
A section detailing the current transformer selection,
and the minimum/maximum current limitations that
accompany this design choice will be a focus.
Test results will also be included that show how PCB
layout and circuit grounding directly affects meter
performance at low current input and channel to
channel crosstalk both in-phase and between phases.
Note:
This application note includes test data
from demo board hardware revision 2,
which was the latest and current PCB revision at time of writing.
Meter Specifications
•
•
•
•
•
•
•
•
•
•
•
Class 0.2 - 0.5 (see Figure 3 through Figure 5)
Nominal Voltage: 3*220/380V
Power Frequency: 50 Hz
Nominal Current: 5A
Maximum Current: 10(20)A
Initiating current: 5 mA
Error limits: (typical - see Figure 3 through
Figure 5)
Constant 6400 imp/kWh
Power Consumption: 1.7W
Voltage Dependence: ±10%
Frequency Dependence: 45 Hz to 65 Hz
FIGURE 1:
PIC18F2520 With MCP3909
Meter Showing Line/load Connections To Test
Equipment.
© 2007 Microchip Technology Inc.
DS01151A-page 1
AN1151
MICROCHIP’S DEMO BOARD
CALIBRATION VS. PROPER METER
CALIBRATION
It is important to note Microchip does not do a full calibration/test on each meter that we ship as demo
boards. Steps have been taken to ensure you receive
an energy meter ‘out of the box’ that performs to the
above meter specifications, but the equipment and
process we use during demo board production is not
true energy calibration equipment, and any testing will
reflect this.
The results shown here were taken from a shipped
energy meter that was simply ‘re-calibrated’ using the
Fluke electrical power standard and the calibration
software GUI that comes with the kit. No hardware
‘tweaks’, or firmware changes were done, only a true
calibration using accurate energy meter calibration
equipment.
Meter Calibration
Each phase was calibration sequentially, starting with
phase A.
Each phase calibration process was a 4(Note 2) step
calibration. The steps are shown here with approximate
calibration times (using 128 line cycle accumulation at
50 Hz)
GAIN (5A, 220V) - 2.5 seconds (Note 1)
DELAY (5A, 220V, PF = 0.5L) - 2.5 seconds (Note 1)
OFFSET for active power
(0.005A, 220V, PF = 1) - 2.5 2.5 seconds (Note 1)
OFFSET for IRMS (0.5A, 220V, PF=1) - 2.5 seconds
(Note 1, Note 2)
Note 1:
Calibration used for this Application Note
Figure 2 describes the calibration and test setup used.
The electrical power standard (Fluke 6100A) was
configured to generate balanced loads for the meter,
3 x ICAL for all calibration steps.
Power Meter
Inputs
LINE
+0°
LOAD
2:
Important! The approach to calibration
used by the PIC18F2520 firmware and
Windows GUI (“energy meter software”),
does not require accumulation of active
power pulses to generate errors and
resulting calibration correction factors for
the meter. Instead, the software allows
user input of the true current and voltage
at each calibration step. The correction
factors are then calculated by comparing
this ideal to the measured active power
after N line cycles, 128 line cycles in the
results shown here. This approach greatly
reduces meter production time.
This fourth calibration step can be
skipped for active power only meters as it
only applies to the RMS measurement.
Total Energy
+120°
LINE
LOAD
LINE
+240°
LOAD
neutral
When the meter is shipped the configuration of the
output pulse is set such that the pulse frequency is
proportional to the total active energy being consumed
across all 3 phases. During meter calibration however,
the firmware and software work together to ensure that
‘phase to phase matching’ is included. When calibrating all 3 phases, one of the phases is selected (normally Phase A) as the ‘reference or ‘standard’ phase,
and the other phases, when accumulating energy
during the gain calibration step, or step 1, compare
their accumulation to that recorded during phase A,
thus phase to phase matching is included. For
equations and signal flow, see the MCP3909 3-Phase
Energy Meter Reference Design using PIC18F2520
User’s Guide, (DS51643).
©Fluke Corporation
FIGURE 2:
DS01151A-page 2
Meter Calibration Setup.
© 2007 Microchip Technology Inc.
AN1151
METER TEST RESULTS
Results - Voltage Variation
Meter calibration was done using the automated
calibration procedure performed by the USB “3-Phase
Energy Meter Software”, and the 4 calibration steps
were all performed.
Figure 3 shows the meter accuracy across the voltage
variation tests.
0.20
0.15
Line = 253 V
0.10
Error - %
The meter test results shown are at 20 points, from
100 mA to 20A, at power factors of 1 and 0.5L, and at
both ends of the voltage and frequency dependence
rated in Table 1. These results are from hardware
revision 2. Differences in hardware revisions will be
discussed later in this document.
Line = 208 V
0.05
0.00
-0.05
Line = 230 V
-0.10
-0.15
Class 0.5 Compliance
The test results will show the meter performs better
than 0.5% accurate from 100 mA to 20A, compliant to
a class 0.5 meter, per IEC62053-22. No less than 0.3%
margin of error exists for this compliance (see Table 1).
-0.20
0.10
1.00
10.00
100.00
Input Current (A)
FIGURE 3:
Variation Testing.
Meter Accuracy, Voltage
Class 0.2 Compliance
For reference, this table shows Class 0.5 and Class 0.2
limits as stated in the IEC62053-22 document.
TABLE 1:
IEC ACCURACY LIMITS FOR
CLASS 0.5 AND 0.2S ENERGY
METERS
Current
Power
Factor
Class
0.5
Class
0.2
0.01 IN < I < 0.05 IN
1
±1.0
±0.4
0.1IN < I < IMAX
1
±0.5
±0.2
0.5L
±1.0
±0.5
0.8C
±1.0
±0.5
0.5L
±0.6
±0.4
0.8C
±0.6
±0.4
0.02IN < I < 0.1 IN
0.1IN < I < IMAX
© 2007 Microchip Technology Inc.
Results - Frequency Variation
Figure 4 shows the meter accuracy across the frequency variation tests.
0.20
0.15
51 Hz
49 Hz
0.10
Error - %
A class 0.2 meter, as required by the IEC specification,
must not be more than 0.3% error at PF=0.5, and no
more than 0.2% error at PF=1. The results from this
meter tested would marginally pass these requirements and be class 0.2 compliant. However, it is the
recommendation stated here that a volume production
run using meters using this PIC18F/MCP3909 design
should expect some yield to be outside of these limits,
mainly due to variance in the current transformer phase
response from meter to meter. The difference between
the PF=1 and PF=0.5 performance (FIGURE 5: “Meter
Accuracy, Frequency Variation Testing.”) are
testament to this issue. Additional data using more
expensive CTs with improved phase non-linearity will
be presented later, including a more detailed
explanation of these test results.
0.05
0.00
50 Hz
-0.05
-0.10
-0.15
-0.20
0.10
1.00
10.00
100.00
Input Current (A)
FIGURE 4:
Variation Testing.
Meter Accuracy, Frequency
DS01151A-page 3
AN1151
Figure 5 shows the meter accuracy across at PF=0.5.
The graph also includes a PF=1 data series for
comparison (dotted line marked “CONTROL”).
The MCP3909 device attributes less than 0.02% error
due to phase error. In Figure 6, taken from the
MCP3909 data sheet, shows active power measurement results used as characterization results and
shown as typical performance curves.
0.50
0.40
PF = 0.5, fLINE = 51 Hz
0.30
0.20
(CONTROL, PF=1)
0.10
0.00
-0.10
PF = 0.5, fLINE = 50 Hz
-0.20
-0.30
PF = 0.5, fLINE = 49 Hz
-0.40
-0.50
0.10
1.00
10.00
100.00
Measurement Error
MCP3909 PHASE RESPONSE
Error - %
Results at PF=0.5 (60 degrees Lead/Lag)
Effects of Phase Non-linearity on Meter
Performance
Measurement Error
Meter Accuracy, Frequency
+85°C
+25°C
- 40°C
0.0001
0.0010
0.0100
0.146%
at PF = 1
0.1000
CH0 Vp-p Amplitude (V)
Input Current (A)
FIGURE 5:
Variation Testing.
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.0000
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0.0000
+85°C
+25°C
-40°C
0.0001
0.0010
0.0100
0.169%
at PF = 0.5
0.1000
CH0 Vp-p Amplitude (V)
Any additional phase delay introduced to either the
current or voltage signal will have a severe effect on the
accuracy of the meter when the PF << 1. This is shown
in Equation 1, where the additional phase delay
introduced is represented by φe.
EQUATION 1:
cos φ – cos ( φ + φ e )
% Error = ⎛⎝ -----------------------------------------------⎞⎠ • 100%
cos φ
If an additional delay of 0.2° is introduced, at PF=1, the
effect is negligible. But, when PF=0.5, this 0.2° causes
an additional 0.6% error, far from negligible for most
meter designs.
FIGURE 6:
As shown with these typical
performance curves, the MCP3909 device does
not contribute any appreciable additional phase
error.
TYPICAL SPECIFICED CT PHASE RESPONSE
The severe non-linearity of the current transformers is
a major obstacle to overcome for most energy meter
designs, and various methods exist to compensate for
this error. The easiest method is to choose a more linear (and typically expensive) current transformer for
your energy meter design. The CT used in our
reference design changed from hardware revision 1 to
hardware revision 2, and may be different depending
on which meter design you have. Both CTs are from the
same manufacturer (He Hua, Shanghai Electronics),
the second with slightly better phase linearity performance.
TACKLING PHASE NON-LINEARITY
THROUGH FIRMWARE CORRECTION
Other than buying a more expensive CT, a second
method to compensate for this error is to calibrate at
multiple points during phase delay calibration of the
meter. As was shown, this meter design uses only a
single point phase correction (at PF= 60 degrees lag).
DS01151A-page 4
© 2007 Microchip Technology Inc.
AN1151
Demo Board Rev 1 vs. Rev 2 Release
Differences
The major changes in creating a revision 2 of the PCB
was to improve the PCB grounding and layout. This
helped to eliminate crosstalk between the voltage and
current inputs of a given phase. In addition, a
PIC18F2520 firmware bug was fixed that as receiving
corrupt MCP3909 data. The graphs below show initial
meter performance prior to fixing these bugs. The
areas circled in red are the critical area of improvement
where the meter performance was adjusted to be well
below IEC62053 class 0.2S requirements.
Voltage Variation
253V
Error (%)
Error (%)
0.50
0.40
0.30
0.20
230V
0.10
0.00
-0.10
-0.20
-0.30
-0.40
-0.50
0.01
0.50
0.40
0.30
0.20
0.10
0.00
-0.10
-0.20
-0.30
-0.40
-0.50
0.01
207V
0.1
1
Current (A)
10
100
50 Hz
49 Hz
51 Hz
1
10
100
Error (%)
Current (A)
0.5
0.4
0.3
0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
-0.5
0.01
There are 3 design decisions to be made when
changing this meter to operate at current ranges other
than the 5(10)A range chosen.
• CT selection
• Bias resistor value for CT circuit
• MCP3909 CH0 Gain (PGA Setting)
The MCP3909 input voltage range on channel zero
(current channel input), is specified across a 1000:1
range at all gain settings (1,2,8,16). In addition the
device offers ~82 dB across this entire range at a gain
of 1, or ~76 dB for G=16. This highly accurate ADC and
PGA allows for extremely wide current ratings such as
5(40)A, 5(60)A, 10(100)A, or 1(10)A meters.
For the 5(10)A design, the approach taken to the
design decisions above took into consideration overcurrent situations and current signals with higher
harmonic content, or crest factors, such that the peakto-peak value of the signal would be greater than the
0.707 * IRMS expected for a pure sine wave. A
conservative approach was taken here, with the goal to
be only at half of the input range of the MCP3909 ADC
when the input current of the meter is at IMAX. This
leaves much room for over-current and greatly reduces
the chance of any signal clipping at the ADC.
Revision 1 of the energy meter uses an 20/80A CT
(SCT220B, He Hua, Shanghai Electronics) and was
designed to a IMAX of 20A. with over range up to 2IMAX
or 40A. This CT has a 1000:1 turns ratio, resulting in
signal of approximately the full scale input range of the
ADC at twice IMAX. A PGA gain of 2 was selected to
match this signal size.
Frequency Variation
0.1
ADAPTING TO WIDER CURRENT RANGES
Revision 2 of the energy meter uses a 6/20A CT
(SCT954) and was designed to an IMAX of 10A, with
over range up to 2IMAX or 20A. This CT has a 2000:1
turns ratio, resulting in a signal of approximately the full
scale range of the ADC at 20A, or twice the maximum
current. A PGA gain of 2 was selected to match this
signal size.
Thus, to adapt this meter to wider current ranges, it is
suggested to target signal size at IMAX to be around half
of the full scale input range of the ADC on the
MCP3909 (allowing over-range and signals with high
crest factors).
Power Factor = 0.5
(CONTROL, PF=1)
49 Hz
50 Hz
0.1
51 Hz
1
Current (A)
10
100
FIGURE 7:
Hardware and Firmware
Improvements Fixed the Areas of Concern
(circled in red). This data is from meter revision 1.
© 2007 Microchip Technology Inc.
DS01151A-page 5
AN1151
SUMMARY
REFERENCES
The meter performs better than 0.5% accurate from
100 mA to 20A, compliant to a class 0.5 meter, per
IEC62053-22. A simple current transformer change
along with burden resistor and gain changes could
increase the maximum current well above 100A.
Although the data presented here is also class 0.2
compliant, it is marginal at PF=0.5, solely due to the
current transformer selection, and the method of phase
correction used, single point. A class 0.2 meter, as
required by the IEC specification, must not be more
than 0.3% error at PF=0.5, and no more than 0.2%
error at PF=1. The results from this meter tested would
marginally pass these requirements and be class 0.2
compliant.
1.
Figure 2: Meter Calibration Setup photo from
Fluke Corporation ©2002.
Migrating the PIC18F2520 “calculation core” used in
this design, to a customer specific energy meter
design, perhaps using another PICmicro controller,
allows accuracy results to be consistent with those
presented here.
DS01151A-page 6
© 2007 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices:
•
Microchip products meet the specification contained in their particular Microchip Data Sheet.
•
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•
Microchip is willing to work with the customer who is concerned about the integrity of their code.
•
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, KEELOQ logo, microID, MPLAB, PIC,
PICmicro, PICSTART, PRO MATE, rfPIC and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, Linear Active Thermistor, Migratable
Memory, MXDEV, MXLAB, SEEVAL, SmartSensor and The
Embedded Control Solutions Company are registered
trademarks of Microchip Technology Incorporated in the
U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi,
MPASM, MPLAB Certified logo, MPLIB, MPLINK, PICkit,
PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select
Mode, Smart Serial, SmartTel, Total Endurance, UNI/O,
WiperLock and ZENA are trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2007, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
© 2007 Microchip Technology Inc.
DS01151A-page 7
WORLDWIDE SALES AND SERVICE
AMERICAS
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2401-1200
Fax: 852-2401-3431
India - Bangalore
Tel: 91-80-4182-8400
Fax: 91-80-4182-8422
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
China - Fuzhou
Tel: 86-591-8750-3506
Fax: 86-591-8750-3521
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
Taiwan - Hsin Chu
Tel: 886-3-572-9526
Fax: 886-3-572-6459
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
China - Shunde
Tel: 86-757-2839-5507
Fax: 86-757-2839-5571
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
10/05/07
DS01151A-page 8
© 2007 Microchip Technology Inc.