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 t he lik e is provided only for your convenience
and may be su perseded by upda t es . It is y our 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 supp ort and/or safety ap plications is entir ely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless M icrochip from any and all dama ges, claims,
suits, or expenses re sulting from such use. No licens es are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL 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, chipKIT,
chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net,
dsPICworks, dsSPEAK, ECAN, ECONOMONITOR,
FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP,
Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB,
MPLINK, mTouch, Omniscient Code Generation, PICC,
PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE,
rfLAB, Select Mode, Total Endurance, TSHARC,
UniWinDriver, 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.
Microchip received ISO/TS-16949:2009 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
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.
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the p age number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available online help files.
®
IDE online help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
MCP3901 and PIC18F65J90 Energy Meter Reference Design User’s Guide. Items
discussed in this chapter include:
MCP3901 and PIC18F65J90 Energy Meter Reference De sign
DOCUMENT LAYOUT
This document describes how to use the MCP3901 and PIC18F65J90 Energy Meter
Reference Design as a development tool to emulate and debug firmware on a target
board. The manual layout is as follows:
• Chapter 1. “Product Overview” – Important information on using the MCP3901
and PIC18F65J90 Energy Meter Reference Design including a Getting Started
section that describes wiring the line and load connections.
• Chapter 2. “Hardwa re ” – Includes details on the function blocks of the meter
including the analog front end design, phase lock loop circuitry, and power supply
design.
• Chapter 3. “Calculation Engine and Register Description” – This section
describes the digital signal flow for all power output quantities such as RMS
current, RMS voltage, active power, and apparent power. This section also
includes the calibration register’s detail.
• Chapter 4. “Meter Protocol and Timings”– This chapter describes the protocol
used for accessing the registers, including commands that are used to interface to
the meter.
• Appendix A. “Schematic and Layouts” – Shows the schematic and layout
diagrams.
• Appendix B. “Bill of Materials (BOM)” – Lists the parts used to build the
MCP3901 and PIC18F65J90 Energy Meter Reference Design.
MCP3901 and PIC18F65J90 Energy Meter Reference De sign
RECOMMENDED READING
This user's guide describes how to use the MCP3901 and PIC18F65J90 Energy Meter
Reference Design. Other useful documents are listed below. The following Microchip
documents are available and recommended as supplemental reference resources.
MCP3901 Data Sheet – “Two Channel Analog Front End” (DS22192)
This data sheet provides detailed information regarding the MCP3901 device.
AN994 – “IEC Compliant Active-Energy Meter Design Using the MCP3905A/06A”
(DS00994)
This application note documents the design decisions associated with using the
MCP390X devices for energy meter design and IEC compliance.
THE MICROCHI P WEB SITE
Microchip provides online support via our web site at www.microchip.com. This web
site is used as a means to make files and information easily available to customers.
Accessible by using your favorite Internet browser, the web site contains the following
information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listin g
• Business of Microchip – Product selector and ordering guides, latest Microchip
press releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at:
The MCP3901 and PIC18F65J90 Energy Meter Reference Design is a fully functional
IEC Class 0.5 compliant single-phase meter. This low-cost design does not use any
transformers and requires few external components. The PIC18F65J90 directly drives
the LCD, and includes both an isolated USB connection for meter calibration and
access to the device power calculations. The system calculates active energy, active
power, RMS current, RMS voltage, reactive energy, reactive power, apparent power
and other typical power quantities.
The Microchip Energy Meter 1-Phase Software is used to calibrate and monitor the
system, and can be used to create custom calibration setups. For some accuracy
requirements, only a single point calibration may be needed. The energy meter
software offers an automated step-by-step calibration process that can be used to
quickly calibrate energy meters.
MCP3901 AND PIC18F65J90
ENERGY METER
REFERENCE DESIGN
FIGURE 1-1:MCP3901 and PIC18F65J90 Single-Phase Energy Meter.
MCP3901 and PIC18F65J90 Energy Meter Reference De sign
1.2WHAT THE MCP3901 AND PIC18F65J90 ENERGY METER REFERENCE
DESIGN KIT INCLUDES
This MCP3901 and PIC18F65J90 Energy Meter Reference Design kit includes:
• MCP3901 and PIC18F65J90 Energy Meter Reference Design User’s Guide
• Important Information Sheet
1.3GETTING STARTED
To describe how to use the MCP3901 and PIC18F65J90 Energy Meter Reference
Design, the following example is given using a two-wire 1-phase, 220 V AC line voltage
and connections using energy meter calibrator equipment, or other programmable load
source. The meter design uses a 5A load for calibration current, and a maximum
current (I
To test a calibrated meter, the following connections apply for a two-wire connection.
1.3.1Step 1: Wiring Connections
Figure 1-2 identifies the line and load connections of the MCP3901 and PIC18F65J90
Energy Meter Reference Design.
MAX
) of 60A.
1
Line
Neutral
MAIN
2
3
4
Line
Neutral
LOAD
FIGURE 1-2:Example Connections using a 2-Wire System.
1.3.2Step 2: Turn On Line/Load Power to the Meter (Power the Meter)
The meter will turn on when the line connection has 220V connected. The LCD display
will show the total energy accumulated.
Figures 2-1 and 2-2 show the MCP3901 and PIC18F65J90 and Energy Meter
Reference Design:
MCP3901 AND PIC18F65J90
ENERGY METER
REFERENCE DESIGN
Chapter 2. Hardware
3
1
4
2
10
J2
U1
LCD1
9
D9D8
D1
P1
D3
J4
J3
D2
SW3
8
7
SW1
C40
SW2
DANGER
HIGH VOLTAGE
MCP3901 / PIC18F65J90 SHUNT METER
Legend:
1 = IR for meter communication7=Push button Switches
2 = Test points8=9-digit LCD Disp lay with icons for kWh and kVARh
3 = MCP3901 Analog Front End9=Pulse Output for Active and Reactive
4 = +9V DC Input (non-isolated)10=USB Connection (isolated)
5 = Connections to shunt
MCP3901 and PIC18F65J90 Energy Meter Reference De sign
.
17
C40
R21
R20
X2
R28
R27 R26
C32
C24 C25
R19
U7
R17
U4
C7
R29
U2
C39
R33
C37
U5
R30
R34
16
12
13
DANGER
HIGH VOLTAGE
C6
C5
C41
R14
R12
C2
R15
R11
C1
L1
Q1
C38
D5
D4
U8
C30
C27
C21
C22
C10
R31
C23
D6
L2
L3
R24 R25
C19
C17
R18
C16
D7
C4
MOV1
U6
C8
C9
R32
U3
Legend:
12=Opto-isolators for Pulse outputs
13=Power supply
14=Non-volatile memory for calibration constants and energy usage data
15=PIC18F65J90
16=Isolation IC
17=MCP2200 for USB connection