SLAA494B May   2011  – September 2023 MSP430AFE221 , MSP430AFE222 , MSP430AFE223 , MSP430AFE231 , MSP430AFE232 , MSP430AFE233 , MSP430AFE251 , MSP430AFE252 , MSP430AFE253

 

  1.   1
  2.   Implementation of a Single-Phase Electronic Watt-Hour Meter Using the MSP430AFE2xx
  3. Trademarks
  4. Introduction
  5. Block Diagram
  6. Hardware Implementation
    1. 4.1 Power Supply
      1. 4.1.1 Resistor Capacitor (RC) Power Supply
      2. 4.1.2 Switching-Based Power Supply
    2. 4.2 Analog Inputs
      1. 4.2.1 Voltage Inputs
      2. 4.2.2 Current Inputs
  7. Software Implementation
    1. 5.1 Peripherals Setup
      1. 5.1.1 SD24 Setup
    2. 5.2 Foreground Process
      1. 5.2.1 Formulas
        1. 5.2.1.1 Voltage and Current
        2. 5.2.1.2 Power and Energy
    3. 5.3 The Background Process
      1. 5.3.1 Voltage and Current Signals
      2. 5.3.2 Phase Compensation
      3. 5.3.3 Frequency Measurement and Cycle Tracking
      4. 5.3.4 LED Pulse Generation
    4. 5.4 Energy Meter Configuration
  8. Energy Meter Demo
    1. 6.1 EVM Overview
      1. 6.1.1 Connections to the Test Setup or AC Voltages
      2. 6.1.2 Power Supply Options
    2. 6.2 Loading the Example Code
      1. 6.2.1 Opening the Project
  9. Results
    1. 7.1 Viewing Results on PC
    2. 7.2 Viewing Results During Debug
  10. Important Notes
  11. Schematics
  12. 10References
  13. 11Revision History

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 accurately calibrate any meter or to report measurement during normal operation. To serve both of these tasks efficiently, the microcontroller must accurately generate and record the number of these pulses. It is a general requirement to generate these pulses with relatively little jitter. Although time jitters are not an indication of bad accuracy, as long as the jitter is averaged out, it can give a negative impression of the overall accuracy of the meter.

The sample code uses the average power to generate the energy pulses. The average power (calculated by the foreground process) is accumulated every SD24 interrupt. This is equivalent to converting it to energy. After the accumulated energy crosses a threshold, a pulse is generated. The amount of energy above this threshold is stored, and new energy amount is added to 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 the power company and is a constant, for example, it can be in kWh. In most meters, the pulses per kWh decide this energy tick. For example, in this application, the number of pulses generated per kWh is set to 1600 for active and reactive energies. The energy tick in this case is 1 kWh/1600. Energy pulses are generated and also indicated via LEDs on the board. Port pins are toggled for the pulses with control over the pulse width for each pulse.

Figure 5-5 shows the flow diagram for pulse generation.

GUID-9189FB68-B4BD-4C64-8554-35060005BFCC-low.gifFigure 5-5 Pulse Generation for Energy Indication

The average power is in units of 0.01 W and 1 kWh threshold is defined as:

1 kWh threshold = 1 / 0.01 × 1 kW × (number of interrupts/sec) × (number of seconds in 1 hour) = 100000 × 3906 × 3600 = 0x14765AAD400