Keywords: MAXQ3120,electricity meter
The meter consists of the MAXQ3120 microcontroller and a few other components. Source code, schematics, bill of materials, and sample PCB layouts are available and easily customized to provide the basis for electricity meters that meet specific regional requirements. The files to accompany the application note can be found here. This reference design package provides the information necessary for a designer to construct an electricity meter application; general MAXQ3120 applications should use the MAXQ3120-KIT kit.
With the MAXQ3120's complement of internal peripherals, only a small set of external parts are needed:
The reference design also includes an external time-of-day clock chip, the DS3231. While the MAXQ3120 contains an integrated real-time clock, the clock is not compensated for temperature (although the microcontroller does contain a digital trim register that could be used for this purpose.) The DS3231 contains a time-of-day clock, a trimmed crystal, and a temperature sensor that automatically compensates the clock. This device is fully supported in code.
The reference design also provides for an external voltage reference. Although the MAXQ3120's internal voltage reference provides sufficient accuracy over temperature for most applications, an external reference can be used where high precision is demanded.
The software is designed to be flexible and customizable. Each task handles a subset of functionality so that features can be removed or enhanced easily. The Message Checker, for example, interprets the packet structure of the DL/T 645 protocol and sends the payload to the Message Decoder. To use a different packet structure, one only needs to recode elements of the Message Checker (and on the encoding side, the Message Builder); there is no need to rewrite the entire application.
|WARNING: De-energize all power sources before connecting the meter. Failure to do so could result in damage to the meter or injury to the operator.|
Terminal 1: Service hot—Connect this terminal to the hot side of the incoming service.
Terminal 2: Load hot—Connect this terminal to the hot side of the load.
Terminal 3: Service neutral—Connect this terminal to the neutral side of the incoming service.
Terminal 4: Load neutral—Connect this terminal to the neutral side of the load.
Terminal 5: Meter pulse positive—Connect to the positive side of a meter pulse receiver. See Meter Pulse below in Table 1 and the Calibration section for more information.
Terminal 6: RS-485 positive—Connect to the positive (A) side of an RS-485 network, if used.
Terminal 7: Meter pulse negative—Connect to the negative side of a meter pulse receiver. See Meter Pulse below, for more information.
Terminal 8: RS-485 negative—Connect to the negative (B) side of an RS-485 network, if used.
You can use either the IR or the EIA-485 interface to perform the address assignment operation. However, if more than one meter is already installed in an EIA-485 network, all these meters will respond to the Set Meter Address network command and will, consequently, have the same address. For this reason, it is recommended to either set meter addresses before installation or use the IR interface to set meter addresses in a multiple-meter installation.
If it becomes necessary to change the address, perform the following steps:
Table 1. Typical Values for Configuring an Electricity Meter
|Setting||Register||Units||Typical Value||Entry Value|
|Meter Constant, real||C030||Pulses/kWh||1,600||00 16 00|
|Meter Constant, reactive||C031||Pulses/kVar||1,600||00 16 00|
|Meter Pulse Width||C211||ms||50||50 00|
|Customer Number||C033||001234567890||90 78 56 34 12 00|
|Meter Number||C032||009988776655||55 66 77 88 99 00|
|Voltage Channel Gain||E125||Unity = 0x8000||32,768||00 80|
|Current Channel Gain||E124||Unity = 0x8000||32,768||00 80|
|Phase Offset||E127||See below||0||00 00|
20 02 00 10
The communications software requires an industry-standard PC with the following characteristics:
The software will work with either an IR interface or an RS-485 interface. Note that the IR interface is not IrDA compliant; it is a custom physical layer dictated by the DL/T 645 standard. Any standard RS-232 to RS-485 converter should serve as a link between a standard PC and the electricity meter. Note that some converters use RTS as a transmit signal (that is, data flow is from the RS-232 side to the RS-485 side), and that other converters use the first transition on TxD as a signal to begin transmitting, and an idle condition for one character period as a signal to turn off the transmitter. The software should work with either type of RS-232 to RS-485 converter.
Figure 1. The software for the electricity meter reference design shows the most used commands at the top.
The software's main window (Figure 1) is organized into two general regions: the top half with the most-used controls; and the bottom half, used more for initial calibration and troubleshooting.
The combo box at the very top of the window contains a drop-down list of commonly accessed registers. You can select one of these registers and click the Read Data button. The software will transmit a Read Register message to the meter, and expect a response. The results will be displayed in the text box just below the Read Data button.
Figure 2. The Direct Register Read/Write menu selection lets you read a register not listed in the top-level drop-down menu.
If you wish to read a register not listed in the drop-down box, you can fill in the register number in the Address box in the Direct Register Read/Write section, and then click Read (Figure 2).
Below the results box are three items used to control and monitor the communications port. The window at the extreme left indicates the status or "health" of the selected comm port. If this indicator is not green, you will not be able to communicate with the meter. To the right of the communications status indicator is a drop-down box to select a port. Further to the right is a drop-down box to select a baud rate.
Directly below the communications panel is a set of buttons that perform specialized functions. They are described below:
In general, a meter will only respond to a DL/T 645 Set Address message if some manual operation has been applied to force the meter to expect the message. In this way, many meters can be connected to the PC through the RS-485 connection without interfering with each another. As explained above, in the reference-design meter the manual operation required is to remove the top cover and activate the net button. When this is done, the display will indicate nEt-10 and begin counting down. When the Set Address message is received, the display will indicate -SEt- and then return to normal operation.
There is one exception to the need to activate the net button: when a meter is installed for the very first time. In this latter case, the meter is operating in Address Set mode until an address is received.
Figure 3. The ID and Passwords dialog lets you set both the network address for the meter and up to ten passwords.
To set a password, load PP VV VV VV into the Data text box. Here PP is the number of the password to assign, and VV VV VV is the value that you want to assign to the password. The Set Password command will be sent with the currently active Superuser Password as a credential.
This dialog is used to set the meter's network address and to set the passwords to use as credentials. The first text box contains the Meter ID, or the network address of the meter. Enter the address of the meter to which you wish to communicate; enter the address as a single string of twelve digits. If you want to use the broadcast address (999999999999), check the Use Broadcast box.
The three text boxes below the Meter ID box contain passwords for three levels of privilege. Password 0, the Superuser Password, is the only password authorized to change other passwords, including itself. Passwords 1 and 2 are the Normal Passwords, and can be presented to change any value in the meter. Finally, passwords 3 through 9 are Read-Only Passwords. Users presenting these latter passwords can only read the meter and cannot change any register, nor can they clear maximum demand.
Suppose, for example, that you are a meter reader and know that password 4 is '123456'. You can select 4 in the drop-down beside the Read-Only Passwords box, and then type '12 34 56' in the text box. Click the radio button beside the Read-Only Passwords text box, and then click the Done button. The software will then present password 4 as its credential the next time it attempts to read a register.
Figure 4. The dialog for automatic calibration makes it an easy three-step process to get calibration values loaded into the meter.
Automatic calibration is the easiest way to get calibration values into the meter. When you click the Cal M1: Auto automatic calibration button, the dialog shown in Figure 4 will appear. Performing calibration is now a quick, three-step process:
When finished, click the Close button to return to the main screen.
Figure 5. You can calibrate the meter manually by using the Cal M2:Manual menu.
If you prefer to calibrate the meter manually, the Cal M2:Manual manual calibration button brings up the manual calibration dialog (Figure 5). Performing manual calibration involves the following steps:
|WARNING: All power sources to the meter MUST be de-energized before beginning the firmware reload process. Elements of the electric meter operate at line potential. Failure to remove power can damage the meter or the PC to which it is connected, or injure the operator.|
Before you begin the process, you should have a PC with MAX-IDE installed and a serial-to-JTAG adapter configured and connected. You will use this PC to transfer the new .HEX file to the electric meter.
Figure 6. Firmware is loaded onto the meter by using the MAX-IDE software.
Figure 7. When you load the firmware, select the .HEX file format.